changeset 101:5cc7a44300dd

Add a hook to check pushkeys Add a server-side prepushkey hook to disable pushing keys, except for phases data. Bookmarks (e.g, '@') can become stale when old hg versions are used on the client, leading to surprising behavior.
author jcoomes
date Tue, 11 Mar 2014 14:29:53 -0700
parents 1cc0e7fc7e8d
children c48f53c04127
files jcheck.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/jcheck.py	Mon Feb 24 10:46:12 2014 -0800
+++ b/jcheck.py	Tue Mar 11 14:29:53 2014 -0700
@@ -658,6 +658,13 @@
         ui.status("\n")
     return ch.rv
 
+# This is invoked on servers to check pushkeys; it's not needed on clients.
+def prepushkey(ui, repo, hooktype, namespace, key, old=None, new=None, **opts):
+    if namespace == 'phases':
+        return Pass
+    ui.write_err('ERROR:  pushing keys (%s) is disabled\n' % namespace)
+    return Fail
+
 opts = [("", "lax", False, "Check comments, tags and whitespace laxly"),
         ("r", "rev", [], "check the specified revision or range (default: tip)"),
         ("s", "strict", False, "check everything")]