# HG changeset patch # User Yuya Nishihara # Date 2018-02-10 12:14:41 # Node ID de0666564bde7c67c4d40a44dcf50515fef2f367 # Parent b7e2cf114e8593f27c86ae09ccee53509bc2d77b # Parent 7b2b82f891bf6355ed87c06ed9198bfcd033fe7d merge with stable diff --git a/mercurial/fileset.py b/mercurial/fileset.py --- a/mercurial/fileset.py +++ b/mercurial/fileset.py @@ -464,9 +464,10 @@ def copied(mctx, x): 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)') diff --git a/tests/test-fileset.t b/tests/test-fileset.t --- a/tests/test-fileset.t +++ b/tests/test-fileset.t @@ -249,6 +249,8 @@ Test files properties 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