[PATCH 09 of 14] bookmarks: Avoid unconditional forwarding of bookmarks for the null revision

Joel Rosdahl joel at rosdahl.net
Sat Oct 25 10:18:42 CDT 2008


# HG changeset patch
# User Joel Rosdahl <joel at rosdahl.net>
# Date 1224947620 -7200
# Node ID bea88297d0dd8592a0b1352727d740bf9c70c9ab
# Parent  a8e0f150fa16636d0c5ea39118e826cef94230d6
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.

diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
--- a/hgext/bookmarks.py
+++ b/hgext/bookmarks.py
@@ -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():


More information about the Mercurial-devel mailing list