mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
revset: make head() honor order of subset
The ordering of 'x & head()' was broken in 329d82866742 (revset: improve head revset performance, 2014-03-13). Presumably due to other optimizations since then, undoing that change to fix the order does not slow down the simple case of "hg log -r 'head()'" mentioned in that commit. I see a small slowdown from ~0.16s to about ~0.19s with 'not 0 & head()', but I'd say it's worth it for the correct output.
This commit is contained in:
parent
f44cccc475
commit
59e258644a
@ -1147,9 +1147,7 @@ def head(repo, subset, x):
|
||||
cl = repo.changelog
|
||||
for ls in repo.branchmap().itervalues():
|
||||
hs.update(cl.rev(h) for h in ls)
|
||||
# XXX We should combine with subset first: 'subset & baseset(...)'. This is
|
||||
# necessary to ensure we preserve the order in subset.
|
||||
return baseset(hs) & subset
|
||||
return subset & baseset(hs)
|
||||
|
||||
@predicate('heads(set)', safe=True)
|
||||
def heads(repo, subset, x):
|
||||
|
@ -952,13 +952,12 @@ ordering defined by it.
|
||||
1
|
||||
0
|
||||
|
||||
'head()' combines sets in wrong order:
|
||||
'head()' combines sets in right order:
|
||||
|
||||
$ log '2:0 & head()'
|
||||
0
|
||||
1
|
||||
2
|
||||
BROKEN: should be '2 1 0'
|
||||
1
|
||||
0
|
||||
|
||||
'a + b', which is optimized to '_list(a b)', should take the ordering of
|
||||
the left expression:
|
||||
|
Loading…
Reference in New Issue
Block a user