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

login
register
mail settings
Submitter Mads Kiilerich
Date Feb. 10, 2014, 12:01 a.m.
Message ID <0449c9dbf366ade29b63.1391990471@localhost.localdomain>
Download mbox | patch
Permalink /patch/3525/
State Accepted
Commit 955547eb2e209efb9b316d71bad9c140059ddbde
Headers show

Comments

Mads Kiilerich - Feb. 10, 2014, 12:01 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@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.

Patch

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: