Add pretxnkw module for updatehook branch updatehook
authorChristian Ebert <blacktrash@gmx.net>
Thu, 14 Dec 2006 10:33:35 +0100
branchupdatehook
changeset 7 e5f131217f87
parent 5 85d1f5bf7cfc
child 17 7aebaf13ea3c
Add pretxnkw module for updatehook branch
hgkw/pretxnkw.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgkw/pretxnkw.py	Thu Dec 14 10:33:35 2006 +0100
@@ -0,0 +1,17 @@
+# $Hg: pretxnkw.py,v$
+
+from hgkw import kwexpander
+
+def pretxnkw(ui=None, repo=None, 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':
+        # bail out with error
+        return True
+
+    modified, added = repo.status()[1:3]
+    candidates = modified + added
+
+    return kwexpander.expandkw(ui, repo, repo.changelog.tip(), node)