Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 49510:e02dcc625171
revset: handle wdir() in `roots()`
This is already handled in `heads()`, and both are needed to determine if a set
is contiguous.
I'm guessing the `0 <= p` check was to try to filter out the null revision, but
it looks like that comes through in the corner case of a new repo with no
commits. But that was already the case, as shown by the tests.
Before (on a clone of hg):
$ python3.8 hg perf::revset --config extensions.perf=contrib/perf.py 'roots(all())'
! wall 0.059301 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
After:
$ python3.8 hg perf::revset --config extensions.perf=contrib/perf.py 'roots(all())'
! wall 0.059387 comb 0.060000 user 0.060000 sys 0.000000 (best of 100)
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 03 Oct 2022 17:24:52 -0400 |
parents | 6dbe74669eba |
children | 117dcc4a0e67 |
comparison
equal
deleted
inserted
replaced
49509:946c023212b8 | 49510:e02dcc625171 |
---|---|
2340 """Changesets in set with no parent changeset in set.""" | 2340 """Changesets in set with no parent changeset in set.""" |
2341 s = getset(repo, fullreposet(repo), x) | 2341 s = getset(repo, fullreposet(repo), x) |
2342 parents = repo.changelog.parentrevs | 2342 parents = repo.changelog.parentrevs |
2343 | 2343 |
2344 def filter(r): | 2344 def filter(r): |
2345 for p in parents(r): | 2345 try: |
2346 if 0 <= p and p in s: | 2346 for p in parents(r): |
2347 return False | 2347 if 0 <= p and p in s: |
2348 return False | |
2349 except error.WdirUnsupported: | |
2350 for p in repo[None].parents(): | |
2351 if p.rev() in s: | |
2352 return False | |
2348 return True | 2353 return True |
2349 | 2354 |
2350 return subset & s.filter(filter, condrepr=b'<roots>') | 2355 return subset & s.filter(filter, condrepr=b'<roots>') |
2351 | 2356 |
2352 | 2357 |