Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 29406:c2193e59ef9f
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.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 23 Jun 2016 12:39:05 -0700 |
parents | 98e8313dcd9e |
children | 20fabe814f89 |
comparison
equal
deleted
inserted
replaced
29405:fbe380dc227a | 29406:c2193e59ef9f |
---|---|
690 if m(f): | 690 if m(f): |
691 return True | 691 return True |
692 | 692 |
693 return subset.filter(matches, condrepr=('<status[%r] %r>', field, pat)) | 693 return subset.filter(matches, condrepr=('<status[%r] %r>', field, pat)) |
694 | 694 |
695 def _children(repo, narrow, parentset): | 695 def _children(repo, subset, parentset): |
696 if not parentset: | 696 if not parentset: |
697 return baseset() | 697 return baseset() |
698 cs = set() | 698 cs = set() |
699 pr = repo.changelog.parentrevs | 699 pr = repo.changelog.parentrevs |
700 minrev = parentset.min() | 700 minrev = parentset.min() |
701 for r in narrow: | 701 for r in subset: |
702 if r <= minrev: | 702 if r <= minrev: |
703 continue | 703 continue |
704 for p in pr(r): | 704 for p in pr(r): |
705 if p in parentset: | 705 if p in parentset: |
706 cs.add(r) | 706 cs.add(r) |
707 # XXX using a set to feed the baseset is wrong. Sets are not ordered. | |
708 # This does not break because of other fullreposet misbehavior. | |
709 return baseset(cs) | 707 return baseset(cs) |
710 | 708 |
711 @predicate('children(set)', safe=True) | 709 @predicate('children(set)', safe=True) |
712 def children(repo, subset, x): | 710 def children(repo, subset, x): |
713 """Child changesets of changesets in set. | 711 """Child changesets of changesets in set. |
1147 getargs(x, 0, 0, _("head takes no arguments")) | 1145 getargs(x, 0, 0, _("head takes no arguments")) |
1148 hs = set() | 1146 hs = set() |
1149 cl = repo.changelog | 1147 cl = repo.changelog |
1150 for b, ls in repo.branchmap().iteritems(): | 1148 for b, ls in repo.branchmap().iteritems(): |
1151 hs.update(cl.rev(h) for h in ls) | 1149 hs.update(cl.rev(h) for h in ls) |
1152 # XXX using a set to feed the baseset is wrong. Sets are not ordered. | |
1153 # This does not break because of other fullreposet misbehavior. | |
1154 # XXX We should combine with subset first: 'subset & baseset(...)'. This is | 1150 # XXX We should combine with subset first: 'subset & baseset(...)'. This is |
1155 # necessary to ensure we preserve the order in subset. | 1151 # necessary to ensure we preserve the order in subset. |
1156 return baseset(hs) & subset | 1152 return baseset(hs) & subset |
1157 | 1153 |
1158 @predicate('heads(set)', safe=True) | 1154 @predicate('heads(set)', safe=True) |