mercurial/bookmarks.py
changeset 15614 260a6449d83a
parent 15613 2fad18f15409
child 15621 013688350c7d
--- a/mercurial/bookmarks.py	Tue Dec 06 14:17:33 2011 -0600
+++ b/mercurial/bookmarks.py	Wed Dec 07 16:19:39 2011 -0600
@@ -177,7 +177,7 @@
     finally:
         w.release()
 
-def updatefromremote(ui, repo, remote):
+def updatefromremote(ui, repo, remote, path):
     ui.debug("checking for updated bookmarks\n")
     rb = remote.listkeys('bookmarks')
     changed = False
@@ -194,10 +194,17 @@
                     changed = True
                     ui.status(_("updating bookmark %s\n") % k)
                 else:
+                    # find a unique @ suffix
                     for x in range(1, 100):
                         n = '%s@%d' % (k, x)
                         if n not in repo._bookmarks:
                             break
+                    # try to use an @pathalias suffix
+                    # if an @pathalias already exists, we overwrite (update) it
+                    for p, u in ui.configitems("paths"):
+                        if path == u:
+                            n = '%s@%s' % (k, p)
+
                     repo._bookmarks[n] = cr.node()
                     changed = True
                     ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n))