[PATCH STABLE] hook for bookmark moving

Alexander Solovyov alexander at solovyov.net
Sun Feb 27 04:41:15 CST 2011


# HG changeset patch
# User Alexander Solovyov <alexander at solovyov.net>
# Date 1298803250 -3600
# Branch stable
# Node ID e4fd504cd269075b910948eebeddaea2ecd00bf7
# Parent  45b48be6b9105d3bd6f760d98bddcd4708df434b
hook for bookmark moving

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -5,10 +5,10 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
+import os
 from mercurial.i18n import _
-from mercurial.node import nullid, nullrev, bin, hex, short
+from mercurial.node import hex
 from mercurial import encoding, util
-import os
 
 def valid(mark):
     for c in (':', '\0', '\n', '\r'):
@@ -130,7 +130,10 @@ def update(repo, parents, node):
         old = repo[marks[mark]]
         new = repo[node]
         if new in old.descendants():
+            from mercurial import hook
             marks[mark] = new.node()
+            hook.hook(repo.ui, repo, 'bookmarkmove', throw=True,
+                      node=hex(new.node()), bookmark=mark)
             update = True
     if update:
         write(repo)


More information about the Mercurial-devel mailing list