# HG changeset patch # User Yuya Nishihara # Date 2016-09-22 06:52:09 # Node ID 2af38229f147f14b6dc518d90d3286076fa3137a # Parent 44b8b5ad30eb41c678c6fccfeac98cff5ec0da38 test-log: test that fctx.ancestors() can't index parents only by linkrev This covers a possible bug that could be caused by the following change: --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1047,7 +1047,7 @@ class basefilectx(object): while True: for parent in c.parents()[:cut]: - visit[(parent.linkrev(), parent.filenode())] = parent + visit[parent.linkrev()] = parent if not visit: break c = visit.pop(max(visit)) diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -1009,6 +1009,77 @@ log --follow --patch FILE in repository $ cd .. +Multiple copy sources of a file: + + $ hg init follow-multi + $ cd follow-multi + $ echo 0 >> a + $ hg ci -qAm 'a' + $ hg cp a b + $ hg ci -m 'a->b' + $ echo 2 >> a + $ hg ci -m 'a' + $ echo 3 >> b + $ hg ci -m 'b' + $ echo 4 >> a + $ echo 4 >> b + $ hg ci -m 'a,b' + $ echo 5 >> a + $ hg ci -m 'a0' + $ echo 6 >> b + $ hg ci -m 'b0' + $ hg up -q 4 + $ echo 7 >> b + $ hg ci -m 'b1' + created new head + $ echo 8 >> a + $ hg ci -m 'a1' + $ hg rm a + $ hg mv b a + $ hg ci -m 'b1->a1' + $ hg merge -qt :local + $ hg ci -m '(a0,b1->a1)->a' + + $ hg log -GT '{rev}: {desc}\n' + @ 10: (a0,b1->a1)->a + |\ + | o 9: b1->a1 + | | + | o 8: a1 + | | + | o 7: b1 + | | + o | 6: b0 + | | + o | 5: a0 + |/ + o 4: a,b + | + o 3: b + | + o 2: a + | + o 1: a->b + | + o 0: a + + + since file 'a' has multiple copy sources at the revision 4, ancestors can't + be indexed solely by fctx.linkrev(). + + $ hg log -T '{rev}: {desc}\n' -f a + 10: (a0,b1->a1)->a + 9: b1->a1 + 7: b1 + 5: a0 + 4: a,b + 3: b + 2: a + 1: a->b + 0: a + + $ cd .. + Test that log should respect the order of -rREV even if multiple OR conditions are specified (issue5100):