diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1773,8 +1773,7 @@ def markcopied(self, src): """marks this file a copy of `src`""" - if self._repo.dirstate[self._path] in "nma": - self._repo.dirstate.copy(src, self._path) + self._repo.dirstate.copy(src, self._path) def clearunknown(self): """Removes conflicting items in the working directory so that diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -798,4 +798,5 @@ for dst, src in pathcopies(repo[fromrev], repo[rev]).iteritems(): if dst in exclude: continue - wctx[dst].markcopied(src) + if dst in wctx: + wctx[dst].markcopied(src) diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -795,12 +795,10 @@ $ hg co -q 0 $ echo a2 > a $ hg ci -qm 'modify a' -BROKEN: obviously... $ hg rebase -r . -d 1 --collapse rebasing 2:41c4ea50d4cf "modify a" (tip) merging b and a to b - abort: a@b977edf6f839: not found in manifest! - [255] + saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg $ cd .. Test rebasing when the file we are merging in destination is empty