diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
index 464aa857c71766966c5cb5f7ea7b014cf7f02302_bWVyY3VyaWFsL2NtZHV0aWwucHk=..ce52377102dbeab2f1ad2cef533635574afbcbbc_bWVyY3VyaWFsL2NtZHV0aWwucHk= 100644
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2505,8 +2505,8 @@
             # was removed, it's no longer relevant. If X is missing (aka
             # deleted), old X must be preserved.
             files.update(filestoamend)
-            files = [f for f in files if (not samefile(f, wctx, base)
-                                          or f in wctx.deleted())]
+            files = [f for f in files if (f not in filestoamend
+                                          or not samefile(f, wctx, base))]
 
             def filectxfn(repo, ctx_, path):
                 try:
diff --git a/tests/test-amend.t b/tests/test-amend.t
index 464aa857c71766966c5cb5f7ea7b014cf7f02302_dGVzdHMvdGVzdC1hbWVuZC50..ce52377102dbeab2f1ad2cef533635574afbcbbc_dGVzdHMvdGVzdC1hbWVuZC50 100644
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -456,7 +456,7 @@
 - working copy parent has a change to file `a`
 - working copy has the inverse change
 - we amend the working copy parent for files other than `a`
-hg includes the changes to `a` anyway.
+hg used to include the changes to `a` anyway.
 
   $ hg init 6157; cd 6157
   $ echo a > a; echo b > b; hg commit -qAm_
@@ -466,4 +466,5 @@
    1 files changed, 1 insertions(+), 1 deletions(-)
   $ echo a > a; echo b2 > b; hg amend -q b
   $ hg diff --stat -c .
+   a |  2 +-
    b |  2 +-
@@ -469,2 +470,2 @@
    b |  2 +-
-   1 files changed, 1 insertions(+), 1 deletions(-)
+   2 files changed, 2 insertions(+), 2 deletions(-)