comparison mercurial/cmdutil.py @ 49144:f45e1618cbf6

amend: move "return None for removed files" into block handling filestoamend This is just a small logic cleanup from D12573, no change in behavior. Differential Revision: https://phab.mercurial-scm.org/D12576
author Kyle Lippincott <spectral@google.com>
date Tue, 19 Apr 2022 12:17:23 -0700
parents ea98850a136e
children c577d394ed6b
comparison
equal deleted inserted replaced
49143:e55ce61891e3 49144:f45e1618cbf6
2931 if (f not in filestoamend or not samefile(f, wctx, base)) 2931 if (f not in filestoamend or not samefile(f, wctx, base))
2932 ] 2932 ]
2933 2933
2934 def filectxfn(repo, ctx_, path): 2934 def filectxfn(repo, ctx_, path):
2935 try: 2935 try:
2936 # Return None for removed files.
2937 if path in wctx.removed() and path in filestoamend:
2938 return None
2939
2940 # If the file being considered is not amongst the files 2936 # If the file being considered is not amongst the files
2941 # to be amended, we should use the file context from the 2937 # to be amended, we should use the file context from the
2942 # old changeset. This avoids issues when only some files in 2938 # old changeset. This avoids issues when only some files in
2943 # the working copy are being amended but there are also 2939 # the working copy are being amended but there are also
2944 # changes to other files from the old changeset. 2940 # changes to other files from the old changeset.
2945 if path in filestoamend: 2941 if path in filestoamend:
2942 # Return None for removed files.
2943 if path in wctx.removed():
2944 return None
2946 fctx = wctx[path] 2945 fctx = wctx[path]
2947 else: 2946 else:
2948 fctx = old.filectx(path) 2947 fctx = old.filectx(path)
2949 flags = fctx.flags() 2948 flags = fctx.flags()
2950 mctx = context.memfilectx( 2949 mctx = context.memfilectx(