[PATCH 2 of 9] shelve: publicancestors do not have to visit nullrev

Mads Kiilerich mads at kiilerich.com
Sun Feb 9 18:01:11 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1391989966 -3600
#      Mon Feb 10 00:52:46 2014 +0100
# Node ID 0449c9dbf366ade29b6384f4d6e644095cd73bc5
# Parent  23335d0a2a4b55ae94c96819d12adfb67b22c609
shelve: publicancestors do not have to visit nullrev

Not visiting nullrev seems more correct and might be a minor optimization.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -22,7 +22,7 @@ shelve".
 """
 
 from mercurial.i18n import _
-from mercurial.node import nullid, bin, hex
+from mercurial.node import nullid, nullrev, bin, hex
 from mercurial import changegroup, cmdutil, scmutil, phases
 from mercurial import error, hg, mdiff, merge, patch, repair, util
 from mercurial import templatefilters
@@ -125,7 +125,7 @@ def createcmd(ui, repo, pats, opts):
         """Compute the heads of the public ancestors of a commit.
 
         Much faster than the revset heads(ancestors(ctx) - draft())"""
-        seen = set()
+        seen = set([nullrev])
         visit = util.deque()
         visit.append(ctx)
         while visit:


More information about the Mercurial-devel mailing list