[PATCH 1 of 5] revsets: passing a set to baseset() is not wrong

Martin von Zweigbergk martinvonz at google.com
Fri Jun 24 22:10:13 UTC 2016


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1466710745 25200
#      Thu Jun 23 12:39:05 2016 -0700
# Node ID 070b3c85eaa93617508e0b4a69e724546566e2b6
# Parent  fbe380dc227a0240939aa5a4941eda70d958ea40
revsets: passing a set to baseset() is not wrong

Since 69c6e9623bdc (revset: force ascending order for baseset
initialized from a set, 2016-04-04), it is safe to pass a revset to a
baseset.

diff -r fbe380dc227a -r 070b3c85eaa9 mercurial/revset.py
--- a/mercurial/revset.py	Fri Jun 24 02:04:43 2016 +0200
+++ b/mercurial/revset.py	Thu Jun 23 12:39:05 2016 -0700
@@ -692,20 +692,18 @@
 
     return subset.filter(matches, condrepr=('<status[%r] %r>', field, pat))
 
-def _children(repo, narrow, parentset):
+def _children(repo, subset, parentset):
     if not parentset:
         return baseset()
     cs = set()
     pr = repo.changelog.parentrevs
     minrev = parentset.min()
-    for r in narrow:
+    for r in subset:
         if r <= minrev:
             continue
         for p in pr(r):
             if p in parentset:
                 cs.add(r)
-    # XXX using a set to feed the baseset is wrong. Sets are not ordered.
-    # This does not break because of other fullreposet misbehavior.
     return baseset(cs)
 
 @predicate('children(set)', safe=True)
@@ -1149,8 +1147,6 @@
     cl = repo.changelog
     for b, ls in repo.branchmap().iteritems():
         hs.update(cl.rev(h) for h in ls)
-    # XXX using a set to feed the baseset is wrong. Sets are not ordered.
-    # This does not break because of other fullreposet misbehavior.
     # XXX We should combine with subset first: 'subset & baseset(...)'. This is
     # necessary to ensure we preserve the order in subset.
     return baseset(hs) & subset


More information about the Mercurial-devel mailing list