1 # $Hg: updatekw.py,v$ |
1 # $Hg$ |
2 |
2 |
3 from hgkw import kwexpander |
3 import kwexpander |
4 |
4 |
5 def updatekw(ui=None, repo=None, hooktype='', **args): |
5 def updatekw(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 if not ui or not repo or hooktype != 'update': |
8 if hooktype != 'update': |
9 # bail out with error |
9 # bail out with error |
10 return True |
10 return True |
11 |
11 |
12 parent1 = repo.dirstate.parents()[0] |
12 p1, p2 = args['parent1'], args['parent2'] |
13 node = repo.changectx(parent1) |
13 node1 = repo.changelog.lookup(p1) |
|
14 if p2: |
|
15 node2 = repo.changelog.lookup(p2) |
|
16 # next line for debugging only (check merges) |
|
17 ui.warn('parent2: %s\n' % p2) |
|
18 else: |
|
19 node2 = None |
14 |
20 |
15 (modified, added, removed, deleted, |
21 (modified, added, removed, deleted, |
16 unknown, ignored, clean) = repo.status(node1=parent1) |
22 unknown, ignored, clean) = repo.status(node1=node1, node2=node2) |
17 |
|
18 candidates = modified + added + clean |
23 candidates = modified + added + clean |
19 |
24 |
20 return kwexpander.expandkw(ui, repo, parent1, node, candidates) |
25 return kwexpander.expandkw(ui, repo, |
|
26 node1, p1, candidates, update=True) |