Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 43817:5558e3437872
amend: check for file modifications when updating dirstate (issue6233)
Previously, we called dirstate.normal(f), which would put information into the
dirstate claiming that the file on disk is what it "should be" for the current
checkout, and it would have the size and timestamp of the most recent
modification to the file (which is not necessarily the one we just committed).
If the file was modified while the commit message editor was open, we would put
incorrect information into the dirstate.
Differential Revision: https://phab.mercurial-scm.org/D7521
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Tue, 26 Nov 2019 16:10:21 -0800 |
parents | 7b14d649af1b |
children | 072b745936f1 |
comparison
equal
deleted
inserted
replaced
43816:32d11a23c9cf | 43817:5558e3437872 |
---|---|
3052 # the dirstate for all the files in the new commit which commitctx | 3052 # the dirstate for all the files in the new commit which commitctx |
3053 # could have done if it updated the dirstate. Now, we can | 3053 # could have done if it updated the dirstate. Now, we can |
3054 # selectively update the dirstate only for the amended files. | 3054 # selectively update the dirstate only for the amended files. |
3055 dirstate = repo.dirstate | 3055 dirstate = repo.dirstate |
3056 | 3056 |
3057 # Update the state of the files which were added and | 3057 # Update the state of the files which were added and modified in the |
3058 # and modified in the amend to "normal" in the dirstate. | 3058 # amend to "normal" in the dirstate. We need to use "normallookup" since |
3059 # the files may have changed since the command started; using "normal" | |
3060 # would mark them as clean but with uncommitted contents. | |
3059 normalfiles = set(wctx.modified() + wctx.added()) & filestoamend | 3061 normalfiles = set(wctx.modified() + wctx.added()) & filestoamend |
3060 for f in normalfiles: | 3062 for f in normalfiles: |
3061 dirstate.normal(f) | 3063 dirstate.normallookup(f) |
3062 | 3064 |
3063 # Update the state of files which were removed in the amend | 3065 # Update the state of files which were removed in the amend |
3064 # to "removed" in the dirstate. | 3066 # to "removed" in the dirstate. |
3065 removedfiles = set(wctx.removed()) & filestoamend | 3067 removedfiles = set(wctx.removed()) & filestoamend |
3066 for f in removedfiles: | 3068 for f in removedfiles: |