changeset 35821:7b2b82f891bf stable

fileset: don't abort when running copied() on a revision with a removed file It looks like AND with any status-y fileset would trigger this, as added() and removed() also failed. The 4.5-rc revision is a convenient test case, but the merge isn't necessary.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 06 Feb 2018 23:53:37 -0500
parents 1d60ad093792
children 9f454a717c43 de0666564bde
files mercurial/fileset.py tests/test-fileset.t
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/fileset.py	Thu Feb 01 14:13:41 2018 -0500
+++ b/mercurial/fileset.py	Tue Feb 06 23:53:37 2018 -0500
@@ -464,9 +464,10 @@
     getargs(x, 0, 0, _("copied takes no arguments"))
     s = []
     for f in mctx.subset:
-        p = mctx.ctx[f].parents()
-        if p and p[0].path() != f:
-            s.append(f)
+        if f in mctx.ctx:
+            p = mctx.ctx[f].parents()
+            if p and p[0].path() != f:
+                s.append(f)
     return s
 
 @predicate('revs(revs, pattern)')
--- a/tests/test-fileset.t	Thu Feb 01 14:13:41 2018 -0500
+++ b/tests/test-fileset.t	Tue Feb 06 23:53:37 2018 -0500
@@ -249,6 +249,8 @@
 Test merge states
 
   $ hg ci -m manychanges
+  $ hg file -r . 'set:copied() & modified()'
+  [1]
   $ hg up -C 0
   * files updated, 0 files merged, * files removed, 0 files unresolved (glob)
   $ echo c >> b2