[PATCH 2 of 4] revset: minor preparatory refactor in _orderedlist

Boris Feld boris.feld at octobus.net
Fri Jan 18 10:53:17 EST 2019


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1547818460 -3600
#      Fri Jan 18 14:34:20 2019 +0100
# Node ID 35c9dec1849f6a41f87fdc130798387376bb8345
# Parent  52d20e4fe2e3049eec58140fdcadb43528729b3d
# EXP-Topic intlist
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 35c9dec1849f
revset: minor preparatory refactor in _orderedlist

In order to enforce the new %ld behavior in the cases where _intlist
serialization is still used, we will have to update this function. We do first
some small changes that do not alter the semantic. They just introduce lookup
caching and some pre-computation.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2172,11 +2172,13 @@ def _orderedlist(repo, subset, x):
         except ValueError:
             revs = stringset(repo, subset, t, defineorder)
 
+        full = isinstance(subset, fullreposet)
+        nullrev = node.nullrev
+
         for r in revs:
             if r in seen:
                 continue
-            if (r in subset
-                or r == node.nullrev and isinstance(subset, fullreposet)):
+            if (r in subset or full and r == nullrev):
                 ls.append(r)
             seen.add(r)
     return baseset(ls)


More information about the Mercurial-devel mailing list