[PATCH] test-log: Add test for "hg log -pf" (issue647)

Mads Kiilerich mads at kiilerich.com
Tue Jul 13 13:00:59 CDT 2010


# HG changeset patch
# User Joel Rosdahl <joel at rosdahl.net>
# Date 1278621855 -7200
# Node ID 1d396a88d2de4ed984ee3ae5056087a13e8d01db
# Parent  4484a7b661f2f79f142c06c7ab1d9b58a7c3a608
test-log: Add test for "hg log -pf" (issue647)

To test f786fc4b8764 we analyze this repo:

0 | 1 |   2    | 3  |   4
a  ------------> b
 \
    b -> dir/b -------> e

                 d

We follow dir/b and expects rev 0, 1 and 2.

A log following b will surprisingly report rev 0 and 1. That's because the
content and the parents are the same in rev 1 and rev 3, and the revlog entry
from rev 1 is thus reused in rev 3 even though the revlink is incorrect.

Note that if we follow e then we will get all revs, including rev 3, because b
gets added to the set of interesting filenames we are following through all
revisions. That might be surprising, but that's (currently) how it is.

Original test case by Joel Rosdahl <joel at rosdahl.net>
Original test reviewed by Nicolas Dumazet <nicdumz at gmail.com>

diff --git a/tests/test-log b/tests/test-log
--- a/tests/test-log
+++ b/tests/test-log
@@ -31,6 +31,11 @@
 echo % many renames
 hg log -vf e
 
+echo % log -pf dir/b
+hg log -pf dir/b
+echo % log -vf dir/b
+hg log -vf dir/b
+
 echo '% log copies with --copies'
 hg log -vC --template '{rev} {file_copies}\n'
 echo '% log copies switch without --copies, with old filecopy template'
diff --git a/tests/test-log.out b/tests/test-log.out
--- a/tests/test-log.out
+++ b/tests/test-log.out
@@ -76,6 +76,65 @@
 a
 
 
+% log -pf dir/b
+changeset:   2:41dd4284081e
+user:        test
+date:        Thu Jan 01 00:00:03 1970 +0000
+summary:     c
+
+diff -r 784de7cef101 -r 41dd4284081e dir/b
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/dir/b	Thu Jan 01 00:00:03 1970 +0000
+@@ -0,0 +1,1 @@
++a
+
+changeset:   1:784de7cef101
+user:        test
+date:        Thu Jan 01 00:00:02 1970 +0000
+summary:     b
+
+diff -r 8580ff50825a -r 784de7cef101 b
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/b	Thu Jan 01 00:00:02 1970 +0000
+@@ -0,0 +1,1 @@
++a
+
+changeset:   0:8580ff50825a
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+summary:     a
+
+diff -r 000000000000 -r 8580ff50825a a
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/a	Thu Jan 01 00:00:01 1970 +0000
+@@ -0,0 +1,1 @@
++a
+
+% log -vf dir/b
+changeset:   2:41dd4284081e
+user:        test
+date:        Thu Jan 01 00:00:03 1970 +0000
+files:       b dir/b
+description:
+c
+
+
+changeset:   1:784de7cef101
+user:        test
+date:        Thu Jan 01 00:00:02 1970 +0000
+files:       b
+description:
+b
+
+
+changeset:   0:8580ff50825a
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+files:       a
+description:
+a
+
+
 % log copies with --copies
 4 e (dir/b)
 3 b (a)


More information about the Mercurial-devel mailing list