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@rosdahl.net>
Original test reviewed by Nicolas Dumazet <nicdumz@gmail.com>
adding a
changeset: 0:8580ff50825a
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: a
% -f, directory
abort: cannot follow nonexistent file: "dir"
% -f, but no args
changeset: 4:66c1345dc4f9
tag: tip
user: test
date: Thu Jan 01 00:00:05 1970 +0000
summary: e
changeset: 3:7c6c671bb7cc
user: test
date: Thu Jan 01 00:00:04 1970 +0000
summary: d
changeset: 2:41dd4284081e
user: test
date: Thu Jan 01 00:00:03 1970 +0000
summary: c
changeset: 1:784de7cef101
user: test
date: Thu Jan 01 00:00:02 1970 +0000
summary: b
changeset: 0:8580ff50825a
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: a
% one rename
changeset: 0:8580ff50825a
user: test
date: Thu Jan 01 00:00:01 1970 +0000
files: a
description:
a
% many renames
changeset: 4:66c1345dc4f9
tag: tip
user: test
date: Thu Jan 01 00:00:05 1970 +0000
files: dir/b e
description:
e
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 -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)
2 dir/b (b)
1 b (a)
0
% log copies switch without --copies, with old filecopy template
4
3
2
1
0
% log copies switch with --copies
4 e (dir/b)
3 b (a)
2 dir/b (b)
1 b (a)
0
% log copies with hardcoded style and with --style=default
changeset: 4:66c1345dc4f9
tag: tip
user: test
date: Thu Jan 01 00:00:05 1970 +0000
files: dir/b e
copies: e (dir/b)
description:
e
changeset: 4:66c1345dc4f9
tag: tip
user: test
date: Thu Jan 01 00:00:05 1970 +0000
files: dir/b e
copies: e (dir/b)
description:
e
% log copies, non-linear manifest
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding foo
created new head
5 e (dir/b)
% log copies, execute bit set
6
% log -p d
changeset: 3:7c6c671bb7cc
user: test
date: Thu Jan 01 00:00:04 1970 +0000
files: a b d
description:
d
diff -r 41dd4284081e -r 7c6c671bb7cc d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/d Thu Jan 01 00:00:04 1970 +0000
@@ -0,0 +1,1 @@
+a
adding base
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adding b1
created new head
% log -f
changeset: 3:e62f78d544b4
tag: tip
parent: 1:3d5bf5654eda
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1
changeset: 1:3d5bf5654eda
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: r1
changeset: 0:67e992f2c4f3
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: base
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding b2
created new head
% log -f -r 1:tip
changeset: 1:3d5bf5654eda
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: r1
changeset: 2:60c670bf5b30
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: r2
changeset: 3:e62f78d544b4
parent: 1:3d5bf5654eda
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
% log -r . with two parents
changeset: 3:e62f78d544b4
parent: 1:3d5bf5654eda
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1
% log -r . with one parent
changeset: 5:302e9dd6890d
tag: tip
parent: 3:e62f78d544b4
parent: 4:ddb82e70d1a1
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: m12
% log --follow-first
changeset: 6:2404bbcab562
tag: tip
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1.1
changeset: 5:302e9dd6890d
parent: 3:e62f78d544b4
parent: 4:ddb82e70d1a1
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: m12
changeset: 3:e62f78d544b4
parent: 1:3d5bf5654eda
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1
changeset: 1:3d5bf5654eda
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: r1
changeset: 0:67e992f2c4f3
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: base
% log -P 2
changeset: 6:2404bbcab562
tag: tip
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1.1
changeset: 5:302e9dd6890d
parent: 3:e62f78d544b4
parent: 4:ddb82e70d1a1
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: m12
changeset: 4:ddb82e70d1a1
parent: 0:67e992f2c4f3
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b2
changeset: 3:e62f78d544b4
parent: 1:3d5bf5654eda
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1
% log -r tip -p --git
changeset: 6:2404bbcab562
tag: tip
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1.1
diff --git a/b1 b/b1
--- a/b1
+++ b/b1
@@ -1,1 +1,2 @@
b1
+postm
% log -r ""
hg: parse error: empty query
% log -r <some unknown node id>
abort: unknown revision '1000000000000000000000000000000000000000'!
% log -k r1
changeset: 1:3d5bf5654eda
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: r1
% log -d -1
% log -p -l2 --color=always
[0;33mchangeset: 6:2404bbcab562[0m
tag: tip
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1.1
[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1[0m
[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000[0m
[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000[0m
[0;35m@@ -1,1 +1,2 @@[0m
b1
[0;32m+postm[0m
[0;33mchangeset: 5:302e9dd6890d[0m
parent: 3:e62f78d544b4
parent: 4:ddb82e70d1a1
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: m12
[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2[0m
[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000[0m
[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000[0m
[0;35m@@ -0,0 +1,1 @@[0m
[0;32m+b2[0m
% log -r tip --stat
changeset: 6:2404bbcab562
tag: tip
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: b1.1
b1 | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
adding a
adding b
changeset: 0:29a4c94f1924
user: User One <user1@example.org>
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
changeset: 1:e834b5e69c0e
tag: tip
user: User Two <user2@example.org>
date: Thu Jan 01 00:00:00 1970 +0000
summary: b
changeset: 0:29a4c94f1924
user: User One <user1@example.org>
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
adding a
marked working directory as branch test
adding b
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding c
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding c
% log -b default
changeset: 2:c3a4f03cc9a7
parent: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
changeset: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
% log -b test
changeset: 3:f5d8de11c2e2
branch: test
tag: tip
parent: 1:d32277701ccb
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
changeset: 1:d32277701ccb
branch: test
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
% log -b dummy
abort: unknown revision 'dummy'!
% log -b .
changeset: 3:f5d8de11c2e2
branch: test
tag: tip
parent: 1:d32277701ccb
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
changeset: 1:d32277701ccb
branch: test
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
% log -b default -b test
changeset: 3:f5d8de11c2e2
branch: test
tag: tip
parent: 1:d32277701ccb
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
changeset: 2:c3a4f03cc9a7
parent: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
changeset: 1:d32277701ccb
branch: test
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
changeset: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
% log -b default -b .
changeset: 3:f5d8de11c2e2
branch: test
tag: tip
parent: 1:d32277701ccb
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
changeset: 2:c3a4f03cc9a7
parent: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
changeset: 1:d32277701ccb
branch: test
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
changeset: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
% log -b . -b test
changeset: 3:f5d8de11c2e2
branch: test
tag: tip
parent: 1:d32277701ccb
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
changeset: 1:d32277701ccb
branch: test
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
% log -b 2
changeset: 2:c3a4f03cc9a7
parent: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
changeset: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
% log -p --cwd dir (in subdir)
changeset: 3:f5d8de11c2e2
branch: test
tag: tip
parent: 1:d32277701ccb
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
diff -r d32277701ccb -r f5d8de11c2e2 c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/c Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+c
changeset: 2:c3a4f03cc9a7
parent: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
diff -r 24427303d56f -r c3a4f03cc9a7 c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/c Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+c
changeset: 1:d32277701ccb
branch: test
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on test
diff -r 24427303d56f -r d32277701ccb b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/b Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+b
changeset: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
diff -r 000000000000 -r 24427303d56f a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+a
% log -p -R repo
changeset: 0:24427303d56f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit on default
diff -r 000000000000 -r 24427303d56f a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+a