changeset 49199: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 e55ce61891e3
children 10b9f11daf15
files mercurial/cmdutil.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Apr 12 17:35:25 2022 +0200
+++ b/mercurial/cmdutil.py	Tue Apr 19 12:17:23 2022 -0700
@@ -2933,16 +2933,15 @@
 
             def filectxfn(repo, ctx_, path):
                 try:
-                    # Return None for removed files.
-                    if path in wctx.removed() and path in filestoamend:
-                        return None
-
                     # If the file being considered is not amongst the files
                     # to be amended, we should use the file context from the
                     # old changeset. This avoids issues when only some files in
                     # the working copy are being amended but there are also
                     # changes to other files from the old changeset.
                     if path in filestoamend:
+                        # Return None for removed files.
+                        if path in wctx.removed():
+                            return None
                         fctx = wctx[path]
                     else:
                         fctx = old.filectx(path)