annotate tests/test-contrib-dumprevlog.t @ 39110:f0c2653ca706

merge: add tests for commit with no content change It isn't easy to say when to reuse the p1 manifest. Basically, that's only when wctx.files() is empty, but we need to know that wctx.files() is not the same as repo['.'].files() after the commit. This patch adds several examples of commits with empty ctx/wctx.files(). I don't think this is exhaustive, but it contains at least one failure mode in which a converted repo result in a different hash. I also note that the manifest revlog does NOT follow the DAG shape of the changelog since p1 manifest is reused if wctx.files() is empty even at merge. I don't know whether it is intentional or not, but it's the behavior since 2011, 301725c3df9a "localrepo: reuse parent manifest in commitctx if no files have changed."
author Yuya Nishihara <yuya@tcha.org>
date Sun, 12 Aug 2018 18:44:42 +0900
parents 567bddcb4271
children f1186c292d03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37407
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 #require reporevlogstore
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 $ CONTRIBDIR="$TESTDIR/../contrib"
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 $ hg init repo-a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6 $ cd repo-a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8 $ echo this is file a > a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9 $ hg add a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10 $ hg commit -m first
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12 $ echo adding to file a >> a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13 $ hg commit -m second
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
15 $ echo adding more to file a >> a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 $ hg commit -m third
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17 $ hg verify
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18 checking changesets
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19 checking manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20 crosschecking files in changesets and manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21 checking files
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
22 1 files, 3 changesets, 3 total revisions
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 Dumping revlog of file a to stdout:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
25 $ $PYTHON "$CONTRIBDIR/dumprevlog" .hg/store/data/a.i
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26 file: .hg/store/data/a.i
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27 node: 183d2312b35066fb6b3b449b84efc370d50993d0
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
28 linkrev: 0
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29 parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
30 length: 15
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 -start-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
32 this is file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34 -end-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36 linkrev: 1
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 parents: 183d2312b35066fb6b3b449b84efc370d50993d0 0000000000000000000000000000000000000000
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38 length: 32
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 -start-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 this is file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 adding to file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
43 -end-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44 node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
45 linkrev: 2
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
46 parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b 0000000000000000000000000000000000000000
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
47 length: 54
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
48 -start-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
49 this is file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
50 adding to file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
51 adding more to file a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
52
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
53 -end-
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
54
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
55 Dump all revlogs to file repo.dump:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
56
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
57 $ find .hg/store -name "*.i" | sort | xargs $PYTHON "$CONTRIBDIR/dumprevlog" > ../repo.dump
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
58 $ cd ..
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
59
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
60 Undumping into repo-b:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
61
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
62 $ hg init repo-b
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
63 $ cd repo-b
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
64 $ $PYTHON "$CONTRIBDIR/undumprevlog" < ../repo.dump
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
65 .hg/store/00changelog.i
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
66 .hg/store/00manifest.i
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
67 .hg/store/data/a.i
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
68 $ cd ..
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
69
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
70 Rebuild fncache with clone --pull:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
71
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
72 $ hg clone --pull -U repo-b repo-c
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
73 requesting all changes
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
74 adding changesets
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
75 adding manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
76 adding file changes
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
77 added 3 changesets with 3 changes to 1 files
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
78 new changesets de1da620e7d8:46946d278c50
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
79
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
80 Verify:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
81
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
82 $ hg -R repo-c verify
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
83 checking changesets
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
84 checking manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
85 crosschecking files in changesets and manifests
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
86 checking files
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
87 1 files, 3 changesets, 3 total revisions
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
88
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
89 Compare repos:
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
90
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
91 $ hg -R repo-c incoming repo-a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
92 comparing with repo-a
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
93 searching for changes
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
94 no changes found
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
95 [1]
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
96
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
97 $ hg -R repo-a incoming repo-c
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
98 comparing with repo-c
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
99 searching for changes
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
100 no changes found
567bddcb4271 tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
101 [1]