diff mercurial/bookmarks.py @ 17770:6c81b8ebf66e

bookmarks: when @ bookmark diverges, don't double the @ sign (BC) This changeset treats the bookmark "@" as a special case for the naming of divergent bookmarks, as per the tables below. For the <no alias> case, the actual suffix will vary, depending on what suffixes are already in use. Before: Bookmark | Remote | Divergent Bookmark -------------------------------------- foo | bar | foo@bar foo | <no alias> | foo@1 @ | bar | @@bar @ | <no alias> | @@1 After: Bookmark | Remote | Divergent Bookmark -------------------------------------- foo | bar | foo@bar foo | <no alias> | foo@1 @ | bar | @bar @ | <no alias> | @1 This case is likely to be more common now that 92980a8dfdfe has made the "@" bookmark have special meaning to clone. The change in behavior was discussed on the mailing list in the thread below: http://markmail.org/thread/rwedgxp7le5j2h2f
author David M. Carr <david@carrclan.us>
date Mon, 15 Oct 2012 23:54:54 -0400
parents b8424c92ba2b
children be1467342038
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Tue Oct 16 16:04:28 2012 +0200
+++ b/mercurial/bookmarks.py	Mon Oct 15 23:54:54 2012 -0400
@@ -214,16 +214,20 @@
                     changed = True
                     ui.status(_("updating bookmark %s\n") % k)
                 else:
+                    if k == '@':
+                        kd = ''
+                    else:
+                        kd = k
                     # find a unique @ suffix
                     for x in range(1, 100):
-                        n = '%s@%d' % (k, x)
+                        n = '%s@%d' % (kd, 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)
+                            n = '%s@%s' % (kd, p)
 
                     repo._bookmarks[n] = cr.node()
                     changed = True