hgkw/updatekw.py
branchextension
changeset 38 6a830bed4af1
parent 37 3dc31476c148
child 39 14038784f986
equal deleted inserted replaced
37:3dc31476c148 38:6a830bed4af1
     1 # $Hg$
       
     2 
       
     3 import kwexpander
       
     4 
       
     5 def updatekw(ui, repo, hooktype, **args):
       
     6     '''Collects candidates for keyword expansion on update
       
     7     and passes them to kwexpander.'''
       
     8 
       
     9     if hooktype != 'update':
       
    10         # bail out with error
       
    11         return True
       
    12 
       
    13     n1, n2 = args['parent1'], args['parent2']
       
    14     r1 = repo.changelog.lookup(n1)
       
    15     if n2:
       
    16         r2 = repo.changelog.lookup(n2)
       
    17         # next line for debugging only (check merges)
       
    18         ui.warn('parent2: %s\n' % n2)
       
    19     else:
       
    20         r2 = None
       
    21 
       
    22     (modified, added, removed, deleted,
       
    23             unknown, ignored, clean) = repo.status(node1=r1, node2=r2)
       
    24     candidates = modified + added + clean
       
    25 
       
    26     if  candidates:
       
    27         return kwexpander.expandkw(ui, repo, r1, n1, candidates, update=True)