hgkw/pretxnkw.py
branchupdatehook
changeset 20 6dc2b4268920
parent 7 e5f131217f87
child 26 bda0dec1aaf1
equal deleted inserted replaced
19:d1f478aa61c5 20:6dc2b4268920
     1 # $Hg: pretxnkw.py,v$
     1 # $Hg$
     2 
     2 
     3 from hgkw import kwexpander
     3 import kwexpander
     4 
     4 
     5 def pretxnkw(ui=None, repo=None, hooktype='', **args):
     5 def pretxnkw(ui, repo, hooktype, **args):
     6     '''Important: returns False on success, True on failure.'''
     6     '''Important: returns False on success, True on failure.'''
     7 
     7 
     8     node = args['node'][0:12]
     8     if hooktype != 'pretxncommit':
     9 
       
    10     if not ui or not repo or not node or hooktype != 'pretxncommit':
       
    11         # bail out with error
     9         # bail out with error
    12         return True
    10         return True
    13 
    11 
    14     modified, added = repo.status()[1:3]
    12     tip = repo.changelog.tip()
       
    13     modified, added = repo.status()[:2]
    15     candidates = modified + added
    14     candidates = modified + added
       
    15     # TODO: check whether we need parent1&2 like in updatekw
    16 
    16 
    17     return kwexpander.expandkw(ui, repo, repo.changelog.tip(), node)
    17     return kwexpander.expandkw(ui, repo,
       
    18             tip, args['node'][0:12], candidates, update=False)