hgkw/pretxnkw.py
branchupdatehook
changeset 20 6dc2b4268920
parent 7 e5f131217f87
child 26 bda0dec1aaf1
--- a/hgkw/pretxnkw.py	Sat Dec 16 15:38:25 2006 +0100
+++ b/hgkw/pretxnkw.py	Sat Dec 16 15:42:27 2006 +0100
@@ -1,17 +1,18 @@
-# $Hg: pretxnkw.py,v$
+# $Hg$
 
-from hgkw import kwexpander
+import kwexpander
 
-def pretxnkw(ui=None, repo=None, hooktype='', **args):
+def pretxnkw(ui, repo, hooktype, **args):
     '''Important: returns False on success, True on failure.'''
 
-    node = args['node'][0:12]
-
-    if not ui or not repo or not node or hooktype != 'pretxncommit':
+    if hooktype != 'pretxncommit':
         # bail out with error
         return True
 
-    modified, added = repo.status()[1:3]
+    tip = repo.changelog.tip()
+    modified, added = repo.status()[:2]
     candidates = modified + added
+    # TODO: check whether we need parent1&2 like in updatekw
 
-    return kwexpander.expandkw(ui, repo, repo.changelog.tip(), node)
+    return kwexpander.expandkw(ui, repo,
+            tip, args['node'][0:12], candidates, update=False)