diff tests/test-log.t @ 30018:2963fba2d18a

log: copy the way of ancestor traversal to --follow matcher (issue5376) We can't use fctx.linkrev() because follow() revset tries hard to simulate the traversal of changelog DAG, not filelog DAG. This patch fixes _makefollowlogfilematcher() to walk file ancestors in the same way as revset._follow(). I'll factor out a common function in future patches.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 24 Sep 2016 19:58:23 +0900
parents cbf9984a7957
children 69b61d0bb008
line wrap: on
line diff
--- a/tests/test-log.t	Sat Sep 24 19:52:02 2016 +0900
+++ b/tests/test-log.t	Sat Sep 24 19:58:23 2016 +0900
@@ -933,6 +933,78 @@
 
   $ cd ..
 
+log --follow --patch FILE in repository where linkrev isn't trustworthy
+(issue5376)
+
+  $ hg init follow-dup
+  $ cd follow-dup
+  $ cat <<EOF >> .hg/hgrc
+  > [ui]
+  > logtemplate = '=== {rev}: {desc}\n'
+  > [diff]
+  > nodates = True
+  > EOF
+  $ echo 0 >> a
+  $ hg ci -qAm 'a0'
+  $ echo 1 >> a
+  $ hg ci -m 'a1'
+  $ hg up -q 0
+  $ echo 1 >> a
+  $ touch b
+  $ hg ci -qAm 'a1 with b'
+  $ echo 3 >> a
+  $ hg ci -m 'a3'
+
+ fctx.rev() == 2, but fctx.linkrev() == 1
+
+  $ hg log -pf a
+  === 3: a3
+  diff -r 4ea02ba94d66 -r e7a6331a34f0 a
+  --- a/a
+  +++ b/a
+  @@ -1,2 +1,3 @@
+   0
+   1
+  +3
+  
+  === 2: a1 with b
+  diff -r 49b5e81287e2 -r 4ea02ba94d66 a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,2 @@
+   0
+  +1
+  
+  === 0: a0
+  diff -r 000000000000 -r 49b5e81287e2 a
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,1 @@
+  +0
+  
+
+ fctx.introrev() == 2, but fctx.linkrev() == 1
+
+  $ hg up -q 2
+  $ hg log -pf a
+  === 2: a1 with b
+  diff -r 49b5e81287e2 -r 4ea02ba94d66 a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,2 @@
+   0
+  +1
+  
+  === 0: a0
+  diff -r 000000000000 -r 49b5e81287e2 a
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,1 @@
+  +0
+  
+
+  $ cd ..
+
 Test that log should respect the order of -rREV even if multiple OR conditions
 are specified (issue5100):