bookmarks: Avoid unconditional forwarding of bookmarks for the null revision
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 25 Oct 2008 19:05:52 +0200
changeset 7256 df800e004077
parent 7255 69e431ea124d
child 7257 7fb0e130cf14
bookmarks: Avoid unconditional forwarding of bookmarks for the null revision This patch fixes the following minor problem: % hg bookmark -r null test % hg bookmarks test -1:000000000000 [...] % hg commit % hg bookmarks * test 17:861ce7a241f9 That is: Bookmarks referring to the null revision are always forwarded to the current revision.
hgext/bookmarks.py
--- a/hgext/bookmarks.py	Sat Oct 25 19:05:52 2008 +0200
+++ b/hgext/bookmarks.py	Sat Oct 25 19:05:52 2008 +0200
@@ -19,7 +19,7 @@
 from mercurial.commands import templateopts, hex, short
 from mercurial.i18n import _
 from mercurial import cmdutil, util, commands, changelog
-from mercurial.node import nullrev
+from mercurial.node import nullid, nullrev
 from mercurial.repo import RepoError
 import mercurial, mercurial.localrepo, mercurial.repair, os
 
@@ -182,6 +182,8 @@
             move the bookmark"""
             node  = super(bookmark_repo, self).commit(*k, **kw)
             parents = repo.changelog.parents(node)
+            if parents[1] == nullid:
+                parents = (parents[0],)
             marks = parse(repo)
             update = False
             for mark, n in marks.items():