Show More
@@ -2967,29 +2967,30 b' def amend(ui, repo, old, extra, pats, op' | |||
|
2967 | 2967 | newid = repo.commitctx(new) |
|
2968 | 2968 | ms.reset() |
|
2969 | 2969 | |
|
2970 | # Reroute the working copy parent to the new changeset | |
|
2971 | repo.setparents(newid, repo.nullid) | |
|
2972 | ||
|
2973 | # Fixing the dirstate because localrepo.commitctx does not update | |
|
2974 | # it. This is rather convenient because we did not need to update | |
|
2975 | # the dirstate for all the files in the new commit which commitctx | |
|
2976 | # could have done if it updated the dirstate. Now, we can | |
|
2977 | # selectively update the dirstate only for the amended files. | |
|
2978 | dirstate = repo.dirstate | |
|
2979 | ||
|
2980 | # Update the state of the files which were added and modified in the | |
|
2981 | # amend to "normal" in the dirstate. We need to use "normallookup" since | |
|
2982 | # the files may have changed since the command started; using "normal" | |
|
2983 | # would mark them as clean but with uncommitted contents. | |
|
2984 | normalfiles = set(wctx.modified() + wctx.added()) & filestoamend | |
|
2985 | for f in normalfiles: | |
|
2986 | dirstate.normallookup(f) | |
|
2987 | ||
|
2988 | # Update the state of files which were removed in the amend | |
|
2989 | # to "removed" in the dirstate. | |
|
2990 | removedfiles = set(wctx.removed()) & filestoamend | |
|
2991 | for f in removedfiles: | |
|
2992 | dirstate.drop(f) | |
|
2970 | with repo.dirstate.parentchange(): | |
|
2971 | # Reroute the working copy parent to the new changeset | |
|
2972 | repo.setparents(newid, repo.nullid) | |
|
2973 | ||
|
2974 | # Fixing the dirstate because localrepo.commitctx does not update | |
|
2975 | # it. This is rather convenient because we did not need to update | |
|
2976 | # the dirstate for all the files in the new commit which commitctx | |
|
2977 | # could have done if it updated the dirstate. Now, we can | |
|
2978 | # selectively update the dirstate only for the amended files. | |
|
2979 | dirstate = repo.dirstate | |
|
2980 | ||
|
2981 | # Update the state of the files which were added and modified in the | |
|
2982 | # amend to "normal" in the dirstate. We need to use "normallookup" since | |
|
2983 | # the files may have changed since the command started; using "normal" | |
|
2984 | # would mark them as clean but with uncommitted contents. | |
|
2985 | normalfiles = set(wctx.modified() + wctx.added()) & filestoamend | |
|
2986 | for f in normalfiles: | |
|
2987 | dirstate.normallookup(f) | |
|
2988 | ||
|
2989 | # Update the state of files which were removed in the amend | |
|
2990 | # to "removed" in the dirstate. | |
|
2991 | removedfiles = set(wctx.removed()) & filestoamend | |
|
2992 | for f in removedfiles: | |
|
2993 | dirstate.drop(f) | |
|
2993 | 2994 | |
|
2994 | 2995 | mapping = {old.node(): (newid,)} |
|
2995 | 2996 | obsmetadata = None |
General Comments 0
You need to be logged in to leave comments.
Login now