Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGf3f5bfbf7e04: copies: use node.nullrev instead of literal -1
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 (4 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | Jan 15 2019, 2:07 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| # remove criss-crossed copies | # remove criss-crossed copies | ||||
| for k, v in list(t.items()): | for k, v in list(t.items()): | ||||
| if k in src and v in dst: | if k in src and v in dst: | ||||
| del t[k] | del t[k] | ||||
| return t | return t | ||||
| def _tracefile(fctx, am, limit=-1): | def _tracefile(fctx, am, limit=node.nullrev): | ||||
| """return file context that is the ancestor of fctx present in ancestor | """return file context that is the ancestor of fctx present in ancestor | ||||
| manifest am, stopping after the first ancestor lower than limit""" | manifest am, stopping after the first ancestor lower than limit""" | ||||
| for f in fctx.ancestors(): | for f in fctx.ancestors(): | ||||
| if am.get(f.path(), None) == f.filenode(): | if am.get(f.path(), None) == f.filenode(): | ||||
| return f | return f | ||||
| if limit >= 0 and not f.isintroducedafter(limit): | if limit >= 0 and not f.isintroducedafter(limit): | ||||
| return None | return None | ||||
| repo = a._repo | repo = a._repo | ||||
| debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies') | debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies') | ||||
| dbg = repo.ui.debug | dbg = repo.ui.debug | ||||
| if debug: | if debug: | ||||
| dbg('debug.copies: looking into rename from %s to %s\n' | dbg('debug.copies: looking into rename from %s to %s\n' | ||||
| % (a, b)) | % (a, b)) | ||||
| limit = _findlimit(repo, a.rev(), b.rev()) | limit = _findlimit(repo, a.rev(), b.rev()) | ||||
| if limit is None: | if limit is None: | ||||
| limit = -1 | limit = node.nullrev | ||||
| if debug: | if debug: | ||||
| dbg('debug.copies: search limit: %d\n' % limit) | dbg('debug.copies: search limit: %d\n' % limit) | ||||
| am = a.manifest() | am = a.manifest() | ||||
| # find where new files came from | # find where new files came from | ||||
| # we currently don't try to find where old files went, too expensive | # we currently don't try to find where old files went, too expensive | ||||
| # this means we can miss a case like 'hg rm b; hg cp a b' | # this means we can miss a case like 'hg rm b; hg cp a b' | ||||
| cm = {} | cm = {} | ||||