diff mercurial/localrepo.py @ 14102:7f45b1911893

pushkey: add hooks for pushkey/listkeys
author Brodie Rao <brodie@bitheap.org>
date Sun, 01 May 2011 11:12:36 +0200
parents 924c82157d46
children 3c3c53d8343a 3a3584967a93
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sat Apr 30 12:02:09 2011 -0500
+++ b/mercurial/localrepo.py	Sun May 01 11:12:36 2011 +0200
@@ -1918,10 +1918,18 @@
         return self.pull(remote, heads)
 
     def pushkey(self, namespace, key, old, new):
-        return pushkey.push(self, namespace, key, old, new)
+        self.hook('prepushkey', throw=True, namespace=namespace, key=key,
+                  old=old, new=new)
+        ret = pushkey.push(self, namespace, key, old, new)
+        self.hook('pushkey', namespace=namespace, key=key, old=old, new=new,
+                  ret=ret)
+        return ret
 
     def listkeys(self, namespace):
-        return pushkey.list(self, namespace)
+        self.hook('prelistkeys', throw=True, namespace=namespace)
+        values = pushkey.list(self, namespace)
+        self.hook('listkeys', namespace=namespace, values=values)
+        return values
 
     def debugwireargs(self, one, two, three=None, four=None, five=None):
         '''used to test argument passing over the wire'''