Mercurial > hg-stable
diff mercurial/scmutil.py @ 47592:0f5c203eb5ab
dirstate: add a function to update tracking status while "moving" parents
The `scmutil.dirstateparent` is moving the dirstate parent without touching the
working copy. It is used by history-rewriting operations like amending of
folding.
The function was directly doing the "low level" computation and dirstate
change. All that logic belong to the dirstate and should be moved there.
For this purpose we introduce a new function that does just that and use it.
Differential Revision: https://phab.mercurial-scm.org/D11012
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 10 Jul 2021 23:31:51 +0200 |
parents | dd339191f2dc |
children | 46c318b9b9a4 |
line wrap: on
line diff
--- a/mercurial/scmutil.py Thu Jul 08 10:05:23 2021 +0200 +++ b/mercurial/scmutil.py Sat Jul 10 23:31:51 2021 +0200 @@ -1485,25 +1485,15 @@ copies = dict(ds.copies()) ds.setparents(newctx.node(), repo.nullid) s = newctx.status(oldctx, match=match) + for f in s.modified: - if ds[f] == b'r': - # modified + removed -> removed - continue - ds.normallookup(f) + ds.update_file_reference(f, p1_tracked=True) for f in s.added: - if ds[f] == b'r': - # added + removed -> unknown - ds.drop(f) - elif ds[f] != b'a': - ds.add(f) + ds.update_file_reference(f, p1_tracked=False) for f in s.removed: - if ds[f] == b'a': - # removed + added -> normal - ds.normallookup(f) - elif ds[f] != b'r': - ds.remove(f) + ds.update_file_reference(f, p1_tracked=True) # Merge old parent and old working dir copies oldcopies = copiesmod.pathcopies(newctx, oldctx, match)