Mercurial > hg
annotate tests/test-drawdag.t @ 45066:5a80915e99ce
commitctx: document the manifest writing function
Same spirit as for `_filecommit` lets document the input and output before
making any change or improvement.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy. We start with
easy and small cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8705
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 06 Jul 2020 21:08:15 +0200 |
parents | 1a09dad8b85a |
children |
rev | line source |
---|---|
33152 | 1 $ cat >> $HGRCPATH<<EOF |
2 > [extensions] | |
3 > drawdag=$TESTDIR/drawdag.py | |
33153
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
4 > [experimental] |
34865
a0100f34e20b
config: replace experimental.stabilization by experimental.evolution
Boris Feld <boris.feld@octobus.net>
parents:
34286
diff
changeset
|
5 > evolution=true |
33152 | 6 > EOF |
7 | |
8 $ reinit () { | |
9 > rm -rf .hg && hg init | |
10 > } | |
11 | |
12 $ hg init | |
13 | |
14 Test what said in drawdag.py docstring | |
15 | |
16 $ hg debugdrawdag <<'EOS' | |
17 > c d | |
18 > |/ | |
19 > b | |
20 > | | |
21 > a | |
22 > EOS | |
23 | |
24 $ hg log -G -T '{rev} {desc} ({tags})' | |
25 o 3 d (d tip) | |
26 | | |
27 | o 2 c (c) | |
28 |/ | |
29 o 1 b (b) | |
30 | | |
31 o 0 a (a) | |
32 | |
33 $ hg debugdrawdag <<'EOS' | |
34 > foo bar bar foo | |
35 > | / | | | |
36 > ancestor(c,d) a baz | |
37 > EOS | |
38 | |
39 $ hg log -G -T '{desc}' | |
40 o foo | |
41 |\ | |
42 +---o bar | |
43 | | | | |
44 | o | baz | |
45 | / | |
46 +---o d | |
47 | | | |
48 +---o c | |
49 | | | |
50 o | b | |
51 |/ | |
52 o a | |
53 | |
54 $ reinit | |
55 | |
56 $ hg debugdrawdag <<'EOS' | |
57 > o foo | |
58 > |\ | |
59 > +---o bar | |
60 > | | | | |
61 > | o | baz | |
62 > | / | |
63 > +---o d | |
64 > | | | |
65 > +---o c | |
66 > | | | |
67 > o | b | |
68 > |/ | |
69 > o a | |
70 > EOS | |
71 | |
72 $ hg log -G -T '{desc}' | |
73 o foo | |
74 |\ | |
75 | | o d | |
76 | |/ | |
77 | | o c | |
78 | |/ | |
79 | | o bar | |
80 | |/| | |
81 | o | b | |
82 | |/ | |
83 o / baz | |
84 / | |
85 o a | |
86 | |
87 $ reinit | |
88 | |
89 $ hg debugdrawdag <<'EOS' | |
90 > o foo | |
91 > |\ | |
92 > | | o d | |
93 > | |/ | |
94 > | | o c | |
95 > | |/ | |
96 > | | o bar | |
97 > | |/| | |
98 > | o | b | |
99 > | |/ | |
100 > o / baz | |
101 > / | |
102 > o a | |
103 > EOS | |
104 | |
105 $ hg log -G -T '{desc}' | |
106 o foo | |
107 |\ | |
108 | | o d | |
109 | |/ | |
110 | | o c | |
111 | |/ | |
112 | | o bar | |
113 | |/| | |
114 | o | b | |
115 | |/ | |
116 o / baz | |
117 / | |
118 o a | |
119 | |
33558
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
120 $ hg manifest -r a |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
121 a |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
122 $ hg manifest -r b |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
123 a |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
124 b |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
125 $ hg manifest -r bar |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
126 a |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
127 b |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
128 $ hg manifest -r foo |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
129 a |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
130 b |
0103e7187237
drawdag: include files from both parents in merge commits
Martin von Zweigbergk <martinvonz@google.com>
parents:
33153
diff
changeset
|
131 baz |
33152 | 132 |
133 Edges existed in repo are no-ops | |
134 | |
135 $ reinit | |
136 $ hg debugdrawdag <<'EOS' | |
137 > B C C | |
138 > | | | | |
139 > A A B | |
140 > EOS | |
141 | |
142 $ hg log -G -T '{desc}' | |
143 o C | |
144 |\ | |
145 | o B | |
146 |/ | |
147 o A | |
148 | |
149 | |
150 $ hg debugdrawdag <<'EOS' | |
151 > C D C | |
152 > | | | | |
153 > B B A | |
154 > EOS | |
155 | |
156 $ hg log -G -T '{desc}' | |
157 o D | |
158 | | |
159 | o C | |
160 |/| | |
161 o | B | |
162 |/ | |
163 o A | |
164 | |
165 | |
166 Node with more than 2 parents are disallowed | |
167 | |
168 $ hg debugdrawdag <<'EOS' | |
169 > A | |
170 > /|\ | |
171 > D B C | |
172 > EOS | |
173 abort: A: too many parents: C D B | |
174 [255] | |
175 | |
176 Cycles are disallowed | |
177 | |
178 $ hg debugdrawdag <<'EOS' | |
179 > A | |
180 > | | |
181 > A | |
182 > EOS | |
183 abort: the graph has cycles | |
184 [255] | |
185 | |
186 $ hg debugdrawdag <<'EOS' | |
187 > A | |
188 > | | |
189 > B | |
190 > | | |
191 > A | |
192 > EOS | |
193 abort: the graph has cycles | |
194 [255] | |
33153
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
195 |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
196 Create obsmarkers via comments |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
197 |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
198 $ reinit |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
199 |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
200 $ hg debugdrawdag <<'EOS' |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
201 > G |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
202 > | |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
203 > I D C F # split: B -> E, F, G |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
204 > \ \| | # replace: C -> D -> H |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
205 > H B E # prune: F, I |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
206 > \|/ |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
207 > A |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
208 > EOS |
35709
1a09dad8b85a
evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents:
35508
diff
changeset
|
209 1 new orphan changesets |
33153
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
210 |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
211 $ hg log -r 'sort(all(), topo)' -G --hidden -T '{desc} {node}' |
35508
9b3f95d9783d
graphlog: add another graph node type, unstable, using character "*" (BC)
Anton Shestakov <av6@dwimlabs.net>
parents:
35393
diff
changeset
|
212 * G 711f53bbef0bebd12eb6f0511d5e2e998b984846 |
33153
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
213 | |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
214 x F 64a8289d249234b9886244d379f15e6b650b28e3 |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
215 | |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
216 o E 7fb047a69f220c21711122dfd94305a9efb60cba |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
217 | |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
218 | x D be0ef73c17ade3fc89dc41701eb9fc3a91b58282 |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
219 | | |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
220 | | x C 26805aba1e600a82e93661149f2313866a221a7b |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
221 | |/ |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
222 | x B 112478962961147124edd43549aedd1a335e44bf |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
223 |/ |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
224 | x I 58e6b987bf7045fcd9c54f496396ca1d1fc81047 |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
225 | | |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
226 | o H 575c4b5ec114d64b681d33f8792853568bfb2b2c |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
227 |/ |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
228 o A 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
229 |
4d780d510b44
drawdag: support obsmarker creation in comments
Jun Wu <quark@fb.com>
parents:
33152
diff
changeset
|
230 $ hg debugobsolete |
34961
a7e49a5b3e6f
obsolete: activate effect-flag by default
Boris Feld <boris.feld@octobus.net>
parents:
34865
diff
changeset
|
231 112478962961147124edd43549aedd1a335e44bf 7fb047a69f220c21711122dfd94305a9efb60cba 64a8289d249234b9886244d379f15e6b650b28e3 711f53bbef0bebd12eb6f0511d5e2e998b984846 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'split', 'user': 'test'} |
a7e49a5b3e6f
obsolete: activate effect-flag by default
Boris Feld <boris.feld@octobus.net>
parents:
34865
diff
changeset
|
232 26805aba1e600a82e93661149f2313866a221a7b be0ef73c17ade3fc89dc41701eb9fc3a91b58282 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'replace', 'user': 'test'} |
a7e49a5b3e6f
obsolete: activate effect-flag by default
Boris Feld <boris.feld@octobus.net>
parents:
34865
diff
changeset
|
233 be0ef73c17ade3fc89dc41701eb9fc3a91b58282 575c4b5ec114d64b681d33f8792853568bfb2b2c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'} |
a7e49a5b3e6f
obsolete: activate effect-flag by default
Boris Feld <boris.feld@octobus.net>
parents:
34865
diff
changeset
|
234 64a8289d249234b9886244d379f15e6b650b28e3 0 {7fb047a69f220c21711122dfd94305a9efb60cba} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'} |
a7e49a5b3e6f
obsolete: activate effect-flag by default
Boris Feld <boris.feld@octobus.net>
parents:
34865
diff
changeset
|
235 58e6b987bf7045fcd9c54f496396ca1d1fc81047 0 {575c4b5ec114d64b681d33f8792853568bfb2b2c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'} |
33788
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
236 |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
237 Change file contents via comments |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
238 |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
239 $ reinit |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
240 $ hg debugdrawdag <<'EOS' |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
241 > C # A/dir1/a = 1\n2 |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
242 > |\ # B/dir2/b = 34 |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
243 > A B # C/dir1/c = 5 |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
244 > # C/dir2/c = 6 |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
245 > # C/A = a |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
246 > # C/B = b |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
247 > EOS |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
248 |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
249 $ hg log -G -T '{desc} {files}' |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
250 o C A B dir1/c dir2/c |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
251 |\ |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
252 | o B B dir2/b |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
253 | |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
254 o A A dir1/a |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
255 |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
256 $ for f in `hg files -r C`; do |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
257 > echo FILE "$f" |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
258 > hg cat -r C "$f" |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
259 > echo |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
260 > done |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
261 FILE A |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
262 a |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
263 FILE B |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
264 b |
35393
4441705b7111
tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents:
34961
diff
changeset
|
265 FILE dir1/a |
33788
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
266 1 |
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
267 2 |
35393
4441705b7111
tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents:
34961
diff
changeset
|
268 FILE dir1/c |
33788
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
269 5 |
35393
4441705b7111
tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents:
34961
diff
changeset
|
270 FILE dir2/b |
33788
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
271 34 |
35393
4441705b7111
tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents:
34961
diff
changeset
|
272 FILE dir2/c |
33788
0531ffd59a98
drawdag: allow override file contents via comments
Jun Wu <quark@fb.com>
parents:
33773
diff
changeset
|
273 6 |