Details
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHG7a06e04cbd68: mq: replace `add` call with newer API
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
Alphare |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | hgext/mq.py (8 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
09000c0a51bd | 4ee8d039ebb5 | Pierre-Yves David | Jul 18 2021, 4:35 PM |
if diffopts.git or diffopts.upgrade: | if diffopts.git or diffopts.upgrade: | ||||
copies = {} | copies = {} | ||||
for dst in a: | for dst in a: | ||||
src = repo.dirstate.copied(dst) | src = repo.dirstate.copied(dst) | ||||
# during qfold, the source file for copies may | # during qfold, the source file for copies may | ||||
# be removed. Treat this as a simple add. | # be removed. Treat this as a simple add. | ||||
if src is not None and src in repo.dirstate: | if src is not None and src in repo.dirstate: | ||||
copies.setdefault(src, []).append(dst) | copies.setdefault(src, []).append(dst) | ||||
repo.dirstate.add(dst) | repo.dirstate.update_file( | ||||
dst, p1_tracked=False, wc_tracked=True | |||||
) | |||||
# remember the copies between patchparent and qtip | # remember the copies between patchparent and qtip | ||||
for dst in aaa: | for dst in aaa: | ||||
src = ctx[dst].copysource() | src = ctx[dst].copysource() | ||||
if src: | if src: | ||||
copies.setdefault(src, []).extend( | copies.setdefault(src, []).extend( | ||||
copies.get(dst, []) | copies.get(dst, []) | ||||
) | ) | ||||
if dst in a: | if dst in a: | ||||
copies[src].append(dst) | copies[src].append(dst) | ||||
# we can't copy a file created by the patch itself | # we can't copy a file created by the patch itself | ||||
if dst in copies: | if dst in copies: | ||||
del copies[dst] | del copies[dst] | ||||
for src, dsts in pycompat.iteritems(copies): | for src, dsts in pycompat.iteritems(copies): | ||||
for dst in dsts: | for dst in dsts: | ||||
repo.dirstate.copy(src, dst) | repo.dirstate.copy(src, dst) | ||||
else: | else: | ||||
for dst in a: | for dst in a: | ||||
repo.dirstate.add(dst) | repo.dirstate.update_file( | ||||
dst, p1_tracked=False, wc_tracked=True | |||||
) | |||||
# Drop useless copy information | # Drop useless copy information | ||||
for f in list(repo.dirstate.copies()): | for f in list(repo.dirstate.copies()): | ||||
repo.dirstate.copy(None, f) | repo.dirstate.copy(None, f) | ||||
for f in r: | for f in r: | ||||
repo.dirstate.update_file_p1(f, p1_tracked=True) | repo.dirstate.update_file_p1(f, p1_tracked=True) | ||||
# if the patch excludes a modified file, mark that | # if the patch excludes a modified file, mark that | ||||
# file with mtime=0 so status can see it. | # file with mtime=0 so status can see it. | ||||
mm = [] | mm = [] |