Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bookmarks.py @ 15613:2fad18f15409
bookmarks: shadow divergent bookmarks of foo with foo@n
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 06 Dec 2011 14:17:33 -0600 |
parents | 7196ed7a1505 |
children | 260a6449d83a |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Tue Dec 06 13:21:45 2011 +0100 +++ b/mercurial/bookmarks.py Tue Dec 06 14:17:33 2011 -0600 @@ -155,7 +155,9 @@ d = {} for k, v in marks.iteritems(): - d[k] = hex(v) + # don't expose local divergent bookmarks + if '@' not in k and not k.endswith('@'): + d[k] = hex(v) return d def pushbookmark(repo, key, old, new): @@ -192,8 +194,14 @@ changed = True ui.status(_("updating bookmark %s\n") % k) else: - ui.warn(_("not updating divergent" - " bookmark %s\n") % k) + for x in range(1, 100): + n = '%s@%d' % (k, x) + if n not in repo._bookmarks: + break + repo._bookmarks[n] = cr.node() + changed = True + ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n)) + if changed: write(repo)