Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGe3e1b0639375: copies: use node.wdirrev instead of inventing another constant for it
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| pulkit |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/copies.py (9 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | Jan 15 2019, 12:20 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| # - walk the graph in topological order with the help of a heap; | # - walk the graph in topological order with the help of a heap; | ||||
| # - add unseen parents to side map | # - add unseen parents to side map | ||||
| # - clear side of any parent that has children on different sides | # - clear side of any parent that has children on different sides | ||||
| # - track number of interesting revs that might still be on a side | # - track number of interesting revs that might still be on a side | ||||
| # - track the lowest interesting rev seen | # - track the lowest interesting rev seen | ||||
| # - quit when interesting revs is zero | # - quit when interesting revs is zero | ||||
| cl = repo.changelog | cl = repo.changelog | ||||
| working = len(cl) # pseudo rev for the working directory | |||||
| if a is None: | if a is None: | ||||
| a = working | a = node.wdirrev | ||||
| if b is None: | if b is None: | ||||
| b = working | b = node.wdirrev | ||||
| side = {a: -1, b: 1} | side = {a: -1, b: 1} | ||||
| visit = [-a, -b] | visit = [-a, -b] | ||||
| heapq.heapify(visit) | heapq.heapify(visit) | ||||
| interesting = len(visit) | interesting = len(visit) | ||||
| hascommonancestor = False | hascommonancestor = False | ||||
| limit = working | limit = node.wdirrev | ||||
| while interesting: | while interesting: | ||||
| r = -heapq.heappop(visit) | r = -heapq.heappop(visit) | ||||
| if r == working: | if r == node.wdirrev: | ||||
| parents = [cl.rev(p) for p in repo.dirstate.parents()] | parents = [cl.rev(p) for p in repo.dirstate.parents()] | ||||
| else: | else: | ||||
| parents = cl.parentrevs(r) | parents = cl.parentrevs(r) | ||||
| for p in parents: | for p in parents: | ||||
| if p < 0: | if p < 0: | ||||
| continue | continue | ||||
| if p not in side: | if p not in side: | ||||
| # first time we see p; add it to visit | # first time we see p; add it to visit | ||||