changeset 22364:5c153c69fdb2

bookmarks: allow pushkey if new equals current Previously a bookmark pushkey would be rejected if the specified 'old' value didn't match the servers 'current' value. This change allows this situation, as long as the 'current' server value equals the 'new' pushkey value already. We are trying to write a hook that forces a server bookmark to move forward, using a changegroup hook. If the user also pushed the bookmark, they would get an error, since they computed their pushkey (old,new) pair before the server moved the bookmark. Long term, bundle2 will let us do this more smartly, but this change seems reasonable for now.
author Durham Goode <durham@fb.com>
date Tue, 26 Aug 2014 04:58:41 -0700
parents 9510b0e9480b
children c5df4af17110
files mercurial/bookmarks.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Fri Aug 29 12:17:53 2014 +0200
+++ b/mercurial/bookmarks.py	Tue Aug 26 04:58:41 2014 -0700
@@ -228,7 +228,8 @@
     w = repo.wlock()
     try:
         marks = repo._bookmarks
-        if hex(marks.get(key, '')) != old:
+        existing = hex(marks.get(key, ''))
+        if existing != old and existing != new:
             return False
         if new == '':
             del marks[key]