changeset 35278:2af38229f147

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))
author Yuya Nishihara <yuya@tcha.org>
date Thu, 22 Sep 2016 15:52:09 +0900
parents 44b8b5ad30eb
children 0d27685b4a2f
files tests/test-log.t
diffstat 1 files changed, 71 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-log.t	Tue Oct 17 15:27:22 2017 +0200
+++ b/tests/test-log.t	Thu Sep 22 15:52:09 2016 +0900
@@ -1009,6 +1009,77 @@
 
   $ 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):