comparison mercurial/cmdutil.py @ 35023:5f40efa472db stable

amend: do not drop missing files (issue5732) samefile() can be wrong since wctx.manifest() does not include missing files, whereas missing files should be preserved on commit.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 04 Nov 2017 23:48:19 +0900
parents 0ba3b928f9a9
children 691524f0bbf6
comparison
equal deleted inserted replaced
35022:0ba3b928f9a9 35023:5f40efa472db
3164 3164
3165 # Prune files which were reverted by the updates: if old 3165 # Prune files which were reverted by the updates: if old
3166 # introduced file X and the file was renamed in the working 3166 # introduced file X and the file was renamed in the working
3167 # copy, then those two files are the same and 3167 # copy, then those two files are the same and
3168 # we can discard X from our list of files. Likewise if X 3168 # we can discard X from our list of files. Likewise if X
3169 # was deleted, it's no longer relevant 3169 # was removed, it's no longer relevant. If X is missing (aka
3170 # deleted), old X must be preserved.
3170 files.update(filestoamend) 3171 files.update(filestoamend)
3171 files = [f for f in files if not samefile(f, wctx, base)] 3172 files = [f for f in files if (not samefile(f, wctx, base)
3173 or f in wctx.deleted())]
3172 3174
3173 def filectxfn(repo, ctx_, path): 3175 def filectxfn(repo, ctx_, path):
3174 try: 3176 try:
3175 # If the file being considered is not amongst the files 3177 # If the file being considered is not amongst the files
3176 # to be amended, we should return the file context from the 3178 # to be amended, we should return the file context from the