src/access.py
changeset 53 853444c5d393
parent 52 f9eb98bb0791
child 62 f1e319d3672a
equal deleted inserted replaced
52:f9eb98bb0791 53:853444c5d393
     8 # This software may be used and distributed according to the terms
     8 # This software may be used and distributed according to the terms
     9 # of the GNU General Public License, incorporated herein by reference.
     9 # of the GNU General Public License, incorporated herein by reference.
    10 
    10 
    11 from mercurial.i18n import _
    11 from mercurial.i18n import _
    12 import mercurial.util
    12 import mercurial.util
       
    13 import mercurial.node
    13 
    14 
    14 import os
    15 import os
    15 import ruleset
    16 import ruleset
    16 import changes
    17 import changes
    17 
    18 
    37 
    38 
    38     def check(self, ctx):
    39     def check(self, ctx):
    39         '''return if access allowed, raise exception if not.'''
    40         '''return if access allowed, raise exception if not.'''
    40         if not self.allow(ctx):
    41         if not self.allow(ctx):
    41             raise mercurial.util.Abort(_('%s: access denied for changeset %s') %
    42             raise mercurial.util.Abort(_('%s: access denied for changeset %s') %
    42                 (__name__, ctx.short()))
    43                 (__name__, mercurial.node.short(ctx.node())))
    43 
    44 
    44 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
    45 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
    45     if hooktype != 'pretxnchangegroup':
    46     if hooktype != 'pretxnchangegroup':
    46         raise mercurial.util.Abort(_('config error - hook type "%s" cannot stop '
    47         raise mercurial.util.Abort(_('config error - hook type "%s" cannot stop '
    47                            'incoming changesets') % hooktype)
    48                            'incoming changesets') % hooktype)