mercurial/bookmarks.py
changeset 33516 f9e6e43c7987
parent 33515 3325c7dcabaa
child 33517 08bf0ebc6c8e
--- a/mercurial/bookmarks.py	Mon Jul 10 20:10:03 2017 +0200
+++ b/mercurial/bookmarks.py	Mon Jul 10 20:26:53 2017 +0200
@@ -112,11 +112,19 @@
     def applychanges(self, repo, tr, changes):
         """Apply a list of changes to bookmarks
         """
+        bmchanges = tr.changes.get('bookmarks')
         for name, node in changes:
+            old = self.get(name)
             if node is None:
                 del self[name]
             else:
                 self[name] = node
+            if bmchanges is not None:
+                # if a previous value exist preserve the "initial" value
+                previous = bmchanges.get(name)
+                if previous is not None:
+                    old = previous[0]
+                bmchanges[name] = (old, node)
         self._recordchange(tr)
 
     def recordchange(self, tr):