mercurial/bookmarks.py
changeset 22659 798185707833
parent 22658 a8f0d8e4c80a
child 22664 6bd685d2a2de
--- a/mercurial/bookmarks.py	Sun Sep 28 13:43:31 2014 -0700
+++ b/mercurial/bookmarks.py	Sun Sep 28 14:07:56 2014 -0700
@@ -358,6 +358,7 @@
     if ui.configbool('ui', 'quietbookmarkmove', False):
         status = warn = ui.debug
 
+    explicit = set(explicit)
     changed = []
     for b, scid, dcid in addsrc:
         if scid in repo: # add remote bookmarks for changes we already have
@@ -366,23 +367,30 @@
     for b, scid, dcid in advsrc:
         changed.append((b, bin(scid), status,
                         _("updating bookmark %s\n") % (b)))
+    # remove normal movement from explicit set
+    explicit.difference_update(d[0] for d in changed)
+
     for b, scid, dcid in diverge:
-        db = _diverge(ui, b, path, localmarks)
-        changed.append((db, bin(scid), warn,
-                        _("divergent bookmark %s stored as %s\n") % (b, db)))
+        if b in explicit:
+            explicit.discard(b)
+            changed.append((b, bin(scid), status,
+                            _("importing bookmark %s\n") % (b, b)))
+        else:
+            db = _diverge(ui, b, path, localmarks)
+            changed.append((db, bin(scid), warn,
+                            _("divergent bookmark %s stored as %s\n")
+                            % (b, db)))
+    for b, scid, dcid in adddst + advdst:
+        if b in explicit:
+            explicit.discard(b)
+            changed.append((b, bin(scid), status,
+                            _("importing bookmark %s\n") % (b, b)))
+
     if changed:
         for b, node, writer, msg in sorted(changed):
             localmarks[b] = node
             writer(msg)
         localmarks.write()
-    # update specified bookmarks
-    if explicit:
-        marks = repo._bookmarks
-        for b in explicit:
-            # explicit pull overrides local bookmark if any
-            repo.ui.status(_("importing bookmark %s\n") % b)
-            marks[b] = repo[remotemarks[b]].node()
-        marks.write()
 
 def diff(ui, dst, src):
     ui.status(_("searching for changed bookmarks\n"))