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))
This commit is contained in:
Yuya Nishihara 2016-09-22 15:52:09 +09:00
parent 8e35ca84ad
commit f3f2688b82

View File

@ -1007,6 +1007,77 @@ log --follow --patch FILE in repository where linkrev isn't trustworthy
+0
$ 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