Patchwork D12576: amend: move "return None for removed files" into block handling filestoamend

login
register
mail settings
Submitter phabricator
Date April 19, 2022, 7:21 p.m.
Message ID <differential-rev-PHID-DREV-2yncbnnbv6sjcj7xs7vv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50924/
State New
Headers show

Comments

phabricator - April 19, 2022, 7:21 p.m.
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is just a small logic cleanup from D12573 <https://phab.mercurial-scm.org/D12573>, no change in behavior.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12576

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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)