diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -190,6 +190,9 @@ class filectx(object): elif name == '_filerev': self._filerev = self._filelog.rev(self._filenode) return self._filerev + elif name == '_repopath': + self._repopath = self._path + return self._repopath else: raise AttributeError, name @@ -404,7 +407,7 @@ class filectx(object): pl = [(n.path(), n.filenode()) for n in c.parents()] acache[(c._path, None)] = pl - flcache = {self._path:self._filelog, fc2._path:fc2._filelog} + flcache = {self._repopath:self._filelog, fc2._repopath:fc2._filelog} def parents(vertex): if vertex in acache: return acache[vertex] diff --git a/tests/test-mv-cp-st-diff b/tests/test-mv-cp-st-diff --- a/tests/test-mv-cp-st-diff +++ b/tests/test-mv-cp-st-diff @@ -65,3 +65,4 @@ tb "hg mv a b" "add b b1" "add b w" "sin tb "hg cp a b" "add b b1" "add a w" "single copy" tb "hg mv a b" "hg mv b c" "hg mv c d" "rename chain" tb "hg cp a b" "hg cp b c" "hg cp c d" "copy chain" +tb "add a a1" "hg mv a b" "hg mv b a" "circular rename" diff --git a/tests/test-mv-cp-st-diff.out b/tests/test-mv-cp-st-diff.out --- a/tests/test-mv-cp-st-diff.out +++ b/tests/test-mv-cp-st-diff.out @@ -793,3 +793,103 @@ deleted file mode 100644 -5 +** circular rename ** +** add a a1 / hg mv a b / hg mv b a +- working to parent: +A a + b +R b + +diff --git a/b b/a +rename from b +rename to a + +- working to root: --rev 0 +M a + +diff --git a/a b/a +--- a/a ++++ b/a +@@ -1,1 +1,3 @@ + a ++6 ++a1 + +- working to branch: --rev 2 +M a + +diff --git a/a b/a +--- a/a ++++ b/a +@@ -1,3 +1,3 @@ + a +-m1 +-m2 ++6 ++a1 + +- root to parent: --rev 0 --rev . +A b + a +R a + +diff --git a/a b/b +rename from a +rename to b +--- a/a ++++ b/b +@@ -1,1 +1,3 @@ + a ++6 ++a1 + +- parent to root: --rev . --rev 0 +A a + b +R b + +diff --git a/b b/a +rename from b +rename to a +--- a/b ++++ b/a +@@ -1,3 +1,1 @@ + a +-6 +-a1 + +- branch to parent: --rev 2 --rev . +A b + a +R a + +diff --git a/a b/b +rename from a +rename to b +--- a/a ++++ b/b +@@ -1,3 +1,3 @@ + a +-m1 +-m2 ++6 ++a1 + +- parent to branch: --rev . --rev 2 +A a + b +R b + +diff --git a/b b/a +rename from b +rename to a +--- a/b ++++ b/a +@@ -1,3 +1,3 @@ + a +-6 +-a1 ++m1 ++m2 + +