Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG823f34acfd46: revset: make heads(commonancestors(x + x^)) be x^, not x
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/revset.py (6 lines) | |||
| M | tests/test-revset.t (2 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Valentin Gatien-Baron | Sep 25 2018, 4:32 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | valentin.gatienbaron | ||
| Closed | valentin.gatienbaron | ||
| Closed | valentin.gatienbaron | ||
| Closed | valentin.gatienbaron | ||
| Closed | valentin.gatienbaron | ||
| Closed | valentin.gatienbaron | ||
| Closed | valentin.gatienbaron |
| condrepr='<branch closed>') | condrepr='<branch closed>') | ||||
| # for internal use | # for internal use | ||||
| @predicate('_commonancestorheads(set)', safe=True) | @predicate('_commonancestorheads(set)', safe=True) | ||||
| def _commonancestorheads(repo, subset, x): | def _commonancestorheads(repo, subset, x): | ||||
| # This is an internal method is for quickly calculating "heads(::x and | # This is an internal method is for quickly calculating "heads(::x and | ||||
| # ::y)" | # ::y)" | ||||
| # These greatest common ancestors are the same ones that the consesus bid | # These greatest common ancestors are the same ones that the consensus bid | ||||
| # merge will find. | # merge will find. | ||||
| h = heads(repo, fullreposet(repo), x, anyorder) | startrevs = getset(repo, fullreposet(repo), x) | ||||
| ancs = repo.changelog._commonancestorsheads(*list(h)) | ancs = repo.changelog._commonancestorsheads(*list(startrevs)) | ||||
| return subset & baseset(ancs) | return subset & baseset(ancs) | ||||
| @predicate('commonancestors(set)', safe=True) | @predicate('commonancestors(set)', safe=True) | ||||
| def commonancestors(repo, subset, x): | def commonancestors(repo, subset, x): | ||||
| """Changesets that are ancestors of every changeset in set. | """Changesets that are ancestors of every changeset in set. | ||||
| """ | """ | ||||
| startrevs = getset(repo, fullreposet(repo), x) | startrevs = getset(repo, fullreposet(repo), x) | ||||
| if not startrevs: | if not startrevs: | ||||
| $ hg log -T '{rev}\n' -r 'heads(commonancestors(7 + 9))' | $ hg log -T '{rev}\n' -r 'heads(commonancestors(7 + 9))' | ||||
| 4 | 4 | ||||
| $ hg log -T '{rev}\n' -r 'heads(commonancestors(heads(all())))' | $ hg log -T '{rev}\n' -r 'heads(commonancestors(heads(all())))' | ||||
| 4 | 4 | ||||
| $ hg log -T '{rev}\n' -r 'heads(commonancestors(9))' | $ hg log -T '{rev}\n' -r 'heads(commonancestors(9))' | ||||
| 9 | 9 | ||||
| $ hg log -T '{rev}\n' -r 'heads(commonancestors(8 + 9))' | $ hg log -T '{rev}\n' -r 'heads(commonancestors(8 + 9))' | ||||
| 9 | 8 | ||||
| test ancestor variants of empty revision | test ancestor variants of empty revision | ||||
| $ log 'ancestor(none())' | $ log 'ancestor(none())' | ||||
| $ log 'ancestors(none())' | $ log 'ancestors(none())' | ||||
| $ log 'commonancestors(none())' | $ log 'commonancestors(none())' | ||||
| $ log 'heads(commonancestors(none()))' | $ log 'heads(commonancestors(none()))' | ||||