##// END OF EJS Templates
tests: clean up many print statements to be print functions instead...
Augie Fackler -
r33687:24849d53 default
parent child Browse files
Show More
@@ -1,426 +1,426 b''
1 1 #require tic
2 2
3 3 Set up a repo
4 4
5 5 $ cp $HGRCPATH $HGRCPATH.pretest
6 6 $ cat <<EOF >> $HGRCPATH
7 7 > [ui]
8 8 > interactive = true
9 9 > interface = curses
10 10 > [experimental]
11 11 > crecordtest = testModeCommands
12 12 > EOF
13 13
14 14 Record with noeol at eof (issue5268)
15 15 $ hg init noeol
16 16 $ cd noeol
17 17 $ printf '0' > a
18 18 $ printf '0\n' > b
19 19 $ hg ci -Aqm initial
20 20 $ printf '1\n0' > a
21 21 $ printf '1\n0\n' > b
22 22 $ cat <<EOF >testModeCommands
23 23 > c
24 24 > EOF
25 25 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "add hunks" -d "0 0"
26 26 $ cd ..
27 27
28 28 Normal repo
29 29 $ hg init a
30 30 $ cd a
31 31
32 32 Committing some changes but stopping on the way
33 33
34 34 $ echo "a" > a
35 35 $ hg add a
36 36 $ cat <<EOF >testModeCommands
37 37 > TOGGLE
38 38 > X
39 39 > EOF
40 40 $ hg commit -i -m "a" -d "0 0"
41 41 no changes to record
42 42 [1]
43 43 $ hg tip
44 44 changeset: -1:000000000000
45 45 tag: tip
46 46 user:
47 47 date: Thu Jan 01 00:00:00 1970 +0000
48 48
49 49
50 50 Committing some changes
51 51
52 52 $ cat <<EOF >testModeCommands
53 53 > X
54 54 > EOF
55 55 $ hg commit -i -m "a" -d "0 0"
56 56 $ hg tip
57 57 changeset: 0:cb9a9f314b8b
58 58 tag: tip
59 59 user: test
60 60 date: Thu Jan 01 00:00:00 1970 +0000
61 61 summary: a
62 62
63 63 Check that commit -i works with no changes
64 64 $ hg commit -i
65 65 no changes to record
66 66 [1]
67 67
68 68 Committing only one file
69 69
70 70 $ echo "a" >> a
71 71 >>> open('b', 'wb').write("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
72 72 $ hg add b
73 73 $ cat <<EOF >testModeCommands
74 74 > TOGGLE
75 75 > KEY_DOWN
76 76 > X
77 77 > EOF
78 78 $ hg commit -i -m "one file" -d "0 0"
79 79 $ hg tip
80 80 changeset: 1:fb2705a663ea
81 81 tag: tip
82 82 user: test
83 83 date: Thu Jan 01 00:00:00 1970 +0000
84 84 summary: one file
85 85
86 86 $ hg cat -r tip a
87 87 a
88 88 $ cat a
89 89 a
90 90 a
91 91
92 92 Committing only one hunk while aborting edition of hunk
93 93
94 94 - Untoggle all the hunks, go down to the second file
95 95 - unfold it
96 96 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
97 97 - toggle the second hunk
98 98 - toggle on and off the amend mode (to check that it toggles off)
99 99 - edit the hunk and quit the editor immediately with non-zero status
100 100 - commit
101 101
102 102 $ printf "printf 'editor ran\n'; exit 1" > editor.sh
103 103 $ echo "x" > c
104 104 $ cat b >> c
105 105 $ echo "y" >> c
106 106 $ mv c b
107 107 $ cat <<EOF >testModeCommands
108 108 > A
109 109 > KEY_DOWN
110 110 > f
111 111 > KEY_DOWN
112 112 > KEY_DOWN
113 113 > KEY_DOWN
114 114 > KEY_DOWN
115 115 > TOGGLE
116 116 > a
117 117 > a
118 118 > e
119 119 > X
120 120 > EOF
121 121 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0"
122 122 editor ran
123 123 $ rm editor.sh
124 124 $ hg tip
125 125 changeset: 2:7d10dfe755a8
126 126 tag: tip
127 127 user: test
128 128 date: Thu Jan 01 00:00:00 1970 +0000
129 129 summary: one hunk
130 130
131 131 $ hg cat -r tip b
132 132 1
133 133 2
134 134 3
135 135 4
136 136 5
137 137 6
138 138 7
139 139 8
140 140 9
141 141 10
142 142 y
143 143 $ cat b
144 144 x
145 145 1
146 146 2
147 147 3
148 148 4
149 149 5
150 150 6
151 151 7
152 152 8
153 153 9
154 154 10
155 155 y
156 156 $ hg commit -m "other hunks"
157 157 $ hg tip
158 158 changeset: 3:a6735021574d
159 159 tag: tip
160 160 user: test
161 161 date: Thu Jan 01 00:00:00 1970 +0000
162 162 summary: other hunks
163 163
164 164 $ hg cat -r tip b
165 165 x
166 166 1
167 167 2
168 168 3
169 169 4
170 170 5
171 171 6
172 172 7
173 173 8
174 174 9
175 175 10
176 176 y
177 177
178 178 Newly added files can be selected with the curses interface
179 179
180 180 $ hg update -C .
181 181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
182 182 $ echo "hello" > x
183 183 $ hg add x
184 184 $ cat <<EOF >testModeCommands
185 185 > TOGGLE
186 186 > TOGGLE
187 187 > X
188 188 > EOF
189 189 $ hg st
190 190 A x
191 191 ? testModeCommands
192 192 $ hg commit -i -m "newly added file" -d "0 0"
193 193 $ hg st
194 194 ? testModeCommands
195 195
196 196 Amend option works
197 197 $ echo "hello world" > x
198 198 $ hg diff -c .
199 199 diff -r a6735021574d -r 2b0e9be4d336 x
200 200 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
201 201 +++ b/x Thu Jan 01 00:00:00 1970 +0000
202 202 @@ -0,0 +1,1 @@
203 203 +hello
204 204 $ cat <<EOF >testModeCommands
205 205 > a
206 206 > X
207 207 > EOF
208 208 $ hg commit -i -m "newly added file" -d "0 0"
209 209 saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend.hg (glob)
210 210 $ hg diff -c .
211 211 diff -r a6735021574d -r c1d239d165ae x
212 212 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
213 213 +++ b/x Thu Jan 01 00:00:00 1970 +0000
214 214 @@ -0,0 +1,1 @@
215 215 +hello world
216 216
217 217 Editing a hunk puts you back on that hunk when done editing (issue5041)
218 218 To do that, we change two lines in a file, pretend to edit the second line,
219 219 exit, toggle the line selected at the end of the edit and commit.
220 220 The first line should be recorded if we were put on the second line at the end
221 221 of the edit.
222 222
223 223 $ hg update -C .
224 224 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 225 $ echo "foo" > x
226 226 $ echo "hello world" >> x
227 227 $ echo "bar" >> x
228 228 $ cat <<EOF >testModeCommands
229 229 > f
230 230 > KEY_DOWN
231 231 > KEY_DOWN
232 232 > KEY_DOWN
233 233 > KEY_DOWN
234 234 > e
235 235 > TOGGLE
236 236 > X
237 237 > EOF
238 238 $ printf "printf 'editor ran\n'; exit 0" > editor.sh
239 239 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0"
240 240 editor ran
241 241 $ hg cat -r . x
242 242 foo
243 243 hello world
244 244
245 245 Testing the review option. The entire final filtered patch should show
246 246 up in the editor and be editable. We will unselect the second file and
247 247 the first hunk of the third file. During review, we will decide that
248 248 "lower" sounds better than "bottom", and the final commit should
249 249 reflect this edition.
250 250
251 251 $ hg update -C .
252 252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 253 $ echo "top" > c
254 254 $ cat x >> c
255 255 $ echo "bottom" >> c
256 256 $ mv c x
257 257 $ echo "third a" >> a
258 258 $ echo "we will unselect this" >> b
259 259
260 260 $ cat > editor.sh <<EOF
261 261 > cat "\$1"
262 262 > cat "\$1" | sed s/bottom/lower/ > tmp
263 263 > mv tmp "\$1"
264 264 > EOF
265 265 $ cat > testModeCommands <<EOF
266 266 > KEY_DOWN
267 267 > TOGGLE
268 268 > KEY_DOWN
269 269 > f
270 270 > KEY_DOWN
271 271 > TOGGLE
272 272 > R
273 273 > EOF
274 274
275 275 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "review hunks" -d "0 0"
276 276 # To remove '-' lines, make them ' ' lines (context).
277 277 # To remove '+' lines, delete them.
278 278 # Lines starting with # will be removed from the patch.
279 279 #
280 280 # If the patch applies cleanly, the edited patch will immediately
281 281 # be finalised. If it does not apply cleanly, rejects files will be
282 282 # generated. You can use those when you try again.
283 283 diff --git a/a b/a
284 284 --- a/a
285 285 +++ b/a
286 286 @@ -1,2 +1,3 @@
287 287 a
288 288 a
289 289 +third a
290 290 diff --git a/x b/x
291 291 --- a/x
292 292 +++ b/x
293 293 @@ -1,2 +1,3 @@
294 294 foo
295 295 hello world
296 296 +bottom
297 297
298 298 $ hg cat -r . a
299 299 a
300 300 a
301 301 third a
302 302
303 303 $ hg cat -r . b
304 304 x
305 305 1
306 306 2
307 307 3
308 308 4
309 309 5
310 310 6
311 311 7
312 312 8
313 313 9
314 314 10
315 315 y
316 316
317 317 $ hg cat -r . x
318 318 foo
319 319 hello world
320 320 lower
321 321
322 322 Check spacemovesdown
323 323
324 324 $ cat <<EOF >> $HGRCPATH
325 325 > [experimental]
326 326 > spacemovesdown = true
327 327 > EOF
328 328 $ cat <<EOF >testModeCommands
329 329 > TOGGLE
330 330 > TOGGLE
331 331 > X
332 332 > EOF
333 333 $ hg status -q
334 334 M b
335 335 M x
336 336 $ hg commit -i -m "nothing to commit?" -d "0 0"
337 337 no changes to record
338 338 [1]
339 339
340 340 Check ui.interface logic for the chunkselector
341 341
342 342 The default interface is text
343 343 $ cp $HGRCPATH.pretest $HGRCPATH
344 344 $ chunkselectorinterface() {
345 345 > $PYTHON <<EOF
346 346 > from mercurial import hg, ui;\
347 347 > repo = hg.repository(ui.ui.load(), ".");\
348 > print repo.ui.interface("chunkselector")
348 > print(repo.ui.interface("chunkselector"))
349 349 > EOF
350 350 > }
351 351 $ chunkselectorinterface
352 352 text
353 353
354 354 If only the default is set, we'll use that for the feature, too
355 355 $ cp $HGRCPATH.pretest $HGRCPATH
356 356 $ cat <<EOF >> $HGRCPATH
357 357 > [ui]
358 358 > interface = curses
359 359 > EOF
360 360 $ chunkselectorinterface
361 361 curses
362 362
363 363 It is possible to override the default interface with a feature specific
364 364 interface
365 365 $ cp $HGRCPATH.pretest $HGRCPATH
366 366 $ cat <<EOF >> $HGRCPATH
367 367 > [ui]
368 368 > interface = text
369 369 > interface.chunkselector = curses
370 370 > EOF
371 371
372 372 $ chunkselectorinterface
373 373 curses
374 374
375 375 $ cp $HGRCPATH.pretest $HGRCPATH
376 376 $ cat <<EOF >> $HGRCPATH
377 377 > [ui]
378 378 > interface = curses
379 379 > interface.chunkselector = text
380 380 > EOF
381 381
382 382 $ chunkselectorinterface
383 383 text
384 384
385 385 If a bad interface name is given, we use the default value (with a nice
386 386 error message to suggest that the configuration needs to be fixed)
387 387
388 388 $ cp $HGRCPATH.pretest $HGRCPATH
389 389 $ cat <<EOF >> $HGRCPATH
390 390 > [ui]
391 391 > interface = blah
392 392 > EOF
393 393 $ chunkselectorinterface
394 394 invalid value for ui.interface: blah (using text)
395 395 text
396 396
397 397 $ cp $HGRCPATH.pretest $HGRCPATH
398 398 $ cat <<EOF >> $HGRCPATH
399 399 > [ui]
400 400 > interface = curses
401 401 > interface.chunkselector = blah
402 402 > EOF
403 403 $ chunkselectorinterface
404 404 invalid value for ui.interface.chunkselector: blah (using curses)
405 405 curses
406 406
407 407 $ cp $HGRCPATH.pretest $HGRCPATH
408 408 $ cat <<EOF >> $HGRCPATH
409 409 > [ui]
410 410 > interface = blah
411 411 > interface.chunkselector = curses
412 412 > EOF
413 413 $ chunkselectorinterface
414 414 invalid value for ui.interface: blah
415 415 curses
416 416
417 417 $ cp $HGRCPATH.pretest $HGRCPATH
418 418 $ cat <<EOF >> $HGRCPATH
419 419 > [ui]
420 420 > interface = blah
421 421 > interface.chunkselector = blah
422 422 > EOF
423 423 $ chunkselectorinterface
424 424 invalid value for ui.interface: blah
425 425 invalid value for ui.interface.chunkselector: blah (using text)
426 426 text
@@ -1,131 +1,131 b''
1 1 # reproduce issue2264, issue2516
2 2
3 3 create test repo
4 4 $ cat <<EOF >> $HGRCPATH
5 5 > [extensions]
6 6 > transplant =
7 7 > EOF
8 8 $ hg init repo
9 9 $ cd repo
10 10 $ template="{rev} {desc|firstline} [{branch}]\n"
11 11
12 12 # we need to start out with two changesets on the default branch
13 13 # in order to avoid the cute little optimization where transplant
14 14 # pulls rather than transplants
15 15 add initial changesets
16 16 $ echo feature1 > file1
17 17 $ hg ci -Am"feature 1"
18 18 adding file1
19 19 $ echo feature2 >> file2
20 20 $ hg ci -Am"feature 2"
21 21 adding file2
22 22
23 23 # The changes to 'bugfix' are enough to show the bug: in fact, with only
24 24 # those changes, it's a very noisy crash ("RuntimeError: nothing
25 25 # committed after transplant"). But if we modify a second file in the
26 26 # transplanted changesets, the bug is much more subtle: transplant
27 27 # silently drops the second change to 'bugfix' on the floor, and we only
28 28 # see it when we run 'hg status' after transplanting. Subtle data loss
29 29 # bugs are worse than crashes, so reproduce the subtle case here.
30 30 commit bug fixes on bug fix branch
31 31 $ hg branch fixes
32 32 marked working directory as branch fixes
33 33 (branches are permanent and global, did you want a bookmark?)
34 34 $ echo fix1 > bugfix
35 35 $ echo fix1 >> file1
36 36 $ hg ci -Am"fix 1"
37 37 adding bugfix
38 38 $ echo fix2 > bugfix
39 39 $ echo fix2 >> file1
40 40 $ hg ci -Am"fix 2"
41 41 $ hg log -G --template="$template"
42 42 @ 3 fix 2 [fixes]
43 43 |
44 44 o 2 fix 1 [fixes]
45 45 |
46 46 o 1 feature 2 [default]
47 47 |
48 48 o 0 feature 1 [default]
49 49
50 50 transplant bug fixes onto release branch
51 51 $ hg update 0
52 52 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
53 53 $ hg branch release
54 54 marked working directory as branch release
55 55 $ hg transplant 2 3
56 56 applying [0-9a-f]{12} (re)
57 57 [0-9a-f]{12} transplanted to [0-9a-f]{12} (re)
58 58 applying [0-9a-f]{12} (re)
59 59 [0-9a-f]{12} transplanted to [0-9a-f]{12} (re)
60 60 $ hg log -G --template="$template"
61 61 @ 5 fix 2 [release]
62 62 |
63 63 o 4 fix 1 [release]
64 64 |
65 65 | o 3 fix 2 [fixes]
66 66 | |
67 67 | o 2 fix 1 [fixes]
68 68 | |
69 69 | o 1 feature 2 [default]
70 70 |/
71 71 o 0 feature 1 [default]
72 72
73 73 $ hg status
74 74 $ hg status --rev 0:4
75 75 M file1
76 76 A bugfix
77 77 $ hg status --rev 4:5
78 78 M bugfix
79 79 M file1
80 80
81 81 now test that we fixed the bug for all scripts/extensions
82 82 $ cat > $TESTTMP/committwice.py <<__EOF__
83 83 > from mercurial import ui, hg, match, node
84 84 > from time import sleep
85 85 >
86 86 > def replacebyte(fn, b):
87 87 > f = open(fn, "rb+")
88 88 > f.seek(0, 0)
89 89 > f.write(b)
90 90 > f.close()
91 91 >
92 92 > def printfiles(repo, rev):
93 > print "revision %s files: %s" % (rev, repo[rev].files())
93 > print("revision %s files: %s" % (rev, repo[rev].files()))
94 94 >
95 95 > repo = hg.repository(ui.ui.load(), '.')
96 96 > assert len(repo) == 6, \
97 97 > "initial: len(repo): %d, expected: 6" % len(repo)
98 98 >
99 99 > replacebyte("bugfix", "u")
100 100 > sleep(2)
101 101 > try:
102 > print "PRE: len(repo): %d" % len(repo)
102 > print("PRE: len(repo): %d" % len(repo))
103 103 > wlock = repo.wlock()
104 104 > lock = repo.lock()
105 105 > replacebyte("file1", "x")
106 106 > repo.commit(text="x", user="test", date=(0, 0))
107 107 > replacebyte("file1", "y")
108 108 > repo.commit(text="y", user="test", date=(0, 0))
109 > print "POST: len(repo): %d" % len(repo)
109 > print("POST: len(repo): %d" % len(repo))
110 110 > finally:
111 111 > lock.release()
112 112 > wlock.release()
113 113 > printfiles(repo, 6)
114 114 > printfiles(repo, 7)
115 115 > __EOF__
116 116 $ $PYTHON $TESTTMP/committwice.py
117 117 PRE: len(repo): 6
118 118 POST: len(repo): 8
119 119 revision 6 files: ['bugfix', 'file1']
120 120 revision 7 files: ['file1']
121 121
122 122 Do a size-preserving modification outside of that process
123 123 $ echo abcd > bugfix
124 124 $ hg status
125 125 M bugfix
126 126 $ hg log --template "{rev} {desc} {files}\n" -r5:
127 127 5 fix 2 bugfix file1
128 128 6 x bugfix file1
129 129 7 y file1
130 130
131 131 $ cd ..
@@ -1,320 +1,320 b''
1 1 $ cat > correct.py <<EOF
2 2 > def toto(arg1, arg2):
3 3 > del arg2
4 4 > return (5 + 6, 9)
5 5 > EOF
6 6 $ cat > wrong.py <<EOF
7 7 > def toto( arg1, arg2):
8 8 > del(arg2)
9 9 > return ( 5+6, 9)
10 10 > EOF
11 11 $ cat > quote.py <<EOF
12 12 > # let's use quote in comments
13 13 > (''' ( 4x5 )
14 14 > but """\\''' and finally''',
15 15 > """let's fool checkpatch""", '1+2',
16 16 > '"""', 42+1, """and
17 17 > ( 4-1 ) """, "( 1+1 )\" and ")
18 18 > a, '\\\\\\\\', "\\\\\\" x-2", "c-1"
19 19 > EOF
20 20 $ cat > classstyle.py <<EOF
21 21 > class newstyle_class(object):
22 22 > pass
23 23 >
24 24 > class oldstyle_class:
25 25 > pass
26 26 >
27 27 > class empty():
28 28 > pass
29 29 >
30 30 > no_class = 1:
31 31 > pass
32 32 > EOF
33 33 $ check_code="$TESTDIR"/../contrib/check-code.py
34 34 $ "$check_code" ./wrong.py ./correct.py ./quote.py ./classstyle.py
35 35 ./wrong.py:1:
36 36 > def toto( arg1, arg2):
37 37 gratuitous whitespace in () or []
38 38 ./wrong.py:2:
39 39 > del(arg2)
40 40 Python keyword is not a function
41 41 ./wrong.py:3:
42 42 > return ( 5+6, 9)
43 43 gratuitous whitespace in () or []
44 44 missing whitespace in expression
45 45 ./quote.py:5:
46 46 > '"""', 42+1, """and
47 47 missing whitespace in expression
48 48 ./classstyle.py:4:
49 49 > class oldstyle_class:
50 50 old-style class, use class foo(object)
51 51 ./classstyle.py:7:
52 52 > class empty():
53 53 class foo() creates old style object, use class foo(object)
54 54 [1]
55 55 $ cat > python3-compat.py << EOF
56 56 > foo <> bar
57 57 > reduce(lambda a, b: a + b, [1, 2, 3, 4])
58 58 > dict(key=value)
59 59 > EOF
60 60 $ "$check_code" python3-compat.py
61 61 python3-compat.py:1:
62 62 > foo <> bar
63 63 <> operator is not available in Python 3+, use !=
64 64 python3-compat.py:2:
65 65 > reduce(lambda a, b: a + b, [1, 2, 3, 4])
66 66 reduce is not available in Python 3+
67 67 python3-compat.py:3:
68 68 > dict(key=value)
69 69 dict() is different in Py2 and 3 and is slower than {}
70 70 [1]
71 71
72 72 $ cat > foo.c <<EOF
73 73 > void narf() {
74 74 > strcpy(foo, bar);
75 75 > // strcpy_s is okay, but this comment is not
76 76 > strcpy_s(foo, bar);
77 77 > }
78 78 > EOF
79 79 $ "$check_code" ./foo.c
80 80 ./foo.c:2:
81 81 > strcpy(foo, bar);
82 82 don't use strcpy, use strlcpy or memcpy
83 83 ./foo.c:3:
84 84 > // strcpy_s is okay, but this comment is not
85 85 don't use //-style comments
86 86 [1]
87 87
88 88 $ cat > is-op.py <<EOF
89 89 > # is-operator comparing number or string literal
90 90 > x = None
91 91 > y = x is 'foo'
92 92 > y = x is "foo"
93 93 > y = x is 5346
94 94 > y = x is -6
95 95 > y = x is not 'foo'
96 96 > y = x is not "foo"
97 97 > y = x is not 5346
98 98 > y = x is not -6
99 99 > EOF
100 100
101 101 $ "$check_code" ./is-op.py
102 102 ./is-op.py:3:
103 103 > y = x is 'foo'
104 104 object comparison with literal
105 105 ./is-op.py:4:
106 106 > y = x is "foo"
107 107 object comparison with literal
108 108 ./is-op.py:5:
109 109 > y = x is 5346
110 110 object comparison with literal
111 111 ./is-op.py:6:
112 112 > y = x is -6
113 113 object comparison with literal
114 114 ./is-op.py:7:
115 115 > y = x is not 'foo'
116 116 object comparison with literal
117 117 ./is-op.py:8:
118 118 > y = x is not "foo"
119 119 object comparison with literal
120 120 ./is-op.py:9:
121 121 > y = x is not 5346
122 122 object comparison with literal
123 123 ./is-op.py:10:
124 124 > y = x is not -6
125 125 object comparison with literal
126 126 [1]
127 127
128 128 $ cat > for-nolineno.py <<EOF
129 129 > except:
130 130 > EOF
131 131 $ "$check_code" for-nolineno.py --nolineno
132 132 for-nolineno.py:0:
133 133 > except:
134 134 naked except clause
135 135 [1]
136 136
137 137 $ cat > warning.t <<EOF
138 138 > $ function warnonly {
139 139 > > }
140 140 > $ diff -N aaa
141 141 > $ function onwarn {}
142 142 > EOF
143 143 $ "$check_code" warning.t
144 144 $ "$check_code" --warn warning.t
145 145 warning.t:1:
146 146 > $ function warnonly {
147 147 warning: don't use 'function', use old style
148 148 warning.t:3:
149 149 > $ diff -N aaa
150 150 warning: don't use 'diff -N'
151 151 warning.t:4:
152 152 > $ function onwarn {}
153 153 warning: don't use 'function', use old style
154 154 [1]
155 155 $ cat > error.t <<EOF
156 156 > $ [ foo == bar ]
157 157 > EOF
158 158 $ "$check_code" error.t
159 159 error.t:1:
160 160 > $ [ foo == bar ]
161 161 [ foo == bar ] is a bashism, use [ foo = bar ] instead
162 162 [1]
163 163 $ rm error.t
164 164 $ cat > raise-format.py <<EOF
165 165 > raise SomeException, message
166 166 > # this next line is okay
167 167 > raise SomeException(arg1, arg2)
168 168 > EOF
169 169 $ "$check_code" not-existing.py raise-format.py
170 170 Skipping*not-existing.py* (glob)
171 171 raise-format.py:1:
172 172 > raise SomeException, message
173 173 don't use old-style two-argument raise, use Exception(message)
174 174 [1]
175 175
176 176 $ cat > rst.py <<EOF
177 177 > """problematic rst text
178 178 >
179 179 > .. note::
180 180 > wrong
181 181 > """
182 182 >
183 183 > '''
184 184 >
185 185 > .. note::
186 186 >
187 187 > valid
188 188 >
189 189 > new text
190 190 >
191 191 > .. note::
192 192 >
193 193 > also valid
194 194 > '''
195 195 >
196 196 > """mixed
197 197 >
198 198 > .. note::
199 199 >
200 200 > good
201 201 >
202 202 > .. note::
203 203 > plus bad
204 204 > """
205 205 > EOF
206 206 $ $check_code -w rst.py
207 207 rst.py:3:
208 208 > .. note::
209 209 warning: add two newlines after '.. note::'
210 210 rst.py:26:
211 211 > .. note::
212 212 warning: add two newlines after '.. note::'
213 213 [1]
214 214
215 215 $ cat > ./map-inside-gettext.py <<EOF
216 > print _("map inside gettext %s" % v)
216 > print(_("map inside gettext %s" % v))
217 217 >
218 > print _("concatenating " " by " " space %s" % v)
219 > print _("concatenating " + " by " + " '+' %s" % v)
218 > print(_("concatenating " " by " " space %s" % v))
219 > print(_("concatenating " + " by " + " '+' %s" % v))
220 220 >
221 > print _("mapping operation in different line %s"
222 > % v)
221 > print(_("mapping operation in different line %s"
222 > % v))
223 223 >
224 > print _(
225 > "leading spaces inside of '(' %s" % v)
224 > print(_(
225 > "leading spaces inside of '(' %s" % v))
226 226 > EOF
227 227 $ "$check_code" ./map-inside-gettext.py
228 228 ./map-inside-gettext.py:1:
229 > print _("map inside gettext %s" % v)
229 > print(_("map inside gettext %s" % v))
230 230 don't use % inside _()
231 231 ./map-inside-gettext.py:3:
232 > print _("concatenating " " by " " space %s" % v)
232 > print(_("concatenating " " by " " space %s" % v))
233 233 don't use % inside _()
234 234 ./map-inside-gettext.py:4:
235 > print _("concatenating " + " by " + " '+' %s" % v)
235 > print(_("concatenating " + " by " + " '+' %s" % v))
236 236 don't use % inside _()
237 237 ./map-inside-gettext.py:6:
238 > print _("mapping operation in different line %s"
238 > print(_("mapping operation in different line %s"
239 239 don't use % inside _()
240 240 ./map-inside-gettext.py:9:
241 > print _(
241 > print(_(
242 242 don't use % inside _()
243 243 [1]
244 244
245 245 web templates
246 246
247 247 $ mkdir -p mercurial/templates
248 248 $ cat > mercurial/templates/example.tmpl <<EOF
249 249 > {desc}
250 250 > {desc|escape}
251 251 > {desc|firstline}
252 252 > {desc|websub}
253 253 > EOF
254 254
255 255 $ "$check_code" --warnings mercurial/templates/example.tmpl
256 256 mercurial/templates/example.tmpl:2:
257 257 > {desc|escape}
258 258 warning: follow desc keyword with either firstline or websub
259 259 [1]
260 260
261 261 'string join across lines with no space' detection
262 262
263 263 $ cat > stringjoin.py <<EOF
264 264 > foo = (' foo'
265 265 > 'bar foo.'
266 266 > 'bar foo:'
267 267 > 'bar foo@'
268 268 > 'bar foo%'
269 269 > 'bar foo*'
270 270 > 'bar foo+'
271 271 > 'bar foo-'
272 272 > 'bar')
273 273 > EOF
274 274
275 275 'missing _() in ui message' detection
276 276
277 277 $ cat > uigettext.py <<EOF
278 278 > ui.status("% 10s %05d % -3.2f %*s %%"
279 279 > # this use '\\\\' instead of '\\', because the latter in
280 280 > # heredoc on shell becomes just '\'
281 281 > '\\\\ \n \t \0'
282 282 > """12345
283 283 > """
284 284 > '''.:*+-=
285 285 > ''' "%-6d \n 123456 .:*+-= foobar")
286 286 > EOF
287 287
288 288 (Checking multiple invalid files at once examines whether caching
289 289 translation table for repquote() works as expected or not. All files
290 290 should break rules depending on result of repquote(), in this case)
291 291
292 292 $ "$check_code" stringjoin.py uigettext.py
293 293 stringjoin.py:1:
294 294 > foo = (' foo'
295 295 string join across lines with no space
296 296 stringjoin.py:2:
297 297 > 'bar foo.'
298 298 string join across lines with no space
299 299 stringjoin.py:3:
300 300 > 'bar foo:'
301 301 string join across lines with no space
302 302 stringjoin.py:4:
303 303 > 'bar foo@'
304 304 string join across lines with no space
305 305 stringjoin.py:5:
306 306 > 'bar foo%'
307 307 string join across lines with no space
308 308 stringjoin.py:6:
309 309 > 'bar foo*'
310 310 string join across lines with no space
311 311 stringjoin.py:7:
312 312 > 'bar foo+'
313 313 string join across lines with no space
314 314 stringjoin.py:8:
315 315 > 'bar foo-'
316 316 string join across lines with no space
317 317 uigettext.py:1:
318 318 > ui.status("% 10s %05d % -3.2f %*s %%"
319 319 missing _() in ui message (use () to hide false-positives)
320 320 [1]
@@ -1,654 +1,654 b''
1 1 #require cvs
2 2
3 3 $ cvscall()
4 4 > {
5 5 > cvs -f "$@"
6 6 > }
7 7 $ hgcat()
8 8 > {
9 9 > hg --cwd src-hg cat -r tip "$1"
10 10 > }
11 11 $ echo "[extensions]" >> $HGRCPATH
12 12 $ echo "convert = " >> $HGRCPATH
13 13 $ cat > cvshooks.py <<EOF
14 14 > def cvslog(ui,repo,hooktype,log):
15 > print "%s hook: %d entries"%(hooktype,len(log))
15 > print("%s hook: %d entries"%(hooktype,len(log)))
16 16 >
17 17 > def cvschangesets(ui,repo,hooktype,changesets):
18 > print "%s hook: %d changesets"%(hooktype,len(changesets))
18 > print("%s hook: %d changesets"%(hooktype,len(changesets)))
19 19 > EOF
20 20 $ hookpath=`pwd`
21 21 $ cat <<EOF >> $HGRCPATH
22 22 > [hooks]
23 23 > cvslog = python:$hookpath/cvshooks.py:cvslog
24 24 > cvschangesets = python:$hookpath/cvshooks.py:cvschangesets
25 25 > EOF
26 26
27 27 create cvs repository
28 28
29 29 $ mkdir cvsrepo
30 30 $ cd cvsrepo
31 31 $ CVSROOT=`pwd`
32 32 $ export CVSROOT
33 33 $ CVS_OPTIONS=-f
34 34 $ export CVS_OPTIONS
35 35 $ cd ..
36 36 $ rmdir cvsrepo
37 37 $ cvscall -q -d "$CVSROOT" init
38 38
39 39 create source directory
40 40
41 41 $ mkdir src-temp
42 42 $ cd src-temp
43 43 $ echo a > a
44 44 $ mkdir b
45 45 $ cd b
46 46 $ echo c > c
47 47 $ cd ..
48 48
49 49 import source directory
50 50
51 51 $ cvscall -q import -m import src INITIAL start
52 52 N src/a
53 53 N src/b/c
54 54
55 55 No conflicts created by this import
56 56
57 57 $ cd ..
58 58
59 59 checkout source directory
60 60
61 61 $ cvscall -q checkout src
62 62 U src/a
63 63 U src/b/c
64 64
65 65 commit a new revision changing b/c
66 66
67 67 $ cd src
68 68 $ sleep 1
69 69 $ echo c >> b/c
70 70 $ cvscall -q commit -mci0 . | grep '<--'
71 71 $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
72 72 $ cd ..
73 73
74 74 convert fresh repo and also check localtimezone option
75 75
76 76 NOTE: This doesn't check all time zones -- it merely determines that
77 77 the configuration option is taking effect.
78 78
79 79 An arbitrary (U.S.) time zone is used here. TZ=US/Hawaii is selected
80 80 since it does not use DST (unlike other U.S. time zones) and is always
81 81 a fixed difference from UTC.
82 82
83 83 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg
84 84 initializing destination src-hg repository
85 85 connecting to $TESTTMP/cvsrepo
86 86 scanning source...
87 87 collecting CVS rlog
88 88 5 log entries
89 89 cvslog hook: 5 entries
90 90 creating changesets
91 91 3 changeset entries
92 92 cvschangesets hook: 3 changesets
93 93 sorting...
94 94 converting...
95 95 2 Initial revision
96 96 1 ci0
97 97 0 import
98 98 updating tags
99 99 $ hgcat a
100 100 a
101 101 $ hgcat b/c
102 102 c
103 103 c
104 104
105 105 convert fresh repo with --filemap
106 106
107 107 $ echo include b/c > filemap
108 108 $ hg convert --filemap filemap src src-filemap
109 109 initializing destination src-filemap repository
110 110 connecting to $TESTTMP/cvsrepo
111 111 scanning source...
112 112 collecting CVS rlog
113 113 5 log entries
114 114 cvslog hook: 5 entries
115 115 creating changesets
116 116 3 changeset entries
117 117 cvschangesets hook: 3 changesets
118 118 sorting...
119 119 converting...
120 120 2 Initial revision
121 121 1 ci0
122 122 0 import
123 123 filtering out empty revision
124 124 repository tip rolled back to revision 1 (undo convert)
125 125 updating tags
126 126 $ hgcat b/c
127 127 c
128 128 c
129 129 $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
130 130 2 update tags files: .hgtags
131 131 1 ci0 files: b/c
132 132 0 Initial revision files: b/c
133 133
134 134 convert full repository (issue1649)
135 135
136 136 $ cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT
137 137 U srcfull/src/a
138 138 U srcfull/src/b/c
139 139 $ ls srcfull
140 140 CVS
141 141 CVSROOT
142 142 src
143 143 $ hg convert srcfull srcfull-hg \
144 144 > | grep -v 'log entries' | grep -v 'hook:' \
145 145 > | grep -v '^[0-3] .*' # filter instable changeset order
146 146 initializing destination srcfull-hg repository
147 147 connecting to $TESTTMP/cvsrepo
148 148 scanning source...
149 149 collecting CVS rlog
150 150 creating changesets
151 151 4 changeset entries
152 152 sorting...
153 153 converting...
154 154 updating tags
155 155 $ hg cat -r tip --cwd srcfull-hg src/a
156 156 a
157 157 $ hg cat -r tip --cwd srcfull-hg src/b/c
158 158 c
159 159 c
160 160
161 161 commit new file revisions
162 162
163 163 $ cd src
164 164 $ echo a >> a
165 165 $ echo c >> b/c
166 166 $ cvscall -q commit -mci1 . | grep '<--'
167 167 $TESTTMP/cvsrepo/src/a,v <-- a
168 168 $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
169 169 $ cd ..
170 170
171 171 convert again
172 172
173 173 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg
174 174 connecting to $TESTTMP/cvsrepo
175 175 scanning source...
176 176 collecting CVS rlog
177 177 7 log entries
178 178 cvslog hook: 7 entries
179 179 creating changesets
180 180 4 changeset entries
181 181 cvschangesets hook: 4 changesets
182 182 sorting...
183 183 converting...
184 184 0 ci1
185 185 $ hgcat a
186 186 a
187 187 a
188 188 $ hgcat b/c
189 189 c
190 190 c
191 191 c
192 192
193 193 convert again with --filemap
194 194
195 195 $ hg convert --filemap filemap src src-filemap
196 196 connecting to $TESTTMP/cvsrepo
197 197 scanning source...
198 198 collecting CVS rlog
199 199 7 log entries
200 200 cvslog hook: 7 entries
201 201 creating changesets
202 202 4 changeset entries
203 203 cvschangesets hook: 4 changesets
204 204 sorting...
205 205 converting...
206 206 0 ci1
207 207 $ hgcat b/c
208 208 c
209 209 c
210 210 c
211 211 $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
212 212 3 ci1 files: b/c
213 213 2 update tags files: .hgtags
214 214 1 ci0 files: b/c
215 215 0 Initial revision files: b/c
216 216
217 217 commit branch
218 218
219 219 $ cd src
220 220 $ cvs -q update -r1.1 b/c
221 221 U b/c
222 222 $ cvs -q tag -b branch
223 223 T a
224 224 T b/c
225 225 $ cvs -q update -r branch > /dev/null
226 226 $ sleep 1
227 227 $ echo d >> b/c
228 228 $ cvs -q commit -mci2 . | grep '<--'
229 229 $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
230 230 $ cd ..
231 231
232 232 convert again
233 233
234 234 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg
235 235 connecting to $TESTTMP/cvsrepo
236 236 scanning source...
237 237 collecting CVS rlog
238 238 8 log entries
239 239 cvslog hook: 8 entries
240 240 creating changesets
241 241 5 changeset entries
242 242 cvschangesets hook: 5 changesets
243 243 sorting...
244 244 converting...
245 245 0 ci2
246 246 $ hgcat b/c
247 247 c
248 248 d
249 249
250 250 convert again with --filemap
251 251
252 252 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True --filemap filemap src src-filemap
253 253 connecting to $TESTTMP/cvsrepo
254 254 scanning source...
255 255 collecting CVS rlog
256 256 8 log entries
257 257 cvslog hook: 8 entries
258 258 creating changesets
259 259 5 changeset entries
260 260 cvschangesets hook: 5 changesets
261 261 sorting...
262 262 converting...
263 263 0 ci2
264 264 $ hgcat b/c
265 265 c
266 266 d
267 267 $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
268 268 4 ci2 files: b/c
269 269 3 ci1 files: b/c
270 270 2 update tags files: .hgtags
271 271 1 ci0 files: b/c
272 272 0 Initial revision files: b/c
273 273
274 274 commit a new revision with funny log message
275 275
276 276 $ cd src
277 277 $ sleep 1
278 278 $ echo e >> a
279 279 $ cvscall -q commit -m'funny
280 280 > ----------------------------
281 281 > log message' . | grep '<--' |\
282 282 > sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
283 283 checking in src/a,v
284 284
285 285 commit new file revisions with some fuzz
286 286
287 287 $ sleep 1
288 288 $ echo f >> a
289 289 $ cvscall -q commit -mfuzzy . | grep '<--'
290 290 $TESTTMP/cvsrepo/src/a,v <-- a
291 291 $ sleep 4 # the two changes will be split if fuzz < 4
292 292 $ echo g >> b/c
293 293 $ cvscall -q commit -mfuzzy . | grep '<--'
294 294 $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
295 295 $ cd ..
296 296
297 297 convert again
298 298
299 299 $ TZ=US/Hawaii hg convert --config convert.cvsps.fuzz=2 --config convert.localtimezone=True src src-hg
300 300 connecting to $TESTTMP/cvsrepo
301 301 scanning source...
302 302 collecting CVS rlog
303 303 11 log entries
304 304 cvslog hook: 11 entries
305 305 creating changesets
306 306 8 changeset entries
307 307 cvschangesets hook: 8 changesets
308 308 sorting...
309 309 converting...
310 310 2 funny
311 311 1 fuzzy
312 312 0 fuzzy
313 313 $ hg -R src-hg log -G --template '{rev} ({branches}) {desc} date: {date|date} files: {files}\n'
314 314 o 8 (branch) fuzzy date: * -1000 files: b/c (glob)
315 315 |
316 316 o 7 (branch) fuzzy date: * -1000 files: a (glob)
317 317 |
318 318 o 6 (branch) funny
319 319 | ----------------------------
320 320 | log message date: * -1000 files: a (glob)
321 321 o 5 (branch) ci2 date: * -1000 files: b/c (glob)
322 322
323 323 o 4 () ci1 date: * -1000 files: a b/c (glob)
324 324 |
325 325 o 3 () update tags date: * +0000 files: .hgtags (glob)
326 326 |
327 327 | o 2 (INITIAL) import date: * -1000 files: (glob)
328 328 | |
329 329 o | 1 () ci0 date: * -1000 files: b/c (glob)
330 330 |/
331 331 o 0 () Initial revision date: * -1000 files: a b/c (glob)
332 332
333 333
334 334 testing debugcvsps
335 335
336 336 $ cd src
337 337 $ hg debugcvsps --fuzz=2 -x >/dev/null
338 338
339 339 commit a new revision changing a and removing b/c
340 340
341 341 $ cvscall -q update -A
342 342 U a
343 343 U b/c
344 344 $ sleep 1
345 345 $ echo h >> a
346 346 $ cvscall -Q remove -f b/c
347 347 $ cvscall -q commit -mci | grep '<--'
348 348 $TESTTMP/cvsrepo/src/a,v <-- a
349 349 $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
350 350
351 351 update and verify the cvsps cache
352 352
353 353 $ hg debugcvsps --fuzz=2 -u
354 354 collecting CVS rlog
355 355 13 log entries
356 356 cvslog hook: 13 entries
357 357 creating changesets
358 358 11 changeset entries
359 359 cvschangesets hook: 11 changesets
360 360 ---------------------
361 361 PatchSet 1
362 362 Date: * (glob)
363 363 Author: * (glob)
364 364 Branch: HEAD
365 365 Tag: (none)
366 366 Branchpoints: INITIAL
367 367 Log:
368 368 Initial revision
369 369
370 370 Members:
371 371 a:INITIAL->1.1
372 372
373 373 ---------------------
374 374 PatchSet 2
375 375 Date: * (glob)
376 376 Author: * (glob)
377 377 Branch: HEAD
378 378 Tag: (none)
379 379 Branchpoints: INITIAL, branch
380 380 Log:
381 381 Initial revision
382 382
383 383 Members:
384 384 b/c:INITIAL->1.1
385 385
386 386 ---------------------
387 387 PatchSet 3
388 388 Date: * (glob)
389 389 Author: * (glob)
390 390 Branch: INITIAL
391 391 Tag: start
392 392 Log:
393 393 import
394 394
395 395 Members:
396 396 a:1.1->1.1.1.1
397 397 b/c:1.1->1.1.1.1
398 398
399 399 ---------------------
400 400 PatchSet 4
401 401 Date: * (glob)
402 402 Author: * (glob)
403 403 Branch: HEAD
404 404 Tag: (none)
405 405 Log:
406 406 ci0
407 407
408 408 Members:
409 409 b/c:1.1->1.2
410 410
411 411 ---------------------
412 412 PatchSet 5
413 413 Date: * (glob)
414 414 Author: * (glob)
415 415 Branch: HEAD
416 416 Tag: (none)
417 417 Branchpoints: branch
418 418 Log:
419 419 ci1
420 420
421 421 Members:
422 422 a:1.1->1.2
423 423
424 424 ---------------------
425 425 PatchSet 6
426 426 Date: * (glob)
427 427 Author: * (glob)
428 428 Branch: HEAD
429 429 Tag: (none)
430 430 Log:
431 431 ci1
432 432
433 433 Members:
434 434 b/c:1.2->1.3
435 435
436 436 ---------------------
437 437 PatchSet 7
438 438 Date: * (glob)
439 439 Author: * (glob)
440 440 Branch: branch
441 441 Tag: (none)
442 442 Log:
443 443 ci2
444 444
445 445 Members:
446 446 b/c:1.1->1.1.2.1
447 447
448 448 ---------------------
449 449 PatchSet 8
450 450 Date: * (glob)
451 451 Author: * (glob)
452 452 Branch: branch
453 453 Tag: (none)
454 454 Log:
455 455 funny
456 456 ----------------------------
457 457 log message
458 458
459 459 Members:
460 460 a:1.2->1.2.2.1
461 461
462 462 ---------------------
463 463 PatchSet 9
464 464 Date: * (glob)
465 465 Author: * (glob)
466 466 Branch: branch
467 467 Tag: (none)
468 468 Log:
469 469 fuzzy
470 470
471 471 Members:
472 472 a:1.2.2.1->1.2.2.2
473 473
474 474 ---------------------
475 475 PatchSet 10
476 476 Date: * (glob)
477 477 Author: * (glob)
478 478 Branch: branch
479 479 Tag: (none)
480 480 Log:
481 481 fuzzy
482 482
483 483 Members:
484 484 b/c:1.1.2.1->1.1.2.2
485 485
486 486 ---------------------
487 487 PatchSet 11
488 488 Date: * (glob)
489 489 Author: * (glob)
490 490 Branch: HEAD
491 491 Tag: (none)
492 492 Log:
493 493 ci
494 494
495 495 Members:
496 496 a:1.2->1.3
497 497 b/c:1.3->1.4(DEAD)
498 498
499 499
500 500 $ cd ..
501 501
502 502 Test transcoding CVS log messages (issue5597)
503 503 =============================================
504 504
505 505 To emulate commit messages in (non-ascii) multiple encodings portably,
506 506 this test scenario writes CVS history file (*,v file) directly via
507 507 python code.
508 508
509 509 Commit messages of version 1.2 - 1.4 use u3042 in 3 encodings below.
510 510
511 511 |encoding |byte sequence | decodable as: |
512 512 | | | utf-8 euc-jp cp932 |
513 513 +----------+--------------+--------------------+
514 514 |utf-8 |\xe3\x81\x82 | o x x |
515 515 |euc-jp |\xa4\xa2 | x o o |
516 516 |cp932 |\x82\xa0 | x x o |
517 517
518 518 $ mkdir -p cvsrepo/transcoding
519 519 $ python <<EOF
520 520 > fp = open('cvsrepo/transcoding/file,v', 'w')
521 521 > fp.write(('''
522 522 > head 1.4;
523 523 > access;
524 524 > symbols
525 525 > start:1.1.1.1 INITIAL:1.1.1;
526 526 > locks; strict;
527 527 > comment @# @;
528 528 >
529 529 >
530 530 > 1.4
531 531 > date 2017.07.10.00.00.04; author nobody; state Exp;
532 532 > branches;
533 533 > next 1.3;
534 534 > commitid 10059635D016A510FFA;
535 535 >
536 536 > 1.3
537 537 > date 2017.07.10.00.00.03; author nobody; state Exp;
538 538 > branches;
539 539 > next 1.2;
540 540 > commitid 10059635CFF6A4FF34E;
541 541 >
542 542 > 1.2
543 543 > date 2017.07.10.00.00.02; author nobody; state Exp;
544 544 > branches;
545 545 > next 1.1;
546 546 > commitid 10059635CFD6A4D5095;
547 547 >
548 548 > 1.1
549 549 > date 2017.07.10.00.00.01; author nobody; state Exp;
550 550 > branches
551 551 > 1.1.1.1;
552 552 > next ;
553 553 > commitid 10059635CFB6A4A3C33;
554 554 >
555 555 > 1.1.1.1
556 556 > date 2017.07.10.00.00.01; author nobody; state Exp;
557 557 > branches;
558 558 > next ;
559 559 > commitid 10059635CFB6A4A3C33;
560 560 >
561 561 >
562 562 > desc
563 563 > @@
564 564 >
565 565 >
566 566 > 1.4
567 567 > log
568 568 > @''' + u'\u3042'.encode('cp932') + ''' (cp932)
569 569 > @
570 570 > text
571 571 > @1
572 572 > 2
573 573 > 3
574 574 > 4
575 575 > @
576 576 >
577 577 >
578 578 > 1.3
579 579 > log
580 580 > @''' + u'\u3042'.encode('euc-jp') + ''' (euc-jp)
581 581 > @
582 582 > text
583 583 > @d4 1
584 584 > @
585 585 >
586 586 >
587 587 > 1.2
588 588 > log
589 589 > @''' + u'\u3042'.encode('utf-8') + ''' (utf-8)
590 590 > @
591 591 > text
592 592 > @d3 1
593 593 > @
594 594 >
595 595 >
596 596 > 1.1
597 597 > log
598 598 > @Initial revision
599 599 > @
600 600 > text
601 601 > @d2 1
602 602 > @
603 603 >
604 604 >
605 605 > 1.1.1.1
606 606 > log
607 607 > @import
608 608 > @
609 609 > text
610 610 > @@
611 611 > ''').lstrip())
612 612 > EOF
613 613
614 614 $ cvscall -q checkout transcoding
615 615 U transcoding/file
616 616
617 617 Test converting in normal case
618 618 ------------------------------
619 619
620 620 (filtering by grep in order to check only form of debug messages)
621 621
622 622 $ hg convert --config convert.cvsps.logencoding=utf-8,euc-jp,cp932 -q --debug transcoding transcoding-hg | grep 'transcoding by'
623 623 transcoding by utf-8: 1.1 of file
624 624 transcoding by utf-8: 1.1.1.1 of file
625 625 transcoding by utf-8: 1.2 of file
626 626 transcoding by euc-jp: 1.3 of file
627 627 transcoding by cp932: 1.4 of file
628 628 $ hg -R transcoding-hg --encoding utf-8 log -T "{rev}: {desc}\n"
629 629 5: update tags
630 630 4: import
631 631 3: \xe3\x81\x82 (cp932) (esc)
632 632 2: \xe3\x81\x82 (euc-jp) (esc)
633 633 1: \xe3\x81\x82 (utf-8) (esc)
634 634 0: Initial revision
635 635 $ rm -rf transcoding-hg
636 636
637 637 Test converting in error cases
638 638 ------------------------------
639 639
640 640 unknown encoding in convert.cvsps.logencoding
641 641
642 642 $ hg convert --config convert.cvsps.logencoding=foobar -q transcoding transcoding-hg
643 643 abort: unknown encoding: foobar
644 644 (check convert.cvsps.logencoding configuration)
645 645 [255]
646 646 $ rm -rf transcoding-hg
647 647
648 648 no acceptable encoding in convert.cvsps.logencoding
649 649
650 650 $ hg convert --config convert.cvsps.logencoding=utf-8,euc-jp -q transcoding transcoding-hg
651 651 abort: no encoding can transcode CVS log message for 1.4 of file
652 652 (check convert.cvsps.logencoding configuration)
653 653 [255]
654 654 $ rm -rf transcoding-hg
@@ -1,561 +1,561 b''
1 1 Test EOL extension
2 2
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [diff]
5 5 > git = True
6 6 > EOF
7 7
8 8 Set up helpers
9 9
10 10 $ cat > switch-eol.py <<EOF
11 11 > import sys
12 12 > try:
13 13 > import os, msvcrt
14 14 > msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
15 15 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
16 16 > except ImportError:
17 17 > pass
18 18 > (old, new) = sys.argv[1] == 'LF' and ('\n', '\r\n') or ('\r\n', '\n')
19 > print "%% switching encoding from %r to %r" % (old, new)
19 > print("%% switching encoding from %r to %r" % (old, new))
20 20 > for path in sys.argv[2:]:
21 21 > data = file(path, 'rb').read()
22 22 > data = data.replace(old, new)
23 23 > file(path, 'wb').write(data)
24 24 > EOF
25 25
26 26 $ seteol () {
27 27 > if [ $1 = "LF" ]; then
28 28 > EOL='\n'
29 29 > else
30 30 > EOL='\r\n'
31 31 > fi
32 32 > }
33 33
34 34 $ makerepo () {
35 35 > seteol $1
36 36 > echo "% setup $1 repository"
37 37 > hg init repo
38 38 > cd repo
39 39 > cat > .hgeol <<EOF
40 40 > [repository]
41 41 > native = $1
42 42 > [patterns]
43 43 > mixed.txt = BIN
44 44 > **.txt = native
45 45 > EOF
46 46 > printf "first${EOL}second${EOL}third${EOL}" > a.txt
47 47 > hg commit --addremove -m 'checkin'
48 48 > echo
49 49 > cd ..
50 50 > }
51 51
52 52 $ dotest () {
53 53 > seteol $1
54 54 > echo "% hg clone repo repo-$1"
55 55 > hg clone --noupdate repo repo-$1
56 56 > cd repo-$1
57 57 > cat > .hg/hgrc <<EOF
58 58 > [extensions]
59 59 > eol =
60 60 > [eol]
61 61 > native = $1
62 62 > EOF
63 63 > hg update
64 64 > echo '% a.txt'
65 65 > cat a.txt
66 66 > echo '% hg cat a.txt'
67 67 > hg cat a.txt
68 68 > printf "fourth${EOL}" >> a.txt
69 69 > echo '% a.txt'
70 70 > cat a.txt
71 71 > hg diff
72 72 > $PYTHON ../switch-eol.py $1 a.txt
73 73 > echo '% hg diff only reports a single changed line:'
74 74 > hg diff
75 75 > echo "% reverting back to $1 format"
76 76 > hg revert a.txt
77 77 > cat a.txt
78 78 > printf "first\r\nsecond\n" > mixed.txt
79 79 > hg add mixed.txt
80 80 > echo "% hg commit of inconsistent .txt file marked as binary (should work)"
81 81 > hg commit -m 'binary file'
82 82 > echo "% hg commit of inconsistent .txt file marked as native (should fail)"
83 83 > printf "first\nsecond\r\nthird\nfourth\r\n" > a.txt
84 84 > hg commit -m 'inconsistent file'
85 85 > echo "% hg commit --config eol.only-consistent=False (should work)"
86 86 > hg commit --config eol.only-consistent=False -m 'inconsistent file'
87 87 > echo "% hg commit of binary .txt file marked as native (binary files always okay)"
88 88 > printf "first${EOL}\0${EOL}third${EOL}" > a.txt
89 89 > hg commit -m 'binary file'
90 90 > cd ..
91 91 > rm -r repo-$1
92 92 > }
93 93
94 94 $ makemixedrepo () {
95 95 > echo
96 96 > echo "# setup $1 repository"
97 97 > hg init mixed
98 98 > cd mixed
99 99 > printf "foo\r\nbar\r\nbaz\r\n" > win.txt
100 100 > printf "foo\nbar\nbaz\n" > unix.txt
101 101 > #printf "foo\r\nbar\nbaz\r\n" > mixed.txt
102 102 > hg commit --addremove -m 'created mixed files'
103 103 > echo "# setting repository-native EOLs to $1"
104 104 > cat > .hgeol <<EOF
105 105 > [repository]
106 106 > native = $1
107 107 > [patterns]
108 108 > **.txt = native
109 109 > EOF
110 110 > hg commit --addremove -m 'added .hgeol'
111 111 > cd ..
112 112 > }
113 113
114 114 $ testmixed () {
115 115 > echo
116 116 > echo "% hg clone mixed mixed-$1"
117 117 > hg clone mixed mixed-$1
118 118 > cd mixed-$1
119 119 > echo '% hg status (eol extension not yet activated)'
120 120 > hg status
121 121 > cat > .hg/hgrc <<EOF
122 122 > [extensions]
123 123 > eol =
124 124 > [eol]
125 125 > native = $1
126 126 > EOF
127 127 > echo '% hg status (eol activated)'
128 128 > hg status
129 129 > echo '% hg commit'
130 130 > hg commit -m 'synchronized EOLs'
131 131 > echo '% hg status'
132 132 > hg status
133 133 > cd ..
134 134 > rm -r mixed-$1
135 135 > }
136 136
137 137 Basic tests
138 138
139 139 $ makerepo LF
140 140 % setup LF repository
141 141 adding .hgeol
142 142 adding a.txt
143 143
144 144 $ dotest LF
145 145 % hg clone repo repo-LF
146 146 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
147 147 % a.txt
148 148 first
149 149 second
150 150 third
151 151 % hg cat a.txt
152 152 first
153 153 second
154 154 third
155 155 % a.txt
156 156 first
157 157 second
158 158 third
159 159 fourth
160 160 diff --git a/a.txt b/a.txt
161 161 --- a/a.txt
162 162 +++ b/a.txt
163 163 @@ -1,3 +1,4 @@
164 164 first
165 165 second
166 166 third
167 167 +fourth
168 168 % switching encoding from '\n' to '\r\n'
169 169 % hg diff only reports a single changed line:
170 170 diff --git a/a.txt b/a.txt
171 171 --- a/a.txt
172 172 +++ b/a.txt
173 173 @@ -1,3 +1,4 @@
174 174 first
175 175 second
176 176 third
177 177 +fourth
178 178 % reverting back to LF format
179 179 first
180 180 second
181 181 third
182 182 % hg commit of inconsistent .txt file marked as binary (should work)
183 183 % hg commit of inconsistent .txt file marked as native (should fail)
184 184 abort: inconsistent newline style in a.txt
185 185
186 186 % hg commit --config eol.only-consistent=False (should work)
187 187 % hg commit of binary .txt file marked as native (binary files always okay)
188 188 $ dotest CRLF
189 189 % hg clone repo repo-CRLF
190 190 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 191 % a.txt
192 192 first\r (esc)
193 193 second\r (esc)
194 194 third\r (esc)
195 195 % hg cat a.txt
196 196 first
197 197 second
198 198 third
199 199 % a.txt
200 200 first\r (esc)
201 201 second\r (esc)
202 202 third\r (esc)
203 203 fourth\r (esc)
204 204 diff --git a/a.txt b/a.txt
205 205 --- a/a.txt
206 206 +++ b/a.txt
207 207 @@ -1,3 +1,4 @@
208 208 first
209 209 second
210 210 third
211 211 +fourth
212 212 % switching encoding from '\r\n' to '\n'
213 213 % hg diff only reports a single changed line:
214 214 diff --git a/a.txt b/a.txt
215 215 --- a/a.txt
216 216 +++ b/a.txt
217 217 @@ -1,3 +1,4 @@
218 218 first
219 219 second
220 220 third
221 221 +fourth
222 222 % reverting back to CRLF format
223 223 first\r (esc)
224 224 second\r (esc)
225 225 third\r (esc)
226 226 % hg commit of inconsistent .txt file marked as binary (should work)
227 227 % hg commit of inconsistent .txt file marked as native (should fail)
228 228 abort: inconsistent newline style in a.txt
229 229
230 230 % hg commit --config eol.only-consistent=False (should work)
231 231 % hg commit of binary .txt file marked as native (binary files always okay)
232 232 $ rm -r repo
233 233 $ makerepo CRLF
234 234 % setup CRLF repository
235 235 adding .hgeol
236 236 adding a.txt
237 237
238 238 $ dotest LF
239 239 % hg clone repo repo-LF
240 240 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
241 241 % a.txt
242 242 first
243 243 second
244 244 third
245 245 % hg cat a.txt
246 246 first\r (esc)
247 247 second\r (esc)
248 248 third\r (esc)
249 249 % a.txt
250 250 first
251 251 second
252 252 third
253 253 fourth
254 254 diff --git a/a.txt b/a.txt
255 255 --- a/a.txt
256 256 +++ b/a.txt
257 257 @@ -1,3 +1,4 @@
258 258 first\r (esc)
259 259 second\r (esc)
260 260 third\r (esc)
261 261 +fourth\r (esc)
262 262 % switching encoding from '\n' to '\r\n'
263 263 % hg diff only reports a single changed line:
264 264 diff --git a/a.txt b/a.txt
265 265 --- a/a.txt
266 266 +++ b/a.txt
267 267 @@ -1,3 +1,4 @@
268 268 first\r (esc)
269 269 second\r (esc)
270 270 third\r (esc)
271 271 +fourth\r (esc)
272 272 % reverting back to LF format
273 273 first
274 274 second
275 275 third
276 276 % hg commit of inconsistent .txt file marked as binary (should work)
277 277 % hg commit of inconsistent .txt file marked as native (should fail)
278 278 abort: inconsistent newline style in a.txt
279 279
280 280 % hg commit --config eol.only-consistent=False (should work)
281 281 % hg commit of binary .txt file marked as native (binary files always okay)
282 282 $ dotest CRLF
283 283 % hg clone repo repo-CRLF
284 284 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
285 285 % a.txt
286 286 first\r (esc)
287 287 second\r (esc)
288 288 third\r (esc)
289 289 % hg cat a.txt
290 290 first\r (esc)
291 291 second\r (esc)
292 292 third\r (esc)
293 293 % a.txt
294 294 first\r (esc)
295 295 second\r (esc)
296 296 third\r (esc)
297 297 fourth\r (esc)
298 298 diff --git a/a.txt b/a.txt
299 299 --- a/a.txt
300 300 +++ b/a.txt
301 301 @@ -1,3 +1,4 @@
302 302 first\r (esc)
303 303 second\r (esc)
304 304 third\r (esc)
305 305 +fourth\r (esc)
306 306 % switching encoding from '\r\n' to '\n'
307 307 % hg diff only reports a single changed line:
308 308 diff --git a/a.txt b/a.txt
309 309 --- a/a.txt
310 310 +++ b/a.txt
311 311 @@ -1,3 +1,4 @@
312 312 first\r (esc)
313 313 second\r (esc)
314 314 third\r (esc)
315 315 +fourth\r (esc)
316 316 % reverting back to CRLF format
317 317 first\r (esc)
318 318 second\r (esc)
319 319 third\r (esc)
320 320 % hg commit of inconsistent .txt file marked as binary (should work)
321 321 % hg commit of inconsistent .txt file marked as native (should fail)
322 322 abort: inconsistent newline style in a.txt
323 323
324 324 % hg commit --config eol.only-consistent=False (should work)
325 325 % hg commit of binary .txt file marked as native (binary files always okay)
326 326 $ rm -r repo
327 327
328 328 Mixed tests
329 329
330 330 $ makemixedrepo LF
331 331
332 332 # setup LF repository
333 333 adding unix.txt
334 334 adding win.txt
335 335 # setting repository-native EOLs to LF
336 336 adding .hgeol
337 337 $ testmixed LF
338 338
339 339 % hg clone mixed mixed-LF
340 340 updating to branch default
341 341 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 342 % hg status (eol extension not yet activated)
343 343 % hg status (eol activated)
344 344 M win.txt
345 345 % hg commit
346 346 % hg status
347 347 $ testmixed CRLF
348 348
349 349 % hg clone mixed mixed-CRLF
350 350 updating to branch default
351 351 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
352 352 % hg status (eol extension not yet activated)
353 353 % hg status (eol activated)
354 354 M win.txt
355 355 % hg commit
356 356 % hg status
357 357 $ rm -r mixed
358 358 $ makemixedrepo CRLF
359 359
360 360 # setup CRLF repository
361 361 adding unix.txt
362 362 adding win.txt
363 363 # setting repository-native EOLs to CRLF
364 364 adding .hgeol
365 365 $ testmixed LF
366 366
367 367 % hg clone mixed mixed-LF
368 368 updating to branch default
369 369 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 370 % hg status (eol extension not yet activated)
371 371 % hg status (eol activated)
372 372 M unix.txt
373 373 % hg commit
374 374 % hg status
375 375 $ testmixed CRLF
376 376
377 377 % hg clone mixed mixed-CRLF
378 378 updating to branch default
379 379 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 380 % hg status (eol extension not yet activated)
381 381 % hg status (eol activated)
382 382 M unix.txt
383 383 % hg commit
384 384 % hg status
385 385 $ rm -r mixed
386 386
387 387 $ echo '[extensions]' >> $HGRCPATH
388 388 $ echo 'eol =' >> $HGRCPATH
389 389
390 390 #if unix-permissions
391 391
392 392 Test issue2569 -- eol extension takes write lock on reading:
393 393
394 394 $ hg init repo
395 395 $ cd repo
396 396 $ touch .hgeol
397 397 $ hg status
398 398 ? .hgeol
399 399 $ chmod -R -w .hg
400 400 $ sleep 1
401 401 $ touch .hgeol
402 402 $ hg status --traceback
403 403 ? .hgeol
404 404 $ chmod -R u+w .hg
405 405 $ cd ..
406 406
407 407 #endif
408 408
409 409 Test cleverencode: and cleverdecode: aliases for win32text extension
410 410
411 411 $ cat <<EOF >> $HGRCPATH
412 412 > [encode]
413 413 > **.txt = cleverencode:
414 414 > [decode]
415 415 > **.txt = cleverdecode:
416 416 > EOF
417 417
418 418 $ hg init win32compat
419 419 $ cd win32compat
420 420 $ printf "foo\r\nbar\r\nbaz\r\n" > win.txt
421 421 $ printf "foo\nbar\nbaz\n" > unix.txt
422 422 $ hg add
423 423 adding unix.txt
424 424 adding win.txt
425 425 $ hg commit -m checkin
426 426
427 427 Check that both files have LF line-endings in the repository:
428 428
429 429 $ hg cat win.txt
430 430 foo
431 431 bar
432 432 baz
433 433 $ hg cat unix.txt
434 434 foo
435 435 bar
436 436 baz
437 437
438 438 Test handling of a broken .hgeol file:
439 439
440 440 $ touch .hgeol
441 441 $ hg add .hgeol
442 442 $ hg commit -m 'clean version'
443 443 $ echo "bad" > .hgeol
444 444 $ hg status
445 445 warning: ignoring .hgeol file due to parse error at .hgeol:1: bad
446 446 M .hgeol
447 447 $ hg revert .hgeol
448 448 warning: ignoring .hgeol file due to parse error at .hgeol:1: bad
449 449 $ hg status
450 450 ? .hgeol.orig
451 451
452 452 Test eol.only-consistent can be specified in .hgeol
453 453
454 454 $ cd $TESTTMP
455 455 $ hg init only-consistent
456 456 $ cd only-consistent
457 457 $ printf "first\nsecond\r\n" > a.txt
458 458 $ hg add a.txt
459 459 $ cat > .hgeol << EOF
460 460 > [eol]
461 461 > only-consistent = True
462 462 > EOF
463 463 $ hg commit -m 'inconsistent'
464 464 abort: inconsistent newline style in a.txt
465 465
466 466 [255]
467 467 $ cat > .hgeol << EOF
468 468 > [eol]
469 469 > only-consistent = False
470 470 > EOF
471 471 $ hg commit -m 'consistent'
472 472
473 473 $ hg init subrepo
474 474 $ hg -R subrepo pull -qu .
475 475 $ echo "subrepo = subrepo" > .hgsub
476 476 $ hg ci -Am "add subrepo"
477 477 adding .hgeol
478 478 adding .hgsub
479 479 $ hg archive -S ../archive
480 480 $ find ../archive/* | sort
481 481 ../archive/a.txt
482 482 ../archive/subrepo
483 483 ../archive/subrepo/a.txt
484 484 $ cat ../archive/a.txt ../archive/subrepo/a.txt
485 485 first\r (esc)
486 486 second\r (esc)
487 487 first\r (esc)
488 488 second\r (esc)
489 489
490 490 Test trailing newline
491 491
492 492 $ cat >> $HGRCPATH <<EOF
493 493 > [extensions]
494 494 > eol=
495 495 > EOF
496 496
497 497 setup repository
498 498
499 499 $ cd $TESTTMP
500 500 $ hg init trailing
501 501 $ cd trailing
502 502 $ cat > .hgeol <<EOF
503 503 > [patterns]
504 504 > **.txt = native
505 505 > [eol]
506 506 > fix-trailing-newline = False
507 507 > EOF
508 508
509 509 add text without trailing newline
510 510
511 511 $ printf "first\nsecond" > a.txt
512 512 $ hg commit --addremove -m 'checking in'
513 513 adding .hgeol
514 514 adding a.txt
515 515 $ rm a.txt
516 516 $ hg update -C -q
517 517 $ cat a.txt
518 518 first
519 519 second (no-eol)
520 520
521 521 $ cat > .hgeol <<EOF
522 522 > [patterns]
523 523 > **.txt = native
524 524 > [eol]
525 525 > fix-trailing-newline = True
526 526 > EOF
527 527 $ printf "third\nfourth" > a.txt
528 528 $ hg commit -m 'checking in with newline fix'
529 529 $ rm a.txt
530 530 $ hg update -C -q
531 531 $ cat a.txt
532 532 third
533 533 fourth
534 534
535 535 append a line without trailing newline
536 536
537 537 $ printf "fifth" >> a.txt
538 538 $ hg commit -m 'adding another line line'
539 539 $ rm a.txt
540 540 $ hg update -C -q
541 541 $ cat a.txt
542 542 third
543 543 fourth
544 544 fifth
545 545
546 546 amend of changesets with renamed/deleted files expose new code paths
547 547
548 548 $ hg mv a.txt b.txt
549 549 $ hg ci --amend -q
550 550 $ hg diff -c.
551 551 diff --git a/a.txt b/b.txt
552 552 rename from a.txt
553 553 rename to b.txt
554 554 --- a/a.txt
555 555 +++ b/b.txt
556 556 @@ -1,2 +1,3 @@
557 557 third
558 558 fourth
559 559 +fifth
560 560
561 561 $ cd ..
@@ -1,1706 +1,1706 b''
1 1 Test basic extension support
2 2
3 3 $ cat > foobar.py <<EOF
4 4 > import os
5 5 > from mercurial import commands, registrar
6 6 > cmdtable = {}
7 7 > command = registrar.command(cmdtable)
8 8 > configtable = {}
9 9 > configitem = registrar.configitem(configtable)
10 10 > configitem('tests', 'foo', default="Foo")
11 11 > def uisetup(ui):
12 12 > ui.write("uisetup called\\n")
13 13 > ui.flush()
14 14 > def reposetup(ui, repo):
15 15 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
16 16 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
17 17 > ui.flush()
18 18 > @command(b'foo', [], 'hg foo')
19 19 > def foo(ui, *args, **kwargs):
20 20 > foo = ui.config('tests', 'foo')
21 21 > ui.write(foo)
22 22 > ui.write("\\n")
23 23 > @command(b'bar', [], 'hg bar', norepo=True)
24 24 > def bar(ui, *args, **kwargs):
25 25 > ui.write("Bar\\n")
26 26 > EOF
27 27 $ abspath=`pwd`/foobar.py
28 28
29 29 $ mkdir barfoo
30 30 $ cp foobar.py barfoo/__init__.py
31 31 $ barfoopath=`pwd`/barfoo
32 32
33 33 $ hg init a
34 34 $ cd a
35 35 $ echo foo > file
36 36 $ hg add file
37 37 $ hg commit -m 'add file'
38 38
39 39 $ echo '[extensions]' >> $HGRCPATH
40 40 $ echo "foobar = $abspath" >> $HGRCPATH
41 41 $ hg foo
42 42 uisetup called
43 43 reposetup called for a
44 44 ui == repo.ui
45 45 Foo
46 46
47 47 $ cd ..
48 48 $ hg clone a b
49 49 uisetup called
50 50 reposetup called for a
51 51 ui == repo.ui
52 52 reposetup called for b
53 53 ui == repo.ui
54 54 updating to branch default
55 55 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 56
57 57 $ hg bar
58 58 uisetup called
59 59 Bar
60 60 $ echo 'foobar = !' >> $HGRCPATH
61 61
62 62 module/__init__.py-style
63 63
64 64 $ echo "barfoo = $barfoopath" >> $HGRCPATH
65 65 $ cd a
66 66 $ hg foo
67 67 uisetup called
68 68 reposetup called for a
69 69 ui == repo.ui
70 70 Foo
71 71 $ echo 'barfoo = !' >> $HGRCPATH
72 72
73 73 Check that extensions are loaded in phases:
74 74
75 75 $ cat > foo.py <<EOF
76 76 > import os
77 77 > name = os.path.basename(__file__).rsplit('.', 1)[0]
78 > print "1) %s imported" % name
78 > print("1) %s imported" % name)
79 79 > def uisetup(ui):
80 > print "2) %s uisetup" % name
80 > print("2) %s uisetup" % name)
81 81 > def extsetup():
82 > print "3) %s extsetup" % name
82 > print("3) %s extsetup" % name)
83 83 > def reposetup(ui, repo):
84 > print "4) %s reposetup" % name
84 > print("4) %s reposetup" % name)
85 85 >
86 86 > # custom predicate to check registration of functions at loading
87 87 > from mercurial import (
88 88 > registrar,
89 89 > smartset,
90 90 > )
91 91 > revsetpredicate = registrar.revsetpredicate()
92 92 > @revsetpredicate(name, safe=True) # safe=True for query via hgweb
93 93 > def custompredicate(repo, subset, x):
94 94 > return smartset.baseset([r for r in subset if r in {0}])
95 95 > EOF
96 96
97 97 $ cp foo.py bar.py
98 98 $ echo 'foo = foo.py' >> $HGRCPATH
99 99 $ echo 'bar = bar.py' >> $HGRCPATH
100 100
101 101 Check normal command's load order of extensions and registration of functions
102 102
103 103 $ hg log -r "foo() and bar()" -q
104 104 1) foo imported
105 105 1) bar imported
106 106 2) foo uisetup
107 107 2) bar uisetup
108 108 3) foo extsetup
109 109 3) bar extsetup
110 110 4) foo reposetup
111 111 4) bar reposetup
112 112 0:c24b9ac61126
113 113
114 114 Check hgweb's load order of extensions and registration of functions
115 115
116 116 $ cat > hgweb.cgi <<EOF
117 117 > #!$PYTHON
118 118 > from mercurial import demandimport; demandimport.enable()
119 119 > from mercurial.hgweb import hgweb
120 120 > from mercurial.hgweb import wsgicgi
121 121 > application = hgweb('.', 'test repo')
122 122 > wsgicgi.launch(application)
123 123 > EOF
124 124 $ . "$TESTDIR/cgienv"
125 125
126 126 $ PATH_INFO='/' SCRIPT_NAME='' $PYTHON hgweb.cgi \
127 127 > | grep '^[0-9]) ' # ignores HTML output
128 128 1) foo imported
129 129 1) bar imported
130 130 2) foo uisetup
131 131 2) bar uisetup
132 132 3) foo extsetup
133 133 3) bar extsetup
134 134 4) foo reposetup
135 135 4) bar reposetup
136 136
137 137 (check that revset predicate foo() and bar() are available)
138 138
139 139 #if msys
140 140 $ PATH_INFO='//shortlog'
141 141 #else
142 142 $ PATH_INFO='/shortlog'
143 143 #endif
144 144 $ export PATH_INFO
145 145 $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' $PYTHON hgweb.cgi \
146 146 > | grep '<a href="/rev/[0-9a-z]*">'
147 147 <a href="/rev/c24b9ac61126">add file</a>
148 148
149 149 $ echo 'foo = !' >> $HGRCPATH
150 150 $ echo 'bar = !' >> $HGRCPATH
151 151
152 152 Check "from __future__ import absolute_import" support for external libraries
153 153
154 154 #if windows
155 155 $ PATHSEP=";"
156 156 #else
157 157 $ PATHSEP=":"
158 158 #endif
159 159 $ export PATHSEP
160 160
161 161 $ mkdir $TESTTMP/libroot
162 162 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
163 163 $ mkdir $TESTTMP/libroot/mod
164 164 $ touch $TESTTMP/libroot/mod/__init__.py
165 165 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
166 166
167 167 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
168 168 > from __future__ import absolute_import
169 169 > import ambig # should load "libroot/ambig.py"
170 170 > s = ambig.s
171 171 > EOF
172 172 $ cat > loadabs.py <<EOF
173 173 > import mod.ambigabs as ambigabs
174 174 > def extsetup():
175 > print 'ambigabs.s=%s' % ambigabs.s
175 > print('ambigabs.s=%s' % ambigabs.s)
176 176 > EOF
177 177 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
178 178 ambigabs.s=libroot/ambig.py
179 179 $TESTTMP/a (glob)
180 180
181 181 #if no-py3k
182 182 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
183 183 > import ambig # should load "libroot/mod/ambig.py"
184 184 > s = ambig.s
185 185 > EOF
186 186 $ cat > loadrel.py <<EOF
187 187 > import mod.ambigrel as ambigrel
188 188 > def extsetup():
189 > print 'ambigrel.s=%s' % ambigrel.s
189 > print('ambigrel.s=%s' % ambigrel.s)
190 190 > EOF
191 191 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
192 192 ambigrel.s=libroot/mod/ambig.py
193 193 $TESTTMP/a (glob)
194 194 #endif
195 195
196 196 Check absolute/relative import of extension specific modules
197 197
198 198 $ mkdir $TESTTMP/extroot
199 199 $ cat > $TESTTMP/extroot/bar.py <<EOF
200 200 > s = 'this is extroot.bar'
201 201 > EOF
202 202 $ mkdir $TESTTMP/extroot/sub1
203 203 $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
204 204 > s = 'this is extroot.sub1.__init__'
205 205 > EOF
206 206 $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
207 207 > s = 'this is extroot.sub1.baz'
208 208 > EOF
209 209 $ cat > $TESTTMP/extroot/__init__.py <<EOF
210 210 > s = 'this is extroot.__init__'
211 211 > import foo
212 212 > def extsetup(ui):
213 213 > ui.write('(extroot) ', foo.func(), '\n')
214 214 > ui.flush()
215 215 > EOF
216 216
217 217 $ cat > $TESTTMP/extroot/foo.py <<EOF
218 218 > # test absolute import
219 219 > buf = []
220 220 > def func():
221 221 > # "not locals" case
222 222 > import extroot.bar
223 223 > buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
224 224 > return '\n(extroot) '.join(buf)
225 225 > # "fromlist == ('*',)" case
226 226 > from extroot.bar import *
227 227 > buf.append('from extroot.bar import *: %s' % s)
228 228 > # "not fromlist" and "if '.' in name" case
229 229 > import extroot.sub1.baz
230 230 > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
231 231 > # "not fromlist" and NOT "if '.' in name" case
232 232 > import extroot
233 233 > buf.append('import extroot: %s' % extroot.s)
234 234 > # NOT "not fromlist" and NOT "level != -1" case
235 235 > from extroot.bar import s
236 236 > buf.append('from extroot.bar import s: %s' % s)
237 237 > EOF
238 238 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
239 239 (extroot) from extroot.bar import *: this is extroot.bar
240 240 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
241 241 (extroot) import extroot: this is extroot.__init__
242 242 (extroot) from extroot.bar import s: this is extroot.bar
243 243 (extroot) import extroot.bar in func(): this is extroot.bar
244 244 $TESTTMP/a (glob)
245 245
246 246 #if no-py3k
247 247 $ rm "$TESTTMP"/extroot/foo.*
248 248 $ cat > $TESTTMP/extroot/foo.py <<EOF
249 249 > # test relative import
250 250 > buf = []
251 251 > def func():
252 252 > # "not locals" case
253 253 > import bar
254 254 > buf.append('import bar in func(): %s' % bar.s)
255 255 > return '\n(extroot) '.join(buf)
256 256 > # "fromlist == ('*',)" case
257 257 > from bar import *
258 258 > buf.append('from bar import *: %s' % s)
259 259 > # "not fromlist" and "if '.' in name" case
260 260 > import sub1.baz
261 261 > buf.append('import sub1.baz: %s' % sub1.baz.s)
262 262 > # "not fromlist" and NOT "if '.' in name" case
263 263 > import sub1
264 264 > buf.append('import sub1: %s' % sub1.s)
265 265 > # NOT "not fromlist" and NOT "level != -1" case
266 266 > from bar import s
267 267 > buf.append('from bar import s: %s' % s)
268 268 > EOF
269 269 $ hg --config extensions.extroot=$TESTTMP/extroot root
270 270 (extroot) from bar import *: this is extroot.bar
271 271 (extroot) import sub1.baz: this is extroot.sub1.baz
272 272 (extroot) import sub1: this is extroot.sub1.__init__
273 273 (extroot) from bar import s: this is extroot.bar
274 274 (extroot) import bar in func(): this is extroot.bar
275 275 $TESTTMP/a (glob)
276 276 #endif
277 277
278 278 #if demandimport
279 279
280 280 Examine whether module loading is delayed until actual referring, even
281 281 though module is imported with "absolute_import" feature.
282 282
283 283 Files below in each packages are used for described purpose:
284 284
285 285 - "called": examine whether "from MODULE import ATTR" works correctly
286 286 - "unused": examine whether loading is delayed correctly
287 287 - "used": examine whether "from PACKAGE import MODULE" works correctly
288 288
289 289 Package hierarchy is needed to examine whether demand importing works
290 290 as expected for "from SUB.PACK.AGE import MODULE".
291 291
292 292 Setup "external library" to be imported with "absolute_import"
293 293 feature.
294 294
295 295 $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2
296 296 $ touch $TESTTMP/extlibroot/__init__.py
297 297 $ touch $TESTTMP/extlibroot/lsub1/__init__.py
298 298 $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py
299 299
300 300 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<EOF
301 301 > def func():
302 302 > return "this is extlibroot.lsub1.lsub2.called.func()"
303 303 > EOF
304 304 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<EOF
305 305 > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally")
306 306 > EOF
307 307 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<EOF
308 308 > detail = "this is extlibroot.lsub1.lsub2.used"
309 309 > EOF
310 310
311 311 Setup sub-package of "external library", which causes instantiation of
312 312 demandmod in "recurse down the module chain" code path. Relative
313 313 importing with "absolute_import" feature isn't tested, because "level
314 314 >=1 " doesn't cause instantiation of demandmod.
315 315
316 316 $ mkdir -p $TESTTMP/extlibroot/recursedown/abs
317 317 $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<EOF
318 318 > detail = "this is extlibroot.recursedown.abs.used"
319 319 > EOF
320 320 $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<EOF
321 321 > from __future__ import absolute_import
322 322 > from extlibroot.recursedown.abs.used import detail
323 323 > EOF
324 324
325 325 $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy
326 326 $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<EOF
327 327 > detail = "this is extlibroot.recursedown.legacy.used"
328 328 > EOF
329 329 $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<EOF
330 330 > # legacy style (level == -1) import
331 331 > from extlibroot.recursedown.legacy.used import detail
332 332 > EOF
333 333
334 334 $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<EOF
335 335 > from __future__ import absolute_import
336 336 > from extlibroot.recursedown.abs import detail as absdetail
337 337 > from .legacy import detail as legacydetail
338 338 > EOF
339 339
340 340 Setup package that re-exports an attribute of its submodule as the same
341 341 name. This leaves 'shadowing.used' pointing to 'used.detail', but still
342 342 the submodule 'used' should be somehow accessible. (issue5617)
343 343
344 344 $ mkdir -p $TESTTMP/extlibroot/shadowing
345 345 $ cat > $TESTTMP/extlibroot/shadowing/used.py <<EOF
346 346 > detail = "this is extlibroot.shadowing.used"
347 347 > EOF
348 348 $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<EOF
349 349 > from __future__ import absolute_import
350 350 > from extlibroot.shadowing.used import detail
351 351 > EOF
352 352 $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<EOF
353 353 > from __future__ import absolute_import
354 354 > from .used import detail as used
355 355 > EOF
356 356
357 357 Setup extension local modules to be imported with "absolute_import"
358 358 feature.
359 359
360 360 $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2
361 361 $ touch $TESTTMP/absextroot/xsub1/__init__.py
362 362 $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py
363 363
364 364 $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<EOF
365 365 > def func():
366 366 > return "this is absextroot.xsub1.xsub2.called.func()"
367 367 > EOF
368 368 $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<EOF
369 369 > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally")
370 370 > EOF
371 371 $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<EOF
372 372 > detail = "this is absextroot.xsub1.xsub2.used"
373 373 > EOF
374 374
375 375 Setup extension local modules to examine whether demand importing
376 376 works as expected in "level > 1" case.
377 377
378 378 $ cat > $TESTTMP/absextroot/relimportee.py <<EOF
379 379 > detail = "this is absextroot.relimportee"
380 380 > EOF
381 381 $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<EOF
382 382 > from __future__ import absolute_import
383 383 > from ... import relimportee
384 384 > detail = "this relimporter imports %r" % (relimportee.detail)
385 385 > EOF
386 386
387 387 Setup modules, which actually import extension local modules at
388 388 runtime.
389 389
390 390 $ cat > $TESTTMP/absextroot/absolute.py << EOF
391 391 > from __future__ import absolute_import
392 392 >
393 393 > # import extension local modules absolutely (level = 0)
394 394 > from absextroot.xsub1.xsub2 import used, unused
395 395 > from absextroot.xsub1.xsub2.called import func
396 396 >
397 397 > def getresult():
398 398 > result = []
399 399 > result.append(used.detail)
400 400 > result.append(func())
401 401 > return result
402 402 > EOF
403 403
404 404 $ cat > $TESTTMP/absextroot/relative.py << EOF
405 405 > from __future__ import absolute_import
406 406 >
407 407 > # import extension local modules relatively (level == 1)
408 408 > from .xsub1.xsub2 import used, unused
409 409 > from .xsub1.xsub2.called import func
410 410 >
411 411 > # import a module, which implies "importing with level > 1"
412 412 > from .xsub1.xsub2 import relimporter
413 413 >
414 414 > def getresult():
415 415 > result = []
416 416 > result.append(used.detail)
417 417 > result.append(func())
418 418 > result.append(relimporter.detail)
419 419 > return result
420 420 > EOF
421 421
422 422 Setup main procedure of extension.
423 423
424 424 $ cat > $TESTTMP/absextroot/__init__.py <<EOF
425 425 > from __future__ import absolute_import
426 426 > from mercurial import registrar
427 427 > cmdtable = {}
428 428 > command = registrar.command(cmdtable)
429 429 >
430 430 > # "absolute" and "relative" shouldn't be imported before actual
431 431 > # command execution, because (1) they import same modules, and (2)
432 432 > # preceding import (= instantiate "demandmod" object instead of
433 433 > # real "module" object) might hide problem of succeeding import.
434 434 >
435 435 > @command(b'showabsolute', [], norepo=True)
436 436 > def showabsolute(ui, *args, **opts):
437 437 > from absextroot import absolute
438 438 > ui.write('ABS: %s\n' % '\nABS: '.join(absolute.getresult()))
439 439 >
440 440 > @command(b'showrelative', [], norepo=True)
441 441 > def showrelative(ui, *args, **opts):
442 442 > from . import relative
443 443 > ui.write('REL: %s\n' % '\nREL: '.join(relative.getresult()))
444 444 >
445 445 > # import modules from external library
446 446 > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused
447 447 > from extlibroot.lsub1.lsub2.called import func as lfunc
448 448 > from extlibroot.recursedown import absdetail, legacydetail
449 449 > from extlibroot.shadowing import proxied
450 450 >
451 451 > def uisetup(ui):
452 452 > result = []
453 453 > result.append(lused.detail)
454 454 > result.append(lfunc())
455 455 > result.append(absdetail)
456 456 > result.append(legacydetail)
457 457 > result.append(proxied.detail)
458 458 > ui.write('LIB: %s\n' % '\nLIB: '.join(result))
459 459 > EOF
460 460
461 461 Examine module importing.
462 462
463 463 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute)
464 464 LIB: this is extlibroot.lsub1.lsub2.used
465 465 LIB: this is extlibroot.lsub1.lsub2.called.func()
466 466 LIB: this is extlibroot.recursedown.abs.used
467 467 LIB: this is extlibroot.recursedown.legacy.used
468 468 LIB: this is extlibroot.shadowing.used
469 469 ABS: this is absextroot.xsub1.xsub2.used
470 470 ABS: this is absextroot.xsub1.xsub2.called.func()
471 471
472 472 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative)
473 473 LIB: this is extlibroot.lsub1.lsub2.used
474 474 LIB: this is extlibroot.lsub1.lsub2.called.func()
475 475 LIB: this is extlibroot.recursedown.abs.used
476 476 LIB: this is extlibroot.recursedown.legacy.used
477 477 LIB: this is extlibroot.shadowing.used
478 478 REL: this is absextroot.xsub1.xsub2.used
479 479 REL: this is absextroot.xsub1.xsub2.called.func()
480 480 REL: this relimporter imports 'this is absextroot.relimportee'
481 481
482 482 Examine whether sub-module is imported relatively as expected.
483 483
484 484 See also issue5208 for detail about example case on Python 3.x.
485 485
486 486 $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py
487 487 $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found
488 488
489 489 $ cat > $TESTTMP/notexist.py <<EOF
490 490 > text = 'notexist.py at root is loaded unintentionally\n'
491 491 > EOF
492 492
493 493 $ cat > $TESTTMP/checkrelativity.py <<EOF
494 494 > from mercurial import registrar
495 495 > cmdtable = {}
496 496 > command = registrar.command(cmdtable)
497 497 >
498 498 > # demand import avoids failure of importing notexist here
499 499 > import extlibroot.lsub1.lsub2.notexist
500 500 >
501 501 > @command(b'checkrelativity', [], norepo=True)
502 502 > def checkrelativity(ui, *args, **opts):
503 503 > try:
504 504 > ui.write(extlibroot.lsub1.lsub2.notexist.text)
505 505 > return 1 # unintentional success
506 506 > except ImportError:
507 507 > pass # intentional failure
508 508 > EOF
509 509
510 510 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity)
511 511
512 512 #endif
513 513
514 514 $ cd ..
515 515
516 516 hide outer repo
517 517 $ hg init
518 518
519 519 $ cat > empty.py <<EOF
520 520 > '''empty cmdtable
521 521 > '''
522 522 > cmdtable = {}
523 523 > EOF
524 524 $ emptypath=`pwd`/empty.py
525 525 $ echo "empty = $emptypath" >> $HGRCPATH
526 526 $ hg help empty
527 527 empty extension - empty cmdtable
528 528
529 529 no commands defined
530 530
531 531
532 532 $ echo 'empty = !' >> $HGRCPATH
533 533
534 534 $ cat > debugextension.py <<EOF
535 535 > '''only debugcommands
536 536 > '''
537 537 > from mercurial import registrar
538 538 > cmdtable = {}
539 539 > command = registrar.command(cmdtable)
540 540 > @command(b'debugfoobar', [], 'hg debugfoobar')
541 541 > def debugfoobar(ui, repo, *args, **opts):
542 542 > "yet another debug command"
543 543 > pass
544 544 > @command(b'foo', [], 'hg foo')
545 545 > def foo(ui, repo, *args, **opts):
546 546 > """yet another foo command
547 547 > This command has been DEPRECATED since forever.
548 548 > """
549 549 > pass
550 550 > EOF
551 551 $ debugpath=`pwd`/debugextension.py
552 552 $ echo "debugextension = $debugpath" >> $HGRCPATH
553 553
554 554 $ hg help debugextension
555 555 hg debugextensions
556 556
557 557 show information about active extensions
558 558
559 559 options:
560 560
561 561 (some details hidden, use --verbose to show complete help)
562 562
563 563
564 564 $ hg --verbose help debugextension
565 565 hg debugextensions
566 566
567 567 show information about active extensions
568 568
569 569 options:
570 570
571 571 -T --template TEMPLATE display with template (EXPERIMENTAL)
572 572
573 573 global options ([+] can be repeated):
574 574
575 575 -R --repository REPO repository root directory or name of overlay bundle
576 576 file
577 577 --cwd DIR change working directory
578 578 -y --noninteractive do not prompt, automatically pick the first choice for
579 579 all prompts
580 580 -q --quiet suppress output
581 581 -v --verbose enable additional output
582 582 --color TYPE when to colorize (boolean, always, auto, never, or
583 583 debug)
584 584 --config CONFIG [+] set/override config option (use 'section.name=value')
585 585 --debug enable debugging output
586 586 --debugger start debugger
587 587 --encoding ENCODE set the charset encoding (default: ascii)
588 588 --encodingmode MODE set the charset encoding mode (default: strict)
589 589 --traceback always print a traceback on exception
590 590 --time time how long the command takes
591 591 --profile print command execution profile
592 592 --version output version information and exit
593 593 -h --help display help and exit
594 594 --hidden consider hidden changesets
595 595 --pager TYPE when to paginate (boolean, always, auto, or never)
596 596 (default: auto)
597 597
598 598
599 599
600 600
601 601
602 602
603 603 $ hg --debug help debugextension
604 604 hg debugextensions
605 605
606 606 show information about active extensions
607 607
608 608 options:
609 609
610 610 -T --template TEMPLATE display with template (EXPERIMENTAL)
611 611
612 612 global options ([+] can be repeated):
613 613
614 614 -R --repository REPO repository root directory or name of overlay bundle
615 615 file
616 616 --cwd DIR change working directory
617 617 -y --noninteractive do not prompt, automatically pick the first choice for
618 618 all prompts
619 619 -q --quiet suppress output
620 620 -v --verbose enable additional output
621 621 --color TYPE when to colorize (boolean, always, auto, never, or
622 622 debug)
623 623 --config CONFIG [+] set/override config option (use 'section.name=value')
624 624 --debug enable debugging output
625 625 --debugger start debugger
626 626 --encoding ENCODE set the charset encoding (default: ascii)
627 627 --encodingmode MODE set the charset encoding mode (default: strict)
628 628 --traceback always print a traceback on exception
629 629 --time time how long the command takes
630 630 --profile print command execution profile
631 631 --version output version information and exit
632 632 -h --help display help and exit
633 633 --hidden consider hidden changesets
634 634 --pager TYPE when to paginate (boolean, always, auto, or never)
635 635 (default: auto)
636 636
637 637
638 638
639 639
640 640
641 641 $ echo 'debugextension = !' >> $HGRCPATH
642 642
643 643 Asking for help about a deprecated extension should do something useful:
644 644
645 645 $ hg help glog
646 646 'glog' is provided by the following extension:
647 647
648 648 graphlog command to view revision graphs from a shell (DEPRECATED)
649 649
650 650 (use 'hg help extensions' for information on enabling extensions)
651 651
652 652 Extension module help vs command help:
653 653
654 654 $ echo 'extdiff =' >> $HGRCPATH
655 655 $ hg help extdiff
656 656 hg extdiff [OPT]... [FILE]...
657 657
658 658 use external program to diff repository (or selected files)
659 659
660 660 Show differences between revisions for the specified files, using an
661 661 external program. The default program used is diff, with default options
662 662 "-Npru".
663 663
664 664 To select a different program, use the -p/--program option. The program
665 665 will be passed the names of two directories to compare. To pass additional
666 666 options to the program, use -o/--option. These will be passed before the
667 667 names of the directories to compare.
668 668
669 669 When two revision arguments are given, then changes are shown between
670 670 those revisions. If only one revision is specified then that revision is
671 671 compared to the working directory, and, when no revisions are specified,
672 672 the working directory files are compared to its parent.
673 673
674 674 (use 'hg help -e extdiff' to show help for the extdiff extension)
675 675
676 676 options ([+] can be repeated):
677 677
678 678 -p --program CMD comparison program to run
679 679 -o --option OPT [+] pass option to comparison program
680 680 -r --rev REV [+] revision
681 681 -c --change REV change made by revision
682 682 --patch compare patches for two revisions
683 683 -I --include PATTERN [+] include names matching the given patterns
684 684 -X --exclude PATTERN [+] exclude names matching the given patterns
685 685 -S --subrepos recurse into subrepositories
686 686
687 687 (some details hidden, use --verbose to show complete help)
688 688
689 689
690 690
691 691
692 692
693 693
694 694
695 695
696 696
697 697
698 698 $ hg help --extension extdiff
699 699 extdiff extension - command to allow external programs to compare revisions
700 700
701 701 The extdiff Mercurial extension allows you to use external programs to compare
702 702 revisions, or revision with working directory. The external diff programs are
703 703 called with a configurable set of options and two non-option arguments: paths
704 704 to directories containing snapshots of files to compare.
705 705
706 706 The extdiff extension also allows you to configure new diff commands, so you
707 707 do not need to type 'hg extdiff -p kdiff3' always.
708 708
709 709 [extdiff]
710 710 # add new command that runs GNU diff(1) in 'context diff' mode
711 711 cdiff = gdiff -Nprc5
712 712 ## or the old way:
713 713 #cmd.cdiff = gdiff
714 714 #opts.cdiff = -Nprc5
715 715
716 716 # add new command called meld, runs meld (no need to name twice). If
717 717 # the meld executable is not available, the meld tool in [merge-tools]
718 718 # will be used, if available
719 719 meld =
720 720
721 721 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
722 722 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
723 723 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
724 724 # your .vimrc
725 725 vimdiff = gvim -f "+next" \
726 726 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
727 727
728 728 Tool arguments can include variables that are expanded at runtime:
729 729
730 730 $parent1, $plabel1 - filename, descriptive label of first parent
731 731 $child, $clabel - filename, descriptive label of child revision
732 732 $parent2, $plabel2 - filename, descriptive label of second parent
733 733 $root - repository root
734 734 $parent is an alias for $parent1.
735 735
736 736 The extdiff extension will look in your [diff-tools] and [merge-tools]
737 737 sections for diff tool arguments, when none are specified in [extdiff].
738 738
739 739 [extdiff]
740 740 kdiff3 =
741 741
742 742 [diff-tools]
743 743 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
744 744
745 745 You can use -I/-X and list of file or directory names like normal 'hg diff'
746 746 command. The extdiff extension makes snapshots of only needed files, so
747 747 running the external diff program will actually be pretty fast (at least
748 748 faster than having to compare the entire tree).
749 749
750 750 list of commands:
751 751
752 752 extdiff use external program to diff repository (or selected files)
753 753
754 754 (use 'hg help -v -e extdiff' to show built-in aliases and global options)
755 755
756 756
757 757
758 758
759 759
760 760
761 761
762 762
763 763
764 764
765 765
766 766
767 767
768 768
769 769
770 770
771 771 $ echo 'extdiff = !' >> $HGRCPATH
772 772
773 773 Test help topic with same name as extension
774 774
775 775 $ cat > multirevs.py <<EOF
776 776 > from mercurial import commands, registrar
777 777 > cmdtable = {}
778 778 > command = registrar.command(cmdtable)
779 779 > """multirevs extension
780 780 > Big multi-line module docstring."""
781 781 > @command(b'multirevs', [], 'ARG', norepo=True)
782 782 > def multirevs(ui, repo, arg, *args, **opts):
783 783 > """multirevs command"""
784 784 > pass
785 785 > EOF
786 786 $ echo "multirevs = multirevs.py" >> $HGRCPATH
787 787
788 788 $ hg help multirevs | tail
789 789 bookmark (this works because the last revision of the revset is used):
790 790
791 791 hg update :@
792 792
793 793 - Show diff between tags 1.3 and 1.5 (this works because the first and the
794 794 last revisions of the revset are used):
795 795
796 796 hg diff -r 1.3::1.5
797 797
798 798 use 'hg help -c multirevs' to see help for the multirevs command
799 799
800 800
801 801
802 802
803 803
804 804
805 805 $ hg help -c multirevs
806 806 hg multirevs ARG
807 807
808 808 multirevs command
809 809
810 810 (some details hidden, use --verbose to show complete help)
811 811
812 812
813 813
814 814 $ hg multirevs
815 815 hg multirevs: invalid arguments
816 816 hg multirevs ARG
817 817
818 818 multirevs command
819 819
820 820 (use 'hg multirevs -h' to show more help)
821 821 [255]
822 822
823 823
824 824
825 825 $ echo "multirevs = !" >> $HGRCPATH
826 826
827 827 Issue811: Problem loading extensions twice (by site and by user)
828 828
829 829 $ cat <<EOF >> $HGRCPATH
830 830 > mq =
831 831 > strip =
832 832 > hgext.mq =
833 833 > hgext/mq =
834 834 > EOF
835 835
836 836 Show extensions:
837 837 (note that mq force load strip, also checking it's not loaded twice)
838 838
839 839 $ hg debugextensions
840 840 mq
841 841 strip
842 842
843 843 For extensions, which name matches one of its commands, help
844 844 message should ask '-v -e' to get list of built-in aliases
845 845 along with extension help itself
846 846
847 847 $ mkdir $TESTTMP/d
848 848 $ cat > $TESTTMP/d/dodo.py <<EOF
849 849 > """
850 850 > This is an awesome 'dodo' extension. It does nothing and
851 851 > writes 'Foo foo'
852 852 > """
853 853 > from mercurial import commands, registrar
854 854 > cmdtable = {}
855 855 > command = registrar.command(cmdtable)
856 856 > @command(b'dodo', [], 'hg dodo')
857 857 > def dodo(ui, *args, **kwargs):
858 858 > """Does nothing"""
859 859 > ui.write("I do nothing. Yay\\n")
860 860 > @command(b'foofoo', [], 'hg foofoo')
861 861 > def foofoo(ui, *args, **kwargs):
862 862 > """Writes 'Foo foo'"""
863 863 > ui.write("Foo foo\\n")
864 864 > EOF
865 865 $ dodopath=$TESTTMP/d/dodo.py
866 866
867 867 $ echo "dodo = $dodopath" >> $HGRCPATH
868 868
869 869 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
870 870 $ hg help -e dodo
871 871 dodo extension -
872 872
873 873 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
874 874
875 875 list of commands:
876 876
877 877 dodo Does nothing
878 878 foofoo Writes 'Foo foo'
879 879
880 880 (use 'hg help -v -e dodo' to show built-in aliases and global options)
881 881
882 882 Make sure that '-v -e' prints list of built-in aliases along with
883 883 extension help itself
884 884 $ hg help -v -e dodo
885 885 dodo extension -
886 886
887 887 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
888 888
889 889 list of commands:
890 890
891 891 dodo Does nothing
892 892 foofoo Writes 'Foo foo'
893 893
894 894 global options ([+] can be repeated):
895 895
896 896 -R --repository REPO repository root directory or name of overlay bundle
897 897 file
898 898 --cwd DIR change working directory
899 899 -y --noninteractive do not prompt, automatically pick the first choice for
900 900 all prompts
901 901 -q --quiet suppress output
902 902 -v --verbose enable additional output
903 903 --color TYPE when to colorize (boolean, always, auto, never, or
904 904 debug)
905 905 --config CONFIG [+] set/override config option (use 'section.name=value')
906 906 --debug enable debugging output
907 907 --debugger start debugger
908 908 --encoding ENCODE set the charset encoding (default: ascii)
909 909 --encodingmode MODE set the charset encoding mode (default: strict)
910 910 --traceback always print a traceback on exception
911 911 --time time how long the command takes
912 912 --profile print command execution profile
913 913 --version output version information and exit
914 914 -h --help display help and exit
915 915 --hidden consider hidden changesets
916 916 --pager TYPE when to paginate (boolean, always, auto, or never)
917 917 (default: auto)
918 918
919 919 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
920 920 $ hg help -v dodo
921 921 hg dodo
922 922
923 923 Does nothing
924 924
925 925 (use 'hg help -e dodo' to show help for the dodo extension)
926 926
927 927 options:
928 928
929 929 --mq operate on patch repository
930 930
931 931 global options ([+] can be repeated):
932 932
933 933 -R --repository REPO repository root directory or name of overlay bundle
934 934 file
935 935 --cwd DIR change working directory
936 936 -y --noninteractive do not prompt, automatically pick the first choice for
937 937 all prompts
938 938 -q --quiet suppress output
939 939 -v --verbose enable additional output
940 940 --color TYPE when to colorize (boolean, always, auto, never, or
941 941 debug)
942 942 --config CONFIG [+] set/override config option (use 'section.name=value')
943 943 --debug enable debugging output
944 944 --debugger start debugger
945 945 --encoding ENCODE set the charset encoding (default: ascii)
946 946 --encodingmode MODE set the charset encoding mode (default: strict)
947 947 --traceback always print a traceback on exception
948 948 --time time how long the command takes
949 949 --profile print command execution profile
950 950 --version output version information and exit
951 951 -h --help display help and exit
952 952 --hidden consider hidden changesets
953 953 --pager TYPE when to paginate (boolean, always, auto, or never)
954 954 (default: auto)
955 955
956 956 In case when extension name doesn't match any of its commands,
957 957 help message should ask for '-v' to get list of built-in aliases
958 958 along with extension help
959 959 $ cat > $TESTTMP/d/dudu.py <<EOF
960 960 > """
961 961 > This is an awesome 'dudu' extension. It does something and
962 962 > also writes 'Beep beep'
963 963 > """
964 964 > from mercurial import commands, registrar
965 965 > cmdtable = {}
966 966 > command = registrar.command(cmdtable)
967 967 > @command(b'something', [], 'hg something')
968 968 > def something(ui, *args, **kwargs):
969 969 > """Does something"""
970 970 > ui.write("I do something. Yaaay\\n")
971 971 > @command(b'beep', [], 'hg beep')
972 972 > def beep(ui, *args, **kwargs):
973 973 > """Writes 'Beep beep'"""
974 974 > ui.write("Beep beep\\n")
975 975 > EOF
976 976 $ dudupath=$TESTTMP/d/dudu.py
977 977
978 978 $ echo "dudu = $dudupath" >> $HGRCPATH
979 979
980 980 $ hg help -e dudu
981 981 dudu extension -
982 982
983 983 This is an awesome 'dudu' extension. It does something and also writes 'Beep
984 984 beep'
985 985
986 986 list of commands:
987 987
988 988 beep Writes 'Beep beep'
989 989 something Does something
990 990
991 991 (use 'hg help -v dudu' to show built-in aliases and global options)
992 992
993 993 In case when extension name doesn't match any of its commands,
994 994 help options '-v' and '-v -e' should be equivalent
995 995 $ hg help -v dudu
996 996 dudu extension -
997 997
998 998 This is an awesome 'dudu' extension. It does something and also writes 'Beep
999 999 beep'
1000 1000
1001 1001 list of commands:
1002 1002
1003 1003 beep Writes 'Beep beep'
1004 1004 something Does something
1005 1005
1006 1006 global options ([+] can be repeated):
1007 1007
1008 1008 -R --repository REPO repository root directory or name of overlay bundle
1009 1009 file
1010 1010 --cwd DIR change working directory
1011 1011 -y --noninteractive do not prompt, automatically pick the first choice for
1012 1012 all prompts
1013 1013 -q --quiet suppress output
1014 1014 -v --verbose enable additional output
1015 1015 --color TYPE when to colorize (boolean, always, auto, never, or
1016 1016 debug)
1017 1017 --config CONFIG [+] set/override config option (use 'section.name=value')
1018 1018 --debug enable debugging output
1019 1019 --debugger start debugger
1020 1020 --encoding ENCODE set the charset encoding (default: ascii)
1021 1021 --encodingmode MODE set the charset encoding mode (default: strict)
1022 1022 --traceback always print a traceback on exception
1023 1023 --time time how long the command takes
1024 1024 --profile print command execution profile
1025 1025 --version output version information and exit
1026 1026 -h --help display help and exit
1027 1027 --hidden consider hidden changesets
1028 1028 --pager TYPE when to paginate (boolean, always, auto, or never)
1029 1029 (default: auto)
1030 1030
1031 1031 $ hg help -v -e dudu
1032 1032 dudu extension -
1033 1033
1034 1034 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1035 1035 beep'
1036 1036
1037 1037 list of commands:
1038 1038
1039 1039 beep Writes 'Beep beep'
1040 1040 something Does something
1041 1041
1042 1042 global options ([+] can be repeated):
1043 1043
1044 1044 -R --repository REPO repository root directory or name of overlay bundle
1045 1045 file
1046 1046 --cwd DIR change working directory
1047 1047 -y --noninteractive do not prompt, automatically pick the first choice for
1048 1048 all prompts
1049 1049 -q --quiet suppress output
1050 1050 -v --verbose enable additional output
1051 1051 --color TYPE when to colorize (boolean, always, auto, never, or
1052 1052 debug)
1053 1053 --config CONFIG [+] set/override config option (use 'section.name=value')
1054 1054 --debug enable debugging output
1055 1055 --debugger start debugger
1056 1056 --encoding ENCODE set the charset encoding (default: ascii)
1057 1057 --encodingmode MODE set the charset encoding mode (default: strict)
1058 1058 --traceback always print a traceback on exception
1059 1059 --time time how long the command takes
1060 1060 --profile print command execution profile
1061 1061 --version output version information and exit
1062 1062 -h --help display help and exit
1063 1063 --hidden consider hidden changesets
1064 1064 --pager TYPE when to paginate (boolean, always, auto, or never)
1065 1065 (default: auto)
1066 1066
1067 1067 Disabled extension commands:
1068 1068
1069 1069 $ ORGHGRCPATH=$HGRCPATH
1070 1070 $ HGRCPATH=
1071 1071 $ export HGRCPATH
1072 1072 $ hg help email
1073 1073 'email' is provided by the following extension:
1074 1074
1075 1075 patchbomb command to send changesets as (a series of) patch emails
1076 1076
1077 1077 (use 'hg help extensions' for information on enabling extensions)
1078 1078
1079 1079
1080 1080 $ hg qdel
1081 1081 hg: unknown command 'qdel'
1082 1082 'qdelete' is provided by the following extension:
1083 1083
1084 1084 mq manage a stack of patches
1085 1085
1086 1086 (use 'hg help extensions' for information on enabling extensions)
1087 1087 [255]
1088 1088
1089 1089
1090 1090 $ hg churn
1091 1091 hg: unknown command 'churn'
1092 1092 'churn' is provided by the following extension:
1093 1093
1094 1094 churn command to display statistics about repository history
1095 1095
1096 1096 (use 'hg help extensions' for information on enabling extensions)
1097 1097 [255]
1098 1098
1099 1099
1100 1100
1101 1101 Disabled extensions:
1102 1102
1103 1103 $ hg help churn
1104 1104 churn extension - command to display statistics about repository history
1105 1105
1106 1106 (use 'hg help extensions' for information on enabling extensions)
1107 1107
1108 1108 $ hg help patchbomb
1109 1109 patchbomb extension - command to send changesets as (a series of) patch emails
1110 1110
1111 1111 The series is started off with a "[PATCH 0 of N]" introduction, which
1112 1112 describes the series as a whole.
1113 1113
1114 1114 Each patch email has a Subject line of "[PATCH M of N] ...", using the first
1115 1115 line of the changeset description as the subject text. The message contains
1116 1116 two or three body parts:
1117 1117
1118 1118 - The changeset description.
1119 1119 - [Optional] The result of running diffstat on the patch.
1120 1120 - The patch itself, as generated by 'hg export'.
1121 1121
1122 1122 Each message refers to the first in the series using the In-Reply-To and
1123 1123 References headers, so they will show up as a sequence in threaded mail and
1124 1124 news readers, and in mail archives.
1125 1125
1126 1126 To configure other defaults, add a section like this to your configuration
1127 1127 file:
1128 1128
1129 1129 [email]
1130 1130 from = My Name <my@email>
1131 1131 to = recipient1, recipient2, ...
1132 1132 cc = cc1, cc2, ...
1133 1133 bcc = bcc1, bcc2, ...
1134 1134 reply-to = address1, address2, ...
1135 1135
1136 1136 Use "[patchbomb]" as configuration section name if you need to override global
1137 1137 "[email]" address settings.
1138 1138
1139 1139 Then you can use the 'hg email' command to mail a series of changesets as a
1140 1140 patchbomb.
1141 1141
1142 1142 You can also either configure the method option in the email section to be a
1143 1143 sendmail compatible mailer or fill out the [smtp] section so that the
1144 1144 patchbomb extension can automatically send patchbombs directly from the
1145 1145 commandline. See the [email] and [smtp] sections in hgrc(5) for details.
1146 1146
1147 1147 By default, 'hg email' will prompt for a "To" or "CC" header if you do not
1148 1148 supply one via configuration or the command line. You can override this to
1149 1149 never prompt by configuring an empty value:
1150 1150
1151 1151 [email]
1152 1152 cc =
1153 1153
1154 1154 You can control the default inclusion of an introduction message with the
1155 1155 "patchbomb.intro" configuration option. The configuration is always
1156 1156 overwritten by command line flags like --intro and --desc:
1157 1157
1158 1158 [patchbomb]
1159 1159 intro=auto # include introduction message if more than 1 patch (default)
1160 1160 intro=never # never include an introduction message
1161 1161 intro=always # always include an introduction message
1162 1162
1163 1163 You can specify a template for flags to be added in subject prefixes. Flags
1164 1164 specified by --flag option are exported as "{flags}" keyword:
1165 1165
1166 1166 [patchbomb]
1167 1167 flagtemplate = "{separate(' ',
1168 1168 ifeq(branch, 'default', '', branch|upper),
1169 1169 flags)}"
1170 1170
1171 1171 You can set patchbomb to always ask for confirmation by setting
1172 1172 "patchbomb.confirm" to true.
1173 1173
1174 1174 (use 'hg help extensions' for information on enabling extensions)
1175 1175
1176 1176
1177 1177 Broken disabled extension and command:
1178 1178
1179 1179 $ mkdir hgext
1180 1180 $ echo > hgext/__init__.py
1181 1181 $ cat > hgext/broken.py <<EOF
1182 1182 > "broken extension'
1183 1183 > EOF
1184 1184 $ cat > path.py <<EOF
1185 1185 > import os, sys
1186 1186 > sys.path.insert(0, os.environ['HGEXTPATH'])
1187 1187 > EOF
1188 1188 $ HGEXTPATH=`pwd`
1189 1189 $ export HGEXTPATH
1190 1190
1191 1191 $ hg --config extensions.path=./path.py help broken
1192 1192 broken extension - (no help text available)
1193 1193
1194 1194 (use 'hg help extensions' for information on enabling extensions)
1195 1195
1196 1196
1197 1197 $ cat > hgext/forest.py <<EOF
1198 1198 > cmdtable = None
1199 1199 > EOF
1200 1200 $ hg --config extensions.path=./path.py help foo > /dev/null
1201 1201 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
1202 1202 abort: no such help topic: foo
1203 1203 (try 'hg help --keyword foo')
1204 1204 [255]
1205 1205
1206 1206 $ cat > throw.py <<EOF
1207 1207 > from mercurial import commands, registrar, util
1208 1208 > cmdtable = {}
1209 1209 > command = registrar.command(cmdtable)
1210 1210 > class Bogon(Exception): pass
1211 1211 > @command(b'throw', [], 'hg throw', norepo=True)
1212 1212 > def throw(ui, **opts):
1213 1213 > """throws an exception"""
1214 1214 > raise Bogon()
1215 1215 > EOF
1216 1216
1217 1217 No declared supported version, extension complains:
1218 1218 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1219 1219 ** Unknown exception encountered with possibly-broken third-party extension throw
1220 1220 ** which supports versions unknown of Mercurial.
1221 1221 ** Please disable throw and try your action again.
1222 1222 ** If that fixes the bug please report it to the extension author.
1223 1223 ** Python * (glob)
1224 1224 ** Mercurial Distributed SCM * (glob)
1225 1225 ** Extensions loaded: throw
1226 1226
1227 1227 empty declaration of supported version, extension complains:
1228 1228 $ echo "testedwith = ''" >> throw.py
1229 1229 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1230 1230 ** Unknown exception encountered with possibly-broken third-party extension throw
1231 1231 ** which supports versions unknown of Mercurial.
1232 1232 ** Please disable throw and try your action again.
1233 1233 ** If that fixes the bug please report it to the extension author.
1234 1234 ** Python * (glob)
1235 1235 ** Mercurial Distributed SCM (*) (glob)
1236 1236 ** Extensions loaded: throw
1237 1237
1238 1238 If the extension specifies a buglink, show that:
1239 1239 $ echo 'buglink = "http://example.com/bts"' >> throw.py
1240 1240 $ rm -f throw.pyc throw.pyo
1241 1241 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1242 1242 ** Unknown exception encountered with possibly-broken third-party extension throw
1243 1243 ** which supports versions unknown of Mercurial.
1244 1244 ** Please disable throw and try your action again.
1245 1245 ** If that fixes the bug please report it to http://example.com/bts
1246 1246 ** Python * (glob)
1247 1247 ** Mercurial Distributed SCM (*) (glob)
1248 1248 ** Extensions loaded: throw
1249 1249
1250 1250 If the extensions declare outdated versions, accuse the older extension first:
1251 1251 $ echo "from mercurial import util" >> older.py
1252 1252 $ echo "util.version = lambda:'2.2'" >> older.py
1253 1253 $ echo "testedwith = '1.9.3'" >> older.py
1254 1254 $ echo "testedwith = '2.1.1'" >> throw.py
1255 1255 $ rm -f throw.pyc throw.pyo
1256 1256 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1257 1257 > throw 2>&1 | egrep '^\*\*'
1258 1258 ** Unknown exception encountered with possibly-broken third-party extension older
1259 1259 ** which supports versions 1.9 of Mercurial.
1260 1260 ** Please disable older and try your action again.
1261 1261 ** If that fixes the bug please report it to the extension author.
1262 1262 ** Python * (glob)
1263 1263 ** Mercurial Distributed SCM (version 2.2)
1264 1264 ** Extensions loaded: throw, older
1265 1265
1266 1266 One extension only tested with older, one only with newer versions:
1267 1267 $ echo "util.version = lambda:'2.1'" >> older.py
1268 1268 $ rm -f older.pyc older.pyo
1269 1269 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1270 1270 > throw 2>&1 | egrep '^\*\*'
1271 1271 ** Unknown exception encountered with possibly-broken third-party extension older
1272 1272 ** which supports versions 1.9 of Mercurial.
1273 1273 ** Please disable older and try your action again.
1274 1274 ** If that fixes the bug please report it to the extension author.
1275 1275 ** Python * (glob)
1276 1276 ** Mercurial Distributed SCM (version 2.1)
1277 1277 ** Extensions loaded: throw, older
1278 1278
1279 1279 Older extension is tested with current version, the other only with newer:
1280 1280 $ echo "util.version = lambda:'1.9.3'" >> older.py
1281 1281 $ rm -f older.pyc older.pyo
1282 1282 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1283 1283 > throw 2>&1 | egrep '^\*\*'
1284 1284 ** Unknown exception encountered with possibly-broken third-party extension throw
1285 1285 ** which supports versions 2.1 of Mercurial.
1286 1286 ** Please disable throw and try your action again.
1287 1287 ** If that fixes the bug please report it to http://example.com/bts
1288 1288 ** Python * (glob)
1289 1289 ** Mercurial Distributed SCM (version 1.9.3)
1290 1290 ** Extensions loaded: throw, older
1291 1291
1292 1292 Ability to point to a different point
1293 1293 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1294 1294 > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*'
1295 1295 ** unknown exception encountered, please report by visiting
1296 1296 ** Your Local Goat Lenders
1297 1297 ** Python * (glob)
1298 1298 ** Mercurial Distributed SCM (*) (glob)
1299 1299 ** Extensions loaded: throw, older
1300 1300
1301 1301 Declare the version as supporting this hg version, show regular bts link:
1302 1302 $ hgver=`hg debuginstall -T '{hgver}'`
1303 1303 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
1304 1304 $ if [ -z "$hgver" ]; then
1305 1305 > echo "unable to fetch a mercurial version. Make sure __version__ is correct";
1306 1306 > fi
1307 1307 $ rm -f throw.pyc throw.pyo
1308 1308 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1309 1309 ** unknown exception encountered, please report by visiting
1310 1310 ** https://mercurial-scm.org/wiki/BugTracker
1311 1311 ** Python * (glob)
1312 1312 ** Mercurial Distributed SCM (*) (glob)
1313 1313 ** Extensions loaded: throw
1314 1314
1315 1315 Patch version is ignored during compatibility check
1316 1316 $ echo "testedwith = '3.2'" >> throw.py
1317 1317 $ echo "util.version = lambda:'3.2.2'" >> throw.py
1318 1318 $ rm -f throw.pyc throw.pyo
1319 1319 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1320 1320 ** unknown exception encountered, please report by visiting
1321 1321 ** https://mercurial-scm.org/wiki/BugTracker
1322 1322 ** Python * (glob)
1323 1323 ** Mercurial Distributed SCM (*) (glob)
1324 1324 ** Extensions loaded: throw
1325 1325
1326 1326 Test version number support in 'hg version':
1327 1327 $ echo '__version__ = (1, 2, 3)' >> throw.py
1328 1328 $ rm -f throw.pyc throw.pyo
1329 1329 $ hg version -v
1330 1330 Mercurial Distributed SCM (version *) (glob)
1331 1331 (see https://mercurial-scm.org for more information)
1332 1332
1333 1333 Copyright (C) 2005-* Matt Mackall and others (glob)
1334 1334 This is free software; see the source for copying conditions. There is NO
1335 1335 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1336 1336
1337 1337 Enabled extensions:
1338 1338
1339 1339
1340 1340 $ hg version -v --config extensions.throw=throw.py
1341 1341 Mercurial Distributed SCM (version *) (glob)
1342 1342 (see https://mercurial-scm.org for more information)
1343 1343
1344 1344 Copyright (C) 2005-* Matt Mackall and others (glob)
1345 1345 This is free software; see the source for copying conditions. There is NO
1346 1346 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1347 1347
1348 1348 Enabled extensions:
1349 1349
1350 1350 throw external 1.2.3
1351 1351 $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
1352 1352 $ rm -f throw.pyc throw.pyo
1353 1353 $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
1354 1354 Mercurial Distributed SCM (version *) (glob)
1355 1355 (see https://mercurial-scm.org for more information)
1356 1356
1357 1357 Copyright (C) 2005-* Matt Mackall and others (glob)
1358 1358 This is free software; see the source for copying conditions. There is NO
1359 1359 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1360 1360
1361 1361 Enabled extensions:
1362 1362
1363 1363 throw external 1.twentythree
1364 1364 strip internal
1365 1365
1366 1366 $ hg version -q --config extensions.throw=throw.py
1367 1367 Mercurial Distributed SCM (version *) (glob)
1368 1368
1369 1369 Test JSON output of version:
1370 1370
1371 1371 $ hg version -Tjson
1372 1372 [
1373 1373 {
1374 1374 "extensions": [],
1375 1375 "ver": "*" (glob)
1376 1376 }
1377 1377 ]
1378 1378
1379 1379 $ hg version --config extensions.throw=throw.py -Tjson
1380 1380 [
1381 1381 {
1382 1382 "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}],
1383 1383 "ver": "3.2.2"
1384 1384 }
1385 1385 ]
1386 1386
1387 1387 $ hg version --config extensions.strip= -Tjson
1388 1388 [
1389 1389 {
1390 1390 "extensions": [{"bundled": true, "name": "strip", "ver": null}],
1391 1391 "ver": "*" (glob)
1392 1392 }
1393 1393 ]
1394 1394
1395 1395 Test template output of version:
1396 1396
1397 1397 $ hg version --config extensions.throw=throw.py --config extensions.strip= \
1398 1398 > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}'
1399 1399 throw 1.twentythree (external)
1400 1400 strip (internal)
1401 1401
1402 1402 Refuse to load extensions with minimum version requirements
1403 1403
1404 1404 $ cat > minversion1.py << EOF
1405 1405 > from mercurial import util
1406 1406 > util.version = lambda: '3.5.2'
1407 1407 > minimumhgversion = '3.6'
1408 1408 > EOF
1409 1409 $ hg --config extensions.minversion=minversion1.py version
1410 1410 (third party extension minversion requires version 3.6 or newer of Mercurial; disabling)
1411 1411 Mercurial Distributed SCM (version 3.5.2)
1412 1412 (see https://mercurial-scm.org for more information)
1413 1413
1414 1414 Copyright (C) 2005-* Matt Mackall and others (glob)
1415 1415 This is free software; see the source for copying conditions. There is NO
1416 1416 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1417 1417
1418 1418 $ cat > minversion2.py << EOF
1419 1419 > from mercurial import util
1420 1420 > util.version = lambda: '3.6'
1421 1421 > minimumhgversion = '3.7'
1422 1422 > EOF
1423 1423 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1424 1424 (third party extension minversion requires version 3.7 or newer of Mercurial; disabling)
1425 1425
1426 1426 Can load version that is only off by point release
1427 1427
1428 1428 $ cat > minversion2.py << EOF
1429 1429 > from mercurial import util
1430 1430 > util.version = lambda: '3.6.1'
1431 1431 > minimumhgversion = '3.6'
1432 1432 > EOF
1433 1433 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1434 1434 [1]
1435 1435
1436 1436 Can load minimum version identical to current
1437 1437
1438 1438 $ cat > minversion3.py << EOF
1439 1439 > from mercurial import util
1440 1440 > util.version = lambda: '3.5'
1441 1441 > minimumhgversion = '3.5'
1442 1442 > EOF
1443 1443 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1444 1444 [1]
1445 1445
1446 1446 Restore HGRCPATH
1447 1447
1448 1448 $ HGRCPATH=$ORGHGRCPATH
1449 1449 $ export HGRCPATH
1450 1450
1451 1451 Commands handling multiple repositories at a time should invoke only
1452 1452 "reposetup()" of extensions enabling in the target repository.
1453 1453
1454 1454 $ mkdir reposetup-test
1455 1455 $ cd reposetup-test
1456 1456
1457 1457 $ cat > $TESTTMP/reposetuptest.py <<EOF
1458 1458 > from mercurial import extensions
1459 1459 > def reposetup(ui, repo):
1460 1460 > ui.write('reposetup() for %s\n' % (repo.root))
1461 1461 > ui.flush()
1462 1462 > EOF
1463 1463 $ hg init src
1464 1464 $ echo a > src/a
1465 1465 $ hg -R src commit -Am '#0 at src/a'
1466 1466 adding a
1467 1467 $ echo '[extensions]' >> src/.hg/hgrc
1468 1468 $ echo '# enable extension locally' >> src/.hg/hgrc
1469 1469 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
1470 1470 $ hg -R src status
1471 1471 reposetup() for $TESTTMP/reposetup-test/src (glob)
1472 1472
1473 1473 $ hg clone -U src clone-dst1
1474 1474 reposetup() for $TESTTMP/reposetup-test/src (glob)
1475 1475 $ hg init push-dst1
1476 1476 $ hg -q -R src push push-dst1
1477 1477 reposetup() for $TESTTMP/reposetup-test/src (glob)
1478 1478 $ hg init pull-src1
1479 1479 $ hg -q -R pull-src1 pull src
1480 1480 reposetup() for $TESTTMP/reposetup-test/src (glob)
1481 1481
1482 1482 $ cat <<EOF >> $HGRCPATH
1483 1483 > [extensions]
1484 1484 > # disable extension globally and explicitly
1485 1485 > reposetuptest = !
1486 1486 > EOF
1487 1487 $ hg clone -U src clone-dst2
1488 1488 reposetup() for $TESTTMP/reposetup-test/src (glob)
1489 1489 $ hg init push-dst2
1490 1490 $ hg -q -R src push push-dst2
1491 1491 reposetup() for $TESTTMP/reposetup-test/src (glob)
1492 1492 $ hg init pull-src2
1493 1493 $ hg -q -R pull-src2 pull src
1494 1494 reposetup() for $TESTTMP/reposetup-test/src (glob)
1495 1495
1496 1496 $ cat <<EOF >> $HGRCPATH
1497 1497 > [extensions]
1498 1498 > # enable extension globally
1499 1499 > reposetuptest = $TESTTMP/reposetuptest.py
1500 1500 > EOF
1501 1501 $ hg clone -U src clone-dst3
1502 1502 reposetup() for $TESTTMP/reposetup-test/src (glob)
1503 1503 reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
1504 1504 $ hg init push-dst3
1505 1505 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
1506 1506 $ hg -q -R src push push-dst3
1507 1507 reposetup() for $TESTTMP/reposetup-test/src (glob)
1508 1508 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
1509 1509 $ hg init pull-src3
1510 1510 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
1511 1511 $ hg -q -R pull-src3 pull src
1512 1512 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
1513 1513 reposetup() for $TESTTMP/reposetup-test/src (glob)
1514 1514
1515 1515 $ echo '[extensions]' >> src/.hg/hgrc
1516 1516 $ echo '# disable extension locally' >> src/.hg/hgrc
1517 1517 $ echo 'reposetuptest = !' >> src/.hg/hgrc
1518 1518 $ hg clone -U src clone-dst4
1519 1519 reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
1520 1520 $ hg init push-dst4
1521 1521 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
1522 1522 $ hg -q -R src push push-dst4
1523 1523 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
1524 1524 $ hg init pull-src4
1525 1525 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
1526 1526 $ hg -q -R pull-src4 pull src
1527 1527 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
1528 1528
1529 1529 disabling in command line overlays with all configuration
1530 1530 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
1531 1531 $ hg --config extensions.reposetuptest=! init push-dst5
1532 1532 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
1533 1533 $ hg --config extensions.reposetuptest=! init pull-src5
1534 1534 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
1535 1535
1536 1536 $ cat <<EOF >> $HGRCPATH
1537 1537 > [extensions]
1538 1538 > # disable extension globally and explicitly
1539 1539 > reposetuptest = !
1540 1540 > EOF
1541 1541 $ hg init parent
1542 1542 $ hg init parent/sub1
1543 1543 $ echo 1 > parent/sub1/1
1544 1544 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
1545 1545 adding 1
1546 1546 $ hg init parent/sub2
1547 1547 $ hg init parent/sub2/sub21
1548 1548 $ echo 21 > parent/sub2/sub21/21
1549 1549 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
1550 1550 adding 21
1551 1551 $ cat > parent/sub2/.hgsub <<EOF
1552 1552 > sub21 = sub21
1553 1553 > EOF
1554 1554 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
1555 1555 adding .hgsub
1556 1556 $ hg init parent/sub3
1557 1557 $ echo 3 > parent/sub3/3
1558 1558 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
1559 1559 adding 3
1560 1560 $ cat > parent/.hgsub <<EOF
1561 1561 > sub1 = sub1
1562 1562 > sub2 = sub2
1563 1563 > sub3 = sub3
1564 1564 > EOF
1565 1565 $ hg -R parent commit -Am '#0 at parent'
1566 1566 adding .hgsub
1567 1567 $ echo '[extensions]' >> parent/.hg/hgrc
1568 1568 $ echo '# enable extension locally' >> parent/.hg/hgrc
1569 1569 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
1570 1570 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
1571 1571 $ hg -R parent status -S -A
1572 1572 reposetup() for $TESTTMP/reposetup-test/parent (glob)
1573 1573 reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
1574 1574 C .hgsub
1575 1575 C .hgsubstate
1576 1576 C sub1/1
1577 1577 C sub2/.hgsub
1578 1578 C sub2/.hgsubstate
1579 1579 C sub2/sub21/21
1580 1580 C sub3/3
1581 1581
1582 1582 $ cd ..
1583 1583
1584 1584 Prohibit registration of commands that don't use @command (issue5137)
1585 1585
1586 1586 $ hg init deprecated
1587 1587 $ cd deprecated
1588 1588
1589 1589 $ cat <<EOF > deprecatedcmd.py
1590 1590 > def deprecatedcmd(repo, ui):
1591 1591 > pass
1592 1592 > cmdtable = {
1593 1593 > 'deprecatedcmd': (deprecatedcmd, [], ''),
1594 1594 > }
1595 1595 > EOF
1596 1596 $ cat <<EOF > .hg/hgrc
1597 1597 > [extensions]
1598 1598 > deprecatedcmd = `pwd`/deprecatedcmd.py
1599 1599 > mq = !
1600 1600 > hgext.mq = !
1601 1601 > hgext/mq = !
1602 1602 > EOF
1603 1603
1604 1604 $ hg deprecatedcmd > /dev/null
1605 1605 *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1606 1606 *** (use @command decorator to register 'deprecatedcmd')
1607 1607 hg: unknown command 'deprecatedcmd'
1608 1608 [255]
1609 1609
1610 1610 the extension shouldn't be loaded at all so the mq works:
1611 1611
1612 1612 $ hg qseries --config extensions.mq= > /dev/null
1613 1613 *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1614 1614 *** (use @command decorator to register 'deprecatedcmd')
1615 1615
1616 1616 $ cd ..
1617 1617
1618 1618 Test synopsis and docstring extending
1619 1619
1620 1620 $ hg init exthelp
1621 1621 $ cat > exthelp.py <<EOF
1622 1622 > from mercurial import commands, extensions
1623 1623 > def exbookmarks(orig, *args, **opts):
1624 1624 > return orig(*args, **opts)
1625 1625 > def uisetup(ui):
1626 1626 > synopsis = ' GREPME [--foo] [-x]'
1627 1627 > docstring = '''
1628 1628 > GREPME make sure that this is in the help!
1629 1629 > '''
1630 1630 > extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
1631 1631 > synopsis, docstring)
1632 1632 > EOF
1633 1633 $ abspath=`pwd`/exthelp.py
1634 1634 $ echo '[extensions]' >> $HGRCPATH
1635 1635 $ echo "exthelp = $abspath" >> $HGRCPATH
1636 1636 $ cd exthelp
1637 1637 $ hg help bookmarks | grep GREPME
1638 1638 hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x]
1639 1639 GREPME make sure that this is in the help!
1640 1640 $ cd ..
1641 1641
1642 1642 Show deprecation warning for the use of cmdutil.command
1643 1643
1644 1644 $ cat > nonregistrar.py <<EOF
1645 1645 > from mercurial import cmdutil
1646 1646 > cmdtable = {}
1647 1647 > command = cmdutil.command(cmdtable)
1648 1648 > @command(b'foo', [], norepo=True)
1649 1649 > def foo(ui):
1650 1650 > pass
1651 1651 > EOF
1652 1652
1653 1653 $ hg --config extensions.nonregistrar=`pwd`/nonregistrar.py version > /dev/null
1654 1654 devel-warn: cmdutil.command is deprecated, use registrar.command to register 'foo'
1655 1655 (compatibility will be dropped after Mercurial-4.6, update your code.) * (glob)
1656 1656
1657 1657 Make sure a broken uisetup doesn't globally break hg:
1658 1658 $ cat > $TESTTMP/baduisetup.py <<EOF
1659 1659 > from mercurial import (
1660 1660 > bdiff,
1661 1661 > extensions,
1662 1662 > )
1663 1663 >
1664 1664 > def blockswrapper(orig, *args, **kwargs):
1665 1665 > return orig(*args, **kwargs)
1666 1666 >
1667 1667 > def uisetup(ui):
1668 1668 > extensions.wrapfunction(bdiff, 'blocks', blockswrapper)
1669 1669 > EOF
1670 1670 $ cat >> $HGRCPATH <<EOF
1671 1671 > [extensions]
1672 1672 > baduisetup = $TESTTMP/baduisetup.py
1673 1673 > EOF
1674 1674
1675 1675 Even though the extension fails during uisetup, hg is still basically usable:
1676 1676 $ hg version
1677 1677 *** failed to set up extension baduisetup: No module named bdiff
1678 1678 Mercurial Distributed SCM (version *) (glob)
1679 1679 (see https://mercurial-scm.org for more information)
1680 1680
1681 1681 Copyright (C) 2005-2017 Matt Mackall and others
1682 1682 This is free software; see the source for copying conditions. There is NO
1683 1683 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1684 1684
1685 1685 $ hg version --traceback
1686 1686 Traceback (most recent call last):
1687 1687 File "*/mercurial/extensions.py", line *, in _runuisetup (glob)
1688 1688 uisetup(ui)
1689 1689 File "$TESTTMP/baduisetup.py", line 10, in uisetup
1690 1690 extensions.wrapfunction(bdiff, 'blocks', blockswrapper)
1691 1691 File "*/mercurial/extensions.py", line *, in wrapfunction (glob)
1692 1692 origfn = getattr(container, funcname)
1693 1693 File "*/hgdemandimport/demandimportpy2.py", line *, in __getattr__ (glob)
1694 1694 self._load()
1695 1695 File "*/hgdemandimport/demandimportpy2.py", line *, in _load (glob)
1696 1696 mod = _hgextimport(_origimport, head, globals, locals, None, level)
1697 1697 File "*/hgdemandimport/demandimportpy2.py", line *, in _hgextimport (glob)
1698 1698 return importfunc(name, globals, *args, **kwargs)
1699 1699 ImportError: No module named bdiff
1700 1700 *** failed to set up extension baduisetup: No module named bdiff
1701 1701 Mercurial Distributed SCM (version *) (glob)
1702 1702 (see https://mercurial-scm.org for more information)
1703 1703
1704 1704 Copyright (C) 2005-2017 Matt Mackall and others
1705 1705 This is free software; see the source for copying conditions. There is NO
1706 1706 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -1,144 +1,145 b''
1 1 This test makes sure that we don't mark a file as merged with its ancestor
2 2 when we do a merge.
3 3
4 4 $ cat <<EOF > merge
5 > from __future__ import print_function
5 6 > import sys, os
6 > print "merging for", os.path.basename(sys.argv[1])
7 > print("merging for", os.path.basename(sys.argv[1]))
7 8 > EOF
8 9 $ HGMERGE="$PYTHON ../merge"; export HGMERGE
9 10
10 11 Creating base:
11 12
12 13 $ hg init a
13 14 $ cd a
14 15 $ echo 1 > foo
15 16 $ echo 1 > bar
16 17 $ echo 1 > baz
17 18 $ echo 1 > quux
18 19 $ hg add foo bar baz quux
19 20 $ hg commit -m "base"
20 21
21 22 $ cd ..
22 23 $ hg clone a b
23 24 updating to branch default
24 25 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 26
26 27 Creating branch a:
27 28
28 29 $ cd a
29 30 $ echo 2a > foo
30 31 $ echo 2a > bar
31 32 $ hg commit -m "branch a"
32 33
33 34 Creating branch b:
34 35
35 36 $ cd ..
36 37 $ cd b
37 38 $ echo 2b > foo
38 39 $ echo 2b > baz
39 40 $ hg commit -m "branch b"
40 41
41 42 We shouldn't have anything but n state here:
42 43
43 44 $ hg debugstate --nodates | grep -v "^n"
44 45 [1]
45 46
46 47 Merging:
47 48
48 49 $ hg pull ../a
49 50 pulling from ../a
50 51 searching for changes
51 52 adding changesets
52 53 adding manifests
53 54 adding file changes
54 55 added 1 changesets with 2 changes to 2 files (+1 heads)
55 56 (run 'hg heads' to see heads, 'hg merge' to merge)
56 57
57 58 $ hg merge -v
58 59 resolving manifests
59 60 getting bar
60 61 merging foo
61 62 merging for foo
62 63 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
63 64 (branch merge, don't forget to commit)
64 65
65 66 $ echo 2m > foo
66 67 $ echo 2b > baz
67 68 $ echo new > quux
68 69
69 70 $ hg ci -m "merge"
70 71
71 72 main: we should have a merge here:
72 73
73 74 $ hg debugindex --changelog
74 75 rev offset length ..... linkrev nodeid p1 p2 (re)
75 76 0 0 73 ..... 0 cdca01651b96 000000000000 000000000000 (re)
76 77 1 73 68 ..... 1 f6718a9cb7f3 cdca01651b96 000000000000 (re)
77 78 2 141 68 ..... 2 bdd988058d16 cdca01651b96 000000000000 (re)
78 79 3 209 66 ..... 3 d8a521142a3c f6718a9cb7f3 bdd988058d16 (re)
79 80
80 81 log should show foo and quux changed:
81 82
82 83 $ hg log -v -r tip
83 84 changeset: 3:d8a521142a3c
84 85 tag: tip
85 86 parent: 1:f6718a9cb7f3
86 87 parent: 2:bdd988058d16
87 88 user: test
88 89 date: Thu Jan 01 00:00:00 1970 +0000
89 90 files: foo quux
90 91 description:
91 92 merge
92 93
93 94
94 95
95 96 foo: we should have a merge here:
96 97
97 98 $ hg debugindex foo
98 99 rev offset length ..... linkrev nodeid p1 p2 (re)
99 100 0 0 3 ..... 0 b8e02f643373 000000000000 000000000000 (re)
100 101 1 3 4 ..... 1 2ffeddde1b65 b8e02f643373 000000000000 (re)
101 102 2 7 4 ..... 2 33d1fb69067a b8e02f643373 000000000000 (re)
102 103 3 11 4 ..... 3 aa27919ee430 2ffeddde1b65 33d1fb69067a (re)
103 104
104 105 bar: we should not have a merge here:
105 106
106 107 $ hg debugindex bar
107 108 rev offset length ..... linkrev nodeid p1 p2 (re)
108 109 0 0 3 ..... 0 b8e02f643373 000000000000 000000000000 (re)
109 110 1 3 4 ..... 2 33d1fb69067a b8e02f643373 000000000000 (re)
110 111
111 112 baz: we should not have a merge here:
112 113
113 114 $ hg debugindex baz
114 115 rev offset length ..... linkrev nodeid p1 p2 (re)
115 116 0 0 3 ..... 0 b8e02f643373 000000000000 000000000000 (re)
116 117 1 3 4 ..... 1 2ffeddde1b65 b8e02f643373 000000000000 (re)
117 118
118 119 quux: we should not have a merge here:
119 120
120 121 $ hg debugindex quux
121 122 rev offset length ..... linkrev nodeid p1 p2 (re)
122 123 0 0 3 ..... 0 b8e02f643373 000000000000 000000000000 (re)
123 124 1 3 5 ..... 3 6128c0f33108 b8e02f643373 000000000000 (re)
124 125
125 126 Manifest entries should match tips of all files:
126 127
127 128 $ hg manifest --debug
128 129 33d1fb69067a0139622a3fa3b7ba1cdb1367972e 644 bar
129 130 2ffeddde1b65b4827f6746174a145474129fa2ce 644 baz
130 131 aa27919ee4303cfd575e1fb932dd64d75aa08be4 644 foo
131 132 6128c0f33108e8cfbb4e0824d13ae48b466d7280 644 quux
132 133
133 134 Everything should be clean now:
134 135
135 136 $ hg status
136 137
137 138 $ hg verify
138 139 checking changesets
139 140 checking manifests
140 141 crosschecking files in changesets and manifests
141 142 checking files
142 143 4 files, 4 changesets, 10 total revisions
143 144
144 145 $ cd ..
@@ -1,3463 +1,3463 b''
1 1 @ (34) head
2 2 |
3 3 | o (33) head
4 4 | |
5 5 o | (32) expand
6 6 |\ \
7 7 | o \ (31) expand
8 8 | |\ \
9 9 | | o \ (30) expand
10 10 | | |\ \
11 11 | | | o | (29) regular commit
12 12 | | | | |
13 13 | | o | | (28) merge zero known
14 14 | | |\ \ \
15 15 o | | | | | (27) collapse
16 16 |/ / / / /
17 17 | | o---+ (26) merge one known; far right
18 18 | | | | |
19 19 +---o | | (25) merge one known; far left
20 20 | | | | |
21 21 | | o | | (24) merge one known; immediate right
22 22 | | |\| |
23 23 | | o | | (23) merge one known; immediate left
24 24 | |/| | |
25 25 +---o---+ (22) merge two known; one far left, one far right
26 26 | | / /
27 27 o | | | (21) expand
28 28 |\ \ \ \
29 29 | o---+-+ (20) merge two known; two far right
30 30 | / / /
31 31 o | | | (19) expand
32 32 |\ \ \ \
33 33 +---+---o (18) merge two known; two far left
34 34 | | | |
35 35 | o | | (17) expand
36 36 | |\ \ \
37 37 | | o---+ (16) merge two known; one immediate right, one near right
38 38 | | |/ /
39 39 o | | | (15) expand
40 40 |\ \ \ \
41 41 | o-----+ (14) merge two known; one immediate right, one far right
42 42 | |/ / /
43 43 o | | | (13) expand
44 44 |\ \ \ \
45 45 +---o | | (12) merge two known; one immediate right, one far left
46 46 | | |/ /
47 47 | o | | (11) expand
48 48 | |\ \ \
49 49 | | o---+ (10) merge two known; one immediate left, one near right
50 50 | |/ / /
51 51 o | | | (9) expand
52 52 |\ \ \ \
53 53 | o-----+ (8) merge two known; one immediate left, one far right
54 54 |/ / / /
55 55 o | | | (7) expand
56 56 |\ \ \ \
57 57 +---o | | (6) merge two known; one immediate left, one far left
58 58 | |/ / /
59 59 | o | | (5) expand
60 60 | |\ \ \
61 61 | | o | | (4) merge two known; one immediate left, one immediate right
62 62 | |/|/ /
63 63 | o / / (3) collapse
64 64 |/ / /
65 65 o / / (2) collapse
66 66 |/ /
67 67 o / (1) collapse
68 68 |/
69 69 o (0) root
70 70
71 71
72 72 $ commit()
73 73 > {
74 74 > rev=$1
75 75 > msg=$2
76 76 > shift 2
77 77 > if [ "$#" -gt 0 ]; then
78 78 > hg debugsetparents "$@"
79 79 > fi
80 80 > echo $rev > a
81 81 > hg commit -Aqd "$rev 0" -m "($rev) $msg"
82 82 > }
83 83
84 84 $ cat > printrevset.py <<EOF
85 85 > from mercurial import extensions, revsetlang, commands, cmdutil
86 86 >
87 87 > def uisetup(ui):
88 88 > def printrevset(orig, ui, repo, *pats, **opts):
89 89 > if opts.get('print_revset'):
90 90 > expr = cmdutil.getgraphlogrevs(repo, pats, opts)[1]
91 91 > if expr:
92 92 > tree = revsetlang.parse(expr)
93 93 > else:
94 94 > tree = []
95 95 > ui.write('%r\n' % (opts.get('rev', []),))
96 96 > ui.write(revsetlang.prettyformat(tree) + '\n')
97 97 > return 0
98 98 > return orig(ui, repo, *pats, **opts)
99 99 > entry = extensions.wrapcommand(commands.table, 'log', printrevset)
100 100 > entry[1].append(('', 'print-revset', False,
101 101 > 'print generated revset and exit (DEPRECATED)'))
102 102 > EOF
103 103
104 104 $ echo "[extensions]" >> $HGRCPATH
105 105 $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
106 106
107 107 $ hg init repo
108 108 $ cd repo
109 109
110 110 Empty repo:
111 111
112 112 $ hg log -G
113 113
114 114
115 115 Building DAG:
116 116
117 117 $ commit 0 "root"
118 118 $ commit 1 "collapse" 0
119 119 $ commit 2 "collapse" 1
120 120 $ commit 3 "collapse" 2
121 121 $ commit 4 "merge two known; one immediate left, one immediate right" 1 3
122 122 $ commit 5 "expand" 3 4
123 123 $ commit 6 "merge two known; one immediate left, one far left" 2 5
124 124 $ commit 7 "expand" 2 5
125 125 $ commit 8 "merge two known; one immediate left, one far right" 0 7
126 126 $ commit 9 "expand" 7 8
127 127 $ commit 10 "merge two known; one immediate left, one near right" 0 6
128 128 $ commit 11 "expand" 6 10
129 129 $ commit 12 "merge two known; one immediate right, one far left" 1 9
130 130 $ commit 13 "expand" 9 11
131 131 $ commit 14 "merge two known; one immediate right, one far right" 0 12
132 132 $ commit 15 "expand" 13 14
133 133 $ commit 16 "merge two known; one immediate right, one near right" 0 1
134 134 $ commit 17 "expand" 12 16
135 135 $ commit 18 "merge two known; two far left" 1 15
136 136 $ commit 19 "expand" 15 17
137 137 $ commit 20 "merge two known; two far right" 0 18
138 138 $ commit 21 "expand" 19 20
139 139 $ commit 22 "merge two known; one far left, one far right" 18 21
140 140 $ commit 23 "merge one known; immediate left" 1 22
141 141 $ commit 24 "merge one known; immediate right" 0 23
142 142 $ commit 25 "merge one known; far left" 21 24
143 143 $ commit 26 "merge one known; far right" 18 25
144 144 $ commit 27 "collapse" 21
145 145 $ commit 28 "merge zero known" 1 26
146 146 $ commit 29 "regular commit" 0
147 147 $ commit 30 "expand" 28 29
148 148 $ commit 31 "expand" 21 30
149 149 $ commit 32 "expand" 27 31
150 150 $ commit 33 "head" 18
151 151 $ commit 34 "head" 32
152 152
153 153
154 154 $ hg log -G -q
155 155 @ 34:fea3ac5810e0
156 156 |
157 157 | o 33:68608f5145f9
158 158 | |
159 159 o | 32:d06dffa21a31
160 160 |\ \
161 161 | o \ 31:621d83e11f67
162 162 | |\ \
163 163 | | o \ 30:6e11cd4b648f
164 164 | | |\ \
165 165 | | | o | 29:cd9bb2be7593
166 166 | | | | |
167 167 | | o | | 28:44ecd0b9ae99
168 168 | | |\ \ \
169 169 o | | | | | 27:886ed638191b
170 170 |/ / / / /
171 171 | | o---+ 26:7f25b6c2f0b9
172 172 | | | | |
173 173 +---o | | 25:91da8ed57247
174 174 | | | | |
175 175 | | o | | 24:a9c19a3d96b7
176 176 | | |\| |
177 177 | | o | | 23:a01cddf0766d
178 178 | |/| | |
179 179 +---o---+ 22:e0d9cccacb5d
180 180 | | / /
181 181 o | | | 21:d42a756af44d
182 182 |\ \ \ \
183 183 | o---+-+ 20:d30ed6450e32
184 184 | / / /
185 185 o | | | 19:31ddc2c1573b
186 186 |\ \ \ \
187 187 +---+---o 18:1aa84d96232a
188 188 | | | |
189 189 | o | | 17:44765d7c06e0
190 190 | |\ \ \
191 191 | | o---+ 16:3677d192927d
192 192 | | |/ /
193 193 o | | | 15:1dda3f72782d
194 194 |\ \ \ \
195 195 | o-----+ 14:8eac370358ef
196 196 | |/ / /
197 197 o | | | 13:22d8966a97e3
198 198 |\ \ \ \
199 199 +---o | | 12:86b91144a6e9
200 200 | | |/ /
201 201 | o | | 11:832d76e6bdf2
202 202 | |\ \ \
203 203 | | o---+ 10:74c64d036d72
204 204 | |/ / /
205 205 o | | | 9:7010c0af0a35
206 206 |\ \ \ \
207 207 | o-----+ 8:7a0b11f71937
208 208 |/ / / /
209 209 o | | | 7:b632bb1b1224
210 210 |\ \ \ \
211 211 +---o | | 6:b105a072e251
212 212 | |/ / /
213 213 | o | | 5:4409d547b708
214 214 | |\ \ \
215 215 | | o | | 4:26a8bac39d9f
216 216 | |/|/ /
217 217 | o / / 3:27eef8ed80b4
218 218 |/ / /
219 219 o / / 2:3d9a33b8d1e1
220 220 |/ /
221 221 o / 1:6db2ef61d156
222 222 |/
223 223 o 0:e6eb3150255d
224 224
225 225
226 226 $ hg log -G
227 227 @ changeset: 34:fea3ac5810e0
228 228 | tag: tip
229 229 | parent: 32:d06dffa21a31
230 230 | user: test
231 231 | date: Thu Jan 01 00:00:34 1970 +0000
232 232 | summary: (34) head
233 233 |
234 234 | o changeset: 33:68608f5145f9
235 235 | | parent: 18:1aa84d96232a
236 236 | | user: test
237 237 | | date: Thu Jan 01 00:00:33 1970 +0000
238 238 | | summary: (33) head
239 239 | |
240 240 o | changeset: 32:d06dffa21a31
241 241 |\ \ parent: 27:886ed638191b
242 242 | | | parent: 31:621d83e11f67
243 243 | | | user: test
244 244 | | | date: Thu Jan 01 00:00:32 1970 +0000
245 245 | | | summary: (32) expand
246 246 | | |
247 247 | o | changeset: 31:621d83e11f67
248 248 | |\ \ parent: 21:d42a756af44d
249 249 | | | | parent: 30:6e11cd4b648f
250 250 | | | | user: test
251 251 | | | | date: Thu Jan 01 00:00:31 1970 +0000
252 252 | | | | summary: (31) expand
253 253 | | | |
254 254 | | o | changeset: 30:6e11cd4b648f
255 255 | | |\ \ parent: 28:44ecd0b9ae99
256 256 | | | | | parent: 29:cd9bb2be7593
257 257 | | | | | user: test
258 258 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
259 259 | | | | | summary: (30) expand
260 260 | | | | |
261 261 | | | o | changeset: 29:cd9bb2be7593
262 262 | | | | | parent: 0:e6eb3150255d
263 263 | | | | | user: test
264 264 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
265 265 | | | | | summary: (29) regular commit
266 266 | | | | |
267 267 | | o | | changeset: 28:44ecd0b9ae99
268 268 | | |\ \ \ parent: 1:6db2ef61d156
269 269 | | | | | | parent: 26:7f25b6c2f0b9
270 270 | | | | | | user: test
271 271 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
272 272 | | | | | | summary: (28) merge zero known
273 273 | | | | | |
274 274 o | | | | | changeset: 27:886ed638191b
275 275 |/ / / / / parent: 21:d42a756af44d
276 276 | | | | | user: test
277 277 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
278 278 | | | | | summary: (27) collapse
279 279 | | | | |
280 280 | | o---+ changeset: 26:7f25b6c2f0b9
281 281 | | | | | parent: 18:1aa84d96232a
282 282 | | | | | parent: 25:91da8ed57247
283 283 | | | | | user: test
284 284 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
285 285 | | | | | summary: (26) merge one known; far right
286 286 | | | | |
287 287 +---o | | changeset: 25:91da8ed57247
288 288 | | | | | parent: 21:d42a756af44d
289 289 | | | | | parent: 24:a9c19a3d96b7
290 290 | | | | | user: test
291 291 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
292 292 | | | | | summary: (25) merge one known; far left
293 293 | | | | |
294 294 | | o | | changeset: 24:a9c19a3d96b7
295 295 | | |\| | parent: 0:e6eb3150255d
296 296 | | | | | parent: 23:a01cddf0766d
297 297 | | | | | user: test
298 298 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
299 299 | | | | | summary: (24) merge one known; immediate right
300 300 | | | | |
301 301 | | o | | changeset: 23:a01cddf0766d
302 302 | |/| | | parent: 1:6db2ef61d156
303 303 | | | | | parent: 22:e0d9cccacb5d
304 304 | | | | | user: test
305 305 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
306 306 | | | | | summary: (23) merge one known; immediate left
307 307 | | | | |
308 308 +---o---+ changeset: 22:e0d9cccacb5d
309 309 | | | | parent: 18:1aa84d96232a
310 310 | | / / parent: 21:d42a756af44d
311 311 | | | | user: test
312 312 | | | | date: Thu Jan 01 00:00:22 1970 +0000
313 313 | | | | summary: (22) merge two known; one far left, one far right
314 314 | | | |
315 315 o | | | changeset: 21:d42a756af44d
316 316 |\ \ \ \ parent: 19:31ddc2c1573b
317 317 | | | | | parent: 20:d30ed6450e32
318 318 | | | | | user: test
319 319 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
320 320 | | | | | summary: (21) expand
321 321 | | | | |
322 322 | o---+-+ changeset: 20:d30ed6450e32
323 323 | | | | parent: 0:e6eb3150255d
324 324 | / / / parent: 18:1aa84d96232a
325 325 | | | | user: test
326 326 | | | | date: Thu Jan 01 00:00:20 1970 +0000
327 327 | | | | summary: (20) merge two known; two far right
328 328 | | | |
329 329 o | | | changeset: 19:31ddc2c1573b
330 330 |\ \ \ \ parent: 15:1dda3f72782d
331 331 | | | | | parent: 17:44765d7c06e0
332 332 | | | | | user: test
333 333 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
334 334 | | | | | summary: (19) expand
335 335 | | | | |
336 336 +---+---o changeset: 18:1aa84d96232a
337 337 | | | | parent: 1:6db2ef61d156
338 338 | | | | parent: 15:1dda3f72782d
339 339 | | | | user: test
340 340 | | | | date: Thu Jan 01 00:00:18 1970 +0000
341 341 | | | | summary: (18) merge two known; two far left
342 342 | | | |
343 343 | o | | changeset: 17:44765d7c06e0
344 344 | |\ \ \ parent: 12:86b91144a6e9
345 345 | | | | | parent: 16:3677d192927d
346 346 | | | | | user: test
347 347 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
348 348 | | | | | summary: (17) expand
349 349 | | | | |
350 350 | | o---+ changeset: 16:3677d192927d
351 351 | | | | | parent: 0:e6eb3150255d
352 352 | | |/ / parent: 1:6db2ef61d156
353 353 | | | | user: test
354 354 | | | | date: Thu Jan 01 00:00:16 1970 +0000
355 355 | | | | summary: (16) merge two known; one immediate right, one near right
356 356 | | | |
357 357 o | | | changeset: 15:1dda3f72782d
358 358 |\ \ \ \ parent: 13:22d8966a97e3
359 359 | | | | | parent: 14:8eac370358ef
360 360 | | | | | user: test
361 361 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
362 362 | | | | | summary: (15) expand
363 363 | | | | |
364 364 | o-----+ changeset: 14:8eac370358ef
365 365 | | | | | parent: 0:e6eb3150255d
366 366 | |/ / / parent: 12:86b91144a6e9
367 367 | | | | user: test
368 368 | | | | date: Thu Jan 01 00:00:14 1970 +0000
369 369 | | | | summary: (14) merge two known; one immediate right, one far right
370 370 | | | |
371 371 o | | | changeset: 13:22d8966a97e3
372 372 |\ \ \ \ parent: 9:7010c0af0a35
373 373 | | | | | parent: 11:832d76e6bdf2
374 374 | | | | | user: test
375 375 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
376 376 | | | | | summary: (13) expand
377 377 | | | | |
378 378 +---o | | changeset: 12:86b91144a6e9
379 379 | | |/ / parent: 1:6db2ef61d156
380 380 | | | | parent: 9:7010c0af0a35
381 381 | | | | user: test
382 382 | | | | date: Thu Jan 01 00:00:12 1970 +0000
383 383 | | | | summary: (12) merge two known; one immediate right, one far left
384 384 | | | |
385 385 | o | | changeset: 11:832d76e6bdf2
386 386 | |\ \ \ parent: 6:b105a072e251
387 387 | | | | | parent: 10:74c64d036d72
388 388 | | | | | user: test
389 389 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
390 390 | | | | | summary: (11) expand
391 391 | | | | |
392 392 | | o---+ changeset: 10:74c64d036d72
393 393 | | | | | parent: 0:e6eb3150255d
394 394 | |/ / / parent: 6:b105a072e251
395 395 | | | | user: test
396 396 | | | | date: Thu Jan 01 00:00:10 1970 +0000
397 397 | | | | summary: (10) merge two known; one immediate left, one near right
398 398 | | | |
399 399 o | | | changeset: 9:7010c0af0a35
400 400 |\ \ \ \ parent: 7:b632bb1b1224
401 401 | | | | | parent: 8:7a0b11f71937
402 402 | | | | | user: test
403 403 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
404 404 | | | | | summary: (9) expand
405 405 | | | | |
406 406 | o-----+ changeset: 8:7a0b11f71937
407 407 | | | | | parent: 0:e6eb3150255d
408 408 |/ / / / parent: 7:b632bb1b1224
409 409 | | | | user: test
410 410 | | | | date: Thu Jan 01 00:00:08 1970 +0000
411 411 | | | | summary: (8) merge two known; one immediate left, one far right
412 412 | | | |
413 413 o | | | changeset: 7:b632bb1b1224
414 414 |\ \ \ \ parent: 2:3d9a33b8d1e1
415 415 | | | | | parent: 5:4409d547b708
416 416 | | | | | user: test
417 417 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
418 418 | | | | | summary: (7) expand
419 419 | | | | |
420 420 +---o | | changeset: 6:b105a072e251
421 421 | |/ / / parent: 2:3d9a33b8d1e1
422 422 | | | | parent: 5:4409d547b708
423 423 | | | | user: test
424 424 | | | | date: Thu Jan 01 00:00:06 1970 +0000
425 425 | | | | summary: (6) merge two known; one immediate left, one far left
426 426 | | | |
427 427 | o | | changeset: 5:4409d547b708
428 428 | |\ \ \ parent: 3:27eef8ed80b4
429 429 | | | | | parent: 4:26a8bac39d9f
430 430 | | | | | user: test
431 431 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
432 432 | | | | | summary: (5) expand
433 433 | | | | |
434 434 | | o | | changeset: 4:26a8bac39d9f
435 435 | |/|/ / parent: 1:6db2ef61d156
436 436 | | | | parent: 3:27eef8ed80b4
437 437 | | | | user: test
438 438 | | | | date: Thu Jan 01 00:00:04 1970 +0000
439 439 | | | | summary: (4) merge two known; one immediate left, one immediate right
440 440 | | | |
441 441 | o | | changeset: 3:27eef8ed80b4
442 442 |/ / / user: test
443 443 | | | date: Thu Jan 01 00:00:03 1970 +0000
444 444 | | | summary: (3) collapse
445 445 | | |
446 446 o | | changeset: 2:3d9a33b8d1e1
447 447 |/ / user: test
448 448 | | date: Thu Jan 01 00:00:02 1970 +0000
449 449 | | summary: (2) collapse
450 450 | |
451 451 o | changeset: 1:6db2ef61d156
452 452 |/ user: test
453 453 | date: Thu Jan 01 00:00:01 1970 +0000
454 454 | summary: (1) collapse
455 455 |
456 456 o changeset: 0:e6eb3150255d
457 457 user: test
458 458 date: Thu Jan 01 00:00:00 1970 +0000
459 459 summary: (0) root
460 460
461 461
462 462 File glog:
463 463 $ hg log -G a
464 464 @ changeset: 34:fea3ac5810e0
465 465 | tag: tip
466 466 | parent: 32:d06dffa21a31
467 467 | user: test
468 468 | date: Thu Jan 01 00:00:34 1970 +0000
469 469 | summary: (34) head
470 470 |
471 471 | o changeset: 33:68608f5145f9
472 472 | | parent: 18:1aa84d96232a
473 473 | | user: test
474 474 | | date: Thu Jan 01 00:00:33 1970 +0000
475 475 | | summary: (33) head
476 476 | |
477 477 o | changeset: 32:d06dffa21a31
478 478 |\ \ parent: 27:886ed638191b
479 479 | | | parent: 31:621d83e11f67
480 480 | | | user: test
481 481 | | | date: Thu Jan 01 00:00:32 1970 +0000
482 482 | | | summary: (32) expand
483 483 | | |
484 484 | o | changeset: 31:621d83e11f67
485 485 | |\ \ parent: 21:d42a756af44d
486 486 | | | | parent: 30:6e11cd4b648f
487 487 | | | | user: test
488 488 | | | | date: Thu Jan 01 00:00:31 1970 +0000
489 489 | | | | summary: (31) expand
490 490 | | | |
491 491 | | o | changeset: 30:6e11cd4b648f
492 492 | | |\ \ parent: 28:44ecd0b9ae99
493 493 | | | | | parent: 29:cd9bb2be7593
494 494 | | | | | user: test
495 495 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
496 496 | | | | | summary: (30) expand
497 497 | | | | |
498 498 | | | o | changeset: 29:cd9bb2be7593
499 499 | | | | | parent: 0:e6eb3150255d
500 500 | | | | | user: test
501 501 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
502 502 | | | | | summary: (29) regular commit
503 503 | | | | |
504 504 | | o | | changeset: 28:44ecd0b9ae99
505 505 | | |\ \ \ parent: 1:6db2ef61d156
506 506 | | | | | | parent: 26:7f25b6c2f0b9
507 507 | | | | | | user: test
508 508 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
509 509 | | | | | | summary: (28) merge zero known
510 510 | | | | | |
511 511 o | | | | | changeset: 27:886ed638191b
512 512 |/ / / / / parent: 21:d42a756af44d
513 513 | | | | | user: test
514 514 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
515 515 | | | | | summary: (27) collapse
516 516 | | | | |
517 517 | | o---+ changeset: 26:7f25b6c2f0b9
518 518 | | | | | parent: 18:1aa84d96232a
519 519 | | | | | parent: 25:91da8ed57247
520 520 | | | | | user: test
521 521 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
522 522 | | | | | summary: (26) merge one known; far right
523 523 | | | | |
524 524 +---o | | changeset: 25:91da8ed57247
525 525 | | | | | parent: 21:d42a756af44d
526 526 | | | | | parent: 24:a9c19a3d96b7
527 527 | | | | | user: test
528 528 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
529 529 | | | | | summary: (25) merge one known; far left
530 530 | | | | |
531 531 | | o | | changeset: 24:a9c19a3d96b7
532 532 | | |\| | parent: 0:e6eb3150255d
533 533 | | | | | parent: 23:a01cddf0766d
534 534 | | | | | user: test
535 535 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
536 536 | | | | | summary: (24) merge one known; immediate right
537 537 | | | | |
538 538 | | o | | changeset: 23:a01cddf0766d
539 539 | |/| | | parent: 1:6db2ef61d156
540 540 | | | | | parent: 22:e0d9cccacb5d
541 541 | | | | | user: test
542 542 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
543 543 | | | | | summary: (23) merge one known; immediate left
544 544 | | | | |
545 545 +---o---+ changeset: 22:e0d9cccacb5d
546 546 | | | | parent: 18:1aa84d96232a
547 547 | | / / parent: 21:d42a756af44d
548 548 | | | | user: test
549 549 | | | | date: Thu Jan 01 00:00:22 1970 +0000
550 550 | | | | summary: (22) merge two known; one far left, one far right
551 551 | | | |
552 552 o | | | changeset: 21:d42a756af44d
553 553 |\ \ \ \ parent: 19:31ddc2c1573b
554 554 | | | | | parent: 20:d30ed6450e32
555 555 | | | | | user: test
556 556 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
557 557 | | | | | summary: (21) expand
558 558 | | | | |
559 559 | o---+-+ changeset: 20:d30ed6450e32
560 560 | | | | parent: 0:e6eb3150255d
561 561 | / / / parent: 18:1aa84d96232a
562 562 | | | | user: test
563 563 | | | | date: Thu Jan 01 00:00:20 1970 +0000
564 564 | | | | summary: (20) merge two known; two far right
565 565 | | | |
566 566 o | | | changeset: 19:31ddc2c1573b
567 567 |\ \ \ \ parent: 15:1dda3f72782d
568 568 | | | | | parent: 17:44765d7c06e0
569 569 | | | | | user: test
570 570 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
571 571 | | | | | summary: (19) expand
572 572 | | | | |
573 573 +---+---o changeset: 18:1aa84d96232a
574 574 | | | | parent: 1:6db2ef61d156
575 575 | | | | parent: 15:1dda3f72782d
576 576 | | | | user: test
577 577 | | | | date: Thu Jan 01 00:00:18 1970 +0000
578 578 | | | | summary: (18) merge two known; two far left
579 579 | | | |
580 580 | o | | changeset: 17:44765d7c06e0
581 581 | |\ \ \ parent: 12:86b91144a6e9
582 582 | | | | | parent: 16:3677d192927d
583 583 | | | | | user: test
584 584 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
585 585 | | | | | summary: (17) expand
586 586 | | | | |
587 587 | | o---+ changeset: 16:3677d192927d
588 588 | | | | | parent: 0:e6eb3150255d
589 589 | | |/ / parent: 1:6db2ef61d156
590 590 | | | | user: test
591 591 | | | | date: Thu Jan 01 00:00:16 1970 +0000
592 592 | | | | summary: (16) merge two known; one immediate right, one near right
593 593 | | | |
594 594 o | | | changeset: 15:1dda3f72782d
595 595 |\ \ \ \ parent: 13:22d8966a97e3
596 596 | | | | | parent: 14:8eac370358ef
597 597 | | | | | user: test
598 598 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
599 599 | | | | | summary: (15) expand
600 600 | | | | |
601 601 | o-----+ changeset: 14:8eac370358ef
602 602 | | | | | parent: 0:e6eb3150255d
603 603 | |/ / / parent: 12:86b91144a6e9
604 604 | | | | user: test
605 605 | | | | date: Thu Jan 01 00:00:14 1970 +0000
606 606 | | | | summary: (14) merge two known; one immediate right, one far right
607 607 | | | |
608 608 o | | | changeset: 13:22d8966a97e3
609 609 |\ \ \ \ parent: 9:7010c0af0a35
610 610 | | | | | parent: 11:832d76e6bdf2
611 611 | | | | | user: test
612 612 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
613 613 | | | | | summary: (13) expand
614 614 | | | | |
615 615 +---o | | changeset: 12:86b91144a6e9
616 616 | | |/ / parent: 1:6db2ef61d156
617 617 | | | | parent: 9:7010c0af0a35
618 618 | | | | user: test
619 619 | | | | date: Thu Jan 01 00:00:12 1970 +0000
620 620 | | | | summary: (12) merge two known; one immediate right, one far left
621 621 | | | |
622 622 | o | | changeset: 11:832d76e6bdf2
623 623 | |\ \ \ parent: 6:b105a072e251
624 624 | | | | | parent: 10:74c64d036d72
625 625 | | | | | user: test
626 626 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
627 627 | | | | | summary: (11) expand
628 628 | | | | |
629 629 | | o---+ changeset: 10:74c64d036d72
630 630 | | | | | parent: 0:e6eb3150255d
631 631 | |/ / / parent: 6:b105a072e251
632 632 | | | | user: test
633 633 | | | | date: Thu Jan 01 00:00:10 1970 +0000
634 634 | | | | summary: (10) merge two known; one immediate left, one near right
635 635 | | | |
636 636 o | | | changeset: 9:7010c0af0a35
637 637 |\ \ \ \ parent: 7:b632bb1b1224
638 638 | | | | | parent: 8:7a0b11f71937
639 639 | | | | | user: test
640 640 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
641 641 | | | | | summary: (9) expand
642 642 | | | | |
643 643 | o-----+ changeset: 8:7a0b11f71937
644 644 | | | | | parent: 0:e6eb3150255d
645 645 |/ / / / parent: 7:b632bb1b1224
646 646 | | | | user: test
647 647 | | | | date: Thu Jan 01 00:00:08 1970 +0000
648 648 | | | | summary: (8) merge two known; one immediate left, one far right
649 649 | | | |
650 650 o | | | changeset: 7:b632bb1b1224
651 651 |\ \ \ \ parent: 2:3d9a33b8d1e1
652 652 | | | | | parent: 5:4409d547b708
653 653 | | | | | user: test
654 654 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
655 655 | | | | | summary: (7) expand
656 656 | | | | |
657 657 +---o | | changeset: 6:b105a072e251
658 658 | |/ / / parent: 2:3d9a33b8d1e1
659 659 | | | | parent: 5:4409d547b708
660 660 | | | | user: test
661 661 | | | | date: Thu Jan 01 00:00:06 1970 +0000
662 662 | | | | summary: (6) merge two known; one immediate left, one far left
663 663 | | | |
664 664 | o | | changeset: 5:4409d547b708
665 665 | |\ \ \ parent: 3:27eef8ed80b4
666 666 | | | | | parent: 4:26a8bac39d9f
667 667 | | | | | user: test
668 668 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
669 669 | | | | | summary: (5) expand
670 670 | | | | |
671 671 | | o | | changeset: 4:26a8bac39d9f
672 672 | |/|/ / parent: 1:6db2ef61d156
673 673 | | | | parent: 3:27eef8ed80b4
674 674 | | | | user: test
675 675 | | | | date: Thu Jan 01 00:00:04 1970 +0000
676 676 | | | | summary: (4) merge two known; one immediate left, one immediate right
677 677 | | | |
678 678 | o | | changeset: 3:27eef8ed80b4
679 679 |/ / / user: test
680 680 | | | date: Thu Jan 01 00:00:03 1970 +0000
681 681 | | | summary: (3) collapse
682 682 | | |
683 683 o | | changeset: 2:3d9a33b8d1e1
684 684 |/ / user: test
685 685 | | date: Thu Jan 01 00:00:02 1970 +0000
686 686 | | summary: (2) collapse
687 687 | |
688 688 o | changeset: 1:6db2ef61d156
689 689 |/ user: test
690 690 | date: Thu Jan 01 00:00:01 1970 +0000
691 691 | summary: (1) collapse
692 692 |
693 693 o changeset: 0:e6eb3150255d
694 694 user: test
695 695 date: Thu Jan 01 00:00:00 1970 +0000
696 696 summary: (0) root
697 697
698 698
699 699 File glog per revset:
700 700
701 701 $ hg log -G -r 'file("a")'
702 702 @ changeset: 34:fea3ac5810e0
703 703 | tag: tip
704 704 | parent: 32:d06dffa21a31
705 705 | user: test
706 706 | date: Thu Jan 01 00:00:34 1970 +0000
707 707 | summary: (34) head
708 708 |
709 709 | o changeset: 33:68608f5145f9
710 710 | | parent: 18:1aa84d96232a
711 711 | | user: test
712 712 | | date: Thu Jan 01 00:00:33 1970 +0000
713 713 | | summary: (33) head
714 714 | |
715 715 o | changeset: 32:d06dffa21a31
716 716 |\ \ parent: 27:886ed638191b
717 717 | | | parent: 31:621d83e11f67
718 718 | | | user: test
719 719 | | | date: Thu Jan 01 00:00:32 1970 +0000
720 720 | | | summary: (32) expand
721 721 | | |
722 722 | o | changeset: 31:621d83e11f67
723 723 | |\ \ parent: 21:d42a756af44d
724 724 | | | | parent: 30:6e11cd4b648f
725 725 | | | | user: test
726 726 | | | | date: Thu Jan 01 00:00:31 1970 +0000
727 727 | | | | summary: (31) expand
728 728 | | | |
729 729 | | o | changeset: 30:6e11cd4b648f
730 730 | | |\ \ parent: 28:44ecd0b9ae99
731 731 | | | | | parent: 29:cd9bb2be7593
732 732 | | | | | user: test
733 733 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
734 734 | | | | | summary: (30) expand
735 735 | | | | |
736 736 | | | o | changeset: 29:cd9bb2be7593
737 737 | | | | | parent: 0:e6eb3150255d
738 738 | | | | | user: test
739 739 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
740 740 | | | | | summary: (29) regular commit
741 741 | | | | |
742 742 | | o | | changeset: 28:44ecd0b9ae99
743 743 | | |\ \ \ parent: 1:6db2ef61d156
744 744 | | | | | | parent: 26:7f25b6c2f0b9
745 745 | | | | | | user: test
746 746 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
747 747 | | | | | | summary: (28) merge zero known
748 748 | | | | | |
749 749 o | | | | | changeset: 27:886ed638191b
750 750 |/ / / / / parent: 21:d42a756af44d
751 751 | | | | | user: test
752 752 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
753 753 | | | | | summary: (27) collapse
754 754 | | | | |
755 755 | | o---+ changeset: 26:7f25b6c2f0b9
756 756 | | | | | parent: 18:1aa84d96232a
757 757 | | | | | parent: 25:91da8ed57247
758 758 | | | | | user: test
759 759 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
760 760 | | | | | summary: (26) merge one known; far right
761 761 | | | | |
762 762 +---o | | changeset: 25:91da8ed57247
763 763 | | | | | parent: 21:d42a756af44d
764 764 | | | | | parent: 24:a9c19a3d96b7
765 765 | | | | | user: test
766 766 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
767 767 | | | | | summary: (25) merge one known; far left
768 768 | | | | |
769 769 | | o | | changeset: 24:a9c19a3d96b7
770 770 | | |\| | parent: 0:e6eb3150255d
771 771 | | | | | parent: 23:a01cddf0766d
772 772 | | | | | user: test
773 773 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
774 774 | | | | | summary: (24) merge one known; immediate right
775 775 | | | | |
776 776 | | o | | changeset: 23:a01cddf0766d
777 777 | |/| | | parent: 1:6db2ef61d156
778 778 | | | | | parent: 22:e0d9cccacb5d
779 779 | | | | | user: test
780 780 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
781 781 | | | | | summary: (23) merge one known; immediate left
782 782 | | | | |
783 783 +---o---+ changeset: 22:e0d9cccacb5d
784 784 | | | | parent: 18:1aa84d96232a
785 785 | | / / parent: 21:d42a756af44d
786 786 | | | | user: test
787 787 | | | | date: Thu Jan 01 00:00:22 1970 +0000
788 788 | | | | summary: (22) merge two known; one far left, one far right
789 789 | | | |
790 790 o | | | changeset: 21:d42a756af44d
791 791 |\ \ \ \ parent: 19:31ddc2c1573b
792 792 | | | | | parent: 20:d30ed6450e32
793 793 | | | | | user: test
794 794 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
795 795 | | | | | summary: (21) expand
796 796 | | | | |
797 797 | o---+-+ changeset: 20:d30ed6450e32
798 798 | | | | parent: 0:e6eb3150255d
799 799 | / / / parent: 18:1aa84d96232a
800 800 | | | | user: test
801 801 | | | | date: Thu Jan 01 00:00:20 1970 +0000
802 802 | | | | summary: (20) merge two known; two far right
803 803 | | | |
804 804 o | | | changeset: 19:31ddc2c1573b
805 805 |\ \ \ \ parent: 15:1dda3f72782d
806 806 | | | | | parent: 17:44765d7c06e0
807 807 | | | | | user: test
808 808 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
809 809 | | | | | summary: (19) expand
810 810 | | | | |
811 811 +---+---o changeset: 18:1aa84d96232a
812 812 | | | | parent: 1:6db2ef61d156
813 813 | | | | parent: 15:1dda3f72782d
814 814 | | | | user: test
815 815 | | | | date: Thu Jan 01 00:00:18 1970 +0000
816 816 | | | | summary: (18) merge two known; two far left
817 817 | | | |
818 818 | o | | changeset: 17:44765d7c06e0
819 819 | |\ \ \ parent: 12:86b91144a6e9
820 820 | | | | | parent: 16:3677d192927d
821 821 | | | | | user: test
822 822 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
823 823 | | | | | summary: (17) expand
824 824 | | | | |
825 825 | | o---+ changeset: 16:3677d192927d
826 826 | | | | | parent: 0:e6eb3150255d
827 827 | | |/ / parent: 1:6db2ef61d156
828 828 | | | | user: test
829 829 | | | | date: Thu Jan 01 00:00:16 1970 +0000
830 830 | | | | summary: (16) merge two known; one immediate right, one near right
831 831 | | | |
832 832 o | | | changeset: 15:1dda3f72782d
833 833 |\ \ \ \ parent: 13:22d8966a97e3
834 834 | | | | | parent: 14:8eac370358ef
835 835 | | | | | user: test
836 836 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
837 837 | | | | | summary: (15) expand
838 838 | | | | |
839 839 | o-----+ changeset: 14:8eac370358ef
840 840 | | | | | parent: 0:e6eb3150255d
841 841 | |/ / / parent: 12:86b91144a6e9
842 842 | | | | user: test
843 843 | | | | date: Thu Jan 01 00:00:14 1970 +0000
844 844 | | | | summary: (14) merge two known; one immediate right, one far right
845 845 | | | |
846 846 o | | | changeset: 13:22d8966a97e3
847 847 |\ \ \ \ parent: 9:7010c0af0a35
848 848 | | | | | parent: 11:832d76e6bdf2
849 849 | | | | | user: test
850 850 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
851 851 | | | | | summary: (13) expand
852 852 | | | | |
853 853 +---o | | changeset: 12:86b91144a6e9
854 854 | | |/ / parent: 1:6db2ef61d156
855 855 | | | | parent: 9:7010c0af0a35
856 856 | | | | user: test
857 857 | | | | date: Thu Jan 01 00:00:12 1970 +0000
858 858 | | | | summary: (12) merge two known; one immediate right, one far left
859 859 | | | |
860 860 | o | | changeset: 11:832d76e6bdf2
861 861 | |\ \ \ parent: 6:b105a072e251
862 862 | | | | | parent: 10:74c64d036d72
863 863 | | | | | user: test
864 864 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
865 865 | | | | | summary: (11) expand
866 866 | | | | |
867 867 | | o---+ changeset: 10:74c64d036d72
868 868 | | | | | parent: 0:e6eb3150255d
869 869 | |/ / / parent: 6:b105a072e251
870 870 | | | | user: test
871 871 | | | | date: Thu Jan 01 00:00:10 1970 +0000
872 872 | | | | summary: (10) merge two known; one immediate left, one near right
873 873 | | | |
874 874 o | | | changeset: 9:7010c0af0a35
875 875 |\ \ \ \ parent: 7:b632bb1b1224
876 876 | | | | | parent: 8:7a0b11f71937
877 877 | | | | | user: test
878 878 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
879 879 | | | | | summary: (9) expand
880 880 | | | | |
881 881 | o-----+ changeset: 8:7a0b11f71937
882 882 | | | | | parent: 0:e6eb3150255d
883 883 |/ / / / parent: 7:b632bb1b1224
884 884 | | | | user: test
885 885 | | | | date: Thu Jan 01 00:00:08 1970 +0000
886 886 | | | | summary: (8) merge two known; one immediate left, one far right
887 887 | | | |
888 888 o | | | changeset: 7:b632bb1b1224
889 889 |\ \ \ \ parent: 2:3d9a33b8d1e1
890 890 | | | | | parent: 5:4409d547b708
891 891 | | | | | user: test
892 892 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
893 893 | | | | | summary: (7) expand
894 894 | | | | |
895 895 +---o | | changeset: 6:b105a072e251
896 896 | |/ / / parent: 2:3d9a33b8d1e1
897 897 | | | | parent: 5:4409d547b708
898 898 | | | | user: test
899 899 | | | | date: Thu Jan 01 00:00:06 1970 +0000
900 900 | | | | summary: (6) merge two known; one immediate left, one far left
901 901 | | | |
902 902 | o | | changeset: 5:4409d547b708
903 903 | |\ \ \ parent: 3:27eef8ed80b4
904 904 | | | | | parent: 4:26a8bac39d9f
905 905 | | | | | user: test
906 906 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
907 907 | | | | | summary: (5) expand
908 908 | | | | |
909 909 | | o | | changeset: 4:26a8bac39d9f
910 910 | |/|/ / parent: 1:6db2ef61d156
911 911 | | | | parent: 3:27eef8ed80b4
912 912 | | | | user: test
913 913 | | | | date: Thu Jan 01 00:00:04 1970 +0000
914 914 | | | | summary: (4) merge two known; one immediate left, one immediate right
915 915 | | | |
916 916 | o | | changeset: 3:27eef8ed80b4
917 917 |/ / / user: test
918 918 | | | date: Thu Jan 01 00:00:03 1970 +0000
919 919 | | | summary: (3) collapse
920 920 | | |
921 921 o | | changeset: 2:3d9a33b8d1e1
922 922 |/ / user: test
923 923 | | date: Thu Jan 01 00:00:02 1970 +0000
924 924 | | summary: (2) collapse
925 925 | |
926 926 o | changeset: 1:6db2ef61d156
927 927 |/ user: test
928 928 | date: Thu Jan 01 00:00:01 1970 +0000
929 929 | summary: (1) collapse
930 930 |
931 931 o changeset: 0:e6eb3150255d
932 932 user: test
933 933 date: Thu Jan 01 00:00:00 1970 +0000
934 934 summary: (0) root
935 935
936 936
937 937
938 938 File glog per revset (only merges):
939 939
940 940 $ hg log -G -r 'file("a")' -m
941 941 o changeset: 32:d06dffa21a31
942 942 |\ parent: 27:886ed638191b
943 943 | : parent: 31:621d83e11f67
944 944 | : user: test
945 945 | : date: Thu Jan 01 00:00:32 1970 +0000
946 946 | : summary: (32) expand
947 947 | :
948 948 o : changeset: 31:621d83e11f67
949 949 |\: parent: 21:d42a756af44d
950 950 | : parent: 30:6e11cd4b648f
951 951 | : user: test
952 952 | : date: Thu Jan 01 00:00:31 1970 +0000
953 953 | : summary: (31) expand
954 954 | :
955 955 o : changeset: 30:6e11cd4b648f
956 956 |\ \ parent: 28:44ecd0b9ae99
957 957 | ~ : parent: 29:cd9bb2be7593
958 958 | : user: test
959 959 | : date: Thu Jan 01 00:00:30 1970 +0000
960 960 | : summary: (30) expand
961 961 | /
962 962 o : changeset: 28:44ecd0b9ae99
963 963 |\ \ parent: 1:6db2ef61d156
964 964 | ~ : parent: 26:7f25b6c2f0b9
965 965 | : user: test
966 966 | : date: Thu Jan 01 00:00:28 1970 +0000
967 967 | : summary: (28) merge zero known
968 968 | /
969 969 o : changeset: 26:7f25b6c2f0b9
970 970 |\ \ parent: 18:1aa84d96232a
971 971 | | : parent: 25:91da8ed57247
972 972 | | : user: test
973 973 | | : date: Thu Jan 01 00:00:26 1970 +0000
974 974 | | : summary: (26) merge one known; far right
975 975 | | :
976 976 | o : changeset: 25:91da8ed57247
977 977 | |\: parent: 21:d42a756af44d
978 978 | | : parent: 24:a9c19a3d96b7
979 979 | | : user: test
980 980 | | : date: Thu Jan 01 00:00:25 1970 +0000
981 981 | | : summary: (25) merge one known; far left
982 982 | | :
983 983 | o : changeset: 24:a9c19a3d96b7
984 984 | |\ \ parent: 0:e6eb3150255d
985 985 | | ~ : parent: 23:a01cddf0766d
986 986 | | : user: test
987 987 | | : date: Thu Jan 01 00:00:24 1970 +0000
988 988 | | : summary: (24) merge one known; immediate right
989 989 | | /
990 990 | o : changeset: 23:a01cddf0766d
991 991 | |\ \ parent: 1:6db2ef61d156
992 992 | | ~ : parent: 22:e0d9cccacb5d
993 993 | | : user: test
994 994 | | : date: Thu Jan 01 00:00:23 1970 +0000
995 995 | | : summary: (23) merge one known; immediate left
996 996 | | /
997 997 | o : changeset: 22:e0d9cccacb5d
998 998 |/:/ parent: 18:1aa84d96232a
999 999 | : parent: 21:d42a756af44d
1000 1000 | : user: test
1001 1001 | : date: Thu Jan 01 00:00:22 1970 +0000
1002 1002 | : summary: (22) merge two known; one far left, one far right
1003 1003 | :
1004 1004 | o changeset: 21:d42a756af44d
1005 1005 | |\ parent: 19:31ddc2c1573b
1006 1006 | | | parent: 20:d30ed6450e32
1007 1007 | | | user: test
1008 1008 | | | date: Thu Jan 01 00:00:21 1970 +0000
1009 1009 | | | summary: (21) expand
1010 1010 | | |
1011 1011 +---o changeset: 20:d30ed6450e32
1012 1012 | | | parent: 0:e6eb3150255d
1013 1013 | | ~ parent: 18:1aa84d96232a
1014 1014 | | user: test
1015 1015 | | date: Thu Jan 01 00:00:20 1970 +0000
1016 1016 | | summary: (20) merge two known; two far right
1017 1017 | |
1018 1018 | o changeset: 19:31ddc2c1573b
1019 1019 | |\ parent: 15:1dda3f72782d
1020 1020 | | | parent: 17:44765d7c06e0
1021 1021 | | | user: test
1022 1022 | | | date: Thu Jan 01 00:00:19 1970 +0000
1023 1023 | | | summary: (19) expand
1024 1024 | | |
1025 1025 o | | changeset: 18:1aa84d96232a
1026 1026 |\| | parent: 1:6db2ef61d156
1027 1027 ~ | | parent: 15:1dda3f72782d
1028 1028 | | user: test
1029 1029 | | date: Thu Jan 01 00:00:18 1970 +0000
1030 1030 | | summary: (18) merge two known; two far left
1031 1031 / /
1032 1032 | o changeset: 17:44765d7c06e0
1033 1033 | |\ parent: 12:86b91144a6e9
1034 1034 | | | parent: 16:3677d192927d
1035 1035 | | | user: test
1036 1036 | | | date: Thu Jan 01 00:00:17 1970 +0000
1037 1037 | | | summary: (17) expand
1038 1038 | | |
1039 1039 | | o changeset: 16:3677d192927d
1040 1040 | | |\ parent: 0:e6eb3150255d
1041 1041 | | ~ ~ parent: 1:6db2ef61d156
1042 1042 | | user: test
1043 1043 | | date: Thu Jan 01 00:00:16 1970 +0000
1044 1044 | | summary: (16) merge two known; one immediate right, one near right
1045 1045 | |
1046 1046 o | changeset: 15:1dda3f72782d
1047 1047 |\ \ parent: 13:22d8966a97e3
1048 1048 | | | parent: 14:8eac370358ef
1049 1049 | | | user: test
1050 1050 | | | date: Thu Jan 01 00:00:15 1970 +0000
1051 1051 | | | summary: (15) expand
1052 1052 | | |
1053 1053 | o | changeset: 14:8eac370358ef
1054 1054 | |\| parent: 0:e6eb3150255d
1055 1055 | ~ | parent: 12:86b91144a6e9
1056 1056 | | user: test
1057 1057 | | date: Thu Jan 01 00:00:14 1970 +0000
1058 1058 | | summary: (14) merge two known; one immediate right, one far right
1059 1059 | /
1060 1060 o | changeset: 13:22d8966a97e3
1061 1061 |\ \ parent: 9:7010c0af0a35
1062 1062 | | | parent: 11:832d76e6bdf2
1063 1063 | | | user: test
1064 1064 | | | date: Thu Jan 01 00:00:13 1970 +0000
1065 1065 | | | summary: (13) expand
1066 1066 | | |
1067 1067 +---o changeset: 12:86b91144a6e9
1068 1068 | | | parent: 1:6db2ef61d156
1069 1069 | | ~ parent: 9:7010c0af0a35
1070 1070 | | user: test
1071 1071 | | date: Thu Jan 01 00:00:12 1970 +0000
1072 1072 | | summary: (12) merge two known; one immediate right, one far left
1073 1073 | |
1074 1074 | o changeset: 11:832d76e6bdf2
1075 1075 | |\ parent: 6:b105a072e251
1076 1076 | | | parent: 10:74c64d036d72
1077 1077 | | | user: test
1078 1078 | | | date: Thu Jan 01 00:00:11 1970 +0000
1079 1079 | | | summary: (11) expand
1080 1080 | | |
1081 1081 | | o changeset: 10:74c64d036d72
1082 1082 | |/| parent: 0:e6eb3150255d
1083 1083 | | ~ parent: 6:b105a072e251
1084 1084 | | user: test
1085 1085 | | date: Thu Jan 01 00:00:10 1970 +0000
1086 1086 | | summary: (10) merge two known; one immediate left, one near right
1087 1087 | |
1088 1088 o | changeset: 9:7010c0af0a35
1089 1089 |\ \ parent: 7:b632bb1b1224
1090 1090 | | | parent: 8:7a0b11f71937
1091 1091 | | | user: test
1092 1092 | | | date: Thu Jan 01 00:00:09 1970 +0000
1093 1093 | | | summary: (9) expand
1094 1094 | | |
1095 1095 | o | changeset: 8:7a0b11f71937
1096 1096 |/| | parent: 0:e6eb3150255d
1097 1097 | ~ | parent: 7:b632bb1b1224
1098 1098 | | user: test
1099 1099 | | date: Thu Jan 01 00:00:08 1970 +0000
1100 1100 | | summary: (8) merge two known; one immediate left, one far right
1101 1101 | /
1102 1102 o | changeset: 7:b632bb1b1224
1103 1103 |\ \ parent: 2:3d9a33b8d1e1
1104 1104 | ~ | parent: 5:4409d547b708
1105 1105 | | user: test
1106 1106 | | date: Thu Jan 01 00:00:07 1970 +0000
1107 1107 | | summary: (7) expand
1108 1108 | /
1109 1109 | o changeset: 6:b105a072e251
1110 1110 |/| parent: 2:3d9a33b8d1e1
1111 1111 | ~ parent: 5:4409d547b708
1112 1112 | user: test
1113 1113 | date: Thu Jan 01 00:00:06 1970 +0000
1114 1114 | summary: (6) merge two known; one immediate left, one far left
1115 1115 |
1116 1116 o changeset: 5:4409d547b708
1117 1117 |\ parent: 3:27eef8ed80b4
1118 1118 | ~ parent: 4:26a8bac39d9f
1119 1119 | user: test
1120 1120 | date: Thu Jan 01 00:00:05 1970 +0000
1121 1121 | summary: (5) expand
1122 1122 |
1123 1123 o changeset: 4:26a8bac39d9f
1124 1124 |\ parent: 1:6db2ef61d156
1125 1125 ~ ~ parent: 3:27eef8ed80b4
1126 1126 user: test
1127 1127 date: Thu Jan 01 00:00:04 1970 +0000
1128 1128 summary: (4) merge two known; one immediate left, one immediate right
1129 1129
1130 1130
1131 1131
1132 1132 Empty revision range - display nothing:
1133 1133 $ hg log -G -r 1..0
1134 1134
1135 1135 $ cd ..
1136 1136
1137 1137 #if no-outer-repo
1138 1138
1139 1139 From outer space:
1140 1140 $ hg log -G -l1 repo
1141 1141 @ changeset: 34:fea3ac5810e0
1142 1142 | tag: tip
1143 1143 ~ parent: 32:d06dffa21a31
1144 1144 user: test
1145 1145 date: Thu Jan 01 00:00:34 1970 +0000
1146 1146 summary: (34) head
1147 1147
1148 1148 $ hg log -G -l1 repo/a
1149 1149 @ changeset: 34:fea3ac5810e0
1150 1150 | tag: tip
1151 1151 ~ parent: 32:d06dffa21a31
1152 1152 user: test
1153 1153 date: Thu Jan 01 00:00:34 1970 +0000
1154 1154 summary: (34) head
1155 1155
1156 1156 $ hg log -G -l1 repo/missing
1157 1157
1158 1158 #endif
1159 1159
1160 1160 File log with revs != cset revs:
1161 1161 $ hg init flog
1162 1162 $ cd flog
1163 1163 $ echo one >one
1164 1164 $ hg add one
1165 1165 $ hg commit -mone
1166 1166 $ echo two >two
1167 1167 $ hg add two
1168 1168 $ hg commit -mtwo
1169 1169 $ echo more >two
1170 1170 $ hg commit -mmore
1171 1171 $ hg log -G two
1172 1172 @ changeset: 2:12c28321755b
1173 1173 | tag: tip
1174 1174 | user: test
1175 1175 | date: Thu Jan 01 00:00:00 1970 +0000
1176 1176 | summary: more
1177 1177 |
1178 1178 o changeset: 1:5ac72c0599bf
1179 1179 | user: test
1180 1180 ~ date: Thu Jan 01 00:00:00 1970 +0000
1181 1181 summary: two
1182 1182
1183 1183
1184 1184 Issue1896: File log with explicit style
1185 1185 $ hg log -G --style=default one
1186 1186 o changeset: 0:3d578b4a1f53
1187 1187 user: test
1188 1188 date: Thu Jan 01 00:00:00 1970 +0000
1189 1189 summary: one
1190 1190
1191 1191 Issue2395: glog --style header and footer
1192 1192 $ hg log -G --style=xml one
1193 1193 <?xml version="1.0"?>
1194 1194 <log>
1195 1195 o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
1196 1196 <author email="test">test</author>
1197 1197 <date>1970-01-01T00:00:00+00:00</date>
1198 1198 <msg xml:space="preserve">one</msg>
1199 1199 </logentry>
1200 1200 </log>
1201 1201
1202 1202 $ cd ..
1203 1203
1204 1204 Incoming and outgoing:
1205 1205
1206 1206 $ hg clone -U -r31 repo repo2
1207 1207 adding changesets
1208 1208 adding manifests
1209 1209 adding file changes
1210 1210 added 31 changesets with 31 changes to 1 files
1211 1211 $ cd repo2
1212 1212
1213 1213 $ hg incoming --graph ../repo
1214 1214 comparing with ../repo
1215 1215 searching for changes
1216 1216 o changeset: 34:fea3ac5810e0
1217 1217 | tag: tip
1218 1218 | parent: 32:d06dffa21a31
1219 1219 | user: test
1220 1220 | date: Thu Jan 01 00:00:34 1970 +0000
1221 1221 | summary: (34) head
1222 1222 |
1223 1223 | o changeset: 33:68608f5145f9
1224 1224 | parent: 18:1aa84d96232a
1225 1225 | user: test
1226 1226 | date: Thu Jan 01 00:00:33 1970 +0000
1227 1227 | summary: (33) head
1228 1228 |
1229 1229 o changeset: 32:d06dffa21a31
1230 1230 | parent: 27:886ed638191b
1231 1231 | parent: 31:621d83e11f67
1232 1232 | user: test
1233 1233 | date: Thu Jan 01 00:00:32 1970 +0000
1234 1234 | summary: (32) expand
1235 1235 |
1236 1236 o changeset: 27:886ed638191b
1237 1237 parent: 21:d42a756af44d
1238 1238 user: test
1239 1239 date: Thu Jan 01 00:00:27 1970 +0000
1240 1240 summary: (27) collapse
1241 1241
1242 1242 $ cd ..
1243 1243
1244 1244 $ hg -R repo outgoing --graph repo2
1245 1245 comparing with repo2
1246 1246 searching for changes
1247 1247 @ changeset: 34:fea3ac5810e0
1248 1248 | tag: tip
1249 1249 | parent: 32:d06dffa21a31
1250 1250 | user: test
1251 1251 | date: Thu Jan 01 00:00:34 1970 +0000
1252 1252 | summary: (34) head
1253 1253 |
1254 1254 | o changeset: 33:68608f5145f9
1255 1255 | parent: 18:1aa84d96232a
1256 1256 | user: test
1257 1257 | date: Thu Jan 01 00:00:33 1970 +0000
1258 1258 | summary: (33) head
1259 1259 |
1260 1260 o changeset: 32:d06dffa21a31
1261 1261 | parent: 27:886ed638191b
1262 1262 | parent: 31:621d83e11f67
1263 1263 | user: test
1264 1264 | date: Thu Jan 01 00:00:32 1970 +0000
1265 1265 | summary: (32) expand
1266 1266 |
1267 1267 o changeset: 27:886ed638191b
1268 1268 parent: 21:d42a756af44d
1269 1269 user: test
1270 1270 date: Thu Jan 01 00:00:27 1970 +0000
1271 1271 summary: (27) collapse
1272 1272
1273 1273
1274 1274 File + limit with revs != cset revs:
1275 1275 $ cd repo
1276 1276 $ touch b
1277 1277 $ hg ci -Aqm0
1278 1278 $ hg log -G -l2 a
1279 1279 o changeset: 34:fea3ac5810e0
1280 1280 | parent: 32:d06dffa21a31
1281 1281 ~ user: test
1282 1282 date: Thu Jan 01 00:00:34 1970 +0000
1283 1283 summary: (34) head
1284 1284
1285 1285 o changeset: 33:68608f5145f9
1286 1286 | parent: 18:1aa84d96232a
1287 1287 ~ user: test
1288 1288 date: Thu Jan 01 00:00:33 1970 +0000
1289 1289 summary: (33) head
1290 1290
1291 1291
1292 1292 File + limit + -ra:b, (b - a) < limit:
1293 1293 $ hg log -G -l3000 -r32:tip a
1294 1294 o changeset: 34:fea3ac5810e0
1295 1295 | parent: 32:d06dffa21a31
1296 1296 | user: test
1297 1297 | date: Thu Jan 01 00:00:34 1970 +0000
1298 1298 | summary: (34) head
1299 1299 |
1300 1300 | o changeset: 33:68608f5145f9
1301 1301 | | parent: 18:1aa84d96232a
1302 1302 | ~ user: test
1303 1303 | date: Thu Jan 01 00:00:33 1970 +0000
1304 1304 | summary: (33) head
1305 1305 |
1306 1306 o changeset: 32:d06dffa21a31
1307 1307 |\ parent: 27:886ed638191b
1308 1308 ~ ~ parent: 31:621d83e11f67
1309 1309 user: test
1310 1310 date: Thu Jan 01 00:00:32 1970 +0000
1311 1311 summary: (32) expand
1312 1312
1313 1313
1314 1314 Point out a common and an uncommon unshown parent
1315 1315
1316 1316 $ hg log -G -r 'rev(8) or rev(9)'
1317 1317 o changeset: 9:7010c0af0a35
1318 1318 |\ parent: 7:b632bb1b1224
1319 1319 | ~ parent: 8:7a0b11f71937
1320 1320 | user: test
1321 1321 | date: Thu Jan 01 00:00:09 1970 +0000
1322 1322 | summary: (9) expand
1323 1323 |
1324 1324 o changeset: 8:7a0b11f71937
1325 1325 |\ parent: 0:e6eb3150255d
1326 1326 ~ ~ parent: 7:b632bb1b1224
1327 1327 user: test
1328 1328 date: Thu Jan 01 00:00:08 1970 +0000
1329 1329 summary: (8) merge two known; one immediate left, one far right
1330 1330
1331 1331
1332 1332 File + limit + -ra:b, b < tip:
1333 1333
1334 1334 $ hg log -G -l1 -r32:34 a
1335 1335 o changeset: 34:fea3ac5810e0
1336 1336 | parent: 32:d06dffa21a31
1337 1337 ~ user: test
1338 1338 date: Thu Jan 01 00:00:34 1970 +0000
1339 1339 summary: (34) head
1340 1340
1341 1341
1342 1342 file(File) + limit + -ra:b, b < tip:
1343 1343
1344 1344 $ hg log -G -l1 -r32:34 -r 'file("a")'
1345 1345 o changeset: 34:fea3ac5810e0
1346 1346 | parent: 32:d06dffa21a31
1347 1347 ~ user: test
1348 1348 date: Thu Jan 01 00:00:34 1970 +0000
1349 1349 summary: (34) head
1350 1350
1351 1351
1352 1352 limit(file(File) and a::b), b < tip:
1353 1353
1354 1354 $ hg log -G -r 'limit(file("a") and 32::34, 1)'
1355 1355 o changeset: 32:d06dffa21a31
1356 1356 |\ parent: 27:886ed638191b
1357 1357 ~ ~ parent: 31:621d83e11f67
1358 1358 user: test
1359 1359 date: Thu Jan 01 00:00:32 1970 +0000
1360 1360 summary: (32) expand
1361 1361
1362 1362
1363 1363 File + limit + -ra:b, b < tip:
1364 1364
1365 1365 $ hg log -G -r 'limit(file("a") and 34::32, 1)'
1366 1366
1367 1367 File + limit + -ra:b, b < tip, (b - a) < limit:
1368 1368
1369 1369 $ hg log -G -l10 -r33:34 a
1370 1370 o changeset: 34:fea3ac5810e0
1371 1371 | parent: 32:d06dffa21a31
1372 1372 ~ user: test
1373 1373 date: Thu Jan 01 00:00:34 1970 +0000
1374 1374 summary: (34) head
1375 1375
1376 1376 o changeset: 33:68608f5145f9
1377 1377 | parent: 18:1aa84d96232a
1378 1378 ~ user: test
1379 1379 date: Thu Jan 01 00:00:33 1970 +0000
1380 1380 summary: (33) head
1381 1381
1382 1382
1383 1383 Do not crash or produce strange graphs if history is buggy
1384 1384
1385 1385 $ hg branch branch
1386 1386 marked working directory as branch branch
1387 1387 (branches are permanent and global, did you want a bookmark?)
1388 1388 $ commit 36 "buggy merge: identical parents" 35 35
1389 1389 $ hg log -G -l5
1390 1390 @ changeset: 36:08a19a744424
1391 1391 | branch: branch
1392 1392 | tag: tip
1393 1393 | parent: 35:9159c3644c5e
1394 1394 | parent: 35:9159c3644c5e
1395 1395 | user: test
1396 1396 | date: Thu Jan 01 00:00:36 1970 +0000
1397 1397 | summary: (36) buggy merge: identical parents
1398 1398 |
1399 1399 o changeset: 35:9159c3644c5e
1400 1400 | user: test
1401 1401 | date: Thu Jan 01 00:00:00 1970 +0000
1402 1402 | summary: 0
1403 1403 |
1404 1404 o changeset: 34:fea3ac5810e0
1405 1405 | parent: 32:d06dffa21a31
1406 1406 | user: test
1407 1407 | date: Thu Jan 01 00:00:34 1970 +0000
1408 1408 | summary: (34) head
1409 1409 |
1410 1410 | o changeset: 33:68608f5145f9
1411 1411 | | parent: 18:1aa84d96232a
1412 1412 | ~ user: test
1413 1413 | date: Thu Jan 01 00:00:33 1970 +0000
1414 1414 | summary: (33) head
1415 1415 |
1416 1416 o changeset: 32:d06dffa21a31
1417 1417 |\ parent: 27:886ed638191b
1418 1418 ~ ~ parent: 31:621d83e11f67
1419 1419 user: test
1420 1420 date: Thu Jan 01 00:00:32 1970 +0000
1421 1421 summary: (32) expand
1422 1422
1423 1423
1424 1424 Test log -G options
1425 1425
1426 1426 $ testlog() {
1427 1427 > hg log -G --print-revset "$@"
1428 1428 > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \
1429 1429 > | sed 's/.*nodetag/nodetag/' > log.nodes
1430 1430 > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
1431 1431 > | sed 's/.*nodetag/nodetag/' > glog.nodes
1432 1432 > (cmp log.nodes glog.nodes || diff -u log.nodes glog.nodes) \
1433 1433 > | grep '^[-+@ ]' || :
1434 1434 > }
1435 1435
1436 1436 glog always reorders nodes which explains the difference with log
1437 1437
1438 1438 $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31
1439 1439 ['27', '25', '21', '34', '32', '31']
1440 1440 []
1441 1441 --- log.nodes * (glob)
1442 1442 +++ glog.nodes * (glob)
1443 1443 @@ -1,6 +1,6 @@
1444 1444 -nodetag 27
1445 1445 -nodetag 25
1446 1446 -nodetag 21
1447 1447 nodetag 34
1448 1448 nodetag 32
1449 1449 nodetag 31
1450 1450 +nodetag 27
1451 1451 +nodetag 25
1452 1452 +nodetag 21
1453 1453 $ testlog -u test -u not-a-user
1454 1454 []
1455 1455 (group
1456 1456 (group
1457 1457 (or
1458 1458 (list
1459 1459 (func
1460 1460 ('symbol', 'user')
1461 1461 ('string', 'test'))
1462 1462 (func
1463 1463 ('symbol', 'user')
1464 1464 ('string', 'not-a-user'))))))
1465 1465 $ testlog -b not-a-branch
1466 1466 abort: unknown revision 'not-a-branch'!
1467 1467 abort: unknown revision 'not-a-branch'!
1468 1468 abort: unknown revision 'not-a-branch'!
1469 1469 $ testlog -b 35 -b 36 --only-branch branch
1470 1470 []
1471 1471 (group
1472 1472 (group
1473 1473 (or
1474 1474 (list
1475 1475 (func
1476 1476 ('symbol', 'branch')
1477 1477 ('string', 'default'))
1478 1478 (func
1479 1479 ('symbol', 'branch')
1480 1480 ('string', 'branch'))
1481 1481 (func
1482 1482 ('symbol', 'branch')
1483 1483 ('string', 'branch'))))))
1484 1484 $ testlog -k expand -k merge
1485 1485 []
1486 1486 (group
1487 1487 (group
1488 1488 (or
1489 1489 (list
1490 1490 (func
1491 1491 ('symbol', 'keyword')
1492 1492 ('string', 'expand'))
1493 1493 (func
1494 1494 ('symbol', 'keyword')
1495 1495 ('string', 'merge'))))))
1496 1496 $ testlog --only-merges
1497 1497 []
1498 1498 (group
1499 1499 (func
1500 1500 ('symbol', 'merge')
1501 1501 None))
1502 1502 $ testlog --no-merges
1503 1503 []
1504 1504 (group
1505 1505 (not
1506 1506 (func
1507 1507 ('symbol', 'merge')
1508 1508 None)))
1509 1509 $ testlog --date '2 0 to 4 0'
1510 1510 []
1511 1511 (group
1512 1512 (func
1513 1513 ('symbol', 'date')
1514 1514 ('string', '2 0 to 4 0')))
1515 1515 $ hg log -G -d 'brace ) in a date'
1516 1516 hg: parse error: invalid date: 'brace ) in a date'
1517 1517 [255]
1518 1518 $ testlog --prune 31 --prune 32
1519 1519 []
1520 1520 (group
1521 1521 (group
1522 1522 (and
1523 1523 (not
1524 1524 (group
1525 1525 (or
1526 1526 (list
1527 1527 ('string', '31')
1528 1528 (func
1529 1529 ('symbol', 'ancestors')
1530 1530 ('string', '31'))))))
1531 1531 (not
1532 1532 (group
1533 1533 (or
1534 1534 (list
1535 1535 ('string', '32')
1536 1536 (func
1537 1537 ('symbol', 'ancestors')
1538 1538 ('string', '32')))))))))
1539 1539
1540 1540 Dedicated repo for --follow and paths filtering. The g is crafted to
1541 1541 have 2 filelog topological heads in a linear changeset graph.
1542 1542
1543 1543 $ cd ..
1544 1544 $ hg init follow
1545 1545 $ cd follow
1546 1546 $ testlog --follow
1547 1547 []
1548 1548 []
1549 1549 $ testlog -rnull
1550 1550 ['null']
1551 1551 []
1552 1552 $ echo a > a
1553 1553 $ echo aa > aa
1554 1554 $ echo f > f
1555 1555 $ hg ci -Am "add a" a aa f
1556 1556 $ hg cp a b
1557 1557 $ hg cp f g
1558 1558 $ hg ci -m "copy a b"
1559 1559 $ mkdir dir
1560 1560 $ hg mv b dir
1561 1561 $ echo g >> g
1562 1562 $ echo f >> f
1563 1563 $ hg ci -m "mv b dir/b"
1564 1564 $ hg mv a b
1565 1565 $ hg cp -f f g
1566 1566 $ echo a > d
1567 1567 $ hg add d
1568 1568 $ hg ci -m "mv a b; add d"
1569 1569 $ hg mv dir/b e
1570 1570 $ hg ci -m "mv dir/b e"
1571 1571 $ hg log -G --template '({rev}) {desc|firstline}\n'
1572 1572 @ (4) mv dir/b e
1573 1573 |
1574 1574 o (3) mv a b; add d
1575 1575 |
1576 1576 o (2) mv b dir/b
1577 1577 |
1578 1578 o (1) copy a b
1579 1579 |
1580 1580 o (0) add a
1581 1581
1582 1582
1583 1583 $ testlog a
1584 1584 []
1585 1585 (group
1586 1586 (group
1587 1587 (func
1588 1588 ('symbol', 'filelog')
1589 1589 ('string', 'a'))))
1590 1590 $ testlog a b
1591 1591 []
1592 1592 (group
1593 1593 (group
1594 1594 (or
1595 1595 (list
1596 1596 (func
1597 1597 ('symbol', 'filelog')
1598 1598 ('string', 'a'))
1599 1599 (func
1600 1600 ('symbol', 'filelog')
1601 1601 ('string', 'b'))))))
1602 1602
1603 1603 Test falling back to slow path for non-existing files
1604 1604
1605 1605 $ testlog a c
1606 1606 []
1607 1607 (group
1608 1608 (func
1609 1609 ('symbol', '_matchfiles')
1610 1610 (list
1611 1611 ('string', 'r:')
1612 1612 ('string', 'd:relpath')
1613 1613 ('string', 'p:a')
1614 1614 ('string', 'p:c'))))
1615 1615
1616 1616 Test multiple --include/--exclude/paths
1617 1617
1618 1618 $ testlog --include a --include e --exclude b --exclude e a e
1619 1619 []
1620 1620 (group
1621 1621 (func
1622 1622 ('symbol', '_matchfiles')
1623 1623 (list
1624 1624 ('string', 'r:')
1625 1625 ('string', 'd:relpath')
1626 1626 ('string', 'p:a')
1627 1627 ('string', 'p:e')
1628 1628 ('string', 'i:a')
1629 1629 ('string', 'i:e')
1630 1630 ('string', 'x:b')
1631 1631 ('string', 'x:e'))))
1632 1632
1633 1633 Test glob expansion of pats
1634 1634
1635 1635 $ expandglobs=`$PYTHON -c "import mercurial.util; \
1636 > print mercurial.util.expandglobs and 'true' or 'false'"`
1636 > print(mercurial.util.expandglobs and 'true' or 'false')"`
1637 1637 $ if [ $expandglobs = "true" ]; then
1638 1638 > testlog 'a*';
1639 1639 > else
1640 1640 > testlog a*;
1641 1641 > fi;
1642 1642 []
1643 1643 (group
1644 1644 (group
1645 1645 (func
1646 1646 ('symbol', 'filelog')
1647 1647 ('string', 'aa'))))
1648 1648
1649 1649 Test --follow on a non-existent directory
1650 1650
1651 1651 $ testlog -f dir
1652 1652 abort: cannot follow file not in parent revision: "dir"
1653 1653 abort: cannot follow file not in parent revision: "dir"
1654 1654 abort: cannot follow file not in parent revision: "dir"
1655 1655
1656 1656 Test --follow on a directory
1657 1657
1658 1658 $ hg up -q '.^'
1659 1659 $ testlog -f dir
1660 1660 []
1661 1661 (group
1662 1662 (and
1663 1663 (func
1664 1664 ('symbol', 'ancestors')
1665 1665 ('symbol', '.'))
1666 1666 (func
1667 1667 ('symbol', '_matchfiles')
1668 1668 (list
1669 1669 ('string', 'r:')
1670 1670 ('string', 'd:relpath')
1671 1671 ('string', 'p:dir')))))
1672 1672 $ hg up -q tip
1673 1673
1674 1674 Test --follow on file not in parent revision
1675 1675
1676 1676 $ testlog -f a
1677 1677 abort: cannot follow file not in parent revision: "a"
1678 1678 abort: cannot follow file not in parent revision: "a"
1679 1679 abort: cannot follow file not in parent revision: "a"
1680 1680
1681 1681 Test --follow and patterns
1682 1682
1683 1683 $ testlog -f 'glob:*'
1684 1684 []
1685 1685 (group
1686 1686 (and
1687 1687 (func
1688 1688 ('symbol', 'ancestors')
1689 1689 ('symbol', '.'))
1690 1690 (func
1691 1691 ('symbol', '_matchfiles')
1692 1692 (list
1693 1693 ('string', 'r:')
1694 1694 ('string', 'd:relpath')
1695 1695 ('string', 'p:glob:*')))))
1696 1696
1697 1697 Test --follow on a single rename
1698 1698
1699 1699 $ hg up -q 2
1700 1700 $ testlog -f a
1701 1701 []
1702 1702 (group
1703 1703 (group
1704 1704 (func
1705 1705 ('symbol', 'follow')
1706 1706 ('string', 'a'))))
1707 1707
1708 1708 Test --follow and multiple renames
1709 1709
1710 1710 $ hg up -q tip
1711 1711 $ testlog -f e
1712 1712 []
1713 1713 (group
1714 1714 (group
1715 1715 (func
1716 1716 ('symbol', 'follow')
1717 1717 ('string', 'e'))))
1718 1718
1719 1719 Test --follow and multiple filelog heads
1720 1720
1721 1721 $ hg up -q 2
1722 1722 $ testlog -f g
1723 1723 []
1724 1724 (group
1725 1725 (group
1726 1726 (func
1727 1727 ('symbol', 'follow')
1728 1728 ('string', 'g'))))
1729 1729 $ cat log.nodes
1730 1730 nodetag 2
1731 1731 nodetag 1
1732 1732 nodetag 0
1733 1733 $ hg up -q tip
1734 1734 $ testlog -f g
1735 1735 []
1736 1736 (group
1737 1737 (group
1738 1738 (func
1739 1739 ('symbol', 'follow')
1740 1740 ('string', 'g'))))
1741 1741 $ cat log.nodes
1742 1742 nodetag 3
1743 1743 nodetag 2
1744 1744 nodetag 0
1745 1745
1746 1746 Test --follow and multiple files
1747 1747
1748 1748 $ testlog -f g e
1749 1749 []
1750 1750 (group
1751 1751 (group
1752 1752 (or
1753 1753 (list
1754 1754 (func
1755 1755 ('symbol', 'follow')
1756 1756 ('string', 'g'))
1757 1757 (func
1758 1758 ('symbol', 'follow')
1759 1759 ('string', 'e'))))))
1760 1760 $ cat log.nodes
1761 1761 nodetag 4
1762 1762 nodetag 3
1763 1763 nodetag 2
1764 1764 nodetag 1
1765 1765 nodetag 0
1766 1766
1767 1767 Test --follow null parent
1768 1768
1769 1769 $ hg up -q null
1770 1770 $ testlog -f
1771 1771 []
1772 1772 []
1773 1773
1774 1774 Test --follow-first
1775 1775
1776 1776 $ hg up -q 3
1777 1777 $ echo ee > e
1778 1778 $ hg ci -Am "add another e" e
1779 1779 created new head
1780 1780 $ hg merge --tool internal:other 4
1781 1781 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
1782 1782 (branch merge, don't forget to commit)
1783 1783 $ echo merge > e
1784 1784 $ hg ci -m "merge 5 and 4"
1785 1785 $ testlog --follow-first
1786 1786 []
1787 1787 (group
1788 1788 (func
1789 1789 ('symbol', '_firstancestors')
1790 1790 (func
1791 1791 ('symbol', 'rev')
1792 1792 ('symbol', '6'))))
1793 1793
1794 1794 Cannot compare with log --follow-first FILE as it never worked
1795 1795
1796 1796 $ hg log -G --print-revset --follow-first e
1797 1797 []
1798 1798 (group
1799 1799 (group
1800 1800 (func
1801 1801 ('symbol', '_followfirst')
1802 1802 ('string', 'e'))))
1803 1803 $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
1804 1804 @ 6 merge 5 and 4
1805 1805 |\
1806 1806 | ~
1807 1807 o 5 add another e
1808 1808 |
1809 1809 ~
1810 1810
1811 1811 Test --copies
1812 1812
1813 1813 $ hg log -G --copies --template "{rev} {desc|firstline} \
1814 1814 > copies: {file_copies_switch}\n"
1815 1815 @ 6 merge 5 and 4 copies:
1816 1816 |\
1817 1817 | o 5 add another e copies:
1818 1818 | |
1819 1819 o | 4 mv dir/b e copies: e (dir/b)
1820 1820 |/
1821 1821 o 3 mv a b; add d copies: b (a)g (f)
1822 1822 |
1823 1823 o 2 mv b dir/b copies: dir/b (b)
1824 1824 |
1825 1825 o 1 copy a b copies: b (a)g (f)
1826 1826 |
1827 1827 o 0 add a copies:
1828 1828
1829 1829 Test "set:..." and parent revision
1830 1830
1831 1831 $ hg up -q 4
1832 1832 $ testlog "set:copied()"
1833 1833 []
1834 1834 (group
1835 1835 (func
1836 1836 ('symbol', '_matchfiles')
1837 1837 (list
1838 1838 ('string', 'r:')
1839 1839 ('string', 'd:relpath')
1840 1840 ('string', 'p:set:copied()'))))
1841 1841 $ testlog --include "set:copied()"
1842 1842 []
1843 1843 (group
1844 1844 (func
1845 1845 ('symbol', '_matchfiles')
1846 1846 (list
1847 1847 ('string', 'r:')
1848 1848 ('string', 'd:relpath')
1849 1849 ('string', 'i:set:copied()'))))
1850 1850 $ testlog -r "sort(file('set:copied()'), -rev)"
1851 1851 ["sort(file('set:copied()'), -rev)"]
1852 1852 []
1853 1853
1854 1854 Test --removed
1855 1855
1856 1856 $ testlog --removed
1857 1857 []
1858 1858 []
1859 1859 $ testlog --removed a
1860 1860 []
1861 1861 (group
1862 1862 (func
1863 1863 ('symbol', '_matchfiles')
1864 1864 (list
1865 1865 ('string', 'r:')
1866 1866 ('string', 'd:relpath')
1867 1867 ('string', 'p:a'))))
1868 1868 $ testlog --removed --follow a
1869 1869 []
1870 1870 (group
1871 1871 (and
1872 1872 (func
1873 1873 ('symbol', 'ancestors')
1874 1874 ('symbol', '.'))
1875 1875 (func
1876 1876 ('symbol', '_matchfiles')
1877 1877 (list
1878 1878 ('string', 'r:')
1879 1879 ('string', 'd:relpath')
1880 1880 ('string', 'p:a')))))
1881 1881
1882 1882 Test --patch and --stat with --follow and --follow-first
1883 1883
1884 1884 $ hg up -q 3
1885 1885 $ hg log -G --git --patch b
1886 1886 o changeset: 1:216d4c92cf98
1887 1887 | user: test
1888 1888 ~ date: Thu Jan 01 00:00:00 1970 +0000
1889 1889 summary: copy a b
1890 1890
1891 1891 diff --git a/a b/b
1892 1892 copy from a
1893 1893 copy to b
1894 1894
1895 1895
1896 1896 $ hg log -G --git --stat b
1897 1897 o changeset: 1:216d4c92cf98
1898 1898 | user: test
1899 1899 ~ date: Thu Jan 01 00:00:00 1970 +0000
1900 1900 summary: copy a b
1901 1901
1902 1902 b | 0
1903 1903 1 files changed, 0 insertions(+), 0 deletions(-)
1904 1904
1905 1905
1906 1906 $ hg log -G --git --patch --follow b
1907 1907 o changeset: 1:216d4c92cf98
1908 1908 | user: test
1909 1909 | date: Thu Jan 01 00:00:00 1970 +0000
1910 1910 | summary: copy a b
1911 1911 |
1912 1912 | diff --git a/a b/b
1913 1913 | copy from a
1914 1914 | copy to b
1915 1915 |
1916 1916 o changeset: 0:f8035bb17114
1917 1917 user: test
1918 1918 date: Thu Jan 01 00:00:00 1970 +0000
1919 1919 summary: add a
1920 1920
1921 1921 diff --git a/a b/a
1922 1922 new file mode 100644
1923 1923 --- /dev/null
1924 1924 +++ b/a
1925 1925 @@ -0,0 +1,1 @@
1926 1926 +a
1927 1927
1928 1928
1929 1929 $ hg log -G --git --stat --follow b
1930 1930 o changeset: 1:216d4c92cf98
1931 1931 | user: test
1932 1932 | date: Thu Jan 01 00:00:00 1970 +0000
1933 1933 | summary: copy a b
1934 1934 |
1935 1935 | b | 0
1936 1936 | 1 files changed, 0 insertions(+), 0 deletions(-)
1937 1937 |
1938 1938 o changeset: 0:f8035bb17114
1939 1939 user: test
1940 1940 date: Thu Jan 01 00:00:00 1970 +0000
1941 1941 summary: add a
1942 1942
1943 1943 a | 1 +
1944 1944 1 files changed, 1 insertions(+), 0 deletions(-)
1945 1945
1946 1946
1947 1947 $ hg up -q 6
1948 1948 $ hg log -G --git --patch --follow-first e
1949 1949 @ changeset: 6:fc281d8ff18d
1950 1950 |\ tag: tip
1951 1951 | ~ parent: 5:99b31f1c2782
1952 1952 | parent: 4:17d952250a9d
1953 1953 | user: test
1954 1954 | date: Thu Jan 01 00:00:00 1970 +0000
1955 1955 | summary: merge 5 and 4
1956 1956 |
1957 1957 | diff --git a/e b/e
1958 1958 | --- a/e
1959 1959 | +++ b/e
1960 1960 | @@ -1,1 +1,1 @@
1961 1961 | -ee
1962 1962 | +merge
1963 1963 |
1964 1964 o changeset: 5:99b31f1c2782
1965 1965 | parent: 3:5918b8d165d1
1966 1966 ~ user: test
1967 1967 date: Thu Jan 01 00:00:00 1970 +0000
1968 1968 summary: add another e
1969 1969
1970 1970 diff --git a/e b/e
1971 1971 new file mode 100644
1972 1972 --- /dev/null
1973 1973 +++ b/e
1974 1974 @@ -0,0 +1,1 @@
1975 1975 +ee
1976 1976
1977 1977
1978 1978 Test old-style --rev
1979 1979
1980 1980 $ hg tag 'foo-bar'
1981 1981 $ testlog -r 'foo-bar'
1982 1982 ['foo-bar']
1983 1983 []
1984 1984
1985 1985 Test --follow and forward --rev
1986 1986
1987 1987 $ hg up -q 6
1988 1988 $ echo g > g
1989 1989 $ hg ci -Am 'add g' g
1990 1990 created new head
1991 1991 $ hg up -q 2
1992 1992 $ hg log -G --template "{rev} {desc|firstline}\n"
1993 1993 o 8 add g
1994 1994 |
1995 1995 | o 7 Added tag foo-bar for changeset fc281d8ff18d
1996 1996 |/
1997 1997 o 6 merge 5 and 4
1998 1998 |\
1999 1999 | o 5 add another e
2000 2000 | |
2001 2001 o | 4 mv dir/b e
2002 2002 |/
2003 2003 o 3 mv a b; add d
2004 2004 |
2005 2005 @ 2 mv b dir/b
2006 2006 |
2007 2007 o 1 copy a b
2008 2008 |
2009 2009 o 0 add a
2010 2010
2011 2011 $ hg archive -r 7 archive
2012 2012 $ grep changessincelatesttag archive/.hg_archival.txt
2013 2013 changessincelatesttag: 1
2014 2014 $ rm -r archive
2015 2015
2016 2016 changessincelatesttag with no prior tag
2017 2017 $ hg archive -r 4 archive
2018 2018 $ grep changessincelatesttag archive/.hg_archival.txt
2019 2019 changessincelatesttag: 5
2020 2020
2021 2021 $ hg export 'all()'
2022 2022 # HG changeset patch
2023 2023 # User test
2024 2024 # Date 0 0
2025 2025 # Thu Jan 01 00:00:00 1970 +0000
2026 2026 # Node ID f8035bb17114da16215af3436ec5222428ace8ee
2027 2027 # Parent 0000000000000000000000000000000000000000
2028 2028 add a
2029 2029
2030 2030 diff -r 000000000000 -r f8035bb17114 a
2031 2031 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2032 2032 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2033 2033 @@ -0,0 +1,1 @@
2034 2034 +a
2035 2035 diff -r 000000000000 -r f8035bb17114 aa
2036 2036 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2037 2037 +++ b/aa Thu Jan 01 00:00:00 1970 +0000
2038 2038 @@ -0,0 +1,1 @@
2039 2039 +aa
2040 2040 diff -r 000000000000 -r f8035bb17114 f
2041 2041 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2042 2042 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2043 2043 @@ -0,0 +1,1 @@
2044 2044 +f
2045 2045 # HG changeset patch
2046 2046 # User test
2047 2047 # Date 0 0
2048 2048 # Thu Jan 01 00:00:00 1970 +0000
2049 2049 # Node ID 216d4c92cf98ff2b4641d508b76b529f3d424c92
2050 2050 # Parent f8035bb17114da16215af3436ec5222428ace8ee
2051 2051 copy a b
2052 2052
2053 2053 diff -r f8035bb17114 -r 216d4c92cf98 b
2054 2054 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2055 2055 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2056 2056 @@ -0,0 +1,1 @@
2057 2057 +a
2058 2058 diff -r f8035bb17114 -r 216d4c92cf98 g
2059 2059 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2060 2060 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2061 2061 @@ -0,0 +1,1 @@
2062 2062 +f
2063 2063 # HG changeset patch
2064 2064 # User test
2065 2065 # Date 0 0
2066 2066 # Thu Jan 01 00:00:00 1970 +0000
2067 2067 # Node ID bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2068 2068 # Parent 216d4c92cf98ff2b4641d508b76b529f3d424c92
2069 2069 mv b dir/b
2070 2070
2071 2071 diff -r 216d4c92cf98 -r bb573313a9e8 b
2072 2072 --- a/b Thu Jan 01 00:00:00 1970 +0000
2073 2073 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2074 2074 @@ -1,1 +0,0 @@
2075 2075 -a
2076 2076 diff -r 216d4c92cf98 -r bb573313a9e8 dir/b
2077 2077 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2078 2078 +++ b/dir/b Thu Jan 01 00:00:00 1970 +0000
2079 2079 @@ -0,0 +1,1 @@
2080 2080 +a
2081 2081 diff -r 216d4c92cf98 -r bb573313a9e8 f
2082 2082 --- a/f Thu Jan 01 00:00:00 1970 +0000
2083 2083 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2084 2084 @@ -1,1 +1,2 @@
2085 2085 f
2086 2086 +f
2087 2087 diff -r 216d4c92cf98 -r bb573313a9e8 g
2088 2088 --- a/g Thu Jan 01 00:00:00 1970 +0000
2089 2089 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2090 2090 @@ -1,1 +1,2 @@
2091 2091 f
2092 2092 +g
2093 2093 # HG changeset patch
2094 2094 # User test
2095 2095 # Date 0 0
2096 2096 # Thu Jan 01 00:00:00 1970 +0000
2097 2097 # Node ID 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2098 2098 # Parent bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2099 2099 mv a b; add d
2100 2100
2101 2101 diff -r bb573313a9e8 -r 5918b8d165d1 a
2102 2102 --- a/a Thu Jan 01 00:00:00 1970 +0000
2103 2103 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2104 2104 @@ -1,1 +0,0 @@
2105 2105 -a
2106 2106 diff -r bb573313a9e8 -r 5918b8d165d1 b
2107 2107 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2108 2108 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2109 2109 @@ -0,0 +1,1 @@
2110 2110 +a
2111 2111 diff -r bb573313a9e8 -r 5918b8d165d1 d
2112 2112 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2113 2113 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2114 2114 @@ -0,0 +1,1 @@
2115 2115 +a
2116 2116 diff -r bb573313a9e8 -r 5918b8d165d1 g
2117 2117 --- a/g Thu Jan 01 00:00:00 1970 +0000
2118 2118 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2119 2119 @@ -1,2 +1,2 @@
2120 2120 f
2121 2121 -g
2122 2122 +f
2123 2123 # HG changeset patch
2124 2124 # User test
2125 2125 # Date 0 0
2126 2126 # Thu Jan 01 00:00:00 1970 +0000
2127 2127 # Node ID 17d952250a9d03cc3dc77b199ab60e959b9b0260
2128 2128 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2129 2129 mv dir/b e
2130 2130
2131 2131 diff -r 5918b8d165d1 -r 17d952250a9d dir/b
2132 2132 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2133 2133 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2134 2134 @@ -1,1 +0,0 @@
2135 2135 -a
2136 2136 diff -r 5918b8d165d1 -r 17d952250a9d e
2137 2137 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2138 2138 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2139 2139 @@ -0,0 +1,1 @@
2140 2140 +a
2141 2141 # HG changeset patch
2142 2142 # User test
2143 2143 # Date 0 0
2144 2144 # Thu Jan 01 00:00:00 1970 +0000
2145 2145 # Node ID 99b31f1c2782e2deb1723cef08930f70fc84b37b
2146 2146 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2147 2147 add another e
2148 2148
2149 2149 diff -r 5918b8d165d1 -r 99b31f1c2782 e
2150 2150 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2151 2151 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2152 2152 @@ -0,0 +1,1 @@
2153 2153 +ee
2154 2154 # HG changeset patch
2155 2155 # User test
2156 2156 # Date 0 0
2157 2157 # Thu Jan 01 00:00:00 1970 +0000
2158 2158 # Node ID fc281d8ff18d999ad6497b3d27390bcd695dcc73
2159 2159 # Parent 99b31f1c2782e2deb1723cef08930f70fc84b37b
2160 2160 # Parent 17d952250a9d03cc3dc77b199ab60e959b9b0260
2161 2161 merge 5 and 4
2162 2162
2163 2163 diff -r 99b31f1c2782 -r fc281d8ff18d dir/b
2164 2164 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2165 2165 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2166 2166 @@ -1,1 +0,0 @@
2167 2167 -a
2168 2168 diff -r 99b31f1c2782 -r fc281d8ff18d e
2169 2169 --- a/e Thu Jan 01 00:00:00 1970 +0000
2170 2170 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2171 2171 @@ -1,1 +1,1 @@
2172 2172 -ee
2173 2173 +merge
2174 2174 # HG changeset patch
2175 2175 # User test
2176 2176 # Date 0 0
2177 2177 # Thu Jan 01 00:00:00 1970 +0000
2178 2178 # Node ID 02dbb8e276b8ab7abfd07cab50c901647e75c2dd
2179 2179 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2180 2180 Added tag foo-bar for changeset fc281d8ff18d
2181 2181
2182 2182 diff -r fc281d8ff18d -r 02dbb8e276b8 .hgtags
2183 2183 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2184 2184 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
2185 2185 @@ -0,0 +1,1 @@
2186 2186 +fc281d8ff18d999ad6497b3d27390bcd695dcc73 foo-bar
2187 2187 # HG changeset patch
2188 2188 # User test
2189 2189 # Date 0 0
2190 2190 # Thu Jan 01 00:00:00 1970 +0000
2191 2191 # Node ID 24c2e826ddebf80f9dcd60b856bdb8e6715c5449
2192 2192 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2193 2193 add g
2194 2194
2195 2195 diff -r fc281d8ff18d -r 24c2e826ddeb g
2196 2196 --- a/g Thu Jan 01 00:00:00 1970 +0000
2197 2197 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2198 2198 @@ -1,2 +1,1 @@
2199 2199 -f
2200 2200 -f
2201 2201 +g
2202 2202 $ testlog --follow -r6 -r8 -r5 -r7 -r4
2203 2203 ['6', '8', '5', '7', '4']
2204 2204 (group
2205 2205 (func
2206 2206 ('symbol', 'descendants')
2207 2207 (func
2208 2208 ('symbol', 'rev')
2209 2209 ('symbol', '6'))))
2210 2210
2211 2211 Test --follow-first and forward --rev
2212 2212
2213 2213 $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
2214 2214 ['6', '8', '5', '7', '4']
2215 2215 (group
2216 2216 (func
2217 2217 ('symbol', '_firstdescendants')
2218 2218 (func
2219 2219 ('symbol', 'rev')
2220 2220 ('symbol', '6'))))
2221 2221 --- log.nodes * (glob)
2222 2222 +++ glog.nodes * (glob)
2223 2223 @@ -1,3 +1,3 @@
2224 2224 -nodetag 6
2225 2225 nodetag 8
2226 2226 nodetag 7
2227 2227 +nodetag 6
2228 2228
2229 2229 Test --follow and backward --rev
2230 2230
2231 2231 $ testlog --follow -r6 -r5 -r7 -r8 -r4
2232 2232 ['6', '5', '7', '8', '4']
2233 2233 (group
2234 2234 (func
2235 2235 ('symbol', 'ancestors')
2236 2236 (func
2237 2237 ('symbol', 'rev')
2238 2238 ('symbol', '6'))))
2239 2239
2240 2240 Test --follow-first and backward --rev
2241 2241
2242 2242 $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
2243 2243 ['6', '5', '7', '8', '4']
2244 2244 (group
2245 2245 (func
2246 2246 ('symbol', '_firstancestors')
2247 2247 (func
2248 2248 ('symbol', 'rev')
2249 2249 ('symbol', '6'))))
2250 2250
2251 2251 Test --follow with --rev of graphlog extension
2252 2252
2253 2253 $ hg --config extensions.graphlog= glog -qfr1
2254 2254 o 1:216d4c92cf98
2255 2255 |
2256 2256 o 0:f8035bb17114
2257 2257
2258 2258
2259 2259 Test subdir
2260 2260
2261 2261 $ hg up -q 3
2262 2262 $ cd dir
2263 2263 $ testlog .
2264 2264 []
2265 2265 (group
2266 2266 (func
2267 2267 ('symbol', '_matchfiles')
2268 2268 (list
2269 2269 ('string', 'r:')
2270 2270 ('string', 'd:relpath')
2271 2271 ('string', 'p:.'))))
2272 2272 $ testlog ../b
2273 2273 []
2274 2274 (group
2275 2275 (group
2276 2276 (func
2277 2277 ('symbol', 'filelog')
2278 2278 ('string', '../b'))))
2279 2279 $ testlog -f ../b
2280 2280 []
2281 2281 (group
2282 2282 (group
2283 2283 (func
2284 2284 ('symbol', 'follow')
2285 2285 ('string', 'b'))))
2286 2286 $ cd ..
2287 2287
2288 2288 Test --hidden
2289 2289 (enable obsolete)
2290 2290
2291 2291 $ cat >> $HGRCPATH << EOF
2292 2292 > [experimental]
2293 2293 > evolution=createmarkers
2294 2294 > EOF
2295 2295
2296 2296 $ hg debugobsolete `hg id --debug -i -r 8`
2297 2297 obsoleted 1 changesets
2298 2298 $ testlog
2299 2299 []
2300 2300 []
2301 2301 $ testlog --hidden
2302 2302 []
2303 2303 []
2304 2304 $ hg log -G --template '{rev} {desc}\n'
2305 2305 o 7 Added tag foo-bar for changeset fc281d8ff18d
2306 2306 |
2307 2307 o 6 merge 5 and 4
2308 2308 |\
2309 2309 | o 5 add another e
2310 2310 | |
2311 2311 o | 4 mv dir/b e
2312 2312 |/
2313 2313 @ 3 mv a b; add d
2314 2314 |
2315 2315 o 2 mv b dir/b
2316 2316 |
2317 2317 o 1 copy a b
2318 2318 |
2319 2319 o 0 add a
2320 2320
2321 2321
2322 2322 A template without trailing newline should do something sane
2323 2323
2324 2324 $ hg log -G -r ::2 --template '{rev} {desc}'
2325 2325 o 2 mv b dir/b
2326 2326 |
2327 2327 o 1 copy a b
2328 2328 |
2329 2329 o 0 add a
2330 2330
2331 2331
2332 2332 Extra newlines must be preserved
2333 2333
2334 2334 $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n'
2335 2335 o
2336 2336 | 2 mv b dir/b
2337 2337 |
2338 2338 o
2339 2339 | 1 copy a b
2340 2340 |
2341 2341 o
2342 2342 0 add a
2343 2343
2344 2344
2345 2345 The almost-empty template should do something sane too ...
2346 2346
2347 2347 $ hg log -G -r ::2 --template '\n'
2348 2348 o
2349 2349 |
2350 2350 o
2351 2351 |
2352 2352 o
2353 2353
2354 2354
2355 2355 issue3772
2356 2356
2357 2357 $ hg log -G -r :null
2358 2358 o changeset: 0:f8035bb17114
2359 2359 | user: test
2360 2360 | date: Thu Jan 01 00:00:00 1970 +0000
2361 2361 | summary: add a
2362 2362 |
2363 2363 o changeset: -1:000000000000
2364 2364 user:
2365 2365 date: Thu Jan 01 00:00:00 1970 +0000
2366 2366
2367 2367 $ hg log -G -r null:null
2368 2368 o changeset: -1:000000000000
2369 2369 user:
2370 2370 date: Thu Jan 01 00:00:00 1970 +0000
2371 2371
2372 2372
2373 2373 should not draw line down to null due to the magic of fullreposet
2374 2374
2375 2375 $ hg log -G -r 'all()' | tail -6
2376 2376 |
2377 2377 o changeset: 0:f8035bb17114
2378 2378 user: test
2379 2379 date: Thu Jan 01 00:00:00 1970 +0000
2380 2380 summary: add a
2381 2381
2382 2382
2383 2383 $ hg log -G -r 'branch(default)' | tail -6
2384 2384 |
2385 2385 o changeset: 0:f8035bb17114
2386 2386 user: test
2387 2387 date: Thu Jan 01 00:00:00 1970 +0000
2388 2388 summary: add a
2389 2389
2390 2390
2391 2391 working-directory revision
2392 2392
2393 2393 $ hg log -G -qr '. + wdir()'
2394 2394 o 2147483647:ffffffffffff
2395 2395 |
2396 2396 @ 3:5918b8d165d1
2397 2397 |
2398 2398 ~
2399 2399
2400 2400 node template with changeset_printer:
2401 2401
2402 2402 $ hg log -Gqr 5:7 --config ui.graphnodetemplate='"{rev}"'
2403 2403 7 7:02dbb8e276b8
2404 2404 |
2405 2405 6 6:fc281d8ff18d
2406 2406 |\
2407 2407 | ~
2408 2408 5 5:99b31f1c2782
2409 2409 |
2410 2410 ~
2411 2411
2412 2412 node template with changeset_templater (shared cache variable):
2413 2413
2414 2414 $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \
2415 2415 > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
2416 2416 o 7 foo-bar+1
2417 2417 |
2418 2418 # 6 foo-bar+0
2419 2419 |\
2420 2420 | ~
2421 2421 o 5 null+5
2422 2422 |
2423 2423 ~
2424 2424
2425 2425 label() should just work in node template:
2426 2426
2427 2427 $ hg log -Gqr 7 --config extensions.color= --color=debug \
2428 2428 > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}'
2429 2429 [branch.default|7] [log.node|7:02dbb8e276b8]
2430 2430 |
2431 2431 ~
2432 2432
2433 2433 $ cd ..
2434 2434
2435 2435 change graph edge styling
2436 2436
2437 2437 $ cd repo
2438 2438 $ cat << EOF >> $HGRCPATH
2439 2439 > [experimental]
2440 2440 > graphstyle.parent = |
2441 2441 > graphstyle.grandparent = :
2442 2442 > graphstyle.missing =
2443 2443 > EOF
2444 2444 $ hg log -G -r 'file("a")' -m
2445 2445 @ changeset: 36:08a19a744424
2446 2446 : branch: branch
2447 2447 : tag: tip
2448 2448 : parent: 35:9159c3644c5e
2449 2449 : parent: 35:9159c3644c5e
2450 2450 : user: test
2451 2451 : date: Thu Jan 01 00:00:36 1970 +0000
2452 2452 : summary: (36) buggy merge: identical parents
2453 2453 :
2454 2454 o changeset: 32:d06dffa21a31
2455 2455 |\ parent: 27:886ed638191b
2456 2456 | : parent: 31:621d83e11f67
2457 2457 | : user: test
2458 2458 | : date: Thu Jan 01 00:00:32 1970 +0000
2459 2459 | : summary: (32) expand
2460 2460 | :
2461 2461 o : changeset: 31:621d83e11f67
2462 2462 |\: parent: 21:d42a756af44d
2463 2463 | : parent: 30:6e11cd4b648f
2464 2464 | : user: test
2465 2465 | : date: Thu Jan 01 00:00:31 1970 +0000
2466 2466 | : summary: (31) expand
2467 2467 | :
2468 2468 o : changeset: 30:6e11cd4b648f
2469 2469 |\ \ parent: 28:44ecd0b9ae99
2470 2470 | ~ : parent: 29:cd9bb2be7593
2471 2471 | : user: test
2472 2472 | : date: Thu Jan 01 00:00:30 1970 +0000
2473 2473 | : summary: (30) expand
2474 2474 | /
2475 2475 o : changeset: 28:44ecd0b9ae99
2476 2476 |\ \ parent: 1:6db2ef61d156
2477 2477 | ~ : parent: 26:7f25b6c2f0b9
2478 2478 | : user: test
2479 2479 | : date: Thu Jan 01 00:00:28 1970 +0000
2480 2480 | : summary: (28) merge zero known
2481 2481 | /
2482 2482 o : changeset: 26:7f25b6c2f0b9
2483 2483 |\ \ parent: 18:1aa84d96232a
2484 2484 | | : parent: 25:91da8ed57247
2485 2485 | | : user: test
2486 2486 | | : date: Thu Jan 01 00:00:26 1970 +0000
2487 2487 | | : summary: (26) merge one known; far right
2488 2488 | | :
2489 2489 | o : changeset: 25:91da8ed57247
2490 2490 | |\: parent: 21:d42a756af44d
2491 2491 | | : parent: 24:a9c19a3d96b7
2492 2492 | | : user: test
2493 2493 | | : date: Thu Jan 01 00:00:25 1970 +0000
2494 2494 | | : summary: (25) merge one known; far left
2495 2495 | | :
2496 2496 | o : changeset: 24:a9c19a3d96b7
2497 2497 | |\ \ parent: 0:e6eb3150255d
2498 2498 | | ~ : parent: 23:a01cddf0766d
2499 2499 | | : user: test
2500 2500 | | : date: Thu Jan 01 00:00:24 1970 +0000
2501 2501 | | : summary: (24) merge one known; immediate right
2502 2502 | | /
2503 2503 | o : changeset: 23:a01cddf0766d
2504 2504 | |\ \ parent: 1:6db2ef61d156
2505 2505 | | ~ : parent: 22:e0d9cccacb5d
2506 2506 | | : user: test
2507 2507 | | : date: Thu Jan 01 00:00:23 1970 +0000
2508 2508 | | : summary: (23) merge one known; immediate left
2509 2509 | | /
2510 2510 | o : changeset: 22:e0d9cccacb5d
2511 2511 |/:/ parent: 18:1aa84d96232a
2512 2512 | : parent: 21:d42a756af44d
2513 2513 | : user: test
2514 2514 | : date: Thu Jan 01 00:00:22 1970 +0000
2515 2515 | : summary: (22) merge two known; one far left, one far right
2516 2516 | :
2517 2517 | o changeset: 21:d42a756af44d
2518 2518 | |\ parent: 19:31ddc2c1573b
2519 2519 | | | parent: 20:d30ed6450e32
2520 2520 | | | user: test
2521 2521 | | | date: Thu Jan 01 00:00:21 1970 +0000
2522 2522 | | | summary: (21) expand
2523 2523 | | |
2524 2524 +---o changeset: 20:d30ed6450e32
2525 2525 | | | parent: 0:e6eb3150255d
2526 2526 | | ~ parent: 18:1aa84d96232a
2527 2527 | | user: test
2528 2528 | | date: Thu Jan 01 00:00:20 1970 +0000
2529 2529 | | summary: (20) merge two known; two far right
2530 2530 | |
2531 2531 | o changeset: 19:31ddc2c1573b
2532 2532 | |\ parent: 15:1dda3f72782d
2533 2533 | | | parent: 17:44765d7c06e0
2534 2534 | | | user: test
2535 2535 | | | date: Thu Jan 01 00:00:19 1970 +0000
2536 2536 | | | summary: (19) expand
2537 2537 | | |
2538 2538 o | | changeset: 18:1aa84d96232a
2539 2539 |\| | parent: 1:6db2ef61d156
2540 2540 ~ | | parent: 15:1dda3f72782d
2541 2541 | | user: test
2542 2542 | | date: Thu Jan 01 00:00:18 1970 +0000
2543 2543 | | summary: (18) merge two known; two far left
2544 2544 / /
2545 2545 | o changeset: 17:44765d7c06e0
2546 2546 | |\ parent: 12:86b91144a6e9
2547 2547 | | | parent: 16:3677d192927d
2548 2548 | | | user: test
2549 2549 | | | date: Thu Jan 01 00:00:17 1970 +0000
2550 2550 | | | summary: (17) expand
2551 2551 | | |
2552 2552 | | o changeset: 16:3677d192927d
2553 2553 | | |\ parent: 0:e6eb3150255d
2554 2554 | | ~ ~ parent: 1:6db2ef61d156
2555 2555 | | user: test
2556 2556 | | date: Thu Jan 01 00:00:16 1970 +0000
2557 2557 | | summary: (16) merge two known; one immediate right, one near right
2558 2558 | |
2559 2559 o | changeset: 15:1dda3f72782d
2560 2560 |\ \ parent: 13:22d8966a97e3
2561 2561 | | | parent: 14:8eac370358ef
2562 2562 | | | user: test
2563 2563 | | | date: Thu Jan 01 00:00:15 1970 +0000
2564 2564 | | | summary: (15) expand
2565 2565 | | |
2566 2566 | o | changeset: 14:8eac370358ef
2567 2567 | |\| parent: 0:e6eb3150255d
2568 2568 | ~ | parent: 12:86b91144a6e9
2569 2569 | | user: test
2570 2570 | | date: Thu Jan 01 00:00:14 1970 +0000
2571 2571 | | summary: (14) merge two known; one immediate right, one far right
2572 2572 | /
2573 2573 o | changeset: 13:22d8966a97e3
2574 2574 |\ \ parent: 9:7010c0af0a35
2575 2575 | | | parent: 11:832d76e6bdf2
2576 2576 | | | user: test
2577 2577 | | | date: Thu Jan 01 00:00:13 1970 +0000
2578 2578 | | | summary: (13) expand
2579 2579 | | |
2580 2580 +---o changeset: 12:86b91144a6e9
2581 2581 | | | parent: 1:6db2ef61d156
2582 2582 | | ~ parent: 9:7010c0af0a35
2583 2583 | | user: test
2584 2584 | | date: Thu Jan 01 00:00:12 1970 +0000
2585 2585 | | summary: (12) merge two known; one immediate right, one far left
2586 2586 | |
2587 2587 | o changeset: 11:832d76e6bdf2
2588 2588 | |\ parent: 6:b105a072e251
2589 2589 | | | parent: 10:74c64d036d72
2590 2590 | | | user: test
2591 2591 | | | date: Thu Jan 01 00:00:11 1970 +0000
2592 2592 | | | summary: (11) expand
2593 2593 | | |
2594 2594 | | o changeset: 10:74c64d036d72
2595 2595 | |/| parent: 0:e6eb3150255d
2596 2596 | | ~ parent: 6:b105a072e251
2597 2597 | | user: test
2598 2598 | | date: Thu Jan 01 00:00:10 1970 +0000
2599 2599 | | summary: (10) merge two known; one immediate left, one near right
2600 2600 | |
2601 2601 o | changeset: 9:7010c0af0a35
2602 2602 |\ \ parent: 7:b632bb1b1224
2603 2603 | | | parent: 8:7a0b11f71937
2604 2604 | | | user: test
2605 2605 | | | date: Thu Jan 01 00:00:09 1970 +0000
2606 2606 | | | summary: (9) expand
2607 2607 | | |
2608 2608 | o | changeset: 8:7a0b11f71937
2609 2609 |/| | parent: 0:e6eb3150255d
2610 2610 | ~ | parent: 7:b632bb1b1224
2611 2611 | | user: test
2612 2612 | | date: Thu Jan 01 00:00:08 1970 +0000
2613 2613 | | summary: (8) merge two known; one immediate left, one far right
2614 2614 | /
2615 2615 o | changeset: 7:b632bb1b1224
2616 2616 |\ \ parent: 2:3d9a33b8d1e1
2617 2617 | ~ | parent: 5:4409d547b708
2618 2618 | | user: test
2619 2619 | | date: Thu Jan 01 00:00:07 1970 +0000
2620 2620 | | summary: (7) expand
2621 2621 | /
2622 2622 | o changeset: 6:b105a072e251
2623 2623 |/| parent: 2:3d9a33b8d1e1
2624 2624 | ~ parent: 5:4409d547b708
2625 2625 | user: test
2626 2626 | date: Thu Jan 01 00:00:06 1970 +0000
2627 2627 | summary: (6) merge two known; one immediate left, one far left
2628 2628 |
2629 2629 o changeset: 5:4409d547b708
2630 2630 |\ parent: 3:27eef8ed80b4
2631 2631 | ~ parent: 4:26a8bac39d9f
2632 2632 | user: test
2633 2633 | date: Thu Jan 01 00:00:05 1970 +0000
2634 2634 | summary: (5) expand
2635 2635 |
2636 2636 o changeset: 4:26a8bac39d9f
2637 2637 |\ parent: 1:6db2ef61d156
2638 2638 ~ ~ parent: 3:27eef8ed80b4
2639 2639 user: test
2640 2640 date: Thu Jan 01 00:00:04 1970 +0000
2641 2641 summary: (4) merge two known; one immediate left, one immediate right
2642 2642
2643 2643
2644 2644 Setting HGPLAIN ignores graphmod styling:
2645 2645
2646 2646 $ HGPLAIN=1 hg log -G -r 'file("a")' -m
2647 2647 @ changeset: 36:08a19a744424
2648 2648 | branch: branch
2649 2649 | tag: tip
2650 2650 | parent: 35:9159c3644c5e
2651 2651 | parent: 35:9159c3644c5e
2652 2652 | user: test
2653 2653 | date: Thu Jan 01 00:00:36 1970 +0000
2654 2654 | summary: (36) buggy merge: identical parents
2655 2655 |
2656 2656 o changeset: 32:d06dffa21a31
2657 2657 |\ parent: 27:886ed638191b
2658 2658 | | parent: 31:621d83e11f67
2659 2659 | | user: test
2660 2660 | | date: Thu Jan 01 00:00:32 1970 +0000
2661 2661 | | summary: (32) expand
2662 2662 | |
2663 2663 o | changeset: 31:621d83e11f67
2664 2664 |\| parent: 21:d42a756af44d
2665 2665 | | parent: 30:6e11cd4b648f
2666 2666 | | user: test
2667 2667 | | date: Thu Jan 01 00:00:31 1970 +0000
2668 2668 | | summary: (31) expand
2669 2669 | |
2670 2670 o | changeset: 30:6e11cd4b648f
2671 2671 |\ \ parent: 28:44ecd0b9ae99
2672 2672 | | | parent: 29:cd9bb2be7593
2673 2673 | | | user: test
2674 2674 | | | date: Thu Jan 01 00:00:30 1970 +0000
2675 2675 | | | summary: (30) expand
2676 2676 | | |
2677 2677 o | | changeset: 28:44ecd0b9ae99
2678 2678 |\ \ \ parent: 1:6db2ef61d156
2679 2679 | | | | parent: 26:7f25b6c2f0b9
2680 2680 | | | | user: test
2681 2681 | | | | date: Thu Jan 01 00:00:28 1970 +0000
2682 2682 | | | | summary: (28) merge zero known
2683 2683 | | | |
2684 2684 o | | | changeset: 26:7f25b6c2f0b9
2685 2685 |\ \ \ \ parent: 18:1aa84d96232a
2686 2686 | | | | | parent: 25:91da8ed57247
2687 2687 | | | | | user: test
2688 2688 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
2689 2689 | | | | | summary: (26) merge one known; far right
2690 2690 | | | | |
2691 2691 | o-----+ changeset: 25:91da8ed57247
2692 2692 | | | | | parent: 21:d42a756af44d
2693 2693 | | | | | parent: 24:a9c19a3d96b7
2694 2694 | | | | | user: test
2695 2695 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
2696 2696 | | | | | summary: (25) merge one known; far left
2697 2697 | | | | |
2698 2698 | o | | | changeset: 24:a9c19a3d96b7
2699 2699 | |\ \ \ \ parent: 0:e6eb3150255d
2700 2700 | | | | | | parent: 23:a01cddf0766d
2701 2701 | | | | | | user: test
2702 2702 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000
2703 2703 | | | | | | summary: (24) merge one known; immediate right
2704 2704 | | | | | |
2705 2705 | o---+ | | changeset: 23:a01cddf0766d
2706 2706 | | | | | | parent: 1:6db2ef61d156
2707 2707 | | | | | | parent: 22:e0d9cccacb5d
2708 2708 | | | | | | user: test
2709 2709 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000
2710 2710 | | | | | | summary: (23) merge one known; immediate left
2711 2711 | | | | | |
2712 2712 | o-------+ changeset: 22:e0d9cccacb5d
2713 2713 | | | | | | parent: 18:1aa84d96232a
2714 2714 |/ / / / / parent: 21:d42a756af44d
2715 2715 | | | | | user: test
2716 2716 | | | | | date: Thu Jan 01 00:00:22 1970 +0000
2717 2717 | | | | | summary: (22) merge two known; one far left, one far right
2718 2718 | | | | |
2719 2719 | | | | o changeset: 21:d42a756af44d
2720 2720 | | | | |\ parent: 19:31ddc2c1573b
2721 2721 | | | | | | parent: 20:d30ed6450e32
2722 2722 | | | | | | user: test
2723 2723 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000
2724 2724 | | | | | | summary: (21) expand
2725 2725 | | | | | |
2726 2726 +-+-------o changeset: 20:d30ed6450e32
2727 2727 | | | | | parent: 0:e6eb3150255d
2728 2728 | | | | | parent: 18:1aa84d96232a
2729 2729 | | | | | user: test
2730 2730 | | | | | date: Thu Jan 01 00:00:20 1970 +0000
2731 2731 | | | | | summary: (20) merge two known; two far right
2732 2732 | | | | |
2733 2733 | | | | o changeset: 19:31ddc2c1573b
2734 2734 | | | | |\ parent: 15:1dda3f72782d
2735 2735 | | | | | | parent: 17:44765d7c06e0
2736 2736 | | | | | | user: test
2737 2737 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000
2738 2738 | | | | | | summary: (19) expand
2739 2739 | | | | | |
2740 2740 o---+---+ | changeset: 18:1aa84d96232a
2741 2741 | | | | | parent: 1:6db2ef61d156
2742 2742 / / / / / parent: 15:1dda3f72782d
2743 2743 | | | | | user: test
2744 2744 | | | | | date: Thu Jan 01 00:00:18 1970 +0000
2745 2745 | | | | | summary: (18) merge two known; two far left
2746 2746 | | | | |
2747 2747 | | | | o changeset: 17:44765d7c06e0
2748 2748 | | | | |\ parent: 12:86b91144a6e9
2749 2749 | | | | | | parent: 16:3677d192927d
2750 2750 | | | | | | user: test
2751 2751 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000
2752 2752 | | | | | | summary: (17) expand
2753 2753 | | | | | |
2754 2754 +-+-------o changeset: 16:3677d192927d
2755 2755 | | | | | parent: 0:e6eb3150255d
2756 2756 | | | | | parent: 1:6db2ef61d156
2757 2757 | | | | | user: test
2758 2758 | | | | | date: Thu Jan 01 00:00:16 1970 +0000
2759 2759 | | | | | summary: (16) merge two known; one immediate right, one near right
2760 2760 | | | | |
2761 2761 | | | o | changeset: 15:1dda3f72782d
2762 2762 | | | |\ \ parent: 13:22d8966a97e3
2763 2763 | | | | | | parent: 14:8eac370358ef
2764 2764 | | | | | | user: test
2765 2765 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000
2766 2766 | | | | | | summary: (15) expand
2767 2767 | | | | | |
2768 2768 +-------o | changeset: 14:8eac370358ef
2769 2769 | | | | |/ parent: 0:e6eb3150255d
2770 2770 | | | | | parent: 12:86b91144a6e9
2771 2771 | | | | | user: test
2772 2772 | | | | | date: Thu Jan 01 00:00:14 1970 +0000
2773 2773 | | | | | summary: (14) merge two known; one immediate right, one far right
2774 2774 | | | | |
2775 2775 | | | o | changeset: 13:22d8966a97e3
2776 2776 | | | |\ \ parent: 9:7010c0af0a35
2777 2777 | | | | | | parent: 11:832d76e6bdf2
2778 2778 | | | | | | user: test
2779 2779 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000
2780 2780 | | | | | | summary: (13) expand
2781 2781 | | | | | |
2782 2782 | +---+---o changeset: 12:86b91144a6e9
2783 2783 | | | | | parent: 1:6db2ef61d156
2784 2784 | | | | | parent: 9:7010c0af0a35
2785 2785 | | | | | user: test
2786 2786 | | | | | date: Thu Jan 01 00:00:12 1970 +0000
2787 2787 | | | | | summary: (12) merge two known; one immediate right, one far left
2788 2788 | | | | |
2789 2789 | | | | o changeset: 11:832d76e6bdf2
2790 2790 | | | | |\ parent: 6:b105a072e251
2791 2791 | | | | | | parent: 10:74c64d036d72
2792 2792 | | | | | | user: test
2793 2793 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000
2794 2794 | | | | | | summary: (11) expand
2795 2795 | | | | | |
2796 2796 +---------o changeset: 10:74c64d036d72
2797 2797 | | | | |/ parent: 0:e6eb3150255d
2798 2798 | | | | | parent: 6:b105a072e251
2799 2799 | | | | | user: test
2800 2800 | | | | | date: Thu Jan 01 00:00:10 1970 +0000
2801 2801 | | | | | summary: (10) merge two known; one immediate left, one near right
2802 2802 | | | | |
2803 2803 | | | o | changeset: 9:7010c0af0a35
2804 2804 | | | |\ \ parent: 7:b632bb1b1224
2805 2805 | | | | | | parent: 8:7a0b11f71937
2806 2806 | | | | | | user: test
2807 2807 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000
2808 2808 | | | | | | summary: (9) expand
2809 2809 | | | | | |
2810 2810 +-------o | changeset: 8:7a0b11f71937
2811 2811 | | | |/ / parent: 0:e6eb3150255d
2812 2812 | | | | | parent: 7:b632bb1b1224
2813 2813 | | | | | user: test
2814 2814 | | | | | date: Thu Jan 01 00:00:08 1970 +0000
2815 2815 | | | | | summary: (8) merge two known; one immediate left, one far right
2816 2816 | | | | |
2817 2817 | | | o | changeset: 7:b632bb1b1224
2818 2818 | | | |\ \ parent: 2:3d9a33b8d1e1
2819 2819 | | | | | | parent: 5:4409d547b708
2820 2820 | | | | | | user: test
2821 2821 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000
2822 2822 | | | | | | summary: (7) expand
2823 2823 | | | | | |
2824 2824 | | | +---o changeset: 6:b105a072e251
2825 2825 | | | | |/ parent: 2:3d9a33b8d1e1
2826 2826 | | | | | parent: 5:4409d547b708
2827 2827 | | | | | user: test
2828 2828 | | | | | date: Thu Jan 01 00:00:06 1970 +0000
2829 2829 | | | | | summary: (6) merge two known; one immediate left, one far left
2830 2830 | | | | |
2831 2831 | | | o | changeset: 5:4409d547b708
2832 2832 | | | |\ \ parent: 3:27eef8ed80b4
2833 2833 | | | | | | parent: 4:26a8bac39d9f
2834 2834 | | | | | | user: test
2835 2835 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000
2836 2836 | | | | | | summary: (5) expand
2837 2837 | | | | | |
2838 2838 | +---o | | changeset: 4:26a8bac39d9f
2839 2839 | | | |/ / parent: 1:6db2ef61d156
2840 2840 | | | | | parent: 3:27eef8ed80b4
2841 2841 | | | | | user: test
2842 2842 | | | | | date: Thu Jan 01 00:00:04 1970 +0000
2843 2843 | | | | | summary: (4) merge two known; one immediate left, one immediate right
2844 2844 | | | | |
2845 2845
2846 2846 .. unless HGPLAINEXCEPT=graph is set:
2847 2847
2848 2848 $ HGPLAIN=1 HGPLAINEXCEPT=graph hg log -G -r 'file("a")' -m
2849 2849 @ changeset: 36:08a19a744424
2850 2850 : branch: branch
2851 2851 : tag: tip
2852 2852 : parent: 35:9159c3644c5e
2853 2853 : parent: 35:9159c3644c5e
2854 2854 : user: test
2855 2855 : date: Thu Jan 01 00:00:36 1970 +0000
2856 2856 : summary: (36) buggy merge: identical parents
2857 2857 :
2858 2858 o changeset: 32:d06dffa21a31
2859 2859 |\ parent: 27:886ed638191b
2860 2860 | : parent: 31:621d83e11f67
2861 2861 | : user: test
2862 2862 | : date: Thu Jan 01 00:00:32 1970 +0000
2863 2863 | : summary: (32) expand
2864 2864 | :
2865 2865 o : changeset: 31:621d83e11f67
2866 2866 |\: parent: 21:d42a756af44d
2867 2867 | : parent: 30:6e11cd4b648f
2868 2868 | : user: test
2869 2869 | : date: Thu Jan 01 00:00:31 1970 +0000
2870 2870 | : summary: (31) expand
2871 2871 | :
2872 2872 o : changeset: 30:6e11cd4b648f
2873 2873 |\ \ parent: 28:44ecd0b9ae99
2874 2874 | ~ : parent: 29:cd9bb2be7593
2875 2875 | : user: test
2876 2876 | : date: Thu Jan 01 00:00:30 1970 +0000
2877 2877 | : summary: (30) expand
2878 2878 | /
2879 2879 o : changeset: 28:44ecd0b9ae99
2880 2880 |\ \ parent: 1:6db2ef61d156
2881 2881 | ~ : parent: 26:7f25b6c2f0b9
2882 2882 | : user: test
2883 2883 | : date: Thu Jan 01 00:00:28 1970 +0000
2884 2884 | : summary: (28) merge zero known
2885 2885 | /
2886 2886 o : changeset: 26:7f25b6c2f0b9
2887 2887 |\ \ parent: 18:1aa84d96232a
2888 2888 | | : parent: 25:91da8ed57247
2889 2889 | | : user: test
2890 2890 | | : date: Thu Jan 01 00:00:26 1970 +0000
2891 2891 | | : summary: (26) merge one known; far right
2892 2892 | | :
2893 2893 | o : changeset: 25:91da8ed57247
2894 2894 | |\: parent: 21:d42a756af44d
2895 2895 | | : parent: 24:a9c19a3d96b7
2896 2896 | | : user: test
2897 2897 | | : date: Thu Jan 01 00:00:25 1970 +0000
2898 2898 | | : summary: (25) merge one known; far left
2899 2899 | | :
2900 2900 | o : changeset: 24:a9c19a3d96b7
2901 2901 | |\ \ parent: 0:e6eb3150255d
2902 2902 | | ~ : parent: 23:a01cddf0766d
2903 2903 | | : user: test
2904 2904 | | : date: Thu Jan 01 00:00:24 1970 +0000
2905 2905 | | : summary: (24) merge one known; immediate right
2906 2906 | | /
2907 2907 | o : changeset: 23:a01cddf0766d
2908 2908 | |\ \ parent: 1:6db2ef61d156
2909 2909 | | ~ : parent: 22:e0d9cccacb5d
2910 2910 | | : user: test
2911 2911 | | : date: Thu Jan 01 00:00:23 1970 +0000
2912 2912 | | : summary: (23) merge one known; immediate left
2913 2913 | | /
2914 2914 | o : changeset: 22:e0d9cccacb5d
2915 2915 |/:/ parent: 18:1aa84d96232a
2916 2916 | : parent: 21:d42a756af44d
2917 2917 | : user: test
2918 2918 | : date: Thu Jan 01 00:00:22 1970 +0000
2919 2919 | : summary: (22) merge two known; one far left, one far right
2920 2920 | :
2921 2921 | o changeset: 21:d42a756af44d
2922 2922 | |\ parent: 19:31ddc2c1573b
2923 2923 | | | parent: 20:d30ed6450e32
2924 2924 | | | user: test
2925 2925 | | | date: Thu Jan 01 00:00:21 1970 +0000
2926 2926 | | | summary: (21) expand
2927 2927 | | |
2928 2928 +---o changeset: 20:d30ed6450e32
2929 2929 | | | parent: 0:e6eb3150255d
2930 2930 | | ~ parent: 18:1aa84d96232a
2931 2931 | | user: test
2932 2932 | | date: Thu Jan 01 00:00:20 1970 +0000
2933 2933 | | summary: (20) merge two known; two far right
2934 2934 | |
2935 2935 | o changeset: 19:31ddc2c1573b
2936 2936 | |\ parent: 15:1dda3f72782d
2937 2937 | | | parent: 17:44765d7c06e0
2938 2938 | | | user: test
2939 2939 | | | date: Thu Jan 01 00:00:19 1970 +0000
2940 2940 | | | summary: (19) expand
2941 2941 | | |
2942 2942 o | | changeset: 18:1aa84d96232a
2943 2943 |\| | parent: 1:6db2ef61d156
2944 2944 ~ | | parent: 15:1dda3f72782d
2945 2945 | | user: test
2946 2946 | | date: Thu Jan 01 00:00:18 1970 +0000
2947 2947 | | summary: (18) merge two known; two far left
2948 2948 / /
2949 2949 | o changeset: 17:44765d7c06e0
2950 2950 | |\ parent: 12:86b91144a6e9
2951 2951 | | | parent: 16:3677d192927d
2952 2952 | | | user: test
2953 2953 | | | date: Thu Jan 01 00:00:17 1970 +0000
2954 2954 | | | summary: (17) expand
2955 2955 | | |
2956 2956 | | o changeset: 16:3677d192927d
2957 2957 | | |\ parent: 0:e6eb3150255d
2958 2958 | | ~ ~ parent: 1:6db2ef61d156
2959 2959 | | user: test
2960 2960 | | date: Thu Jan 01 00:00:16 1970 +0000
2961 2961 | | summary: (16) merge two known; one immediate right, one near right
2962 2962 | |
2963 2963 o | changeset: 15:1dda3f72782d
2964 2964 |\ \ parent: 13:22d8966a97e3
2965 2965 | | | parent: 14:8eac370358ef
2966 2966 | | | user: test
2967 2967 | | | date: Thu Jan 01 00:00:15 1970 +0000
2968 2968 | | | summary: (15) expand
2969 2969 | | |
2970 2970 | o | changeset: 14:8eac370358ef
2971 2971 | |\| parent: 0:e6eb3150255d
2972 2972 | ~ | parent: 12:86b91144a6e9
2973 2973 | | user: test
2974 2974 | | date: Thu Jan 01 00:00:14 1970 +0000
2975 2975 | | summary: (14) merge two known; one immediate right, one far right
2976 2976 | /
2977 2977 o | changeset: 13:22d8966a97e3
2978 2978 |\ \ parent: 9:7010c0af0a35
2979 2979 | | | parent: 11:832d76e6bdf2
2980 2980 | | | user: test
2981 2981 | | | date: Thu Jan 01 00:00:13 1970 +0000
2982 2982 | | | summary: (13) expand
2983 2983 | | |
2984 2984 +---o changeset: 12:86b91144a6e9
2985 2985 | | | parent: 1:6db2ef61d156
2986 2986 | | ~ parent: 9:7010c0af0a35
2987 2987 | | user: test
2988 2988 | | date: Thu Jan 01 00:00:12 1970 +0000
2989 2989 | | summary: (12) merge two known; one immediate right, one far left
2990 2990 | |
2991 2991 | o changeset: 11:832d76e6bdf2
2992 2992 | |\ parent: 6:b105a072e251
2993 2993 | | | parent: 10:74c64d036d72
2994 2994 | | | user: test
2995 2995 | | | date: Thu Jan 01 00:00:11 1970 +0000
2996 2996 | | | summary: (11) expand
2997 2997 | | |
2998 2998 | | o changeset: 10:74c64d036d72
2999 2999 | |/| parent: 0:e6eb3150255d
3000 3000 | | ~ parent: 6:b105a072e251
3001 3001 | | user: test
3002 3002 | | date: Thu Jan 01 00:00:10 1970 +0000
3003 3003 | | summary: (10) merge two known; one immediate left, one near right
3004 3004 | |
3005 3005 o | changeset: 9:7010c0af0a35
3006 3006 |\ \ parent: 7:b632bb1b1224
3007 3007 | | | parent: 8:7a0b11f71937
3008 3008 | | | user: test
3009 3009 | | | date: Thu Jan 01 00:00:09 1970 +0000
3010 3010 | | | summary: (9) expand
3011 3011 | | |
3012 3012 | o | changeset: 8:7a0b11f71937
3013 3013 |/| | parent: 0:e6eb3150255d
3014 3014 | ~ | parent: 7:b632bb1b1224
3015 3015 | | user: test
3016 3016 | | date: Thu Jan 01 00:00:08 1970 +0000
3017 3017 | | summary: (8) merge two known; one immediate left, one far right
3018 3018 | /
3019 3019 o | changeset: 7:b632bb1b1224
3020 3020 |\ \ parent: 2:3d9a33b8d1e1
3021 3021 | ~ | parent: 5:4409d547b708
3022 3022 | | user: test
3023 3023 | | date: Thu Jan 01 00:00:07 1970 +0000
3024 3024 | | summary: (7) expand
3025 3025 | /
3026 3026 | o changeset: 6:b105a072e251
3027 3027 |/| parent: 2:3d9a33b8d1e1
3028 3028 | ~ parent: 5:4409d547b708
3029 3029 | user: test
3030 3030 | date: Thu Jan 01 00:00:06 1970 +0000
3031 3031 | summary: (6) merge two known; one immediate left, one far left
3032 3032 |
3033 3033 o changeset: 5:4409d547b708
3034 3034 |\ parent: 3:27eef8ed80b4
3035 3035 | ~ parent: 4:26a8bac39d9f
3036 3036 | user: test
3037 3037 | date: Thu Jan 01 00:00:05 1970 +0000
3038 3038 | summary: (5) expand
3039 3039 |
3040 3040 o changeset: 4:26a8bac39d9f
3041 3041 |\ parent: 1:6db2ef61d156
3042 3042 ~ ~ parent: 3:27eef8ed80b4
3043 3043 user: test
3044 3044 date: Thu Jan 01 00:00:04 1970 +0000
3045 3045 summary: (4) merge two known; one immediate left, one immediate right
3046 3046
3047 3047 Draw only part of a grandparent line differently with "<N><char>"; only the
3048 3048 last N lines (for positive N) or everything but the first N lines (for
3049 3049 negative N) along the current node use the style, the rest of the edge uses
3050 3050 the parent edge styling.
3051 3051
3052 3052 Last 3 lines:
3053 3053
3054 3054 $ cat << EOF >> $HGRCPATH
3055 3055 > [experimental]
3056 3056 > graphstyle.parent = !
3057 3057 > graphstyle.grandparent = 3.
3058 3058 > graphstyle.missing =
3059 3059 > EOF
3060 3060 $ hg log -G -r '36:18 & file("a")' -m
3061 3061 @ changeset: 36:08a19a744424
3062 3062 ! branch: branch
3063 3063 ! tag: tip
3064 3064 ! parent: 35:9159c3644c5e
3065 3065 ! parent: 35:9159c3644c5e
3066 3066 ! user: test
3067 3067 . date: Thu Jan 01 00:00:36 1970 +0000
3068 3068 . summary: (36) buggy merge: identical parents
3069 3069 .
3070 3070 o changeset: 32:d06dffa21a31
3071 3071 !\ parent: 27:886ed638191b
3072 3072 ! ! parent: 31:621d83e11f67
3073 3073 ! ! user: test
3074 3074 ! . date: Thu Jan 01 00:00:32 1970 +0000
3075 3075 ! . summary: (32) expand
3076 3076 ! .
3077 3077 o ! changeset: 31:621d83e11f67
3078 3078 !\! parent: 21:d42a756af44d
3079 3079 ! ! parent: 30:6e11cd4b648f
3080 3080 ! ! user: test
3081 3081 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3082 3082 ! ! summary: (31) expand
3083 3083 ! !
3084 3084 o ! changeset: 30:6e11cd4b648f
3085 3085 !\ \ parent: 28:44ecd0b9ae99
3086 3086 ! ~ ! parent: 29:cd9bb2be7593
3087 3087 ! ! user: test
3088 3088 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3089 3089 ! ! summary: (30) expand
3090 3090 ! /
3091 3091 o ! changeset: 28:44ecd0b9ae99
3092 3092 !\ \ parent: 1:6db2ef61d156
3093 3093 ! ~ ! parent: 26:7f25b6c2f0b9
3094 3094 ! ! user: test
3095 3095 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3096 3096 ! ! summary: (28) merge zero known
3097 3097 ! /
3098 3098 o ! changeset: 26:7f25b6c2f0b9
3099 3099 !\ \ parent: 18:1aa84d96232a
3100 3100 ! ! ! parent: 25:91da8ed57247
3101 3101 ! ! ! user: test
3102 3102 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3103 3103 ! ! ! summary: (26) merge one known; far right
3104 3104 ! ! !
3105 3105 ! o ! changeset: 25:91da8ed57247
3106 3106 ! !\! parent: 21:d42a756af44d
3107 3107 ! ! ! parent: 24:a9c19a3d96b7
3108 3108 ! ! ! user: test
3109 3109 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3110 3110 ! ! ! summary: (25) merge one known; far left
3111 3111 ! ! !
3112 3112 ! o ! changeset: 24:a9c19a3d96b7
3113 3113 ! !\ \ parent: 0:e6eb3150255d
3114 3114 ! ! ~ ! parent: 23:a01cddf0766d
3115 3115 ! ! ! user: test
3116 3116 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3117 3117 ! ! ! summary: (24) merge one known; immediate right
3118 3118 ! ! /
3119 3119 ! o ! changeset: 23:a01cddf0766d
3120 3120 ! !\ \ parent: 1:6db2ef61d156
3121 3121 ! ! ~ ! parent: 22:e0d9cccacb5d
3122 3122 ! ! ! user: test
3123 3123 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3124 3124 ! ! ! summary: (23) merge one known; immediate left
3125 3125 ! ! /
3126 3126 ! o ! changeset: 22:e0d9cccacb5d
3127 3127 !/!/ parent: 18:1aa84d96232a
3128 3128 ! ! parent: 21:d42a756af44d
3129 3129 ! ! user: test
3130 3130 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3131 3131 ! ! summary: (22) merge two known; one far left, one far right
3132 3132 ! !
3133 3133 ! o changeset: 21:d42a756af44d
3134 3134 ! !\ parent: 19:31ddc2c1573b
3135 3135 ! ! ! parent: 20:d30ed6450e32
3136 3136 ! ! ! user: test
3137 3137 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3138 3138 ! ! ! summary: (21) expand
3139 3139 ! ! !
3140 3140 +---o changeset: 20:d30ed6450e32
3141 3141 ! ! | parent: 0:e6eb3150255d
3142 3142 ! ! ~ parent: 18:1aa84d96232a
3143 3143 ! ! user: test
3144 3144 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3145 3145 ! ! summary: (20) merge two known; two far right
3146 3146 ! !
3147 3147 ! o changeset: 19:31ddc2c1573b
3148 3148 ! |\ parent: 15:1dda3f72782d
3149 3149 ! ~ ~ parent: 17:44765d7c06e0
3150 3150 ! user: test
3151 3151 ! date: Thu Jan 01 00:00:19 1970 +0000
3152 3152 ! summary: (19) expand
3153 3153 !
3154 3154 o changeset: 18:1aa84d96232a
3155 3155 |\ parent: 1:6db2ef61d156
3156 3156 ~ ~ parent: 15:1dda3f72782d
3157 3157 user: test
3158 3158 date: Thu Jan 01 00:00:18 1970 +0000
3159 3159 summary: (18) merge two known; two far left
3160 3160
3161 3161 All but the first 3 lines:
3162 3162
3163 3163 $ cat << EOF >> $HGRCPATH
3164 3164 > [experimental]
3165 3165 > graphstyle.parent = !
3166 3166 > graphstyle.grandparent = -3.
3167 3167 > graphstyle.missing =
3168 3168 > EOF
3169 3169 $ hg log -G -r '36:18 & file("a")' -m
3170 3170 @ changeset: 36:08a19a744424
3171 3171 ! branch: branch
3172 3172 ! tag: tip
3173 3173 . parent: 35:9159c3644c5e
3174 3174 . parent: 35:9159c3644c5e
3175 3175 . user: test
3176 3176 . date: Thu Jan 01 00:00:36 1970 +0000
3177 3177 . summary: (36) buggy merge: identical parents
3178 3178 .
3179 3179 o changeset: 32:d06dffa21a31
3180 3180 !\ parent: 27:886ed638191b
3181 3181 ! ! parent: 31:621d83e11f67
3182 3182 ! . user: test
3183 3183 ! . date: Thu Jan 01 00:00:32 1970 +0000
3184 3184 ! . summary: (32) expand
3185 3185 ! .
3186 3186 o ! changeset: 31:621d83e11f67
3187 3187 !\! parent: 21:d42a756af44d
3188 3188 ! ! parent: 30:6e11cd4b648f
3189 3189 ! ! user: test
3190 3190 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3191 3191 ! ! summary: (31) expand
3192 3192 ! !
3193 3193 o ! changeset: 30:6e11cd4b648f
3194 3194 !\ \ parent: 28:44ecd0b9ae99
3195 3195 ! ~ ! parent: 29:cd9bb2be7593
3196 3196 ! ! user: test
3197 3197 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3198 3198 ! ! summary: (30) expand
3199 3199 ! /
3200 3200 o ! changeset: 28:44ecd0b9ae99
3201 3201 !\ \ parent: 1:6db2ef61d156
3202 3202 ! ~ ! parent: 26:7f25b6c2f0b9
3203 3203 ! ! user: test
3204 3204 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3205 3205 ! ! summary: (28) merge zero known
3206 3206 ! /
3207 3207 o ! changeset: 26:7f25b6c2f0b9
3208 3208 !\ \ parent: 18:1aa84d96232a
3209 3209 ! ! ! parent: 25:91da8ed57247
3210 3210 ! ! ! user: test
3211 3211 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3212 3212 ! ! ! summary: (26) merge one known; far right
3213 3213 ! ! !
3214 3214 ! o ! changeset: 25:91da8ed57247
3215 3215 ! !\! parent: 21:d42a756af44d
3216 3216 ! ! ! parent: 24:a9c19a3d96b7
3217 3217 ! ! ! user: test
3218 3218 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3219 3219 ! ! ! summary: (25) merge one known; far left
3220 3220 ! ! !
3221 3221 ! o ! changeset: 24:a9c19a3d96b7
3222 3222 ! !\ \ parent: 0:e6eb3150255d
3223 3223 ! ! ~ ! parent: 23:a01cddf0766d
3224 3224 ! ! ! user: test
3225 3225 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3226 3226 ! ! ! summary: (24) merge one known; immediate right
3227 3227 ! ! /
3228 3228 ! o ! changeset: 23:a01cddf0766d
3229 3229 ! !\ \ parent: 1:6db2ef61d156
3230 3230 ! ! ~ ! parent: 22:e0d9cccacb5d
3231 3231 ! ! ! user: test
3232 3232 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3233 3233 ! ! ! summary: (23) merge one known; immediate left
3234 3234 ! ! /
3235 3235 ! o ! changeset: 22:e0d9cccacb5d
3236 3236 !/!/ parent: 18:1aa84d96232a
3237 3237 ! ! parent: 21:d42a756af44d
3238 3238 ! ! user: test
3239 3239 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3240 3240 ! ! summary: (22) merge two known; one far left, one far right
3241 3241 ! !
3242 3242 ! o changeset: 21:d42a756af44d
3243 3243 ! !\ parent: 19:31ddc2c1573b
3244 3244 ! ! ! parent: 20:d30ed6450e32
3245 3245 ! ! ! user: test
3246 3246 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3247 3247 ! ! ! summary: (21) expand
3248 3248 ! ! !
3249 3249 +---o changeset: 20:d30ed6450e32
3250 3250 ! ! | parent: 0:e6eb3150255d
3251 3251 ! ! ~ parent: 18:1aa84d96232a
3252 3252 ! ! user: test
3253 3253 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3254 3254 ! ! summary: (20) merge two known; two far right
3255 3255 ! !
3256 3256 ! o changeset: 19:31ddc2c1573b
3257 3257 ! |\ parent: 15:1dda3f72782d
3258 3258 ! ~ ~ parent: 17:44765d7c06e0
3259 3259 ! user: test
3260 3260 ! date: Thu Jan 01 00:00:19 1970 +0000
3261 3261 ! summary: (19) expand
3262 3262 !
3263 3263 o changeset: 18:1aa84d96232a
3264 3264 |\ parent: 1:6db2ef61d156
3265 3265 ~ ~ parent: 15:1dda3f72782d
3266 3266 user: test
3267 3267 date: Thu Jan 01 00:00:18 1970 +0000
3268 3268 summary: (18) merge two known; two far left
3269 3269
3270 3270 $ cd ..
3271 3271
3272 3272 Change graph shorten, test better with graphstyle.missing not none
3273 3273
3274 3274 $ cd repo
3275 3275 $ cat << EOF >> $HGRCPATH
3276 3276 > [experimental]
3277 3277 > graphstyle.parent = |
3278 3278 > graphstyle.grandparent = :
3279 3279 > graphstyle.missing = '
3280 3280 > graphshorten = true
3281 3281 > EOF
3282 3282 $ hg log -G -r 'file("a")' -m -T '{rev} {desc}'
3283 3283 @ 36 (36) buggy merge: identical parents
3284 3284 o 32 (32) expand
3285 3285 |\
3286 3286 o : 31 (31) expand
3287 3287 |\:
3288 3288 o : 30 (30) expand
3289 3289 |\ \
3290 3290 o \ \ 28 (28) merge zero known
3291 3291 |\ \ \
3292 3292 o \ \ \ 26 (26) merge one known; far right
3293 3293 |\ \ \ \
3294 3294 | o-----+ 25 (25) merge one known; far left
3295 3295 | o ' ' : 24 (24) merge one known; immediate right
3296 3296 | |\ \ \ \
3297 3297 | o---+ ' : 23 (23) merge one known; immediate left
3298 3298 | o-------+ 22 (22) merge two known; one far left, one far right
3299 3299 |/ / / / /
3300 3300 | ' ' ' o 21 (21) expand
3301 3301 | ' ' ' |\
3302 3302 +-+-------o 20 (20) merge two known; two far right
3303 3303 | ' ' ' o 19 (19) expand
3304 3304 | ' ' ' |\
3305 3305 o---+---+ | 18 (18) merge two known; two far left
3306 3306 / / / / /
3307 3307 ' ' ' | o 17 (17) expand
3308 3308 ' ' ' | |\
3309 3309 +-+-------o 16 (16) merge two known; one immediate right, one near right
3310 3310 ' ' ' o | 15 (15) expand
3311 3311 ' ' ' |\ \
3312 3312 +-------o | 14 (14) merge two known; one immediate right, one far right
3313 3313 ' ' ' | |/
3314 3314 ' ' ' o | 13 (13) expand
3315 3315 ' ' ' |\ \
3316 3316 ' +---+---o 12 (12) merge two known; one immediate right, one far left
3317 3317 ' ' ' | o 11 (11) expand
3318 3318 ' ' ' | |\
3319 3319 +---------o 10 (10) merge two known; one immediate left, one near right
3320 3320 ' ' ' | |/
3321 3321 ' ' ' o | 9 (9) expand
3322 3322 ' ' ' |\ \
3323 3323 +-------o | 8 (8) merge two known; one immediate left, one far right
3324 3324 ' ' ' |/ /
3325 3325 ' ' ' o | 7 (7) expand
3326 3326 ' ' ' |\ \
3327 3327 ' ' ' +---o 6 (6) merge two known; one immediate left, one far left
3328 3328 ' ' ' | '/
3329 3329 ' ' ' o ' 5 (5) expand
3330 3330 ' ' ' |\ \
3331 3331 ' +---o ' ' 4 (4) merge two known; one immediate left, one immediate right
3332 3332 ' ' ' '/ /
3333 3333
3334 3334 behavior with newlines
3335 3335
3336 3336 $ hg log -G -r ::2 -T '{rev} {desc}'
3337 3337 o 2 (2) collapse
3338 3338 o 1 (1) collapse
3339 3339 o 0 (0) root
3340 3340
3341 3341 $ hg log -G -r ::2 -T '{rev} {desc}\n'
3342 3342 o 2 (2) collapse
3343 3343 o 1 (1) collapse
3344 3344 o 0 (0) root
3345 3345
3346 3346 $ hg log -G -r ::2 -T '{rev} {desc}\n\n'
3347 3347 o 2 (2) collapse
3348 3348 |
3349 3349 o 1 (1) collapse
3350 3350 |
3351 3351 o 0 (0) root
3352 3352
3353 3353
3354 3354 $ hg log -G -r ::2 -T '\n{rev} {desc}'
3355 3355 o
3356 3356 | 2 (2) collapse
3357 3357 o
3358 3358 | 1 (1) collapse
3359 3359 o
3360 3360 0 (0) root
3361 3361
3362 3362 $ hg log -G -r ::2 -T '{rev} {desc}\n\n\n'
3363 3363 o 2 (2) collapse
3364 3364 |
3365 3365 |
3366 3366 o 1 (1) collapse
3367 3367 |
3368 3368 |
3369 3369 o 0 (0) root
3370 3370
3371 3371
3372 3372 $ cd ..
3373 3373
3374 3374 When inserting extra line nodes to handle more than 2 parents, ensure that
3375 3375 the right node styles are used (issue5174):
3376 3376
3377 3377 $ hg init repo-issue5174
3378 3378 $ cd repo-issue5174
3379 3379 $ echo a > f0
3380 3380 $ hg ci -Aqm 0
3381 3381 $ echo a > f1
3382 3382 $ hg ci -Aqm 1
3383 3383 $ echo a > f2
3384 3384 $ hg ci -Aqm 2
3385 3385 $ hg co ".^"
3386 3386 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
3387 3387 $ echo a > f3
3388 3388 $ hg ci -Aqm 3
3389 3389 $ hg co ".^^"
3390 3390 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
3391 3391 $ echo a > f4
3392 3392 $ hg ci -Aqm 4
3393 3393 $ hg merge -r 2
3394 3394 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
3395 3395 (branch merge, don't forget to commit)
3396 3396 $ hg ci -qm 5
3397 3397 $ hg merge -r 3
3398 3398 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3399 3399 (branch merge, don't forget to commit)
3400 3400 $ hg ci -qm 6
3401 3401 $ hg log -G -r '0 | 1 | 2 | 6'
3402 3402 @ changeset: 6:851fe89689ad
3403 3403 :\ tag: tip
3404 3404 : : parent: 5:4f1e3cf15f5d
3405 3405 : : parent: 3:b74ba7084d2d
3406 3406 : : user: test
3407 3407 : : date: Thu Jan 01 00:00:00 1970 +0000
3408 3408 : : summary: 6
3409 3409 : :
3410 3410 : \
3411 3411 : :\
3412 3412 : o : changeset: 2:3e6599df4cce
3413 3413 : :/ user: test
3414 3414 : : date: Thu Jan 01 00:00:00 1970 +0000
3415 3415 : : summary: 2
3416 3416 : :
3417 3417 : o changeset: 1:bd9a55143933
3418 3418 :/ user: test
3419 3419 : date: Thu Jan 01 00:00:00 1970 +0000
3420 3420 : summary: 1
3421 3421 :
3422 3422 o changeset: 0:870a5edc339c
3423 3423 user: test
3424 3424 date: Thu Jan 01 00:00:00 1970 +0000
3425 3425 summary: 0
3426 3426
3427 3427
3428 3428 $ cd ..
3429 3429
3430 3430 Multiple roots (issue5440):
3431 3431
3432 3432 $ hg init multiroots
3433 3433 $ cd multiroots
3434 3434 $ cat <<EOF > .hg/hgrc
3435 3435 > [ui]
3436 3436 > logtemplate = '{rev} {desc}\n\n'
3437 3437 > EOF
3438 3438
3439 3439 $ touch foo
3440 3440 $ hg ci -Aqm foo
3441 3441 $ hg co -q null
3442 3442 $ touch bar
3443 3443 $ hg ci -Aqm bar
3444 3444
3445 3445 $ hg log -Gr null:
3446 3446 @ 1 bar
3447 3447 |
3448 3448 | o 0 foo
3449 3449 |/
3450 3450 o -1
3451 3451
3452 3452 $ hg log -Gr null+0
3453 3453 o 0 foo
3454 3454 |
3455 3455 o -1
3456 3456
3457 3457 $ hg log -Gr null+1
3458 3458 @ 1 bar
3459 3459 |
3460 3460 o -1
3461 3461
3462 3462
3463 3463 $ cd ..
@@ -1,426 +1,427 b''
1 1 #require hardlink
2 2
3 3 $ cat > nlinks.py <<EOF
4 > from __future__ import print_function
4 5 > import sys
5 6 > from mercurial import util
6 7 > for f in sorted(sys.stdin.readlines()):
7 8 > f = f[:-1]
8 > print util.nlinks(f), f
9 > print(util.nlinks(f), f)
9 10 > EOF
10 11
11 12 $ nlinksdir()
12 13 > {
13 14 > find "$@" -type f | $PYTHON $TESTTMP/nlinks.py
14 15 > }
15 16
16 17 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
17 18
18 19 $ cat > linkcp.py <<EOF
19 20 > from mercurial import util
20 21 > import sys
21 22 > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
22 23 > EOF
23 24
24 25 $ linkcp()
25 26 > {
26 27 > $PYTHON $TESTTMP/linkcp.py $1 $2
27 28 > }
28 29
29 30 Prepare repo r1:
30 31
31 32 $ hg init r1
32 33 $ cd r1
33 34
34 35 $ echo c1 > f1
35 36 $ hg add f1
36 37 $ hg ci -m0
37 38
38 39 $ mkdir d1
39 40 $ cd d1
40 41 $ echo c2 > f2
41 42 $ hg add f2
42 43 $ hg ci -m1
43 44 $ cd ../..
44 45
45 46 $ nlinksdir r1/.hg/store
46 47 1 r1/.hg/store/00changelog.i
47 48 1 r1/.hg/store/00manifest.i
48 49 1 r1/.hg/store/data/d1/f2.i
49 50 1 r1/.hg/store/data/f1.i
50 51 1 r1/.hg/store/fncache
51 52 1 r1/.hg/store/phaseroots
52 53 1 r1/.hg/store/undo
53 54 1 r1/.hg/store/undo.backup.fncache
54 55 1 r1/.hg/store/undo.backupfiles
55 56 1 r1/.hg/store/undo.phaseroots
56 57
57 58
58 59 Create hardlinked clone r2:
59 60
60 61 $ hg clone -U --debug r1 r2 --config progress.debug=true
61 62 linking: 1
62 63 linking: 2
63 64 linking: 3
64 65 linking: 4
65 66 linking: 5
66 67 linking: 6
67 68 linking: 7
68 69 linked 7 files
69 70
70 71 Create non-hardlinked clone r3:
71 72
72 73 $ hg clone --pull r1 r3
73 74 requesting all changes
74 75 adding changesets
75 76 adding manifests
76 77 adding file changes
77 78 added 2 changesets with 2 changes to 2 files
78 79 updating to branch default
79 80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 81
81 82
82 83 Repos r1 and r2 should now contain hardlinked files:
83 84
84 85 $ nlinksdir r1/.hg/store
85 86 2 r1/.hg/store/00changelog.i
86 87 2 r1/.hg/store/00manifest.i
87 88 2 r1/.hg/store/data/d1/f2.i
88 89 2 r1/.hg/store/data/f1.i
89 90 2 r1/.hg/store/fncache
90 91 1 r1/.hg/store/phaseroots
91 92 1 r1/.hg/store/undo
92 93 1 r1/.hg/store/undo.backup.fncache
93 94 1 r1/.hg/store/undo.backupfiles
94 95 1 r1/.hg/store/undo.phaseroots
95 96
96 97 $ nlinksdir r2/.hg/store
97 98 2 r2/.hg/store/00changelog.i
98 99 2 r2/.hg/store/00manifest.i
99 100 2 r2/.hg/store/data/d1/f2.i
100 101 2 r2/.hg/store/data/f1.i
101 102 2 r2/.hg/store/fncache
102 103
103 104 Repo r3 should not be hardlinked:
104 105
105 106 $ nlinksdir r3/.hg/store
106 107 1 r3/.hg/store/00changelog.i
107 108 1 r3/.hg/store/00manifest.i
108 109 1 r3/.hg/store/data/d1/f2.i
109 110 1 r3/.hg/store/data/f1.i
110 111 1 r3/.hg/store/fncache
111 112 1 r3/.hg/store/phaseroots
112 113 1 r3/.hg/store/undo
113 114 1 r3/.hg/store/undo.backupfiles
114 115 1 r3/.hg/store/undo.phaseroots
115 116
116 117
117 118 Create a non-inlined filelog in r3:
118 119
119 120 $ cd r3/d1
120 121 >>> f = open('data1', 'wb')
121 122 >>> for x in range(10000):
122 123 ... f.write("%s\n" % str(x))
123 124 >>> f.close()
124 125 $ for j in 0 1 2 3 4 5 6 7 8 9; do
125 126 > cat data1 >> f2
126 127 > hg commit -m$j
127 128 > done
128 129 $ cd ../..
129 130
130 131 $ nlinksdir r3/.hg/store
131 132 1 r3/.hg/store/00changelog.i
132 133 1 r3/.hg/store/00manifest.i
133 134 1 r3/.hg/store/data/d1/f2.d
134 135 1 r3/.hg/store/data/d1/f2.i
135 136 1 r3/.hg/store/data/f1.i
136 137 1 r3/.hg/store/fncache
137 138 1 r3/.hg/store/phaseroots
138 139 1 r3/.hg/store/undo
139 140 1 r3/.hg/store/undo.backup.fncache
140 141 1 r3/.hg/store/undo.backup.phaseroots
141 142 1 r3/.hg/store/undo.backupfiles
142 143 1 r3/.hg/store/undo.phaseroots
143 144
144 145 Push to repo r1 should break up most hardlinks in r2:
145 146
146 147 $ hg -R r2 verify
147 148 checking changesets
148 149 checking manifests
149 150 crosschecking files in changesets and manifests
150 151 checking files
151 152 2 files, 2 changesets, 2 total revisions
152 153
153 154 $ cd r3
154 155 $ hg push
155 156 pushing to $TESTTMP/r1 (glob)
156 157 searching for changes
157 158 adding changesets
158 159 adding manifests
159 160 adding file changes
160 161 added 10 changesets with 10 changes to 1 files
161 162
162 163 $ cd ..
163 164
164 165 $ nlinksdir r2/.hg/store
165 166 1 r2/.hg/store/00changelog.i
166 167 1 r2/.hg/store/00manifest.i
167 168 1 r2/.hg/store/data/d1/f2.i
168 169 2 r2/.hg/store/data/f1.i
169 170 [12] r2/\.hg/store/fncache (re)
170 171
171 172 #if hardlink-whitelisted
172 173 $ nlinksdir r2/.hg/store/fncache
173 174 2 r2/.hg/store/fncache
174 175 #endif
175 176
176 177 $ hg -R r2 verify
177 178 checking changesets
178 179 checking manifests
179 180 crosschecking files in changesets and manifests
180 181 checking files
181 182 2 files, 2 changesets, 2 total revisions
182 183
183 184
184 185 $ cd r1
185 186 $ hg up
186 187 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
187 188
188 189 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
189 190
190 191 $ echo c1c1 >> f1
191 192 $ hg ci -m00
192 193 $ cd ..
193 194
194 195 $ nlinksdir r2/.hg/store
195 196 1 r2/.hg/store/00changelog.i
196 197 1 r2/.hg/store/00manifest.i
197 198 1 r2/.hg/store/data/d1/f2.i
198 199 1 r2/.hg/store/data/f1.i
199 200 [12] r2/\.hg/store/fncache (re)
200 201
201 202 #if hardlink-whitelisted
202 203 $ nlinksdir r2/.hg/store/fncache
203 204 2 r2/.hg/store/fncache
204 205 #endif
205 206
206 207 Create a file which exec permissions we will change
207 208 $ cd r3
208 209 $ echo "echo hello world" > f3
209 210 $ hg add f3
210 211 $ hg ci -mf3
211 212 $ cd ..
212 213
213 214 $ cd r3
214 215 $ hg tip --template '{rev}:{node|short}\n'
215 216 12:d3b77733a28a
216 217 $ echo bla > f1
217 218 $ chmod +x f3
218 219 $ hg ci -m1
219 220 $ cd ..
220 221
221 222 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
222 223
223 224 $ linkcp r3 r4
224 225
225 226 'checklink' is produced by hardlinking a symlink, which is undefined whether
226 227 the symlink should be followed or not. It does behave differently on Linux and
227 228 BSD. Just remove it so the test pass on both platforms.
228 229
229 230 $ rm -f r4/.hg/cache/checklink
230 231
231 232 r4 has hardlinks in the working dir (not just inside .hg):
232 233
233 234 $ nlinksdir r4
234 235 2 r4/.hg/00changelog.i
235 236 2 r4/.hg/branch
236 237 2 r4/.hg/cache/branch2-base
237 238 2 r4/.hg/cache/branch2-served
238 239 2 r4/.hg/cache/checkisexec (execbit !)
239 240 ? r4/.hg/cache/checklink-target (glob) (symlink !)
240 241 2 r4/.hg/cache/checknoexec (execbit !)
241 242 2 r4/.hg/cache/rbc-names-v1
242 243 2 r4/.hg/cache/rbc-revs-v1
243 244 2 r4/.hg/dirstate
244 245 2 r4/.hg/fsmonitor.state (fsmonitor !)
245 246 2 r4/.hg/hgrc
246 247 2 r4/.hg/last-message.txt
247 248 2 r4/.hg/requires
248 249 2 r4/.hg/store/00changelog.i
249 250 2 r4/.hg/store/00manifest.i
250 251 2 r4/.hg/store/data/d1/f2.d
251 252 2 r4/.hg/store/data/d1/f2.i
252 253 2 r4/.hg/store/data/f1.i
253 254 2 r4/.hg/store/data/f3.i
254 255 2 r4/.hg/store/fncache
255 256 2 r4/.hg/store/phaseroots
256 257 2 r4/.hg/store/undo
257 258 2 r4/.hg/store/undo.backup.fncache
258 259 2 r4/.hg/store/undo.backup.phaseroots
259 260 2 r4/.hg/store/undo.backupfiles
260 261 2 r4/.hg/store/undo.phaseroots
261 262 [24] r4/\.hg/undo\.backup\.dirstate (re)
262 263 2 r4/.hg/undo.bookmarks
263 264 2 r4/.hg/undo.branch
264 265 2 r4/.hg/undo.desc
265 266 [24] r4/\.hg/undo\.dirstate (re)
266 267 2 r4/d1/data1
267 268 2 r4/d1/f2
268 269 2 r4/f1
269 270 2 r4/f3
270 271
271 272 Update back to revision 12 in r4 should break hardlink of file f1 and f3:
272 273 #if hardlink-whitelisted
273 274 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
274 275 4 r4/.hg/undo.backup.dirstate
275 276 4 r4/.hg/undo.dirstate
276 277 #endif
277 278
278 279
279 280 $ hg -R r4 up 12
280 281 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (execbit !)
281 282 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-execbit !)
282 283
283 284 $ nlinksdir r4
284 285 2 r4/.hg/00changelog.i
285 286 1 r4/.hg/branch
286 287 2 r4/.hg/cache/branch2-base
287 288 2 r4/.hg/cache/branch2-served
288 289 2 r4/.hg/cache/checkisexec (execbit !)
289 290 2 r4/.hg/cache/checklink-target (symlink !)
290 291 2 r4/.hg/cache/checknoexec (execbit !)
291 292 2 r4/.hg/cache/rbc-names-v1
292 293 2 r4/.hg/cache/rbc-revs-v1
293 294 1 r4/.hg/dirstate
294 295 1 r4/.hg/fsmonitor.state (fsmonitor !)
295 296 2 r4/.hg/hgrc
296 297 2 r4/.hg/last-message.txt
297 298 2 r4/.hg/requires
298 299 2 r4/.hg/store/00changelog.i
299 300 2 r4/.hg/store/00manifest.i
300 301 2 r4/.hg/store/data/d1/f2.d
301 302 2 r4/.hg/store/data/d1/f2.i
302 303 2 r4/.hg/store/data/f1.i
303 304 2 r4/.hg/store/data/f3.i
304 305 2 r4/.hg/store/fncache
305 306 2 r4/.hg/store/phaseroots
306 307 2 r4/.hg/store/undo
307 308 2 r4/.hg/store/undo.backup.fncache
308 309 2 r4/.hg/store/undo.backup.phaseroots
309 310 2 r4/.hg/store/undo.backupfiles
310 311 2 r4/.hg/store/undo.phaseroots
311 312 [24] r4/\.hg/undo\.backup\.dirstate (re)
312 313 2 r4/.hg/undo.bookmarks
313 314 2 r4/.hg/undo.branch
314 315 2 r4/.hg/undo.desc
315 316 [24] r4/\.hg/undo\.dirstate (re)
316 317 2 r4/d1/data1
317 318 2 r4/d1/f2
318 319 1 r4/f1
319 320 1 r4/f3 (execbit !)
320 321 2 r4/f3 (no-execbit !)
321 322
322 323 #if hardlink-whitelisted
323 324 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
324 325 4 r4/.hg/undo.backup.dirstate
325 326 4 r4/.hg/undo.dirstate
326 327 #endif
327 328
328 329 Test hardlinking outside hg:
329 330
330 331 $ mkdir x
331 332 $ echo foo > x/a
332 333
333 334 $ linkcp x y
334 335 $ echo bar >> y/a
335 336
336 337 No diff if hardlink:
337 338
338 339 $ diff x/a y/a
339 340
340 341 Test mq hardlinking:
341 342
342 343 $ echo "[extensions]" >> $HGRCPATH
343 344 $ echo "mq=" >> $HGRCPATH
344 345
345 346 $ hg init a
346 347 $ cd a
347 348
348 349 $ hg qimport -n foo - << EOF
349 350 > # HG changeset patch
350 351 > # Date 1 0
351 352 > diff -r 2588a8b53d66 a
352 353 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
353 354 > +++ b/a Wed Jul 23 15:54:29 2008 +0200
354 355 > @@ -0,0 +1,1 @@
355 356 > +a
356 357 > EOF
357 358 adding foo to series file
358 359
359 360 $ hg qpush
360 361 applying foo
361 362 now at: foo
362 363
363 364 $ cd ..
364 365 $ linkcp a b
365 366 $ cd b
366 367
367 368 $ hg qimport -n bar - << EOF
368 369 > # HG changeset patch
369 370 > # Date 2 0
370 371 > diff -r 2588a8b53d66 a
371 372 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
372 373 > +++ b/b Wed Jul 23 15:54:29 2008 +0200
373 374 > @@ -0,0 +1,1 @@
374 375 > +b
375 376 > EOF
376 377 adding bar to series file
377 378
378 379 $ hg qpush
379 380 applying bar
380 381 now at: bar
381 382
382 383 $ cat .hg/patches/status
383 384 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
384 385 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
385 386
386 387 $ cat .hg/patches/series
387 388 foo
388 389 bar
389 390
390 391 $ cat ../a/.hg/patches/status
391 392 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
392 393
393 394 $ cat ../a/.hg/patches/series
394 395 foo
395 396
396 397 Test tags hardlinking:
397 398
398 399 $ hg qdel -r qbase:qtip
399 400 patch foo finalized without changeset message
400 401 patch bar finalized without changeset message
401 402
402 403 $ hg tag -l lfoo
403 404 $ hg tag foo
404 405
405 406 $ cd ..
406 407 $ linkcp b c
407 408 $ cd c
408 409
409 410 $ hg tag -l -r 0 lbar
410 411 $ hg tag -r 0 bar
411 412
412 413 $ cat .hgtags
413 414 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
414 415 430ed4828a74fa4047bc816a25500f7472ab4bfe bar
415 416
416 417 $ cat .hg/localtags
417 418 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
418 419 430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
419 420
420 421 $ cat ../b/.hgtags
421 422 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
422 423
423 424 $ cat ../b/.hg/localtags
424 425 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
425 426
426 427 $ cd ..
@@ -1,3367 +1,3367 b''
1 1 Short help:
2 2
3 3 $ hg
4 4 Mercurial Distributed SCM
5 5
6 6 basic commands:
7 7
8 8 add add the specified files on the next commit
9 9 annotate show changeset information by line for each file
10 10 clone make a copy of an existing repository
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 14 forget forget the specified files on the next commit
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge another revision into working directory
18 18 pull pull changes from the specified source
19 19 push push changes to the specified destination
20 20 remove remove the specified files on the next commit
21 21 serve start stand-alone webserver
22 22 status show changed files in the working directory
23 23 summary summarize working directory state
24 24 update update working directory (or switch revisions)
25 25
26 26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27 27
28 28 $ hg -q
29 29 add add the specified files on the next commit
30 30 annotate show changeset information by line for each file
31 31 clone make a copy of an existing repository
32 32 commit commit the specified files or all outstanding changes
33 33 diff diff repository (or selected files)
34 34 export dump the header and diffs for one or more changesets
35 35 forget forget the specified files on the next commit
36 36 init create a new repository in the given directory
37 37 log show revision history of entire repository or files
38 38 merge merge another revision into working directory
39 39 pull pull changes from the specified source
40 40 push push changes to the specified destination
41 41 remove remove the specified files on the next commit
42 42 serve start stand-alone webserver
43 43 status show changed files in the working directory
44 44 summary summarize working directory state
45 45 update update working directory (or switch revisions)
46 46
47 47 $ hg help
48 48 Mercurial Distributed SCM
49 49
50 50 list of commands:
51 51
52 52 add add the specified files on the next commit
53 53 addremove add all new files, delete all missing files
54 54 annotate show changeset information by line for each file
55 55 archive create an unversioned archive of a repository revision
56 56 backout reverse effect of earlier changeset
57 57 bisect subdivision search of changesets
58 58 bookmarks create a new bookmark or list existing bookmarks
59 59 branch set or show the current branch name
60 60 branches list repository named branches
61 61 bundle create a bundle file
62 62 cat output the current or given revision of files
63 63 clone make a copy of an existing repository
64 64 commit commit the specified files or all outstanding changes
65 65 config show combined config settings from all hgrc files
66 66 copy mark files as copied for the next commit
67 67 diff diff repository (or selected files)
68 68 export dump the header and diffs for one or more changesets
69 69 files list tracked files
70 70 forget forget the specified files on the next commit
71 71 graft copy changes from other branches onto the current branch
72 72 grep search revision history for a pattern in specified files
73 73 heads show branch heads
74 74 help show help for a given topic or a help overview
75 75 identify identify the working directory or specified revision
76 76 import import an ordered set of patches
77 77 incoming show new changesets found in source
78 78 init create a new repository in the given directory
79 79 log show revision history of entire repository or files
80 80 manifest output the current or given revision of the project manifest
81 81 merge merge another revision into working directory
82 82 outgoing show changesets not found in the destination
83 83 paths show aliases for remote repositories
84 84 phase set or show the current phase name
85 85 pull pull changes from the specified source
86 86 push push changes to the specified destination
87 87 recover roll back an interrupted transaction
88 88 remove remove the specified files on the next commit
89 89 rename rename files; equivalent of copy + remove
90 90 resolve redo merges or set/view the merge status of files
91 91 revert restore files to their checkout state
92 92 root print the root (top) of the current working directory
93 93 serve start stand-alone webserver
94 94 status show changed files in the working directory
95 95 summary summarize working directory state
96 96 tag add one or more tags for the current or given revision
97 97 tags list repository tags
98 98 unbundle apply one or more bundle files
99 99 update update working directory (or switch revisions)
100 100 verify verify the integrity of the repository
101 101 version output version and copyright information
102 102
103 103 additional help topics:
104 104
105 105 bundlespec Bundle File Formats
106 106 color Colorizing Outputs
107 107 config Configuration Files
108 108 dates Date Formats
109 109 diffs Diff Formats
110 110 environment Environment Variables
111 111 extensions Using Additional Features
112 112 filesets Specifying File Sets
113 113 glossary Glossary
114 114 hgignore Syntax for Mercurial Ignore Files
115 115 hgweb Configuring hgweb
116 116 internals Technical implementation topics
117 117 merge-tools Merge Tools
118 118 pager Pager Support
119 119 patterns File Name Patterns
120 120 phases Working with Phases
121 121 revisions Specifying Revisions
122 122 scripting Using Mercurial from scripts and automation
123 123 subrepos Subrepositories
124 124 templating Template Usage
125 125 urls URL Paths
126 126
127 127 (use 'hg help -v' to show built-in aliases and global options)
128 128
129 129 $ hg -q help
130 130 add add the specified files on the next commit
131 131 addremove add all new files, delete all missing files
132 132 annotate show changeset information by line for each file
133 133 archive create an unversioned archive of a repository revision
134 134 backout reverse effect of earlier changeset
135 135 bisect subdivision search of changesets
136 136 bookmarks create a new bookmark or list existing bookmarks
137 137 branch set or show the current branch name
138 138 branches list repository named branches
139 139 bundle create a bundle file
140 140 cat output the current or given revision of files
141 141 clone make a copy of an existing repository
142 142 commit commit the specified files or all outstanding changes
143 143 config show combined config settings from all hgrc files
144 144 copy mark files as copied for the next commit
145 145 diff diff repository (or selected files)
146 146 export dump the header and diffs for one or more changesets
147 147 files list tracked files
148 148 forget forget the specified files on the next commit
149 149 graft copy changes from other branches onto the current branch
150 150 grep search revision history for a pattern in specified files
151 151 heads show branch heads
152 152 help show help for a given topic or a help overview
153 153 identify identify the working directory or specified revision
154 154 import import an ordered set of patches
155 155 incoming show new changesets found in source
156 156 init create a new repository in the given directory
157 157 log show revision history of entire repository or files
158 158 manifest output the current or given revision of the project manifest
159 159 merge merge another revision into working directory
160 160 outgoing show changesets not found in the destination
161 161 paths show aliases for remote repositories
162 162 phase set or show the current phase name
163 163 pull pull changes from the specified source
164 164 push push changes to the specified destination
165 165 recover roll back an interrupted transaction
166 166 remove remove the specified files on the next commit
167 167 rename rename files; equivalent of copy + remove
168 168 resolve redo merges or set/view the merge status of files
169 169 revert restore files to their checkout state
170 170 root print the root (top) of the current working directory
171 171 serve start stand-alone webserver
172 172 status show changed files in the working directory
173 173 summary summarize working directory state
174 174 tag add one or more tags for the current or given revision
175 175 tags list repository tags
176 176 unbundle apply one or more bundle files
177 177 update update working directory (or switch revisions)
178 178 verify verify the integrity of the repository
179 179 version output version and copyright information
180 180
181 181 additional help topics:
182 182
183 183 bundlespec Bundle File Formats
184 184 color Colorizing Outputs
185 185 config Configuration Files
186 186 dates Date Formats
187 187 diffs Diff Formats
188 188 environment Environment Variables
189 189 extensions Using Additional Features
190 190 filesets Specifying File Sets
191 191 glossary Glossary
192 192 hgignore Syntax for Mercurial Ignore Files
193 193 hgweb Configuring hgweb
194 194 internals Technical implementation topics
195 195 merge-tools Merge Tools
196 196 pager Pager Support
197 197 patterns File Name Patterns
198 198 phases Working with Phases
199 199 revisions Specifying Revisions
200 200 scripting Using Mercurial from scripts and automation
201 201 subrepos Subrepositories
202 202 templating Template Usage
203 203 urls URL Paths
204 204
205 205 Test extension help:
206 206 $ hg help extensions --config extensions.rebase= --config extensions.children=
207 207 Using Additional Features
208 208 """""""""""""""""""""""""
209 209
210 210 Mercurial has the ability to add new features through the use of
211 211 extensions. Extensions may add new commands, add options to existing
212 212 commands, change the default behavior of commands, or implement hooks.
213 213
214 214 To enable the "foo" extension, either shipped with Mercurial or in the
215 215 Python search path, create an entry for it in your configuration file,
216 216 like this:
217 217
218 218 [extensions]
219 219 foo =
220 220
221 221 You may also specify the full path to an extension:
222 222
223 223 [extensions]
224 224 myfeature = ~/.hgext/myfeature.py
225 225
226 226 See 'hg help config' for more information on configuration files.
227 227
228 228 Extensions are not loaded by default for a variety of reasons: they can
229 229 increase startup overhead; they may be meant for advanced usage only; they
230 230 may provide potentially dangerous abilities (such as letting you destroy
231 231 or modify history); they might not be ready for prime time; or they may
232 232 alter some usual behaviors of stock Mercurial. It is thus up to the user
233 233 to activate extensions as needed.
234 234
235 235 To explicitly disable an extension enabled in a configuration file of
236 236 broader scope, prepend its path with !:
237 237
238 238 [extensions]
239 239 # disabling extension bar residing in /path/to/extension/bar.py
240 240 bar = !/path/to/extension/bar.py
241 241 # ditto, but no path was supplied for extension baz
242 242 baz = !
243 243
244 244 enabled extensions:
245 245
246 246 children command to display child changesets (DEPRECATED)
247 247 rebase command to move sets of revisions to a different ancestor
248 248
249 249 disabled extensions:
250 250
251 251 acl hooks for controlling repository access
252 252 blackbox log repository events to a blackbox for debugging
253 253 bugzilla hooks for integrating with the Bugzilla bug tracker
254 254 censor erase file content at a given revision
255 255 churn command to display statistics about repository history
256 256 clonebundles advertise pre-generated bundles to seed clones
257 257 convert import revisions from foreign VCS repositories into
258 258 Mercurial
259 259 eol automatically manage newlines in repository files
260 260 extdiff command to allow external programs to compare revisions
261 261 factotum http authentication with factotum
262 262 gpg commands to sign and verify changesets
263 263 hgk browse the repository in a graphical way
264 264 highlight syntax highlighting for hgweb (requires Pygments)
265 265 histedit interactive history editing
266 266 keyword expand keywords in tracked files
267 267 largefiles track large binary files
268 268 mq manage a stack of patches
269 269 notify hooks for sending email push notifications
270 270 patchbomb command to send changesets as (a series of) patch emails
271 271 purge command to delete untracked files from the working
272 272 directory
273 273 relink recreates hardlinks between repository clones
274 274 schemes extend schemes with shortcuts to repository swarms
275 275 share share a common history between several working directories
276 276 shelve save and restore changes to the working directory
277 277 strip strip changesets and their descendants from history
278 278 transplant command to transplant changesets from another branch
279 279 win32mbcs allow the use of MBCS paths with problematic encodings
280 280 zeroconf discover and advertise repositories on the local network
281 281
282 282 Verify that extension keywords appear in help templates
283 283
284 284 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
285 285
286 286 Test short command list with verbose option
287 287
288 288 $ hg -v help shortlist
289 289 Mercurial Distributed SCM
290 290
291 291 basic commands:
292 292
293 293 add add the specified files on the next commit
294 294 annotate, blame
295 295 show changeset information by line for each file
296 296 clone make a copy of an existing repository
297 297 commit, ci commit the specified files or all outstanding changes
298 298 diff diff repository (or selected files)
299 299 export dump the header and diffs for one or more changesets
300 300 forget forget the specified files on the next commit
301 301 init create a new repository in the given directory
302 302 log, history show revision history of entire repository or files
303 303 merge merge another revision into working directory
304 304 pull pull changes from the specified source
305 305 push push changes to the specified destination
306 306 remove, rm remove the specified files on the next commit
307 307 serve start stand-alone webserver
308 308 status, st show changed files in the working directory
309 309 summary, sum summarize working directory state
310 310 update, up, checkout, co
311 311 update working directory (or switch revisions)
312 312
313 313 global options ([+] can be repeated):
314 314
315 315 -R --repository REPO repository root directory or name of overlay bundle
316 316 file
317 317 --cwd DIR change working directory
318 318 -y --noninteractive do not prompt, automatically pick the first choice for
319 319 all prompts
320 320 -q --quiet suppress output
321 321 -v --verbose enable additional output
322 322 --color TYPE when to colorize (boolean, always, auto, never, or
323 323 debug)
324 324 --config CONFIG [+] set/override config option (use 'section.name=value')
325 325 --debug enable debugging output
326 326 --debugger start debugger
327 327 --encoding ENCODE set the charset encoding (default: ascii)
328 328 --encodingmode MODE set the charset encoding mode (default: strict)
329 329 --traceback always print a traceback on exception
330 330 --time time how long the command takes
331 331 --profile print command execution profile
332 332 --version output version information and exit
333 333 -h --help display help and exit
334 334 --hidden consider hidden changesets
335 335 --pager TYPE when to paginate (boolean, always, auto, or never)
336 336 (default: auto)
337 337
338 338 (use 'hg help' for the full list of commands)
339 339
340 340 $ hg add -h
341 341 hg add [OPTION]... [FILE]...
342 342
343 343 add the specified files on the next commit
344 344
345 345 Schedule files to be version controlled and added to the repository.
346 346
347 347 The files will be added to the repository at the next commit. To undo an
348 348 add before that, see 'hg forget'.
349 349
350 350 If no names are given, add all files to the repository (except files
351 351 matching ".hgignore").
352 352
353 353 Returns 0 if all files are successfully added.
354 354
355 355 options ([+] can be repeated):
356 356
357 357 -I --include PATTERN [+] include names matching the given patterns
358 358 -X --exclude PATTERN [+] exclude names matching the given patterns
359 359 -S --subrepos recurse into subrepositories
360 360 -n --dry-run do not perform actions, just print output
361 361
362 362 (some details hidden, use --verbose to show complete help)
363 363
364 364 Verbose help for add
365 365
366 366 $ hg add -hv
367 367 hg add [OPTION]... [FILE]...
368 368
369 369 add the specified files on the next commit
370 370
371 371 Schedule files to be version controlled and added to the repository.
372 372
373 373 The files will be added to the repository at the next commit. To undo an
374 374 add before that, see 'hg forget'.
375 375
376 376 If no names are given, add all files to the repository (except files
377 377 matching ".hgignore").
378 378
379 379 Examples:
380 380
381 381 - New (unknown) files are added automatically by 'hg add':
382 382
383 383 $ ls
384 384 foo.c
385 385 $ hg status
386 386 ? foo.c
387 387 $ hg add
388 388 adding foo.c
389 389 $ hg status
390 390 A foo.c
391 391
392 392 - Specific files to be added can be specified:
393 393
394 394 $ ls
395 395 bar.c foo.c
396 396 $ hg status
397 397 ? bar.c
398 398 ? foo.c
399 399 $ hg add bar.c
400 400 $ hg status
401 401 A bar.c
402 402 ? foo.c
403 403
404 404 Returns 0 if all files are successfully added.
405 405
406 406 options ([+] can be repeated):
407 407
408 408 -I --include PATTERN [+] include names matching the given patterns
409 409 -X --exclude PATTERN [+] exclude names matching the given patterns
410 410 -S --subrepos recurse into subrepositories
411 411 -n --dry-run do not perform actions, just print output
412 412
413 413 global options ([+] can be repeated):
414 414
415 415 -R --repository REPO repository root directory or name of overlay bundle
416 416 file
417 417 --cwd DIR change working directory
418 418 -y --noninteractive do not prompt, automatically pick the first choice for
419 419 all prompts
420 420 -q --quiet suppress output
421 421 -v --verbose enable additional output
422 422 --color TYPE when to colorize (boolean, always, auto, never, or
423 423 debug)
424 424 --config CONFIG [+] set/override config option (use 'section.name=value')
425 425 --debug enable debugging output
426 426 --debugger start debugger
427 427 --encoding ENCODE set the charset encoding (default: ascii)
428 428 --encodingmode MODE set the charset encoding mode (default: strict)
429 429 --traceback always print a traceback on exception
430 430 --time time how long the command takes
431 431 --profile print command execution profile
432 432 --version output version information and exit
433 433 -h --help display help and exit
434 434 --hidden consider hidden changesets
435 435 --pager TYPE when to paginate (boolean, always, auto, or never)
436 436 (default: auto)
437 437
438 438 Test the textwidth config option
439 439
440 440 $ hg root -h --config ui.textwidth=50
441 441 hg root
442 442
443 443 print the root (top) of the current working
444 444 directory
445 445
446 446 Print the root directory of the current
447 447 repository.
448 448
449 449 Returns 0 on success.
450 450
451 451 (some details hidden, use --verbose to show
452 452 complete help)
453 453
454 454 Test help option with version option
455 455
456 456 $ hg add -h --version
457 457 Mercurial Distributed SCM (version *) (glob)
458 458 (see https://mercurial-scm.org for more information)
459 459
460 460 Copyright (C) 2005-* Matt Mackall and others (glob)
461 461 This is free software; see the source for copying conditions. There is NO
462 462 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
463 463
464 464 $ hg add --skjdfks
465 465 hg add: option --skjdfks not recognized
466 466 hg add [OPTION]... [FILE]...
467 467
468 468 add the specified files on the next commit
469 469
470 470 options ([+] can be repeated):
471 471
472 472 -I --include PATTERN [+] include names matching the given patterns
473 473 -X --exclude PATTERN [+] exclude names matching the given patterns
474 474 -S --subrepos recurse into subrepositories
475 475 -n --dry-run do not perform actions, just print output
476 476
477 477 (use 'hg add -h' to show more help)
478 478 [255]
479 479
480 480 Test ambiguous command help
481 481
482 482 $ hg help ad
483 483 list of commands:
484 484
485 485 add add the specified files on the next commit
486 486 addremove add all new files, delete all missing files
487 487
488 488 (use 'hg help -v ad' to show built-in aliases and global options)
489 489
490 490 Test command without options
491 491
492 492 $ hg help verify
493 493 hg verify
494 494
495 495 verify the integrity of the repository
496 496
497 497 Verify the integrity of the current repository.
498 498
499 499 This will perform an extensive check of the repository's integrity,
500 500 validating the hashes and checksums of each entry in the changelog,
501 501 manifest, and tracked files, as well as the integrity of their crosslinks
502 502 and indices.
503 503
504 504 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
505 505 information about recovery from corruption of the repository.
506 506
507 507 Returns 0 on success, 1 if errors are encountered.
508 508
509 509 (some details hidden, use --verbose to show complete help)
510 510
511 511 $ hg help diff
512 512 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
513 513
514 514 diff repository (or selected files)
515 515
516 516 Show differences between revisions for the specified files.
517 517
518 518 Differences between files are shown using the unified diff format.
519 519
520 520 Note:
521 521 'hg diff' may generate unexpected results for merges, as it will
522 522 default to comparing against the working directory's first parent
523 523 changeset if no revisions are specified.
524 524
525 525 When two revision arguments are given, then changes are shown between
526 526 those revisions. If only one revision is specified then that revision is
527 527 compared to the working directory, and, when no revisions are specified,
528 528 the working directory files are compared to its first parent.
529 529
530 530 Alternatively you can specify -c/--change with a revision to see the
531 531 changes in that changeset relative to its first parent.
532 532
533 533 Without the -a/--text option, diff will avoid generating diffs of files it
534 534 detects as binary. With -a, diff will generate a diff anyway, probably
535 535 with undesirable results.
536 536
537 537 Use the -g/--git option to generate diffs in the git extended diff format.
538 538 For more information, read 'hg help diffs'.
539 539
540 540 Returns 0 on success.
541 541
542 542 options ([+] can be repeated):
543 543
544 544 -r --rev REV [+] revision
545 545 -c --change REV change made by revision
546 546 -a --text treat all files as text
547 547 -g --git use git extended diff format
548 548 --binary generate binary diffs in git mode (default)
549 549 --nodates omit dates from diff headers
550 550 --noprefix omit a/ and b/ prefixes from filenames
551 551 -p --show-function show which function each change is in
552 552 --reverse produce a diff that undoes the changes
553 553 -w --ignore-all-space ignore white space when comparing lines
554 554 -b --ignore-space-change ignore changes in the amount of white space
555 555 -B --ignore-blank-lines ignore changes whose lines are all blank
556 556 -U --unified NUM number of lines of context to show
557 557 --stat output diffstat-style summary of changes
558 558 --root DIR produce diffs relative to subdirectory
559 559 -I --include PATTERN [+] include names matching the given patterns
560 560 -X --exclude PATTERN [+] exclude names matching the given patterns
561 561 -S --subrepos recurse into subrepositories
562 562
563 563 (some details hidden, use --verbose to show complete help)
564 564
565 565 $ hg help status
566 566 hg status [OPTION]... [FILE]...
567 567
568 568 aliases: st
569 569
570 570 show changed files in the working directory
571 571
572 572 Show status of files in the repository. If names are given, only files
573 573 that match are shown. Files that are clean or ignored or the source of a
574 574 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
575 575 -C/--copies or -A/--all are given. Unless options described with "show
576 576 only ..." are given, the options -mardu are used.
577 577
578 578 Option -q/--quiet hides untracked (unknown and ignored) files unless
579 579 explicitly requested with -u/--unknown or -i/--ignored.
580 580
581 581 Note:
582 582 'hg status' may appear to disagree with diff if permissions have
583 583 changed or a merge has occurred. The standard diff format does not
584 584 report permission changes and diff only reports changes relative to one
585 585 merge parent.
586 586
587 587 If one revision is given, it is used as the base revision. If two
588 588 revisions are given, the differences between them are shown. The --change
589 589 option can also be used as a shortcut to list the changed files of a
590 590 revision from its first parent.
591 591
592 592 The codes used to show the status of files are:
593 593
594 594 M = modified
595 595 A = added
596 596 R = removed
597 597 C = clean
598 598 ! = missing (deleted by non-hg command, but still tracked)
599 599 ? = not tracked
600 600 I = ignored
601 601 = origin of the previous file (with --copies)
602 602
603 603 Returns 0 on success.
604 604
605 605 options ([+] can be repeated):
606 606
607 607 -A --all show status of all files
608 608 -m --modified show only modified files
609 609 -a --added show only added files
610 610 -r --removed show only removed files
611 611 -d --deleted show only deleted (but tracked) files
612 612 -c --clean show only files without changes
613 613 -u --unknown show only unknown (not tracked) files
614 614 -i --ignored show only ignored files
615 615 -n --no-status hide status prefix
616 616 -C --copies show source of copied files
617 617 -0 --print0 end filenames with NUL, for use with xargs
618 618 --rev REV [+] show difference from revision
619 619 --change REV list the changed files of a revision
620 620 -I --include PATTERN [+] include names matching the given patterns
621 621 -X --exclude PATTERN [+] exclude names matching the given patterns
622 622 -S --subrepos recurse into subrepositories
623 623
624 624 (some details hidden, use --verbose to show complete help)
625 625
626 626 $ hg -q help status
627 627 hg status [OPTION]... [FILE]...
628 628
629 629 show changed files in the working directory
630 630
631 631 $ hg help foo
632 632 abort: no such help topic: foo
633 633 (try 'hg help --keyword foo')
634 634 [255]
635 635
636 636 $ hg skjdfks
637 637 hg: unknown command 'skjdfks'
638 638 Mercurial Distributed SCM
639 639
640 640 basic commands:
641 641
642 642 add add the specified files on the next commit
643 643 annotate show changeset information by line for each file
644 644 clone make a copy of an existing repository
645 645 commit commit the specified files or all outstanding changes
646 646 diff diff repository (or selected files)
647 647 export dump the header and diffs for one or more changesets
648 648 forget forget the specified files on the next commit
649 649 init create a new repository in the given directory
650 650 log show revision history of entire repository or files
651 651 merge merge another revision into working directory
652 652 pull pull changes from the specified source
653 653 push push changes to the specified destination
654 654 remove remove the specified files on the next commit
655 655 serve start stand-alone webserver
656 656 status show changed files in the working directory
657 657 summary summarize working directory state
658 658 update update working directory (or switch revisions)
659 659
660 660 (use 'hg help' for the full list of commands or 'hg -v' for details)
661 661 [255]
662 662
663 663 Typoed command gives suggestion
664 664 $ hg puls
665 665 hg: unknown command 'puls'
666 666 (did you mean one of pull, push?)
667 667 [255]
668 668
669 669 Not enabled extension gets suggested
670 670
671 671 $ hg rebase
672 672 hg: unknown command 'rebase'
673 673 'rebase' is provided by the following extension:
674 674
675 675 rebase command to move sets of revisions to a different ancestor
676 676
677 677 (use 'hg help extensions' for information on enabling extensions)
678 678 [255]
679 679
680 680 Disabled extension gets suggested
681 681 $ hg --config extensions.rebase=! rebase
682 682 hg: unknown command 'rebase'
683 683 'rebase' is provided by the following extension:
684 684
685 685 rebase command to move sets of revisions to a different ancestor
686 686
687 687 (use 'hg help extensions' for information on enabling extensions)
688 688 [255]
689 689
690 690 Make sure that we don't run afoul of the help system thinking that
691 691 this is a section and erroring out weirdly.
692 692
693 693 $ hg .log
694 694 hg: unknown command '.log'
695 695 (did you mean log?)
696 696 [255]
697 697
698 698 $ hg log.
699 699 hg: unknown command 'log.'
700 700 (did you mean log?)
701 701 [255]
702 702 $ hg pu.lh
703 703 hg: unknown command 'pu.lh'
704 704 (did you mean one of pull, push?)
705 705 [255]
706 706
707 707 $ cat > helpext.py <<EOF
708 708 > import os
709 709 > from mercurial import commands, registrar
710 710 >
711 711 > cmdtable = {}
712 712 > command = registrar.command(cmdtable)
713 713 >
714 714 > @command(b'nohelp',
715 715 > [(b'', b'longdesc', 3, b'x'*90),
716 716 > (b'n', b'', None, b'normal desc'),
717 717 > (b'', b'newline', b'', b'line1\nline2')],
718 718 > b'hg nohelp',
719 719 > norepo=True)
720 720 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
721 721 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
722 722 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
723 723 > def nohelp(ui, *args, **kwargs):
724 724 > pass
725 725 >
726 726 > def uisetup(ui):
727 727 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
728 728 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
729 729 >
730 730 > EOF
731 731 $ echo '[extensions]' >> $HGRCPATH
732 732 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
733 733
734 734 Test for aliases
735 735
736 736 $ hg help hgalias
737 737 hg hgalias [--remote]
738 738
739 739 alias for: hg summary
740 740
741 741 summarize working directory state
742 742
743 743 This generates a brief summary of the working directory state, including
744 744 parents, branch, commit status, phase and available updates.
745 745
746 746 With the --remote option, this will check the default paths for incoming
747 747 and outgoing changes. This can be time-consuming.
748 748
749 749 Returns 0 on success.
750 750
751 751 defined by: helpext
752 752
753 753 options:
754 754
755 755 --remote check for push and pull
756 756
757 757 (some details hidden, use --verbose to show complete help)
758 758
759 759 $ hg help shellalias
760 760 hg shellalias
761 761
762 762 shell alias for:
763 763
764 764 echo hi
765 765
766 766 defined by: helpext
767 767
768 768 (some details hidden, use --verbose to show complete help)
769 769
770 770 Test command with no help text
771 771
772 772 $ hg help nohelp
773 773 hg nohelp
774 774
775 775 (no help text available)
776 776
777 777 options:
778 778
779 779 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
780 780 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
781 781 -n -- normal desc
782 782 --newline VALUE line1 line2
783 783
784 784 (some details hidden, use --verbose to show complete help)
785 785
786 786 $ hg help -k nohelp
787 787 Commands:
788 788
789 789 nohelp hg nohelp
790 790
791 791 Extension Commands:
792 792
793 793 nohelp (no help text available)
794 794
795 795 Test that default list of commands omits extension commands
796 796
797 797 $ hg help
798 798 Mercurial Distributed SCM
799 799
800 800 list of commands:
801 801
802 802 add add the specified files on the next commit
803 803 addremove add all new files, delete all missing files
804 804 annotate show changeset information by line for each file
805 805 archive create an unversioned archive of a repository revision
806 806 backout reverse effect of earlier changeset
807 807 bisect subdivision search of changesets
808 808 bookmarks create a new bookmark or list existing bookmarks
809 809 branch set or show the current branch name
810 810 branches list repository named branches
811 811 bundle create a bundle file
812 812 cat output the current or given revision of files
813 813 clone make a copy of an existing repository
814 814 commit commit the specified files or all outstanding changes
815 815 config show combined config settings from all hgrc files
816 816 copy mark files as copied for the next commit
817 817 diff diff repository (or selected files)
818 818 export dump the header and diffs for one or more changesets
819 819 files list tracked files
820 820 forget forget the specified files on the next commit
821 821 graft copy changes from other branches onto the current branch
822 822 grep search revision history for a pattern in specified files
823 823 heads show branch heads
824 824 help show help for a given topic or a help overview
825 825 identify identify the working directory or specified revision
826 826 import import an ordered set of patches
827 827 incoming show new changesets found in source
828 828 init create a new repository in the given directory
829 829 log show revision history of entire repository or files
830 830 manifest output the current or given revision of the project manifest
831 831 merge merge another revision into working directory
832 832 outgoing show changesets not found in the destination
833 833 paths show aliases for remote repositories
834 834 phase set or show the current phase name
835 835 pull pull changes from the specified source
836 836 push push changes to the specified destination
837 837 recover roll back an interrupted transaction
838 838 remove remove the specified files on the next commit
839 839 rename rename files; equivalent of copy + remove
840 840 resolve redo merges or set/view the merge status of files
841 841 revert restore files to their checkout state
842 842 root print the root (top) of the current working directory
843 843 serve start stand-alone webserver
844 844 status show changed files in the working directory
845 845 summary summarize working directory state
846 846 tag add one or more tags for the current or given revision
847 847 tags list repository tags
848 848 unbundle apply one or more bundle files
849 849 update update working directory (or switch revisions)
850 850 verify verify the integrity of the repository
851 851 version output version and copyright information
852 852
853 853 enabled extensions:
854 854
855 855 helpext (no help text available)
856 856
857 857 additional help topics:
858 858
859 859 bundlespec Bundle File Formats
860 860 color Colorizing Outputs
861 861 config Configuration Files
862 862 dates Date Formats
863 863 diffs Diff Formats
864 864 environment Environment Variables
865 865 extensions Using Additional Features
866 866 filesets Specifying File Sets
867 867 glossary Glossary
868 868 hgignore Syntax for Mercurial Ignore Files
869 869 hgweb Configuring hgweb
870 870 internals Technical implementation topics
871 871 merge-tools Merge Tools
872 872 pager Pager Support
873 873 patterns File Name Patterns
874 874 phases Working with Phases
875 875 revisions Specifying Revisions
876 876 scripting Using Mercurial from scripts and automation
877 877 subrepos Subrepositories
878 878 templating Template Usage
879 879 urls URL Paths
880 880
881 881 (use 'hg help -v' to show built-in aliases and global options)
882 882
883 883
884 884 Test list of internal help commands
885 885
886 886 $ hg help debug
887 887 debug commands (internal and unsupported):
888 888
889 889 debugancestor
890 890 find the ancestor revision of two revisions in a given index
891 891 debugapplystreamclonebundle
892 892 apply a stream clone bundle file
893 893 debugbuilddag
894 894 builds a repo with a given DAG from scratch in the current
895 895 empty repo
896 896 debugbundle lists the contents of a bundle
897 897 debugcheckstate
898 898 validate the correctness of the current dirstate
899 899 debugcolor show available color, effects or style
900 900 debugcommands
901 901 list all available commands and options
902 902 debugcomplete
903 903 returns the completion list associated with the given command
904 904 debugcreatestreamclonebundle
905 905 create a stream clone bundle file
906 906 debugdag format the changelog or an index DAG as a concise textual
907 907 description
908 908 debugdata dump the contents of a data file revision
909 909 debugdate parse and display a date
910 910 debugdeltachain
911 911 dump information about delta chains in a revlog
912 912 debugdirstate
913 913 show the contents of the current dirstate
914 914 debugdiscovery
915 915 runs the changeset discovery protocol in isolation
916 916 debugextensions
917 917 show information about active extensions
918 918 debugfileset parse and apply a fileset specification
919 919 debugfsinfo show information detected about current filesystem
920 920 debuggetbundle
921 921 retrieves a bundle from a repo
922 922 debugignore display the combined ignore pattern and information about
923 923 ignored files
924 924 debugindex dump the contents of an index file
925 925 debugindexdot
926 926 dump an index DAG as a graphviz dot file
927 927 debuginstall test Mercurial installation
928 928 debugknown test whether node ids are known to a repo
929 929 debuglocks show or modify state of locks
930 930 debugmergestate
931 931 print merge state
932 932 debugnamecomplete
933 933 complete "names" - tags, open branch names, bookmark names
934 934 debugobsolete
935 935 create arbitrary obsolete marker
936 936 debugoptADV (no help text available)
937 937 debugoptDEP (no help text available)
938 938 debugoptEXP (no help text available)
939 939 debugpathcomplete
940 940 complete part or all of a tracked path
941 941 debugpickmergetool
942 942 examine which merge tool is chosen for specified file
943 943 debugpushkey access the pushkey key/value protocol
944 944 debugpvec (no help text available)
945 945 debugrebuilddirstate
946 946 rebuild the dirstate as it would look like for the given
947 947 revision
948 948 debugrebuildfncache
949 949 rebuild the fncache file
950 950 debugrename dump rename information
951 951 debugrevlog show data and statistics about a revlog
952 952 debugrevspec parse and apply a revision specification
953 953 debugsetparents
954 954 manually set the parents of the current working directory
955 955 debugssl test a secure connection to a server
956 956 debugsub (no help text available)
957 957 debugsuccessorssets
958 958 show set of successors for revision
959 959 debugtemplate
960 960 parse and apply a template
961 961 debugupdatecaches
962 962 warm all known caches in the repository
963 963 debugupgraderepo
964 964 upgrade a repository to use different features
965 965 debugwalk show how files match on given patterns
966 966 debugwireargs
967 967 (no help text available)
968 968
969 969 (use 'hg help -v debug' to show built-in aliases and global options)
970 970
971 971 internals topic renders index of available sub-topics
972 972
973 973 $ hg help internals
974 974 Technical implementation topics
975 975 """""""""""""""""""""""""""""""
976 976
977 977 To access a subtopic, use "hg help internals.{subtopic-name}"
978 978
979 979 bundles Bundles
980 980 censor Censor
981 981 changegroups Changegroups
982 982 requirements Repository Requirements
983 983 revlogs Revision Logs
984 984 wireprotocol Wire Protocol
985 985
986 986 sub-topics can be accessed
987 987
988 988 $ hg help internals.changegroups
989 989 Changegroups
990 990 """"""""""""
991 991
992 992 Changegroups are representations of repository revlog data, specifically
993 993 the changelog data, root/flat manifest data, treemanifest data, and
994 994 filelogs.
995 995
996 996 There are 3 versions of changegroups: "1", "2", and "3". From a high-
997 997 level, versions "1" and "2" are almost exactly the same, with the only
998 998 difference being an additional item in the *delta header*. Version "3"
999 999 adds support for revlog flags in the *delta header* and optionally
1000 1000 exchanging treemanifests (enabled by setting an option on the
1001 1001 "changegroup" part in the bundle2).
1002 1002
1003 1003 Changegroups when not exchanging treemanifests consist of 3 logical
1004 1004 segments:
1005 1005
1006 1006 +---------------------------------+
1007 1007 | | | |
1008 1008 | changeset | manifest | filelogs |
1009 1009 | | | |
1010 1010 | | | |
1011 1011 +---------------------------------+
1012 1012
1013 1013 When exchanging treemanifests, there are 4 logical segments:
1014 1014
1015 1015 +-------------------------------------------------+
1016 1016 | | | | |
1017 1017 | changeset | root | treemanifests | filelogs |
1018 1018 | | manifest | | |
1019 1019 | | | | |
1020 1020 +-------------------------------------------------+
1021 1021
1022 1022 The principle building block of each segment is a *chunk*. A *chunk* is a
1023 1023 framed piece of data:
1024 1024
1025 1025 +---------------------------------------+
1026 1026 | | |
1027 1027 | length | data |
1028 1028 | (4 bytes) | (<length - 4> bytes) |
1029 1029 | | |
1030 1030 +---------------------------------------+
1031 1031
1032 1032 All integers are big-endian signed integers. Each chunk starts with a
1033 1033 32-bit integer indicating the length of the entire chunk (including the
1034 1034 length field itself).
1035 1035
1036 1036 There is a special case chunk that has a value of 0 for the length
1037 1037 ("0x00000000"). We call this an *empty chunk*.
1038 1038
1039 1039 Delta Groups
1040 1040 ============
1041 1041
1042 1042 A *delta group* expresses the content of a revlog as a series of deltas,
1043 1043 or patches against previous revisions.
1044 1044
1045 1045 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1046 1046 to signal the end of the delta group:
1047 1047
1048 1048 +------------------------------------------------------------------------+
1049 1049 | | | | | |
1050 1050 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1051 1051 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1052 1052 | | | | | |
1053 1053 +------------------------------------------------------------------------+
1054 1054
1055 1055 Each *chunk*'s data consists of the following:
1056 1056
1057 1057 +---------------------------------------+
1058 1058 | | |
1059 1059 | delta header | delta data |
1060 1060 | (various by version) | (various) |
1061 1061 | | |
1062 1062 +---------------------------------------+
1063 1063
1064 1064 The *delta data* is a series of *delta*s that describe a diff from an
1065 1065 existing entry (either that the recipient already has, or previously
1066 1066 specified in the bundle/changegroup).
1067 1067
1068 1068 The *delta header* is different between versions "1", "2", and "3" of the
1069 1069 changegroup format.
1070 1070
1071 1071 Version 1 (headerlen=80):
1072 1072
1073 1073 +------------------------------------------------------+
1074 1074 | | | | |
1075 1075 | node | p1 node | p2 node | link node |
1076 1076 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1077 1077 | | | | |
1078 1078 +------------------------------------------------------+
1079 1079
1080 1080 Version 2 (headerlen=100):
1081 1081
1082 1082 +------------------------------------------------------------------+
1083 1083 | | | | | |
1084 1084 | node | p1 node | p2 node | base node | link node |
1085 1085 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1086 1086 | | | | | |
1087 1087 +------------------------------------------------------------------+
1088 1088
1089 1089 Version 3 (headerlen=102):
1090 1090
1091 1091 +------------------------------------------------------------------------------+
1092 1092 | | | | | | |
1093 1093 | node | p1 node | p2 node | base node | link node | flags |
1094 1094 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1095 1095 | | | | | | |
1096 1096 +------------------------------------------------------------------------------+
1097 1097
1098 1098 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1099 1099 contain a series of *delta*s, densely packed (no separators). These deltas
1100 1100 describe a diff from an existing entry (either that the recipient already
1101 1101 has, or previously specified in the bundle/changegroup). The format is
1102 1102 described more fully in "hg help internals.bdiff", but briefly:
1103 1103
1104 1104 +---------------------------------------------------------------+
1105 1105 | | | | |
1106 1106 | start offset | end offset | new length | content |
1107 1107 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1108 1108 | | | | |
1109 1109 +---------------------------------------------------------------+
1110 1110
1111 1111 Please note that the length field in the delta data does *not* include
1112 1112 itself.
1113 1113
1114 1114 In version 1, the delta is always applied against the previous node from
1115 1115 the changegroup or the first parent if this is the first entry in the
1116 1116 changegroup.
1117 1117
1118 1118 In version 2 and up, the delta base node is encoded in the entry in the
1119 1119 changegroup. This allows the delta to be expressed against any parent,
1120 1120 which can result in smaller deltas and more efficient encoding of data.
1121 1121
1122 1122 Changeset Segment
1123 1123 =================
1124 1124
1125 1125 The *changeset segment* consists of a single *delta group* holding
1126 1126 changelog data. The *empty chunk* at the end of the *delta group* denotes
1127 1127 the boundary to the *manifest segment*.
1128 1128
1129 1129 Manifest Segment
1130 1130 ================
1131 1131
1132 1132 The *manifest segment* consists of a single *delta group* holding manifest
1133 1133 data. If treemanifests are in use, it contains only the manifest for the
1134 1134 root directory of the repository. Otherwise, it contains the entire
1135 1135 manifest data. The *empty chunk* at the end of the *delta group* denotes
1136 1136 the boundary to the next segment (either the *treemanifests segment* or
1137 1137 the *filelogs segment*, depending on version and the request options).
1138 1138
1139 1139 Treemanifests Segment
1140 1140 ---------------------
1141 1141
1142 1142 The *treemanifests segment* only exists in changegroup version "3", and
1143 1143 only if the 'treemanifest' param is part of the bundle2 changegroup part
1144 1144 (it is not possible to use changegroup version 3 outside of bundle2).
1145 1145 Aside from the filenames in the *treemanifests segment* containing a
1146 1146 trailing "/" character, it behaves identically to the *filelogs segment*
1147 1147 (see below). The final sub-segment is followed by an *empty chunk*
1148 1148 (logically, a sub-segment with filename size 0). This denotes the boundary
1149 1149 to the *filelogs segment*.
1150 1150
1151 1151 Filelogs Segment
1152 1152 ================
1153 1153
1154 1154 The *filelogs segment* consists of multiple sub-segments, each
1155 1155 corresponding to an individual file whose data is being described:
1156 1156
1157 1157 +--------------------------------------------------+
1158 1158 | | | | | |
1159 1159 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1160 1160 | | | | | (4 bytes) |
1161 1161 | | | | | |
1162 1162 +--------------------------------------------------+
1163 1163
1164 1164 The final filelog sub-segment is followed by an *empty chunk* (logically,
1165 1165 a sub-segment with filename size 0). This denotes the end of the segment
1166 1166 and of the overall changegroup.
1167 1167
1168 1168 Each filelog sub-segment consists of the following:
1169 1169
1170 1170 +------------------------------------------------------+
1171 1171 | | | |
1172 1172 | filename length | filename | delta group |
1173 1173 | (4 bytes) | (<length - 4> bytes) | (various) |
1174 1174 | | | |
1175 1175 +------------------------------------------------------+
1176 1176
1177 1177 That is, a *chunk* consisting of the filename (not terminated or padded)
1178 1178 followed by N chunks constituting the *delta group* for this file. The
1179 1179 *empty chunk* at the end of each *delta group* denotes the boundary to the
1180 1180 next filelog sub-segment.
1181 1181
1182 1182 Test list of commands with command with no help text
1183 1183
1184 1184 $ hg help helpext
1185 1185 helpext extension - no help text available
1186 1186
1187 1187 list of commands:
1188 1188
1189 1189 nohelp (no help text available)
1190 1190
1191 1191 (use 'hg help -v helpext' to show built-in aliases and global options)
1192 1192
1193 1193
1194 1194 test advanced, deprecated and experimental options are hidden in command help
1195 1195 $ hg help debugoptADV
1196 1196 hg debugoptADV
1197 1197
1198 1198 (no help text available)
1199 1199
1200 1200 options:
1201 1201
1202 1202 (some details hidden, use --verbose to show complete help)
1203 1203 $ hg help debugoptDEP
1204 1204 hg debugoptDEP
1205 1205
1206 1206 (no help text available)
1207 1207
1208 1208 options:
1209 1209
1210 1210 (some details hidden, use --verbose to show complete help)
1211 1211
1212 1212 $ hg help debugoptEXP
1213 1213 hg debugoptEXP
1214 1214
1215 1215 (no help text available)
1216 1216
1217 1217 options:
1218 1218
1219 1219 (some details hidden, use --verbose to show complete help)
1220 1220
1221 1221 test advanced, deprecated and experimental options are shown with -v
1222 1222 $ hg help -v debugoptADV | grep aopt
1223 1223 --aopt option is (ADVANCED)
1224 1224 $ hg help -v debugoptDEP | grep dopt
1225 1225 --dopt option is (DEPRECATED)
1226 1226 $ hg help -v debugoptEXP | grep eopt
1227 1227 --eopt option is (EXPERIMENTAL)
1228 1228
1229 1229 #if gettext
1230 1230 test deprecated option is hidden with translation with untranslated description
1231 1231 (use many globy for not failing on changed transaction)
1232 1232 $ LANGUAGE=sv hg help debugoptDEP
1233 1233 hg debugoptDEP
1234 1234
1235 1235 (*) (glob)
1236 1236
1237 1237 options:
1238 1238
1239 1239 (some details hidden, use --verbose to show complete help)
1240 1240 #endif
1241 1241
1242 1242 Test commands that collide with topics (issue4240)
1243 1243
1244 1244 $ hg config -hq
1245 1245 hg config [-u] [NAME]...
1246 1246
1247 1247 show combined config settings from all hgrc files
1248 1248 $ hg showconfig -hq
1249 1249 hg config [-u] [NAME]...
1250 1250
1251 1251 show combined config settings from all hgrc files
1252 1252
1253 1253 Test a help topic
1254 1254
1255 1255 $ hg help dates
1256 1256 Date Formats
1257 1257 """"""""""""
1258 1258
1259 1259 Some commands allow the user to specify a date, e.g.:
1260 1260
1261 1261 - backout, commit, import, tag: Specify the commit date.
1262 1262 - log, revert, update: Select revision(s) by date.
1263 1263
1264 1264 Many date formats are valid. Here are some examples:
1265 1265
1266 1266 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1267 1267 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1268 1268 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1269 1269 - "Dec 6" (midnight)
1270 1270 - "13:18" (today assumed)
1271 1271 - "3:39" (3:39AM assumed)
1272 1272 - "3:39pm" (15:39)
1273 1273 - "2006-12-06 13:18:29" (ISO 8601 format)
1274 1274 - "2006-12-6 13:18"
1275 1275 - "2006-12-6"
1276 1276 - "12-6"
1277 1277 - "12/6"
1278 1278 - "12/6/6" (Dec 6 2006)
1279 1279 - "today" (midnight)
1280 1280 - "yesterday" (midnight)
1281 1281 - "now" - right now
1282 1282
1283 1283 Lastly, there is Mercurial's internal format:
1284 1284
1285 1285 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1286 1286
1287 1287 This is the internal representation format for dates. The first number is
1288 1288 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1289 1289 is the offset of the local timezone, in seconds west of UTC (negative if
1290 1290 the timezone is east of UTC).
1291 1291
1292 1292 The log command also accepts date ranges:
1293 1293
1294 1294 - "<DATE" - at or before a given date/time
1295 1295 - ">DATE" - on or after a given date/time
1296 1296 - "DATE to DATE" - a date range, inclusive
1297 1297 - "-DAYS" - within a given number of days of today
1298 1298
1299 1299 Test repeated config section name
1300 1300
1301 1301 $ hg help config.host
1302 1302 "http_proxy.host"
1303 1303 Host name and (optional) port of the proxy server, for example
1304 1304 "myproxy:8000".
1305 1305
1306 1306 "smtp.host"
1307 1307 Host name of mail server, e.g. "mail.example.com".
1308 1308
1309 1309 Unrelated trailing paragraphs shouldn't be included
1310 1310
1311 1311 $ hg help config.extramsg | grep '^$'
1312 1312
1313 1313
1314 1314 Test capitalized section name
1315 1315
1316 1316 $ hg help scripting.HGPLAIN > /dev/null
1317 1317
1318 1318 Help subsection:
1319 1319
1320 1320 $ hg help config.charsets |grep "Email example:" > /dev/null
1321 1321 [1]
1322 1322
1323 1323 Show nested definitions
1324 1324 ("profiling.type"[break]"ls"[break]"stat"[break])
1325 1325
1326 1326 $ hg help config.type | egrep '^$'|wc -l
1327 1327 \s*3 (re)
1328 1328
1329 1329 Separate sections from subsections
1330 1330
1331 1331 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1332 1332 "format"
1333 1333 --------
1334 1334
1335 1335 "usegeneraldelta"
1336 1336
1337 1337 "dotencode"
1338 1338
1339 1339 "usefncache"
1340 1340
1341 1341 "usestore"
1342 1342
1343 1343 "profiling"
1344 1344 -----------
1345 1345
1346 1346 "format"
1347 1347
1348 1348 "progress"
1349 1349 ----------
1350 1350
1351 1351 "format"
1352 1352
1353 1353
1354 1354 Last item in help config.*:
1355 1355
1356 1356 $ hg help config.`hg help config|grep '^ "'| \
1357 1357 > tail -1|sed 's![ "]*!!g'`| \
1358 1358 > grep 'hg help -c config' > /dev/null
1359 1359 [1]
1360 1360
1361 1361 note to use help -c for general hg help config:
1362 1362
1363 1363 $ hg help config |grep 'hg help -c config' > /dev/null
1364 1364
1365 1365 Test templating help
1366 1366
1367 1367 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1368 1368 desc String. The text of the changeset description.
1369 1369 diffstat String. Statistics of changes with the following format:
1370 1370 firstline Any text. Returns the first line of text.
1371 1371 nonempty Any text. Returns '(none)' if the string is empty.
1372 1372
1373 1373 Test deprecated items
1374 1374
1375 1375 $ hg help -v templating | grep currentbookmark
1376 1376 currentbookmark
1377 1377 $ hg help templating | (grep currentbookmark || true)
1378 1378
1379 1379 Test help hooks
1380 1380
1381 1381 $ cat > helphook1.py <<EOF
1382 1382 > from mercurial import help
1383 1383 >
1384 1384 > def rewrite(ui, topic, doc):
1385 1385 > return doc + '\nhelphook1\n'
1386 1386 >
1387 1387 > def extsetup(ui):
1388 1388 > help.addtopichook('revisions', rewrite)
1389 1389 > EOF
1390 1390 $ cat > helphook2.py <<EOF
1391 1391 > from mercurial import help
1392 1392 >
1393 1393 > def rewrite(ui, topic, doc):
1394 1394 > return doc + '\nhelphook2\n'
1395 1395 >
1396 1396 > def extsetup(ui):
1397 1397 > help.addtopichook('revisions', rewrite)
1398 1398 > EOF
1399 1399 $ echo '[extensions]' >> $HGRCPATH
1400 1400 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1401 1401 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1402 1402 $ hg help revsets | grep helphook
1403 1403 helphook1
1404 1404 helphook2
1405 1405
1406 1406 help -c should only show debug --debug
1407 1407
1408 1408 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1409 1409 [1]
1410 1410
1411 1411 help -c should only show deprecated for -v
1412 1412
1413 1413 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1414 1414 [1]
1415 1415
1416 1416 Test -s / --system
1417 1417
1418 1418 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1419 1419 > wc -l | sed -e 's/ //g'
1420 1420 0
1421 1421 $ hg help config.files --system unix | grep 'USER' | \
1422 1422 > wc -l | sed -e 's/ //g'
1423 1423 0
1424 1424
1425 1425 Test -e / -c / -k combinations
1426 1426
1427 1427 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1428 1428 Commands:
1429 1429 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1430 1430 Extensions:
1431 1431 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1432 1432 Topics:
1433 1433 Commands:
1434 1434 Extensions:
1435 1435 Extension Commands:
1436 1436 $ hg help -c schemes
1437 1437 abort: no such help topic: schemes
1438 1438 (try 'hg help --keyword schemes')
1439 1439 [255]
1440 1440 $ hg help -e schemes |head -1
1441 1441 schemes extension - extend schemes with shortcuts to repository swarms
1442 1442 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1443 1443 Commands:
1444 1444 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1445 1445 Extensions:
1446 1446 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1447 1447 Extensions:
1448 1448 Commands:
1449 1449 $ hg help -c commit > /dev/null
1450 1450 $ hg help -e -c commit > /dev/null
1451 1451 $ hg help -e commit > /dev/null
1452 1452 abort: no such help topic: commit
1453 1453 (try 'hg help --keyword commit')
1454 1454 [255]
1455 1455
1456 1456 Test keyword search help
1457 1457
1458 1458 $ cat > prefixedname.py <<EOF
1459 1459 > '''matched against word "clone"
1460 1460 > '''
1461 1461 > EOF
1462 1462 $ echo '[extensions]' >> $HGRCPATH
1463 1463 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1464 1464 $ hg help -k clone
1465 1465 Topics:
1466 1466
1467 1467 config Configuration Files
1468 1468 extensions Using Additional Features
1469 1469 glossary Glossary
1470 1470 phases Working with Phases
1471 1471 subrepos Subrepositories
1472 1472 urls URL Paths
1473 1473
1474 1474 Commands:
1475 1475
1476 1476 bookmarks create a new bookmark or list existing bookmarks
1477 1477 clone make a copy of an existing repository
1478 1478 paths show aliases for remote repositories
1479 1479 update update working directory (or switch revisions)
1480 1480
1481 1481 Extensions:
1482 1482
1483 1483 clonebundles advertise pre-generated bundles to seed clones
1484 1484 prefixedname matched against word "clone"
1485 1485 relink recreates hardlinks between repository clones
1486 1486
1487 1487 Extension Commands:
1488 1488
1489 1489 qclone clone main and patch repository at same time
1490 1490
1491 1491 Test unfound topic
1492 1492
1493 1493 $ hg help nonexistingtopicthatwillneverexisteverever
1494 1494 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1495 1495 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1496 1496 [255]
1497 1497
1498 1498 Test unfound keyword
1499 1499
1500 1500 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1501 1501 abort: no matches
1502 1502 (try 'hg help' for a list of topics)
1503 1503 [255]
1504 1504
1505 1505 Test omit indicating for help
1506 1506
1507 1507 $ cat > addverboseitems.py <<EOF
1508 1508 > '''extension to test omit indicating.
1509 1509 >
1510 1510 > This paragraph is never omitted (for extension)
1511 1511 >
1512 1512 > .. container:: verbose
1513 1513 >
1514 1514 > This paragraph is omitted,
1515 1515 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1516 1516 >
1517 1517 > This paragraph is never omitted, too (for extension)
1518 1518 > '''
1519 1519 >
1520 1520 > from mercurial import help, commands
1521 1521 > testtopic = """This paragraph is never omitted (for topic).
1522 1522 >
1523 1523 > .. container:: verbose
1524 1524 >
1525 1525 > This paragraph is omitted,
1526 1526 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1527 1527 >
1528 1528 > This paragraph is never omitted, too (for topic)
1529 1529 > """
1530 1530 > def extsetup(ui):
1531 1531 > help.helptable.append((["topic-containing-verbose"],
1532 1532 > "This is the topic to test omit indicating.",
1533 1533 > lambda ui: testtopic))
1534 1534 > EOF
1535 1535 $ echo '[extensions]' >> $HGRCPATH
1536 1536 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1537 1537 $ hg help addverboseitems
1538 1538 addverboseitems extension - extension to test omit indicating.
1539 1539
1540 1540 This paragraph is never omitted (for extension)
1541 1541
1542 1542 This paragraph is never omitted, too (for extension)
1543 1543
1544 1544 (some details hidden, use --verbose to show complete help)
1545 1545
1546 1546 no commands defined
1547 1547 $ hg help -v addverboseitems
1548 1548 addverboseitems extension - extension to test omit indicating.
1549 1549
1550 1550 This paragraph is never omitted (for extension)
1551 1551
1552 1552 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1553 1553 extension)
1554 1554
1555 1555 This paragraph is never omitted, too (for extension)
1556 1556
1557 1557 no commands defined
1558 1558 $ hg help topic-containing-verbose
1559 1559 This is the topic to test omit indicating.
1560 1560 """"""""""""""""""""""""""""""""""""""""""
1561 1561
1562 1562 This paragraph is never omitted (for topic).
1563 1563
1564 1564 This paragraph is never omitted, too (for topic)
1565 1565
1566 1566 (some details hidden, use --verbose to show complete help)
1567 1567 $ hg help -v topic-containing-verbose
1568 1568 This is the topic to test omit indicating.
1569 1569 """"""""""""""""""""""""""""""""""""""""""
1570 1570
1571 1571 This paragraph is never omitted (for topic).
1572 1572
1573 1573 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1574 1574 topic)
1575 1575
1576 1576 This paragraph is never omitted, too (for topic)
1577 1577
1578 1578 Test section lookup
1579 1579
1580 1580 $ hg help revset.merge
1581 1581 "merge()"
1582 1582 Changeset is a merge changeset.
1583 1583
1584 1584 $ hg help glossary.dag
1585 1585 DAG
1586 1586 The repository of changesets of a distributed version control system
1587 1587 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1588 1588 of nodes and edges, where nodes correspond to changesets and edges
1589 1589 imply a parent -> child relation. This graph can be visualized by
1590 1590 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1591 1591 limited by the requirement for children to have at most two parents.
1592 1592
1593 1593
1594 1594 $ hg help hgrc.paths
1595 1595 "paths"
1596 1596 -------
1597 1597
1598 1598 Assigns symbolic names and behavior to repositories.
1599 1599
1600 1600 Options are symbolic names defining the URL or directory that is the
1601 1601 location of the repository. Example:
1602 1602
1603 1603 [paths]
1604 1604 my_server = https://example.com/my_repo
1605 1605 local_path = /home/me/repo
1606 1606
1607 1607 These symbolic names can be used from the command line. To pull from
1608 1608 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1609 1609 local_path'.
1610 1610
1611 1611 Options containing colons (":") denote sub-options that can influence
1612 1612 behavior for that specific path. Example:
1613 1613
1614 1614 [paths]
1615 1615 my_server = https://example.com/my_path
1616 1616 my_server:pushurl = ssh://example.com/my_path
1617 1617
1618 1618 The following sub-options can be defined:
1619 1619
1620 1620 "pushurl"
1621 1621 The URL to use for push operations. If not defined, the location
1622 1622 defined by the path's main entry is used.
1623 1623
1624 1624 "pushrev"
1625 1625 A revset defining which revisions to push by default.
1626 1626
1627 1627 When 'hg push' is executed without a "-r" argument, the revset defined
1628 1628 by this sub-option is evaluated to determine what to push.
1629 1629
1630 1630 For example, a value of "." will push the working directory's revision
1631 1631 by default.
1632 1632
1633 1633 Revsets specifying bookmarks will not result in the bookmark being
1634 1634 pushed.
1635 1635
1636 1636 The following special named paths exist:
1637 1637
1638 1638 "default"
1639 1639 The URL or directory to use when no source or remote is specified.
1640 1640
1641 1641 'hg clone' will automatically define this path to the location the
1642 1642 repository was cloned from.
1643 1643
1644 1644 "default-push"
1645 1645 (deprecated) The URL or directory for the default 'hg push' location.
1646 1646 "default:pushurl" should be used instead.
1647 1647
1648 1648 $ hg help glossary.mcguffin
1649 1649 abort: help section not found: glossary.mcguffin
1650 1650 [255]
1651 1651
1652 1652 $ hg help glossary.mc.guffin
1653 1653 abort: help section not found: glossary.mc.guffin
1654 1654 [255]
1655 1655
1656 1656 $ hg help template.files
1657 1657 files List of strings. All files modified, added, or removed by
1658 1658 this changeset.
1659 1659 files(pattern)
1660 1660 All files of the current changeset matching the pattern. See
1661 1661 'hg help patterns'.
1662 1662
1663 1663 Test section lookup by translated message
1664 1664
1665 1665 str.lower() instead of encoding.lower(str) on translated message might
1666 1666 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1667 1667 as the second or later byte of multi-byte character.
1668 1668
1669 1669 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1670 1670 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1671 1671 replacement makes message meaningless.
1672 1672
1673 1673 This tests that section lookup by translated string isn't broken by
1674 1674 such str.lower().
1675 1675
1676 1676 $ $PYTHON <<EOF
1677 1677 > def escape(s):
1678 1678 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1679 1679 > # translation of "record" in ja_JP.cp932
1680 1680 > upper = "\x8bL\x98^"
1681 1681 > # str.lower()-ed section name should be treated as different one
1682 1682 > lower = "\x8bl\x98^"
1683 1683 > with open('ambiguous.py', 'w') as fp:
1684 1684 > fp.write("""# ambiguous section names in ja_JP.cp932
1685 1685 > u'''summary of extension
1686 1686 >
1687 1687 > %s
1688 1688 > ----
1689 1689 >
1690 1690 > Upper name should show only this message
1691 1691 >
1692 1692 > %s
1693 1693 > ----
1694 1694 >
1695 1695 > Lower name should show only this message
1696 1696 >
1697 1697 > subsequent section
1698 1698 > ------------------
1699 1699 >
1700 1700 > This should be hidden at 'hg help ambiguous' with section name.
1701 1701 > '''
1702 1702 > """ % (escape(upper), escape(lower)))
1703 1703 > EOF
1704 1704
1705 1705 $ cat >> $HGRCPATH <<EOF
1706 1706 > [extensions]
1707 1707 > ambiguous = ./ambiguous.py
1708 1708 > EOF
1709 1709
1710 1710 $ $PYTHON <<EOF | sh
1711 1711 > upper = "\x8bL\x98^"
1712 > print "hg --encoding cp932 help -e ambiguous.%s" % upper
1712 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1713 1713 > EOF
1714 1714 \x8bL\x98^ (esc)
1715 1715 ----
1716 1716
1717 1717 Upper name should show only this message
1718 1718
1719 1719
1720 1720 $ $PYTHON <<EOF | sh
1721 1721 > lower = "\x8bl\x98^"
1722 > print "hg --encoding cp932 help -e ambiguous.%s" % lower
1722 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1723 1723 > EOF
1724 1724 \x8bl\x98^ (esc)
1725 1725 ----
1726 1726
1727 1727 Lower name should show only this message
1728 1728
1729 1729
1730 1730 $ cat >> $HGRCPATH <<EOF
1731 1731 > [extensions]
1732 1732 > ambiguous = !
1733 1733 > EOF
1734 1734
1735 1735 Show help content of disabled extensions
1736 1736
1737 1737 $ cat >> $HGRCPATH <<EOF
1738 1738 > [extensions]
1739 1739 > ambiguous = !./ambiguous.py
1740 1740 > EOF
1741 1741 $ hg help -e ambiguous
1742 1742 ambiguous extension - (no help text available)
1743 1743
1744 1744 (use 'hg help extensions' for information on enabling extensions)
1745 1745
1746 1746 Test dynamic list of merge tools only shows up once
1747 1747 $ hg help merge-tools
1748 1748 Merge Tools
1749 1749 """""""""""
1750 1750
1751 1751 To merge files Mercurial uses merge tools.
1752 1752
1753 1753 A merge tool combines two different versions of a file into a merged file.
1754 1754 Merge tools are given the two files and the greatest common ancestor of
1755 1755 the two file versions, so they can determine the changes made on both
1756 1756 branches.
1757 1757
1758 1758 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1759 1759 backout' and in several extensions.
1760 1760
1761 1761 Usually, the merge tool tries to automatically reconcile the files by
1762 1762 combining all non-overlapping changes that occurred separately in the two
1763 1763 different evolutions of the same initial base file. Furthermore, some
1764 1764 interactive merge programs make it easier to manually resolve conflicting
1765 1765 merges, either in a graphical way, or by inserting some conflict markers.
1766 1766 Mercurial does not include any interactive merge programs but relies on
1767 1767 external tools for that.
1768 1768
1769 1769 Available merge tools
1770 1770 =====================
1771 1771
1772 1772 External merge tools and their properties are configured in the merge-
1773 1773 tools configuration section - see hgrc(5) - but they can often just be
1774 1774 named by their executable.
1775 1775
1776 1776 A merge tool is generally usable if its executable can be found on the
1777 1777 system and if it can handle the merge. The executable is found if it is an
1778 1778 absolute or relative executable path or the name of an application in the
1779 1779 executable search path. The tool is assumed to be able to handle the merge
1780 1780 if it can handle symlinks if the file is a symlink, if it can handle
1781 1781 binary files if the file is binary, and if a GUI is available if the tool
1782 1782 requires a GUI.
1783 1783
1784 1784 There are some internal merge tools which can be used. The internal merge
1785 1785 tools are:
1786 1786
1787 1787 ":dump"
1788 1788 Creates three versions of the files to merge, containing the contents of
1789 1789 local, other and base. These files can then be used to perform a merge
1790 1790 manually. If the file to be merged is named "a.txt", these files will
1791 1791 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1792 1792 they will be placed in the same directory as "a.txt".
1793 1793
1794 1794 This implies permerge. Therefore, files aren't dumped, if premerge runs
1795 1795 successfully. Use :forcedump to forcibly write files out.
1796 1796
1797 1797 ":fail"
1798 1798 Rather than attempting to merge files that were modified on both
1799 1799 branches, it marks them as unresolved. The resolve command must be used
1800 1800 to resolve these conflicts.
1801 1801
1802 1802 ":forcedump"
1803 1803 Creates three versions of the files as same as :dump, but omits
1804 1804 premerge.
1805 1805
1806 1806 ":local"
1807 1807 Uses the local 'p1()' version of files as the merged version.
1808 1808
1809 1809 ":merge"
1810 1810 Uses the internal non-interactive simple merge algorithm for merging
1811 1811 files. It will fail if there are any conflicts and leave markers in the
1812 1812 partially merged file. Markers will have two sections, one for each side
1813 1813 of merge.
1814 1814
1815 1815 ":merge-local"
1816 1816 Like :merge, but resolve all conflicts non-interactively in favor of the
1817 1817 local 'p1()' changes.
1818 1818
1819 1819 ":merge-other"
1820 1820 Like :merge, but resolve all conflicts non-interactively in favor of the
1821 1821 other 'p2()' changes.
1822 1822
1823 1823 ":merge3"
1824 1824 Uses the internal non-interactive simple merge algorithm for merging
1825 1825 files. It will fail if there are any conflicts and leave markers in the
1826 1826 partially merged file. Marker will have three sections, one from each
1827 1827 side of the merge and one for the base content.
1828 1828
1829 1829 ":other"
1830 1830 Uses the other 'p2()' version of files as the merged version.
1831 1831
1832 1832 ":prompt"
1833 1833 Asks the user which of the local 'p1()' or the other 'p2()' version to
1834 1834 keep as the merged version.
1835 1835
1836 1836 ":tagmerge"
1837 1837 Uses the internal tag merge algorithm (experimental).
1838 1838
1839 1839 ":union"
1840 1840 Uses the internal non-interactive simple merge algorithm for merging
1841 1841 files. It will use both left and right sides for conflict regions. No
1842 1842 markers are inserted.
1843 1843
1844 1844 Internal tools are always available and do not require a GUI but will by
1845 1845 default not handle symlinks or binary files.
1846 1846
1847 1847 Choosing a merge tool
1848 1848 =====================
1849 1849
1850 1850 Mercurial uses these rules when deciding which merge tool to use:
1851 1851
1852 1852 1. If a tool has been specified with the --tool option to merge or
1853 1853 resolve, it is used. If it is the name of a tool in the merge-tools
1854 1854 configuration, its configuration is used. Otherwise the specified tool
1855 1855 must be executable by the shell.
1856 1856 2. If the "HGMERGE" environment variable is present, its value is used and
1857 1857 must be executable by the shell.
1858 1858 3. If the filename of the file to be merged matches any of the patterns in
1859 1859 the merge-patterns configuration section, the first usable merge tool
1860 1860 corresponding to a matching pattern is used. Here, binary capabilities
1861 1861 of the merge tool are not considered.
1862 1862 4. If ui.merge is set it will be considered next. If the value is not the
1863 1863 name of a configured tool, the specified value is used and must be
1864 1864 executable by the shell. Otherwise the named tool is used if it is
1865 1865 usable.
1866 1866 5. If any usable merge tools are present in the merge-tools configuration
1867 1867 section, the one with the highest priority is used.
1868 1868 6. If a program named "hgmerge" can be found on the system, it is used -
1869 1869 but it will by default not be used for symlinks and binary files.
1870 1870 7. If the file to be merged is not binary and is not a symlink, then
1871 1871 internal ":merge" is used.
1872 1872 8. Otherwise, ":prompt" is used.
1873 1873
1874 1874 Note:
1875 1875 After selecting a merge program, Mercurial will by default attempt to
1876 1876 merge the files using a simple merge algorithm first. Only if it
1877 1877 doesn't succeed because of conflicting changes Mercurial will actually
1878 1878 execute the merge program. Whether to use the simple merge algorithm
1879 1879 first can be controlled by the premerge setting of the merge tool.
1880 1880 Premerge is enabled by default unless the file is binary or a symlink.
1881 1881
1882 1882 See the merge-tools and ui sections of hgrc(5) for details on the
1883 1883 configuration of merge tools.
1884 1884
1885 1885 Compression engines listed in `hg help bundlespec`
1886 1886
1887 1887 $ hg help bundlespec | grep gzip
1888 1888 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1889 1889 An algorithm that produces smaller bundles than "gzip".
1890 1890 This engine will likely produce smaller bundles than "gzip" but will be
1891 1891 "gzip"
1892 1892 better compression than "gzip". It also frequently yields better (?)
1893 1893
1894 1894 Test usage of section marks in help documents
1895 1895
1896 1896 $ cd "$TESTDIR"/../doc
1897 1897 $ $PYTHON check-seclevel.py
1898 1898 $ cd $TESTTMP
1899 1899
1900 1900 #if serve
1901 1901
1902 1902 Test the help pages in hgweb.
1903 1903
1904 1904 Dish up an empty repo; serve it cold.
1905 1905
1906 1906 $ hg init "$TESTTMP/test"
1907 1907 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1908 1908 $ cat hg.pid >> $DAEMON_PIDS
1909 1909
1910 1910 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1911 1911 200 Script output follows
1912 1912
1913 1913 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1914 1914 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1915 1915 <head>
1916 1916 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1917 1917 <meta name="robots" content="index, nofollow" />
1918 1918 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1919 1919 <script type="text/javascript" src="/static/mercurial.js"></script>
1920 1920
1921 1921 <title>Help: Index</title>
1922 1922 </head>
1923 1923 <body>
1924 1924
1925 1925 <div class="container">
1926 1926 <div class="menu">
1927 1927 <div class="logo">
1928 1928 <a href="https://mercurial-scm.org/">
1929 1929 <img src="/static/hglogo.png" alt="mercurial" /></a>
1930 1930 </div>
1931 1931 <ul>
1932 1932 <li><a href="/shortlog">log</a></li>
1933 1933 <li><a href="/graph">graph</a></li>
1934 1934 <li><a href="/tags">tags</a></li>
1935 1935 <li><a href="/bookmarks">bookmarks</a></li>
1936 1936 <li><a href="/branches">branches</a></li>
1937 1937 </ul>
1938 1938 <ul>
1939 1939 <li class="active">help</li>
1940 1940 </ul>
1941 1941 </div>
1942 1942
1943 1943 <div class="main">
1944 1944 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1945 1945
1946 1946 <form class="search" action="/log">
1947 1947
1948 1948 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1949 1949 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1950 1950 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1951 1951 </form>
1952 1952 <table class="bigtable">
1953 1953 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1954 1954
1955 1955 <tr><td>
1956 1956 <a href="/help/bundlespec">
1957 1957 bundlespec
1958 1958 </a>
1959 1959 </td><td>
1960 1960 Bundle File Formats
1961 1961 </td></tr>
1962 1962 <tr><td>
1963 1963 <a href="/help/color">
1964 1964 color
1965 1965 </a>
1966 1966 </td><td>
1967 1967 Colorizing Outputs
1968 1968 </td></tr>
1969 1969 <tr><td>
1970 1970 <a href="/help/config">
1971 1971 config
1972 1972 </a>
1973 1973 </td><td>
1974 1974 Configuration Files
1975 1975 </td></tr>
1976 1976 <tr><td>
1977 1977 <a href="/help/dates">
1978 1978 dates
1979 1979 </a>
1980 1980 </td><td>
1981 1981 Date Formats
1982 1982 </td></tr>
1983 1983 <tr><td>
1984 1984 <a href="/help/diffs">
1985 1985 diffs
1986 1986 </a>
1987 1987 </td><td>
1988 1988 Diff Formats
1989 1989 </td></tr>
1990 1990 <tr><td>
1991 1991 <a href="/help/environment">
1992 1992 environment
1993 1993 </a>
1994 1994 </td><td>
1995 1995 Environment Variables
1996 1996 </td></tr>
1997 1997 <tr><td>
1998 1998 <a href="/help/extensions">
1999 1999 extensions
2000 2000 </a>
2001 2001 </td><td>
2002 2002 Using Additional Features
2003 2003 </td></tr>
2004 2004 <tr><td>
2005 2005 <a href="/help/filesets">
2006 2006 filesets
2007 2007 </a>
2008 2008 </td><td>
2009 2009 Specifying File Sets
2010 2010 </td></tr>
2011 2011 <tr><td>
2012 2012 <a href="/help/glossary">
2013 2013 glossary
2014 2014 </a>
2015 2015 </td><td>
2016 2016 Glossary
2017 2017 </td></tr>
2018 2018 <tr><td>
2019 2019 <a href="/help/hgignore">
2020 2020 hgignore
2021 2021 </a>
2022 2022 </td><td>
2023 2023 Syntax for Mercurial Ignore Files
2024 2024 </td></tr>
2025 2025 <tr><td>
2026 2026 <a href="/help/hgweb">
2027 2027 hgweb
2028 2028 </a>
2029 2029 </td><td>
2030 2030 Configuring hgweb
2031 2031 </td></tr>
2032 2032 <tr><td>
2033 2033 <a href="/help/internals">
2034 2034 internals
2035 2035 </a>
2036 2036 </td><td>
2037 2037 Technical implementation topics
2038 2038 </td></tr>
2039 2039 <tr><td>
2040 2040 <a href="/help/merge-tools">
2041 2041 merge-tools
2042 2042 </a>
2043 2043 </td><td>
2044 2044 Merge Tools
2045 2045 </td></tr>
2046 2046 <tr><td>
2047 2047 <a href="/help/pager">
2048 2048 pager
2049 2049 </a>
2050 2050 </td><td>
2051 2051 Pager Support
2052 2052 </td></tr>
2053 2053 <tr><td>
2054 2054 <a href="/help/patterns">
2055 2055 patterns
2056 2056 </a>
2057 2057 </td><td>
2058 2058 File Name Patterns
2059 2059 </td></tr>
2060 2060 <tr><td>
2061 2061 <a href="/help/phases">
2062 2062 phases
2063 2063 </a>
2064 2064 </td><td>
2065 2065 Working with Phases
2066 2066 </td></tr>
2067 2067 <tr><td>
2068 2068 <a href="/help/revisions">
2069 2069 revisions
2070 2070 </a>
2071 2071 </td><td>
2072 2072 Specifying Revisions
2073 2073 </td></tr>
2074 2074 <tr><td>
2075 2075 <a href="/help/scripting">
2076 2076 scripting
2077 2077 </a>
2078 2078 </td><td>
2079 2079 Using Mercurial from scripts and automation
2080 2080 </td></tr>
2081 2081 <tr><td>
2082 2082 <a href="/help/subrepos">
2083 2083 subrepos
2084 2084 </a>
2085 2085 </td><td>
2086 2086 Subrepositories
2087 2087 </td></tr>
2088 2088 <tr><td>
2089 2089 <a href="/help/templating">
2090 2090 templating
2091 2091 </a>
2092 2092 </td><td>
2093 2093 Template Usage
2094 2094 </td></tr>
2095 2095 <tr><td>
2096 2096 <a href="/help/urls">
2097 2097 urls
2098 2098 </a>
2099 2099 </td><td>
2100 2100 URL Paths
2101 2101 </td></tr>
2102 2102 <tr><td>
2103 2103 <a href="/help/topic-containing-verbose">
2104 2104 topic-containing-verbose
2105 2105 </a>
2106 2106 </td><td>
2107 2107 This is the topic to test omit indicating.
2108 2108 </td></tr>
2109 2109
2110 2110
2111 2111 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2112 2112
2113 2113 <tr><td>
2114 2114 <a href="/help/add">
2115 2115 add
2116 2116 </a>
2117 2117 </td><td>
2118 2118 add the specified files on the next commit
2119 2119 </td></tr>
2120 2120 <tr><td>
2121 2121 <a href="/help/annotate">
2122 2122 annotate
2123 2123 </a>
2124 2124 </td><td>
2125 2125 show changeset information by line for each file
2126 2126 </td></tr>
2127 2127 <tr><td>
2128 2128 <a href="/help/clone">
2129 2129 clone
2130 2130 </a>
2131 2131 </td><td>
2132 2132 make a copy of an existing repository
2133 2133 </td></tr>
2134 2134 <tr><td>
2135 2135 <a href="/help/commit">
2136 2136 commit
2137 2137 </a>
2138 2138 </td><td>
2139 2139 commit the specified files or all outstanding changes
2140 2140 </td></tr>
2141 2141 <tr><td>
2142 2142 <a href="/help/diff">
2143 2143 diff
2144 2144 </a>
2145 2145 </td><td>
2146 2146 diff repository (or selected files)
2147 2147 </td></tr>
2148 2148 <tr><td>
2149 2149 <a href="/help/export">
2150 2150 export
2151 2151 </a>
2152 2152 </td><td>
2153 2153 dump the header and diffs for one or more changesets
2154 2154 </td></tr>
2155 2155 <tr><td>
2156 2156 <a href="/help/forget">
2157 2157 forget
2158 2158 </a>
2159 2159 </td><td>
2160 2160 forget the specified files on the next commit
2161 2161 </td></tr>
2162 2162 <tr><td>
2163 2163 <a href="/help/init">
2164 2164 init
2165 2165 </a>
2166 2166 </td><td>
2167 2167 create a new repository in the given directory
2168 2168 </td></tr>
2169 2169 <tr><td>
2170 2170 <a href="/help/log">
2171 2171 log
2172 2172 </a>
2173 2173 </td><td>
2174 2174 show revision history of entire repository or files
2175 2175 </td></tr>
2176 2176 <tr><td>
2177 2177 <a href="/help/merge">
2178 2178 merge
2179 2179 </a>
2180 2180 </td><td>
2181 2181 merge another revision into working directory
2182 2182 </td></tr>
2183 2183 <tr><td>
2184 2184 <a href="/help/pull">
2185 2185 pull
2186 2186 </a>
2187 2187 </td><td>
2188 2188 pull changes from the specified source
2189 2189 </td></tr>
2190 2190 <tr><td>
2191 2191 <a href="/help/push">
2192 2192 push
2193 2193 </a>
2194 2194 </td><td>
2195 2195 push changes to the specified destination
2196 2196 </td></tr>
2197 2197 <tr><td>
2198 2198 <a href="/help/remove">
2199 2199 remove
2200 2200 </a>
2201 2201 </td><td>
2202 2202 remove the specified files on the next commit
2203 2203 </td></tr>
2204 2204 <tr><td>
2205 2205 <a href="/help/serve">
2206 2206 serve
2207 2207 </a>
2208 2208 </td><td>
2209 2209 start stand-alone webserver
2210 2210 </td></tr>
2211 2211 <tr><td>
2212 2212 <a href="/help/status">
2213 2213 status
2214 2214 </a>
2215 2215 </td><td>
2216 2216 show changed files in the working directory
2217 2217 </td></tr>
2218 2218 <tr><td>
2219 2219 <a href="/help/summary">
2220 2220 summary
2221 2221 </a>
2222 2222 </td><td>
2223 2223 summarize working directory state
2224 2224 </td></tr>
2225 2225 <tr><td>
2226 2226 <a href="/help/update">
2227 2227 update
2228 2228 </a>
2229 2229 </td><td>
2230 2230 update working directory (or switch revisions)
2231 2231 </td></tr>
2232 2232
2233 2233
2234 2234
2235 2235 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2236 2236
2237 2237 <tr><td>
2238 2238 <a href="/help/addremove">
2239 2239 addremove
2240 2240 </a>
2241 2241 </td><td>
2242 2242 add all new files, delete all missing files
2243 2243 </td></tr>
2244 2244 <tr><td>
2245 2245 <a href="/help/archive">
2246 2246 archive
2247 2247 </a>
2248 2248 </td><td>
2249 2249 create an unversioned archive of a repository revision
2250 2250 </td></tr>
2251 2251 <tr><td>
2252 2252 <a href="/help/backout">
2253 2253 backout
2254 2254 </a>
2255 2255 </td><td>
2256 2256 reverse effect of earlier changeset
2257 2257 </td></tr>
2258 2258 <tr><td>
2259 2259 <a href="/help/bisect">
2260 2260 bisect
2261 2261 </a>
2262 2262 </td><td>
2263 2263 subdivision search of changesets
2264 2264 </td></tr>
2265 2265 <tr><td>
2266 2266 <a href="/help/bookmarks">
2267 2267 bookmarks
2268 2268 </a>
2269 2269 </td><td>
2270 2270 create a new bookmark or list existing bookmarks
2271 2271 </td></tr>
2272 2272 <tr><td>
2273 2273 <a href="/help/branch">
2274 2274 branch
2275 2275 </a>
2276 2276 </td><td>
2277 2277 set or show the current branch name
2278 2278 </td></tr>
2279 2279 <tr><td>
2280 2280 <a href="/help/branches">
2281 2281 branches
2282 2282 </a>
2283 2283 </td><td>
2284 2284 list repository named branches
2285 2285 </td></tr>
2286 2286 <tr><td>
2287 2287 <a href="/help/bundle">
2288 2288 bundle
2289 2289 </a>
2290 2290 </td><td>
2291 2291 create a bundle file
2292 2292 </td></tr>
2293 2293 <tr><td>
2294 2294 <a href="/help/cat">
2295 2295 cat
2296 2296 </a>
2297 2297 </td><td>
2298 2298 output the current or given revision of files
2299 2299 </td></tr>
2300 2300 <tr><td>
2301 2301 <a href="/help/config">
2302 2302 config
2303 2303 </a>
2304 2304 </td><td>
2305 2305 show combined config settings from all hgrc files
2306 2306 </td></tr>
2307 2307 <tr><td>
2308 2308 <a href="/help/copy">
2309 2309 copy
2310 2310 </a>
2311 2311 </td><td>
2312 2312 mark files as copied for the next commit
2313 2313 </td></tr>
2314 2314 <tr><td>
2315 2315 <a href="/help/files">
2316 2316 files
2317 2317 </a>
2318 2318 </td><td>
2319 2319 list tracked files
2320 2320 </td></tr>
2321 2321 <tr><td>
2322 2322 <a href="/help/graft">
2323 2323 graft
2324 2324 </a>
2325 2325 </td><td>
2326 2326 copy changes from other branches onto the current branch
2327 2327 </td></tr>
2328 2328 <tr><td>
2329 2329 <a href="/help/grep">
2330 2330 grep
2331 2331 </a>
2332 2332 </td><td>
2333 2333 search revision history for a pattern in specified files
2334 2334 </td></tr>
2335 2335 <tr><td>
2336 2336 <a href="/help/heads">
2337 2337 heads
2338 2338 </a>
2339 2339 </td><td>
2340 2340 show branch heads
2341 2341 </td></tr>
2342 2342 <tr><td>
2343 2343 <a href="/help/help">
2344 2344 help
2345 2345 </a>
2346 2346 </td><td>
2347 2347 show help for a given topic or a help overview
2348 2348 </td></tr>
2349 2349 <tr><td>
2350 2350 <a href="/help/hgalias">
2351 2351 hgalias
2352 2352 </a>
2353 2353 </td><td>
2354 2354 summarize working directory state
2355 2355 </td></tr>
2356 2356 <tr><td>
2357 2357 <a href="/help/identify">
2358 2358 identify
2359 2359 </a>
2360 2360 </td><td>
2361 2361 identify the working directory or specified revision
2362 2362 </td></tr>
2363 2363 <tr><td>
2364 2364 <a href="/help/import">
2365 2365 import
2366 2366 </a>
2367 2367 </td><td>
2368 2368 import an ordered set of patches
2369 2369 </td></tr>
2370 2370 <tr><td>
2371 2371 <a href="/help/incoming">
2372 2372 incoming
2373 2373 </a>
2374 2374 </td><td>
2375 2375 show new changesets found in source
2376 2376 </td></tr>
2377 2377 <tr><td>
2378 2378 <a href="/help/manifest">
2379 2379 manifest
2380 2380 </a>
2381 2381 </td><td>
2382 2382 output the current or given revision of the project manifest
2383 2383 </td></tr>
2384 2384 <tr><td>
2385 2385 <a href="/help/nohelp">
2386 2386 nohelp
2387 2387 </a>
2388 2388 </td><td>
2389 2389 (no help text available)
2390 2390 </td></tr>
2391 2391 <tr><td>
2392 2392 <a href="/help/outgoing">
2393 2393 outgoing
2394 2394 </a>
2395 2395 </td><td>
2396 2396 show changesets not found in the destination
2397 2397 </td></tr>
2398 2398 <tr><td>
2399 2399 <a href="/help/paths">
2400 2400 paths
2401 2401 </a>
2402 2402 </td><td>
2403 2403 show aliases for remote repositories
2404 2404 </td></tr>
2405 2405 <tr><td>
2406 2406 <a href="/help/phase">
2407 2407 phase
2408 2408 </a>
2409 2409 </td><td>
2410 2410 set or show the current phase name
2411 2411 </td></tr>
2412 2412 <tr><td>
2413 2413 <a href="/help/recover">
2414 2414 recover
2415 2415 </a>
2416 2416 </td><td>
2417 2417 roll back an interrupted transaction
2418 2418 </td></tr>
2419 2419 <tr><td>
2420 2420 <a href="/help/rename">
2421 2421 rename
2422 2422 </a>
2423 2423 </td><td>
2424 2424 rename files; equivalent of copy + remove
2425 2425 </td></tr>
2426 2426 <tr><td>
2427 2427 <a href="/help/resolve">
2428 2428 resolve
2429 2429 </a>
2430 2430 </td><td>
2431 2431 redo merges or set/view the merge status of files
2432 2432 </td></tr>
2433 2433 <tr><td>
2434 2434 <a href="/help/revert">
2435 2435 revert
2436 2436 </a>
2437 2437 </td><td>
2438 2438 restore files to their checkout state
2439 2439 </td></tr>
2440 2440 <tr><td>
2441 2441 <a href="/help/root">
2442 2442 root
2443 2443 </a>
2444 2444 </td><td>
2445 2445 print the root (top) of the current working directory
2446 2446 </td></tr>
2447 2447 <tr><td>
2448 2448 <a href="/help/shellalias">
2449 2449 shellalias
2450 2450 </a>
2451 2451 </td><td>
2452 2452 (no help text available)
2453 2453 </td></tr>
2454 2454 <tr><td>
2455 2455 <a href="/help/tag">
2456 2456 tag
2457 2457 </a>
2458 2458 </td><td>
2459 2459 add one or more tags for the current or given revision
2460 2460 </td></tr>
2461 2461 <tr><td>
2462 2462 <a href="/help/tags">
2463 2463 tags
2464 2464 </a>
2465 2465 </td><td>
2466 2466 list repository tags
2467 2467 </td></tr>
2468 2468 <tr><td>
2469 2469 <a href="/help/unbundle">
2470 2470 unbundle
2471 2471 </a>
2472 2472 </td><td>
2473 2473 apply one or more bundle files
2474 2474 </td></tr>
2475 2475 <tr><td>
2476 2476 <a href="/help/verify">
2477 2477 verify
2478 2478 </a>
2479 2479 </td><td>
2480 2480 verify the integrity of the repository
2481 2481 </td></tr>
2482 2482 <tr><td>
2483 2483 <a href="/help/version">
2484 2484 version
2485 2485 </a>
2486 2486 </td><td>
2487 2487 output version and copyright information
2488 2488 </td></tr>
2489 2489
2490 2490
2491 2491 </table>
2492 2492 </div>
2493 2493 </div>
2494 2494
2495 2495
2496 2496
2497 2497 </body>
2498 2498 </html>
2499 2499
2500 2500
2501 2501 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2502 2502 200 Script output follows
2503 2503
2504 2504 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2505 2505 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2506 2506 <head>
2507 2507 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2508 2508 <meta name="robots" content="index, nofollow" />
2509 2509 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2510 2510 <script type="text/javascript" src="/static/mercurial.js"></script>
2511 2511
2512 2512 <title>Help: add</title>
2513 2513 </head>
2514 2514 <body>
2515 2515
2516 2516 <div class="container">
2517 2517 <div class="menu">
2518 2518 <div class="logo">
2519 2519 <a href="https://mercurial-scm.org/">
2520 2520 <img src="/static/hglogo.png" alt="mercurial" /></a>
2521 2521 </div>
2522 2522 <ul>
2523 2523 <li><a href="/shortlog">log</a></li>
2524 2524 <li><a href="/graph">graph</a></li>
2525 2525 <li><a href="/tags">tags</a></li>
2526 2526 <li><a href="/bookmarks">bookmarks</a></li>
2527 2527 <li><a href="/branches">branches</a></li>
2528 2528 </ul>
2529 2529 <ul>
2530 2530 <li class="active"><a href="/help">help</a></li>
2531 2531 </ul>
2532 2532 </div>
2533 2533
2534 2534 <div class="main">
2535 2535 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2536 2536 <h3>Help: add</h3>
2537 2537
2538 2538 <form class="search" action="/log">
2539 2539
2540 2540 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2541 2541 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2542 2542 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2543 2543 </form>
2544 2544 <div id="doc">
2545 2545 <p>
2546 2546 hg add [OPTION]... [FILE]...
2547 2547 </p>
2548 2548 <p>
2549 2549 add the specified files on the next commit
2550 2550 </p>
2551 2551 <p>
2552 2552 Schedule files to be version controlled and added to the
2553 2553 repository.
2554 2554 </p>
2555 2555 <p>
2556 2556 The files will be added to the repository at the next commit. To
2557 2557 undo an add before that, see 'hg forget'.
2558 2558 </p>
2559 2559 <p>
2560 2560 If no names are given, add all files to the repository (except
2561 2561 files matching &quot;.hgignore&quot;).
2562 2562 </p>
2563 2563 <p>
2564 2564 Examples:
2565 2565 </p>
2566 2566 <ul>
2567 2567 <li> New (unknown) files are added automatically by 'hg add':
2568 2568 <pre>
2569 2569 \$ ls (re)
2570 2570 foo.c
2571 2571 \$ hg status (re)
2572 2572 ? foo.c
2573 2573 \$ hg add (re)
2574 2574 adding foo.c
2575 2575 \$ hg status (re)
2576 2576 A foo.c
2577 2577 </pre>
2578 2578 <li> Specific files to be added can be specified:
2579 2579 <pre>
2580 2580 \$ ls (re)
2581 2581 bar.c foo.c
2582 2582 \$ hg status (re)
2583 2583 ? bar.c
2584 2584 ? foo.c
2585 2585 \$ hg add bar.c (re)
2586 2586 \$ hg status (re)
2587 2587 A bar.c
2588 2588 ? foo.c
2589 2589 </pre>
2590 2590 </ul>
2591 2591 <p>
2592 2592 Returns 0 if all files are successfully added.
2593 2593 </p>
2594 2594 <p>
2595 2595 options ([+] can be repeated):
2596 2596 </p>
2597 2597 <table>
2598 2598 <tr><td>-I</td>
2599 2599 <td>--include PATTERN [+]</td>
2600 2600 <td>include names matching the given patterns</td></tr>
2601 2601 <tr><td>-X</td>
2602 2602 <td>--exclude PATTERN [+]</td>
2603 2603 <td>exclude names matching the given patterns</td></tr>
2604 2604 <tr><td>-S</td>
2605 2605 <td>--subrepos</td>
2606 2606 <td>recurse into subrepositories</td></tr>
2607 2607 <tr><td>-n</td>
2608 2608 <td>--dry-run</td>
2609 2609 <td>do not perform actions, just print output</td></tr>
2610 2610 </table>
2611 2611 <p>
2612 2612 global options ([+] can be repeated):
2613 2613 </p>
2614 2614 <table>
2615 2615 <tr><td>-R</td>
2616 2616 <td>--repository REPO</td>
2617 2617 <td>repository root directory or name of overlay bundle file</td></tr>
2618 2618 <tr><td></td>
2619 2619 <td>--cwd DIR</td>
2620 2620 <td>change working directory</td></tr>
2621 2621 <tr><td>-y</td>
2622 2622 <td>--noninteractive</td>
2623 2623 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2624 2624 <tr><td>-q</td>
2625 2625 <td>--quiet</td>
2626 2626 <td>suppress output</td></tr>
2627 2627 <tr><td>-v</td>
2628 2628 <td>--verbose</td>
2629 2629 <td>enable additional output</td></tr>
2630 2630 <tr><td></td>
2631 2631 <td>--color TYPE</td>
2632 2632 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2633 2633 <tr><td></td>
2634 2634 <td>--config CONFIG [+]</td>
2635 2635 <td>set/override config option (use 'section.name=value')</td></tr>
2636 2636 <tr><td></td>
2637 2637 <td>--debug</td>
2638 2638 <td>enable debugging output</td></tr>
2639 2639 <tr><td></td>
2640 2640 <td>--debugger</td>
2641 2641 <td>start debugger</td></tr>
2642 2642 <tr><td></td>
2643 2643 <td>--encoding ENCODE</td>
2644 2644 <td>set the charset encoding (default: ascii)</td></tr>
2645 2645 <tr><td></td>
2646 2646 <td>--encodingmode MODE</td>
2647 2647 <td>set the charset encoding mode (default: strict)</td></tr>
2648 2648 <tr><td></td>
2649 2649 <td>--traceback</td>
2650 2650 <td>always print a traceback on exception</td></tr>
2651 2651 <tr><td></td>
2652 2652 <td>--time</td>
2653 2653 <td>time how long the command takes</td></tr>
2654 2654 <tr><td></td>
2655 2655 <td>--profile</td>
2656 2656 <td>print command execution profile</td></tr>
2657 2657 <tr><td></td>
2658 2658 <td>--version</td>
2659 2659 <td>output version information and exit</td></tr>
2660 2660 <tr><td>-h</td>
2661 2661 <td>--help</td>
2662 2662 <td>display help and exit</td></tr>
2663 2663 <tr><td></td>
2664 2664 <td>--hidden</td>
2665 2665 <td>consider hidden changesets</td></tr>
2666 2666 <tr><td></td>
2667 2667 <td>--pager TYPE</td>
2668 2668 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2669 2669 </table>
2670 2670
2671 2671 </div>
2672 2672 </div>
2673 2673 </div>
2674 2674
2675 2675
2676 2676
2677 2677 </body>
2678 2678 </html>
2679 2679
2680 2680
2681 2681 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2682 2682 200 Script output follows
2683 2683
2684 2684 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2685 2685 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2686 2686 <head>
2687 2687 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2688 2688 <meta name="robots" content="index, nofollow" />
2689 2689 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2690 2690 <script type="text/javascript" src="/static/mercurial.js"></script>
2691 2691
2692 2692 <title>Help: remove</title>
2693 2693 </head>
2694 2694 <body>
2695 2695
2696 2696 <div class="container">
2697 2697 <div class="menu">
2698 2698 <div class="logo">
2699 2699 <a href="https://mercurial-scm.org/">
2700 2700 <img src="/static/hglogo.png" alt="mercurial" /></a>
2701 2701 </div>
2702 2702 <ul>
2703 2703 <li><a href="/shortlog">log</a></li>
2704 2704 <li><a href="/graph">graph</a></li>
2705 2705 <li><a href="/tags">tags</a></li>
2706 2706 <li><a href="/bookmarks">bookmarks</a></li>
2707 2707 <li><a href="/branches">branches</a></li>
2708 2708 </ul>
2709 2709 <ul>
2710 2710 <li class="active"><a href="/help">help</a></li>
2711 2711 </ul>
2712 2712 </div>
2713 2713
2714 2714 <div class="main">
2715 2715 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2716 2716 <h3>Help: remove</h3>
2717 2717
2718 2718 <form class="search" action="/log">
2719 2719
2720 2720 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2721 2721 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2722 2722 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2723 2723 </form>
2724 2724 <div id="doc">
2725 2725 <p>
2726 2726 hg remove [OPTION]... FILE...
2727 2727 </p>
2728 2728 <p>
2729 2729 aliases: rm
2730 2730 </p>
2731 2731 <p>
2732 2732 remove the specified files on the next commit
2733 2733 </p>
2734 2734 <p>
2735 2735 Schedule the indicated files for removal from the current branch.
2736 2736 </p>
2737 2737 <p>
2738 2738 This command schedules the files to be removed at the next commit.
2739 2739 To undo a remove before that, see 'hg revert'. To undo added
2740 2740 files, see 'hg forget'.
2741 2741 </p>
2742 2742 <p>
2743 2743 -A/--after can be used to remove only files that have already
2744 2744 been deleted, -f/--force can be used to force deletion, and -Af
2745 2745 can be used to remove files from the next revision without
2746 2746 deleting them from the working directory.
2747 2747 </p>
2748 2748 <p>
2749 2749 The following table details the behavior of remove for different
2750 2750 file states (columns) and option combinations (rows). The file
2751 2751 states are Added [A], Clean [C], Modified [M] and Missing [!]
2752 2752 (as reported by 'hg status'). The actions are Warn, Remove
2753 2753 (from branch) and Delete (from disk):
2754 2754 </p>
2755 2755 <table>
2756 2756 <tr><td>opt/state</td>
2757 2757 <td>A</td>
2758 2758 <td>C</td>
2759 2759 <td>M</td>
2760 2760 <td>!</td></tr>
2761 2761 <tr><td>none</td>
2762 2762 <td>W</td>
2763 2763 <td>RD</td>
2764 2764 <td>W</td>
2765 2765 <td>R</td></tr>
2766 2766 <tr><td>-f</td>
2767 2767 <td>R</td>
2768 2768 <td>RD</td>
2769 2769 <td>RD</td>
2770 2770 <td>R</td></tr>
2771 2771 <tr><td>-A</td>
2772 2772 <td>W</td>
2773 2773 <td>W</td>
2774 2774 <td>W</td>
2775 2775 <td>R</td></tr>
2776 2776 <tr><td>-Af</td>
2777 2777 <td>R</td>
2778 2778 <td>R</td>
2779 2779 <td>R</td>
2780 2780 <td>R</td></tr>
2781 2781 </table>
2782 2782 <p>
2783 2783 <b>Note:</b>
2784 2784 </p>
2785 2785 <p>
2786 2786 'hg remove' never deletes files in Added [A] state from the
2787 2787 working directory, not even if &quot;--force&quot; is specified.
2788 2788 </p>
2789 2789 <p>
2790 2790 Returns 0 on success, 1 if any warnings encountered.
2791 2791 </p>
2792 2792 <p>
2793 2793 options ([+] can be repeated):
2794 2794 </p>
2795 2795 <table>
2796 2796 <tr><td>-A</td>
2797 2797 <td>--after</td>
2798 2798 <td>record delete for missing files</td></tr>
2799 2799 <tr><td>-f</td>
2800 2800 <td>--force</td>
2801 2801 <td>forget added files, delete modified files</td></tr>
2802 2802 <tr><td>-S</td>
2803 2803 <td>--subrepos</td>
2804 2804 <td>recurse into subrepositories</td></tr>
2805 2805 <tr><td>-I</td>
2806 2806 <td>--include PATTERN [+]</td>
2807 2807 <td>include names matching the given patterns</td></tr>
2808 2808 <tr><td>-X</td>
2809 2809 <td>--exclude PATTERN [+]</td>
2810 2810 <td>exclude names matching the given patterns</td></tr>
2811 2811 </table>
2812 2812 <p>
2813 2813 global options ([+] can be repeated):
2814 2814 </p>
2815 2815 <table>
2816 2816 <tr><td>-R</td>
2817 2817 <td>--repository REPO</td>
2818 2818 <td>repository root directory or name of overlay bundle file</td></tr>
2819 2819 <tr><td></td>
2820 2820 <td>--cwd DIR</td>
2821 2821 <td>change working directory</td></tr>
2822 2822 <tr><td>-y</td>
2823 2823 <td>--noninteractive</td>
2824 2824 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2825 2825 <tr><td>-q</td>
2826 2826 <td>--quiet</td>
2827 2827 <td>suppress output</td></tr>
2828 2828 <tr><td>-v</td>
2829 2829 <td>--verbose</td>
2830 2830 <td>enable additional output</td></tr>
2831 2831 <tr><td></td>
2832 2832 <td>--color TYPE</td>
2833 2833 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2834 2834 <tr><td></td>
2835 2835 <td>--config CONFIG [+]</td>
2836 2836 <td>set/override config option (use 'section.name=value')</td></tr>
2837 2837 <tr><td></td>
2838 2838 <td>--debug</td>
2839 2839 <td>enable debugging output</td></tr>
2840 2840 <tr><td></td>
2841 2841 <td>--debugger</td>
2842 2842 <td>start debugger</td></tr>
2843 2843 <tr><td></td>
2844 2844 <td>--encoding ENCODE</td>
2845 2845 <td>set the charset encoding (default: ascii)</td></tr>
2846 2846 <tr><td></td>
2847 2847 <td>--encodingmode MODE</td>
2848 2848 <td>set the charset encoding mode (default: strict)</td></tr>
2849 2849 <tr><td></td>
2850 2850 <td>--traceback</td>
2851 2851 <td>always print a traceback on exception</td></tr>
2852 2852 <tr><td></td>
2853 2853 <td>--time</td>
2854 2854 <td>time how long the command takes</td></tr>
2855 2855 <tr><td></td>
2856 2856 <td>--profile</td>
2857 2857 <td>print command execution profile</td></tr>
2858 2858 <tr><td></td>
2859 2859 <td>--version</td>
2860 2860 <td>output version information and exit</td></tr>
2861 2861 <tr><td>-h</td>
2862 2862 <td>--help</td>
2863 2863 <td>display help and exit</td></tr>
2864 2864 <tr><td></td>
2865 2865 <td>--hidden</td>
2866 2866 <td>consider hidden changesets</td></tr>
2867 2867 <tr><td></td>
2868 2868 <td>--pager TYPE</td>
2869 2869 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2870 2870 </table>
2871 2871
2872 2872 </div>
2873 2873 </div>
2874 2874 </div>
2875 2875
2876 2876
2877 2877
2878 2878 </body>
2879 2879 </html>
2880 2880
2881 2881
2882 2882 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2883 2883 200 Script output follows
2884 2884
2885 2885 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2886 2886 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2887 2887 <head>
2888 2888 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2889 2889 <meta name="robots" content="index, nofollow" />
2890 2890 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2891 2891 <script type="text/javascript" src="/static/mercurial.js"></script>
2892 2892
2893 2893 <title>Help: dates</title>
2894 2894 </head>
2895 2895 <body>
2896 2896
2897 2897 <div class="container">
2898 2898 <div class="menu">
2899 2899 <div class="logo">
2900 2900 <a href="https://mercurial-scm.org/">
2901 2901 <img src="/static/hglogo.png" alt="mercurial" /></a>
2902 2902 </div>
2903 2903 <ul>
2904 2904 <li><a href="/shortlog">log</a></li>
2905 2905 <li><a href="/graph">graph</a></li>
2906 2906 <li><a href="/tags">tags</a></li>
2907 2907 <li><a href="/bookmarks">bookmarks</a></li>
2908 2908 <li><a href="/branches">branches</a></li>
2909 2909 </ul>
2910 2910 <ul>
2911 2911 <li class="active"><a href="/help">help</a></li>
2912 2912 </ul>
2913 2913 </div>
2914 2914
2915 2915 <div class="main">
2916 2916 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2917 2917 <h3>Help: dates</h3>
2918 2918
2919 2919 <form class="search" action="/log">
2920 2920
2921 2921 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2922 2922 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2923 2923 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2924 2924 </form>
2925 2925 <div id="doc">
2926 2926 <h1>Date Formats</h1>
2927 2927 <p>
2928 2928 Some commands allow the user to specify a date, e.g.:
2929 2929 </p>
2930 2930 <ul>
2931 2931 <li> backout, commit, import, tag: Specify the commit date.
2932 2932 <li> log, revert, update: Select revision(s) by date.
2933 2933 </ul>
2934 2934 <p>
2935 2935 Many date formats are valid. Here are some examples:
2936 2936 </p>
2937 2937 <ul>
2938 2938 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2939 2939 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2940 2940 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2941 2941 <li> &quot;Dec 6&quot; (midnight)
2942 2942 <li> &quot;13:18&quot; (today assumed)
2943 2943 <li> &quot;3:39&quot; (3:39AM assumed)
2944 2944 <li> &quot;3:39pm&quot; (15:39)
2945 2945 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2946 2946 <li> &quot;2006-12-6 13:18&quot;
2947 2947 <li> &quot;2006-12-6&quot;
2948 2948 <li> &quot;12-6&quot;
2949 2949 <li> &quot;12/6&quot;
2950 2950 <li> &quot;12/6/6&quot; (Dec 6 2006)
2951 2951 <li> &quot;today&quot; (midnight)
2952 2952 <li> &quot;yesterday&quot; (midnight)
2953 2953 <li> &quot;now&quot; - right now
2954 2954 </ul>
2955 2955 <p>
2956 2956 Lastly, there is Mercurial's internal format:
2957 2957 </p>
2958 2958 <ul>
2959 2959 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2960 2960 </ul>
2961 2961 <p>
2962 2962 This is the internal representation format for dates. The first number
2963 2963 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2964 2964 second is the offset of the local timezone, in seconds west of UTC
2965 2965 (negative if the timezone is east of UTC).
2966 2966 </p>
2967 2967 <p>
2968 2968 The log command also accepts date ranges:
2969 2969 </p>
2970 2970 <ul>
2971 2971 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2972 2972 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2973 2973 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2974 2974 <li> &quot;-DAYS&quot; - within a given number of days of today
2975 2975 </ul>
2976 2976
2977 2977 </div>
2978 2978 </div>
2979 2979 </div>
2980 2980
2981 2981
2982 2982
2983 2983 </body>
2984 2984 </html>
2985 2985
2986 2986
2987 2987 Sub-topic indexes rendered properly
2988 2988
2989 2989 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
2990 2990 200 Script output follows
2991 2991
2992 2992 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2993 2993 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2994 2994 <head>
2995 2995 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2996 2996 <meta name="robots" content="index, nofollow" />
2997 2997 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2998 2998 <script type="text/javascript" src="/static/mercurial.js"></script>
2999 2999
3000 3000 <title>Help: internals</title>
3001 3001 </head>
3002 3002 <body>
3003 3003
3004 3004 <div class="container">
3005 3005 <div class="menu">
3006 3006 <div class="logo">
3007 3007 <a href="https://mercurial-scm.org/">
3008 3008 <img src="/static/hglogo.png" alt="mercurial" /></a>
3009 3009 </div>
3010 3010 <ul>
3011 3011 <li><a href="/shortlog">log</a></li>
3012 3012 <li><a href="/graph">graph</a></li>
3013 3013 <li><a href="/tags">tags</a></li>
3014 3014 <li><a href="/bookmarks">bookmarks</a></li>
3015 3015 <li><a href="/branches">branches</a></li>
3016 3016 </ul>
3017 3017 <ul>
3018 3018 <li><a href="/help">help</a></li>
3019 3019 </ul>
3020 3020 </div>
3021 3021
3022 3022 <div class="main">
3023 3023 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3024 3024
3025 3025 <form class="search" action="/log">
3026 3026
3027 3027 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3028 3028 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3029 3029 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3030 3030 </form>
3031 3031 <table class="bigtable">
3032 3032 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3033 3033
3034 3034 <tr><td>
3035 3035 <a href="/help/internals.bundles">
3036 3036 bundles
3037 3037 </a>
3038 3038 </td><td>
3039 3039 Bundles
3040 3040 </td></tr>
3041 3041 <tr><td>
3042 3042 <a href="/help/internals.censor">
3043 3043 censor
3044 3044 </a>
3045 3045 </td><td>
3046 3046 Censor
3047 3047 </td></tr>
3048 3048 <tr><td>
3049 3049 <a href="/help/internals.changegroups">
3050 3050 changegroups
3051 3051 </a>
3052 3052 </td><td>
3053 3053 Changegroups
3054 3054 </td></tr>
3055 3055 <tr><td>
3056 3056 <a href="/help/internals.requirements">
3057 3057 requirements
3058 3058 </a>
3059 3059 </td><td>
3060 3060 Repository Requirements
3061 3061 </td></tr>
3062 3062 <tr><td>
3063 3063 <a href="/help/internals.revlogs">
3064 3064 revlogs
3065 3065 </a>
3066 3066 </td><td>
3067 3067 Revision Logs
3068 3068 </td></tr>
3069 3069 <tr><td>
3070 3070 <a href="/help/internals.wireprotocol">
3071 3071 wireprotocol
3072 3072 </a>
3073 3073 </td><td>
3074 3074 Wire Protocol
3075 3075 </td></tr>
3076 3076
3077 3077
3078 3078
3079 3079
3080 3080
3081 3081 </table>
3082 3082 </div>
3083 3083 </div>
3084 3084
3085 3085
3086 3086
3087 3087 </body>
3088 3088 </html>
3089 3089
3090 3090
3091 3091 Sub-topic topics rendered properly
3092 3092
3093 3093 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3094 3094 200 Script output follows
3095 3095
3096 3096 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3097 3097 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3098 3098 <head>
3099 3099 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3100 3100 <meta name="robots" content="index, nofollow" />
3101 3101 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3102 3102 <script type="text/javascript" src="/static/mercurial.js"></script>
3103 3103
3104 3104 <title>Help: internals.changegroups</title>
3105 3105 </head>
3106 3106 <body>
3107 3107
3108 3108 <div class="container">
3109 3109 <div class="menu">
3110 3110 <div class="logo">
3111 3111 <a href="https://mercurial-scm.org/">
3112 3112 <img src="/static/hglogo.png" alt="mercurial" /></a>
3113 3113 </div>
3114 3114 <ul>
3115 3115 <li><a href="/shortlog">log</a></li>
3116 3116 <li><a href="/graph">graph</a></li>
3117 3117 <li><a href="/tags">tags</a></li>
3118 3118 <li><a href="/bookmarks">bookmarks</a></li>
3119 3119 <li><a href="/branches">branches</a></li>
3120 3120 </ul>
3121 3121 <ul>
3122 3122 <li class="active"><a href="/help">help</a></li>
3123 3123 </ul>
3124 3124 </div>
3125 3125
3126 3126 <div class="main">
3127 3127 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3128 3128 <h3>Help: internals.changegroups</h3>
3129 3129
3130 3130 <form class="search" action="/log">
3131 3131
3132 3132 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3133 3133 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3134 3134 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3135 3135 </form>
3136 3136 <div id="doc">
3137 3137 <h1>Changegroups</h1>
3138 3138 <p>
3139 3139 Changegroups are representations of repository revlog data, specifically
3140 3140 the changelog data, root/flat manifest data, treemanifest data, and
3141 3141 filelogs.
3142 3142 </p>
3143 3143 <p>
3144 3144 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3145 3145 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3146 3146 only difference being an additional item in the *delta header*. Version
3147 3147 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3148 3148 exchanging treemanifests (enabled by setting an option on the
3149 3149 &quot;changegroup&quot; part in the bundle2).
3150 3150 </p>
3151 3151 <p>
3152 3152 Changegroups when not exchanging treemanifests consist of 3 logical
3153 3153 segments:
3154 3154 </p>
3155 3155 <pre>
3156 3156 +---------------------------------+
3157 3157 | | | |
3158 3158 | changeset | manifest | filelogs |
3159 3159 | | | |
3160 3160 | | | |
3161 3161 +---------------------------------+
3162 3162 </pre>
3163 3163 <p>
3164 3164 When exchanging treemanifests, there are 4 logical segments:
3165 3165 </p>
3166 3166 <pre>
3167 3167 +-------------------------------------------------+
3168 3168 | | | | |
3169 3169 | changeset | root | treemanifests | filelogs |
3170 3170 | | manifest | | |
3171 3171 | | | | |
3172 3172 +-------------------------------------------------+
3173 3173 </pre>
3174 3174 <p>
3175 3175 The principle building block of each segment is a *chunk*. A *chunk*
3176 3176 is a framed piece of data:
3177 3177 </p>
3178 3178 <pre>
3179 3179 +---------------------------------------+
3180 3180 | | |
3181 3181 | length | data |
3182 3182 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3183 3183 | | |
3184 3184 +---------------------------------------+
3185 3185 </pre>
3186 3186 <p>
3187 3187 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3188 3188 integer indicating the length of the entire chunk (including the length field
3189 3189 itself).
3190 3190 </p>
3191 3191 <p>
3192 3192 There is a special case chunk that has a value of 0 for the length
3193 3193 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3194 3194 </p>
3195 3195 <h2>Delta Groups</h2>
3196 3196 <p>
3197 3197 A *delta group* expresses the content of a revlog as a series of deltas,
3198 3198 or patches against previous revisions.
3199 3199 </p>
3200 3200 <p>
3201 3201 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3202 3202 to signal the end of the delta group:
3203 3203 </p>
3204 3204 <pre>
3205 3205 +------------------------------------------------------------------------+
3206 3206 | | | | | |
3207 3207 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3208 3208 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3209 3209 | | | | | |
3210 3210 +------------------------------------------------------------------------+
3211 3211 </pre>
3212 3212 <p>
3213 3213 Each *chunk*'s data consists of the following:
3214 3214 </p>
3215 3215 <pre>
3216 3216 +---------------------------------------+
3217 3217 | | |
3218 3218 | delta header | delta data |
3219 3219 | (various by version) | (various) |
3220 3220 | | |
3221 3221 +---------------------------------------+
3222 3222 </pre>
3223 3223 <p>
3224 3224 The *delta data* is a series of *delta*s that describe a diff from an existing
3225 3225 entry (either that the recipient already has, or previously specified in the
3226 3226 bundle/changegroup).
3227 3227 </p>
3228 3228 <p>
3229 3229 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3230 3230 &quot;3&quot; of the changegroup format.
3231 3231 </p>
3232 3232 <p>
3233 3233 Version 1 (headerlen=80):
3234 3234 </p>
3235 3235 <pre>
3236 3236 +------------------------------------------------------+
3237 3237 | | | | |
3238 3238 | node | p1 node | p2 node | link node |
3239 3239 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3240 3240 | | | | |
3241 3241 +------------------------------------------------------+
3242 3242 </pre>
3243 3243 <p>
3244 3244 Version 2 (headerlen=100):
3245 3245 </p>
3246 3246 <pre>
3247 3247 +------------------------------------------------------------------+
3248 3248 | | | | | |
3249 3249 | node | p1 node | p2 node | base node | link node |
3250 3250 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3251 3251 | | | | | |
3252 3252 +------------------------------------------------------------------+
3253 3253 </pre>
3254 3254 <p>
3255 3255 Version 3 (headerlen=102):
3256 3256 </p>
3257 3257 <pre>
3258 3258 +------------------------------------------------------------------------------+
3259 3259 | | | | | | |
3260 3260 | node | p1 node | p2 node | base node | link node | flags |
3261 3261 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3262 3262 | | | | | | |
3263 3263 +------------------------------------------------------------------------------+
3264 3264 </pre>
3265 3265 <p>
3266 3266 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3267 3267 series of *delta*s, densely packed (no separators). These deltas describe a diff
3268 3268 from an existing entry (either that the recipient already has, or previously
3269 3269 specified in the bundle/changegroup). The format is described more fully in
3270 3270 &quot;hg help internals.bdiff&quot;, but briefly:
3271 3271 </p>
3272 3272 <pre>
3273 3273 +---------------------------------------------------------------+
3274 3274 | | | | |
3275 3275 | start offset | end offset | new length | content |
3276 3276 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3277 3277 | | | | |
3278 3278 +---------------------------------------------------------------+
3279 3279 </pre>
3280 3280 <p>
3281 3281 Please note that the length field in the delta data does *not* include itself.
3282 3282 </p>
3283 3283 <p>
3284 3284 In version 1, the delta is always applied against the previous node from
3285 3285 the changegroup or the first parent if this is the first entry in the
3286 3286 changegroup.
3287 3287 </p>
3288 3288 <p>
3289 3289 In version 2 and up, the delta base node is encoded in the entry in the
3290 3290 changegroup. This allows the delta to be expressed against any parent,
3291 3291 which can result in smaller deltas and more efficient encoding of data.
3292 3292 </p>
3293 3293 <h2>Changeset Segment</h2>
3294 3294 <p>
3295 3295 The *changeset segment* consists of a single *delta group* holding
3296 3296 changelog data. The *empty chunk* at the end of the *delta group* denotes
3297 3297 the boundary to the *manifest segment*.
3298 3298 </p>
3299 3299 <h2>Manifest Segment</h2>
3300 3300 <p>
3301 3301 The *manifest segment* consists of a single *delta group* holding manifest
3302 3302 data. If treemanifests are in use, it contains only the manifest for the
3303 3303 root directory of the repository. Otherwise, it contains the entire
3304 3304 manifest data. The *empty chunk* at the end of the *delta group* denotes
3305 3305 the boundary to the next segment (either the *treemanifests segment* or the
3306 3306 *filelogs segment*, depending on version and the request options).
3307 3307 </p>
3308 3308 <h3>Treemanifests Segment</h3>
3309 3309 <p>
3310 3310 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3311 3311 only if the 'treemanifest' param is part of the bundle2 changegroup part
3312 3312 (it is not possible to use changegroup version 3 outside of bundle2).
3313 3313 Aside from the filenames in the *treemanifests segment* containing a
3314 3314 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3315 3315 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3316 3316 a sub-segment with filename size 0). This denotes the boundary to the
3317 3317 *filelogs segment*.
3318 3318 </p>
3319 3319 <h2>Filelogs Segment</h2>
3320 3320 <p>
3321 3321 The *filelogs segment* consists of multiple sub-segments, each
3322 3322 corresponding to an individual file whose data is being described:
3323 3323 </p>
3324 3324 <pre>
3325 3325 +--------------------------------------------------+
3326 3326 | | | | | |
3327 3327 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3328 3328 | | | | | (4 bytes) |
3329 3329 | | | | | |
3330 3330 +--------------------------------------------------+
3331 3331 </pre>
3332 3332 <p>
3333 3333 The final filelog sub-segment is followed by an *empty chunk* (logically,
3334 3334 a sub-segment with filename size 0). This denotes the end of the segment
3335 3335 and of the overall changegroup.
3336 3336 </p>
3337 3337 <p>
3338 3338 Each filelog sub-segment consists of the following:
3339 3339 </p>
3340 3340 <pre>
3341 3341 +------------------------------------------------------+
3342 3342 | | | |
3343 3343 | filename length | filename | delta group |
3344 3344 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3345 3345 | | | |
3346 3346 +------------------------------------------------------+
3347 3347 </pre>
3348 3348 <p>
3349 3349 That is, a *chunk* consisting of the filename (not terminated or padded)
3350 3350 followed by N chunks constituting the *delta group* for this file. The
3351 3351 *empty chunk* at the end of each *delta group* denotes the boundary to the
3352 3352 next filelog sub-segment.
3353 3353 </p>
3354 3354
3355 3355 </div>
3356 3356 </div>
3357 3357 </div>
3358 3358
3359 3359
3360 3360
3361 3361 </body>
3362 3362 </html>
3363 3363
3364 3364
3365 3365 $ killdaemons.py
3366 3366
3367 3367 #endif
@@ -1,937 +1,938 b''
1 1 commit hooks can see env vars
2 2 (and post-transaction one are run unlocked)
3 3
4 4
5 5 $ cat > $TESTTMP/txnabort.checkargs.py <<EOF
6 6 > def showargs(ui, repo, hooktype, **kwargs):
7 7 > ui.write('%s Python hook: %s\n' % (hooktype, ','.join(sorted(kwargs))))
8 8 > EOF
9 9
10 10 $ hg init a
11 11 $ cd a
12 12 $ cat > .hg/hgrc <<EOF
13 13 > [hooks]
14 14 > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit"
15 15 > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b"
16 16 > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit"
17 17 > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit"
18 18 > pretxncommit.tip = hg -q tip
19 19 > pre-identify = sh -c "printenv.py pre-identify 1"
20 20 > pre-cat = sh -c "printenv.py pre-cat"
21 21 > post-cat = sh -c "printenv.py post-cat"
22 22 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen"
23 23 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose"
24 24 > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose"
25 25 > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs
26 26 > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort"
27 27 > txnclose.checklock = sh -c "hg debuglock > /dev/null"
28 28 > EOF
29 29 $ echo a > a
30 30 $ hg add a
31 31 $ hg commit -m a
32 32 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000
33 33 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
34 34 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
35 35 0:cb9a9f314b8b
36 36 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
37 37 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
38 38 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
39 39 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
40 40
41 41 $ hg clone . ../b
42 42 updating to branch default
43 43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
44 44 $ cd ../b
45 45
46 46 changegroup hooks can see env vars
47 47
48 48 $ cat > .hg/hgrc <<EOF
49 49 > [hooks]
50 50 > prechangegroup = sh -c "printenv.py prechangegroup"
51 51 > changegroup = sh -c "printenv.py changegroup"
52 52 > incoming = sh -c "printenv.py incoming"
53 53 > EOF
54 54
55 55 pretxncommit and commit hooks can see both parents of merge
56 56
57 57 $ cd ../a
58 58 $ echo b >> a
59 59 $ hg commit -m a1 -d "1 0"
60 60 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
61 61 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
62 62 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
63 63 1:ab228980c14d
64 64 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
65 65 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
66 66 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
67 67 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
68 68 $ hg update -C 0
69 69 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 70 $ echo b > b
71 71 $ hg add b
72 72 $ hg commit -m b -d '1 0'
73 73 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
74 74 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
75 75 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
76 76 2:ee9deb46ab31
77 77 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
78 78 created new head
79 79 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
80 80 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
81 81 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
82 82 $ hg merge 1
83 83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 84 (branch merge, don't forget to commit)
85 85 $ hg commit -m merge -d '2 0'
86 86 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
87 87 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
88 88 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
89 89 3:07f3376c1e65
90 90 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
91 91 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
92 92 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
93 93 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
94 94
95 95 test generic hooks
96 96
97 97 $ hg id
98 98 pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''} HG_PATS=[]
99 99 abort: pre-identify hook exited with status 1
100 100 [255]
101 101 $ hg cat b
102 102 pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b']
103 103 b
104 104 post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] HG_RESULT=0
105 105
106 106 $ cd ../b
107 107 $ hg pull ../a
108 108 pulling from ../a
109 109 searching for changes
110 110 prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
111 111 adding changesets
112 112 adding manifests
113 113 adding file changes
114 114 added 3 changesets with 2 changes to 2 files
115 115 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
116 116 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
117 117 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
118 118 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
119 119 (run 'hg update' to get a working copy)
120 120
121 121 tag hooks can see env vars
122 122
123 123 $ cd ../a
124 124 $ cat >> .hg/hgrc <<EOF
125 125 > pretag = sh -c "printenv.py pretag"
126 126 > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag"
127 127 > EOF
128 128 $ hg tag -d '3 0' a
129 129 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
130 130 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
131 131 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
132 132 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
133 133 4:539e4b31b6dc
134 134 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
135 135 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
136 136 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
137 137 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
138 138 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
139 139 $ hg tag -l la
140 140 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
141 141 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
142 142
143 143 pretag hook can forbid tagging
144 144
145 145 $ cat >> .hg/hgrc <<EOF
146 146 > pretag.forbid = sh -c "printenv.py pretag.forbid 1"
147 147 > EOF
148 148 $ hg tag -d '4 0' fa
149 149 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
150 150 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
151 151 abort: pretag.forbid hook exited with status 1
152 152 [255]
153 153 $ hg tag -l fla
154 154 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
155 155 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
156 156 abort: pretag.forbid hook exited with status 1
157 157 [255]
158 158
159 159 pretxncommit hook can see changeset, can roll back txn, changeset no
160 160 more there after
161 161
162 162 $ cat >> .hg/hgrc <<EOF
163 163 > pretxncommit.forbid0 = sh -c "hg tip -q"
164 164 > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1"
165 165 > EOF
166 166 $ echo z > z
167 167 $ hg add z
168 168 $ hg -q tip
169 169 4:539e4b31b6dc
170 170 $ hg commit -m 'fail' -d '4 0'
171 171 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
172 172 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
173 173 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
174 174 5:6f611f8018c1
175 175 5:6f611f8018c1
176 176 pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
177 177 transaction abort!
178 178 txnabort Python hook: txnid,txnname
179 179 txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
180 180 rollback completed
181 181 abort: pretxncommit.forbid1 hook exited with status 1
182 182 [255]
183 183 $ hg -q tip
184 184 4:539e4b31b6dc
185 185
186 186 (Check that no 'changelog.i.a' file were left behind)
187 187
188 188 $ ls -1 .hg/store/
189 189 00changelog.i
190 190 00manifest.i
191 191 data
192 192 fncache
193 193 journal.phaseroots
194 194 phaseroots
195 195 undo
196 196 undo.backup.fncache
197 197 undo.backupfiles
198 198 undo.phaseroots
199 199
200 200
201 201 precommit hook can prevent commit
202 202
203 203 $ cat >> .hg/hgrc <<EOF
204 204 > precommit.forbid = sh -c "printenv.py precommit.forbid 1"
205 205 > EOF
206 206 $ hg commit -m 'fail' -d '4 0'
207 207 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
208 208 precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
209 209 abort: precommit.forbid hook exited with status 1
210 210 [255]
211 211 $ hg -q tip
212 212 4:539e4b31b6dc
213 213
214 214 preupdate hook can prevent update
215 215
216 216 $ cat >> .hg/hgrc <<EOF
217 217 > preupdate = sh -c "printenv.py preupdate"
218 218 > EOF
219 219 $ hg update 1
220 220 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d
221 221 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
222 222
223 223 update hook
224 224
225 225 $ cat >> .hg/hgrc <<EOF
226 226 > update = sh -c "printenv.py update"
227 227 > EOF
228 228 $ hg update
229 229 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc
230 230 update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc
231 231 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
232 232
233 233 pushkey hook
234 234
235 235 $ cat >> .hg/hgrc <<EOF
236 236 > pushkey = sh -c "printenv.py pushkey"
237 237 > EOF
238 238 $ cd ../b
239 239 $ hg bookmark -r null foo
240 240 $ hg push -B foo ../a
241 241 pushing to ../a
242 242 searching for changes
243 243 no changes found
244 244 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
245 245 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
246 246 pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
247 247 txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
248 248 exporting bookmark foo
249 249 [1]
250 250 $ cd ../a
251 251
252 252 listkeys hook
253 253
254 254 $ cat >> .hg/hgrc <<EOF
255 255 > listkeys = sh -c "printenv.py listkeys"
256 256 > EOF
257 257 $ hg bookmark -r null bar
258 258 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
259 259 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
260 260 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
261 261 $ cd ../b
262 262 $ hg pull -B bar ../a
263 263 pulling from ../a
264 264 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
265 265 no changes found
266 266 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
267 267 adding remote bookmark bar
268 268 $ cd ../a
269 269
270 270 test that prepushkey can prevent incoming keys
271 271
272 272 $ cat >> .hg/hgrc <<EOF
273 273 > prepushkey = sh -c "printenv.py prepushkey.forbid 1"
274 274 > EOF
275 275 $ cd ../b
276 276 $ hg bookmark -r null baz
277 277 $ hg push -B baz ../a
278 278 pushing to ../a
279 279 searching for changes
280 280 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
281 281 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
282 282 no changes found
283 283 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
284 284 prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
285 285 pushkey-abort: prepushkey hook exited with status 1
286 286 abort: exporting bookmark baz failed!
287 287 [255]
288 288 $ cd ../a
289 289
290 290 test that prelistkeys can prevent listing keys
291 291
292 292 $ cat >> .hg/hgrc <<EOF
293 293 > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1"
294 294 > EOF
295 295 $ hg bookmark -r null quux
296 296 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
297 297 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
298 298 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
299 299 $ cd ../b
300 300 $ hg pull -B quux ../a
301 301 pulling from ../a
302 302 prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks
303 303 abort: prelistkeys hook exited with status 1
304 304 [255]
305 305 $ cd ../a
306 306 $ rm .hg/hgrc
307 307
308 308 prechangegroup hook can prevent incoming changes
309 309
310 310 $ cd ../b
311 311 $ hg -q tip
312 312 3:07f3376c1e65
313 313 $ cat > .hg/hgrc <<EOF
314 314 > [hooks]
315 315 > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1"
316 316 > EOF
317 317 $ hg pull ../a
318 318 pulling from ../a
319 319 searching for changes
320 320 prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
321 321 abort: prechangegroup.forbid hook exited with status 1
322 322 [255]
323 323
324 324 pretxnchangegroup hook can see incoming changes, can roll back txn,
325 325 incoming changes no longer there after
326 326
327 327 $ cat > .hg/hgrc <<EOF
328 328 > [hooks]
329 329 > pretxnchangegroup.forbid0 = hg tip -q
330 330 > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1"
331 331 > EOF
332 332 $ hg pull ../a
333 333 pulling from ../a
334 334 searching for changes
335 335 adding changesets
336 336 adding manifests
337 337 adding file changes
338 338 added 1 changesets with 1 changes to 1 files
339 339 4:539e4b31b6dc
340 340 pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
341 341 transaction abort!
342 342 rollback completed
343 343 abort: pretxnchangegroup.forbid1 hook exited with status 1
344 344 [255]
345 345 $ hg -q tip
346 346 3:07f3376c1e65
347 347
348 348 outgoing hooks can see env vars
349 349
350 350 $ rm .hg/hgrc
351 351 $ cat > ../a/.hg/hgrc <<EOF
352 352 > [hooks]
353 353 > preoutgoing = sh -c "printenv.py preoutgoing"
354 354 > outgoing = sh -c "printenv.py outgoing"
355 355 > EOF
356 356 $ hg pull ../a
357 357 pulling from ../a
358 358 searching for changes
359 359 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
360 360 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
361 361 adding changesets
362 362 adding manifests
363 363 adding file changes
364 364 added 1 changesets with 1 changes to 1 files
365 365 adding remote bookmark quux
366 366 (run 'hg update' to get a working copy)
367 367 $ hg rollback
368 368 repository tip rolled back to revision 3 (undo pull)
369 369
370 370 preoutgoing hook can prevent outgoing changes
371 371
372 372 $ cat >> ../a/.hg/hgrc <<EOF
373 373 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
374 374 > EOF
375 375 $ hg pull ../a
376 376 pulling from ../a
377 377 searching for changes
378 378 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
379 379 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
380 380 abort: preoutgoing.forbid hook exited with status 1
381 381 [255]
382 382
383 383 outgoing hooks work for local clones
384 384
385 385 $ cd ..
386 386 $ cat > a/.hg/hgrc <<EOF
387 387 > [hooks]
388 388 > preoutgoing = sh -c "printenv.py preoutgoing"
389 389 > outgoing = sh -c "printenv.py outgoing"
390 390 > EOF
391 391 $ hg clone a c
392 392 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
393 393 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
394 394 updating to branch default
395 395 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
396 396 $ rm -rf c
397 397
398 398 preoutgoing hook can prevent outgoing changes for local clones
399 399
400 400 $ cat >> a/.hg/hgrc <<EOF
401 401 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
402 402 > EOF
403 403 $ hg clone a zzz
404 404 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
405 405 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
406 406 abort: preoutgoing.forbid hook exited with status 1
407 407 [255]
408 408
409 409 $ cd "$TESTTMP/b"
410 410
411 411 $ cat > hooktests.py <<EOF
412 > from __future__ import print_function
412 413 > from mercurial import error
413 414 >
414 415 > uncallable = 0
415 416 >
416 417 > def printargs(args):
417 418 > args.pop('ui', None)
418 419 > args.pop('repo', None)
419 420 > a = list(args.items())
420 421 > a.sort()
421 > print 'hook args:'
422 > print('hook args:')
422 423 > for k, v in a:
423 > print ' ', k, v
424 > print(' ', k, v)
424 425 >
425 426 > def passhook(**args):
426 427 > printargs(args)
427 428 >
428 429 > def failhook(**args):
429 430 > printargs(args)
430 431 > return True
431 432 >
432 433 > class LocalException(Exception):
433 434 > pass
434 435 >
435 436 > def raisehook(**args):
436 437 > raise LocalException('exception from hook')
437 438 >
438 439 > def aborthook(**args):
439 440 > raise error.Abort('raise abort from hook')
440 441 >
441 442 > def brokenhook(**args):
442 443 > return 1 + {}
443 444 >
444 445 > def verbosehook(ui, **args):
445 446 > ui.note('verbose output from hook\n')
446 447 >
447 448 > def printtags(ui, repo, **args):
448 > print sorted(repo.tags())
449 > print(sorted(repo.tags()))
449 450 >
450 451 > class container:
451 452 > unreachable = 1
452 453 > EOF
453 454
454 455 $ cat > syntaxerror.py << EOF
455 456 > (foo
456 457 > EOF
457 458
458 459 test python hooks
459 460
460 461 #if windows
461 462 $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH"
462 463 #else
463 464 $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH"
464 465 #endif
465 466 $ export PYTHONPATH
466 467
467 468 $ echo '[hooks]' > ../a/.hg/hgrc
468 469 $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
469 470 $ hg pull ../a 2>&1 | grep 'raised an exception'
470 471 error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
471 472
472 473 $ echo '[hooks]' > ../a/.hg/hgrc
473 474 $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
474 475 $ hg pull ../a 2>&1 | grep 'raised an exception'
475 476 error: preoutgoing.raise hook raised an exception: exception from hook
476 477
477 478 $ echo '[hooks]' > ../a/.hg/hgrc
478 479 $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
479 480 $ hg pull ../a
480 481 pulling from ../a
481 482 searching for changes
482 483 error: preoutgoing.abort hook failed: raise abort from hook
483 484 abort: raise abort from hook
484 485 [255]
485 486
486 487 $ echo '[hooks]' > ../a/.hg/hgrc
487 488 $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
488 489 $ hg pull ../a
489 490 pulling from ../a
490 491 searching for changes
491 492 hook args:
492 493 hooktype preoutgoing
493 494 source pull
494 495 abort: preoutgoing.fail hook failed
495 496 [255]
496 497
497 498 $ echo '[hooks]' > ../a/.hg/hgrc
498 499 $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
499 500 $ hg pull ../a
500 501 pulling from ../a
501 502 searching for changes
502 503 abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable
503 504 [255]
504 505
505 506 $ echo '[hooks]' > ../a/.hg/hgrc
506 507 $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
507 508 $ hg pull ../a
508 509 pulling from ../a
509 510 searching for changes
510 511 abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined
511 512 [255]
512 513
513 514 $ echo '[hooks]' > ../a/.hg/hgrc
514 515 $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
515 516 $ hg pull ../a
516 517 pulling from ../a
517 518 searching for changes
518 519 abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module
519 520 [255]
520 521
521 522 $ echo '[hooks]' > ../a/.hg/hgrc
522 523 $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
523 524 $ hg pull ../a
524 525 pulling from ../a
525 526 searching for changes
526 527 abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed
527 528 (run with --traceback for stack trace)
528 529 [255]
529 530
530 531 $ echo '[hooks]' > ../a/.hg/hgrc
531 532 $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc
532 533 $ hg pull ../a
533 534 pulling from ../a
534 535 searching for changes
535 536 abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed
536 537 (run with --traceback for stack trace)
537 538 [255]
538 539
539 540 $ echo '[hooks]' > ../a/.hg/hgrc
540 541 $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc
541 542 $ hg pull ../a
542 543 pulling from ../a
543 544 searching for changes
544 545 abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
545 546 (run with --traceback for stack trace)
546 547 [255]
547 548
548 549 The second egrep is to filter out lines like ' ^', which are slightly
549 550 different between Python 2.6 and Python 2.7.
550 551 $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$'
551 552 pulling from ../a
552 553 searching for changes
553 554 exception from first failed import attempt:
554 555 Traceback (most recent call last):
555 556 SyntaxError: * (glob)
556 557 exception from second failed import attempt:
557 558 Traceback (most recent call last):
558 559 ImportError: No module named hgext_syntaxerror
559 560 Traceback (most recent call last):
560 561 HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
561 562 abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
562 563
563 564 $ echo '[hooks]' > ../a/.hg/hgrc
564 565 $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
565 566 $ hg pull ../a
566 567 pulling from ../a
567 568 searching for changes
568 569 hook args:
569 570 hooktype preoutgoing
570 571 source pull
571 572 adding changesets
572 573 adding manifests
573 574 adding file changes
574 575 added 1 changesets with 1 changes to 1 files
575 576 adding remote bookmark quux
576 577 (run 'hg update' to get a working copy)
577 578
578 579 post- python hooks that fail to *run* don't cause an abort
579 580 $ rm ../a/.hg/hgrc
580 581 $ echo '[hooks]' > .hg/hgrc
581 582 $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc
582 583 $ hg pull ../a
583 584 pulling from ../a
584 585 searching for changes
585 586 no changes found
586 587 error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
587 588 (run with --traceback for stack trace)
588 589
589 590 but post- python hooks that fail to *load* do
590 591 $ echo '[hooks]' > .hg/hgrc
591 592 $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc
592 593 $ hg pull ../a
593 594 pulling from ../a
594 595 searching for changes
595 596 no changes found
596 597 abort: post-pull.nomodule hook is invalid: "nomodule" not in a module
597 598 [255]
598 599
599 600 $ echo '[hooks]' > .hg/hgrc
600 601 $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc
601 602 $ hg pull ../a
602 603 pulling from ../a
603 604 searching for changes
604 605 no changes found
605 606 abort: post-pull.badmodule hook is invalid: import of "nomodule" failed
606 607 (run with --traceback for stack trace)
607 608 [255]
608 609
609 610 $ echo '[hooks]' > .hg/hgrc
610 611 $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc
611 612 $ hg pull ../a
612 613 pulling from ../a
613 614 searching for changes
614 615 no changes found
615 616 abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined
616 617 [255]
617 618
618 619 make sure --traceback works
619 620
620 621 $ echo '[hooks]' > .hg/hgrc
621 622 $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc
622 623
623 624 $ echo aa > a
624 625 $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback'
625 626 Traceback (most recent call last):
626 627
627 628 $ cd ..
628 629 $ hg init c
629 630 $ cd c
630 631
631 632 $ cat > hookext.py <<EOF
632 633 > def autohook(**args):
633 > print "Automatically installed hook"
634 > print("Automatically installed hook")
634 635 >
635 636 > def reposetup(ui, repo):
636 637 > repo.ui.setconfig("hooks", "commit.auto", autohook)
637 638 > EOF
638 639 $ echo '[extensions]' >> .hg/hgrc
639 640 $ echo 'hookext = hookext.py' >> .hg/hgrc
640 641
641 642 $ touch foo
642 643 $ hg add foo
643 644 $ hg ci -d '0 0' -m 'add foo'
644 645 Automatically installed hook
645 646 $ echo >> foo
646 647 $ hg ci --debug -d '0 0' -m 'change foo'
647 648 committing files:
648 649 foo
649 650 committing manifest
650 651 committing changelog
651 652 updating the branch cache
652 653 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
653 654 calling hook commit.auto: hgext_hookext.autohook
654 655 Automatically installed hook
655 656
656 657 $ hg showconfig hooks
657 658 hooks.commit.auto=<function autohook at *> (glob)
658 659
659 660 test python hook configured with python:[file]:[hook] syntax
660 661
661 662 $ cd ..
662 663 $ mkdir d
663 664 $ cd d
664 665 $ hg init repo
665 666 $ mkdir hooks
666 667
667 668 $ cd hooks
668 669 $ cat > testhooks.py <<EOF
669 670 > def testhook(**args):
670 > print 'hook works'
671 > print('hook works')
671 672 > EOF
672 673 $ echo '[hooks]' > ../repo/.hg/hgrc
673 674 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
674 675
675 676 $ cd ../repo
676 677 $ hg commit -d '0 0'
677 678 hook works
678 679 nothing changed
679 680 [1]
680 681
681 682 $ echo '[hooks]' > .hg/hgrc
682 683 $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc
683 684 $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc
684 685
685 686 $ hg up null
686 687 loading update.ne hook failed:
687 688 abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py
688 689 [255]
689 690
690 691 $ hg id
691 692 loading pre-identify.npmd hook failed:
692 693 abort: No module named repo!
693 694 [255]
694 695
695 696 $ cd ../../b
696 697
697 698 make sure --traceback works on hook import failure
698 699
699 700 $ cat > importfail.py <<EOF
700 701 > import somebogusmodule
701 702 > # dereference something in the module to force demandimport to load it
702 703 > somebogusmodule.whatever
703 704 > EOF
704 705
705 706 $ echo '[hooks]' > .hg/hgrc
706 707 $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
707 708
708 709 $ echo a >> a
709 710 $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])'
710 711 exception from first failed import attempt:
711 712 Traceback (most recent call last):
712 713 ImportError: No module named somebogusmodule
713 714 exception from second failed import attempt:
714 715 Traceback (most recent call last):
715 716 ImportError: No module named hgext_importfail
716 717 Traceback (most recent call last):
717 718 HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed
718 719 abort: precommit.importfail hook is invalid: import of "importfail" failed
719 720
720 721 Issue1827: Hooks Update & Commit not completely post operation
721 722
722 723 commit and update hooks should run after command completion. The largefiles
723 724 use demonstrates a recursive wlock, showing the hook doesn't run until the
724 725 final release (and dirstate flush).
725 726
726 727 $ echo '[hooks]' > .hg/hgrc
727 728 $ echo 'commit = hg id' >> .hg/hgrc
728 729 $ echo 'update = hg id' >> .hg/hgrc
729 730 $ echo bb > a
730 731 $ hg ci -ma
731 732 223eafe2750c tip
732 733 $ hg up 0 --config extensions.largefiles=
733 734 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
734 735 cb9a9f314b8b
735 736 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
736 737
737 738 make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui
738 739 that is passed to pre/post hooks
739 740
740 741 $ echo '[hooks]' > .hg/hgrc
741 742 $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc
742 743 $ hg id
743 744 cb9a9f314b8b
744 745 $ hg id --verbose
745 746 calling hook pre-identify: hooktests.verbosehook
746 747 verbose output from hook
747 748 cb9a9f314b8b
748 749
749 750 Ensure hooks can be prioritized
750 751
751 752 $ echo '[hooks]' > .hg/hgrc
752 753 $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc
753 754 $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc
754 755 $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc
755 756 $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc
756 757 $ hg id --verbose
757 758 calling hook pre-identify.b: hooktests.verbosehook
758 759 verbose output from hook
759 760 calling hook pre-identify.a: hooktests.verbosehook
760 761 verbose output from hook
761 762 calling hook pre-identify.c: hooktests.verbosehook
762 763 verbose output from hook
763 764 cb9a9f314b8b
764 765
765 766 new tags must be visible in pretxncommit (issue3210)
766 767
767 768 $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc
768 769 $ hg tag -f foo
769 770 ['a', 'foo', 'tip']
770 771
771 772 post-init hooks must not crash (issue4983)
772 773 This also creates the `to` repo for the next test block.
773 774
774 775 $ cd ..
775 776 $ cat << EOF >> hgrc-with-post-init-hook
776 777 > [hooks]
777 778 > post-init = sh -c "printenv.py post-init"
778 779 > EOF
779 780 $ HGRCPATH=hgrc-with-post-init-hook hg init to
780 781 post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0
781 782
782 783 new commits must be visible in pretxnchangegroup (issue3428)
783 784
784 785 $ echo '[hooks]' >> to/.hg/hgrc
785 786 $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc
786 787 $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc
787 788 $ echo a >> to/a
788 789 $ hg --cwd to ci -Ama
789 790 adding a
790 791 $ hg clone to from
791 792 updating to branch default
792 793 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
793 794 $ echo aa >> from/a
794 795 $ hg --cwd from ci -mb
795 796 $ hg --cwd from push
796 797 pushing to $TESTTMP/to (glob)
797 798 searching for changes
798 799 changeset: 0:cb9a9f314b8b
799 800 tag: tip
800 801 user: test
801 802 date: Thu Jan 01 00:00:00 1970 +0000
802 803 summary: a
803 804
804 805 adding changesets
805 806 adding manifests
806 807 adding file changes
807 808 added 1 changesets with 1 changes to 1 files
808 809 changeset: 1:9836a07b9b9d
809 810 tag: tip
810 811 user: test
811 812 date: Thu Jan 01 00:00:00 1970 +0000
812 813 summary: b
813 814
814 815
815 816 pretxnclose hook failure should abort the transaction
816 817
817 818 $ hg init txnfailure
818 819 $ cd txnfailure
819 820 $ touch a && hg commit -Aqm a
820 821 $ cat >> .hg/hgrc <<EOF
821 822 > [hooks]
822 823 > pretxnclose.error = exit 1
823 824 > EOF
824 825 $ hg strip -r 0 --config extensions.strip=
825 826 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
826 827 saved backup bundle to * (glob)
827 828 transaction abort!
828 829 rollback completed
829 830 strip failed, backup bundle stored in * (glob)
830 831 abort: pretxnclose.error hook exited with status 1
831 832 [255]
832 833 $ hg recover
833 834 no interrupted transaction available
834 835 [1]
835 836 $ cd ..
836 837
837 838 check whether HG_PENDING makes pending changes only in related
838 839 repositories visible to an external hook.
839 840
840 841 (emulate a transaction running concurrently by copied
841 842 .hg/store/00changelog.i.a in subsequent test)
842 843
843 844 $ cat > $TESTTMP/savepending.sh <<EOF
844 845 > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved
845 846 > exit 1 # to avoid adding new revision for subsequent tests
846 847 > EOF
847 848 $ cd a
848 849 $ hg tip -q
849 850 4:539e4b31b6dc
850 851 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible"
851 852 transaction abort!
852 853 rollback completed
853 854 abort: pretxnclose hook exited with status 1
854 855 [255]
855 856 $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a
856 857
857 858 (check (in)visibility of new changeset while transaction running in
858 859 repo)
859 860
860 861 $ cat > $TESTTMP/checkpending.sh <<EOF
861 862 > echo '@a'
862 863 > hg -R "$TESTTMP/a" tip -q
863 864 > echo '@a/nested'
864 865 > hg -R "$TESTTMP/a/nested" tip -q
865 866 > exit 1 # to avoid adding new revision for subsequent tests
866 867 > EOF
867 868 $ hg init nested
868 869 $ cd nested
869 870 $ echo a > a
870 871 $ hg add a
871 872 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0'
872 873 @a
873 874 4:539e4b31b6dc
874 875 @a/nested
875 876 0:bf5e395ced2c
876 877 transaction abort!
877 878 rollback completed
878 879 abort: pretxnclose hook exited with status 1
879 880 [255]
880 881
881 882 Hook from untrusted hgrc are reported as failure
882 883 ================================================
883 884
884 885 $ cat << EOF > $TESTTMP/untrusted.py
885 886 > from mercurial import scmutil, util
886 887 > def uisetup(ui):
887 888 > class untrustedui(ui.__class__):
888 889 > def _trusted(self, fp, f):
889 890 > if util.normpath(fp.name).endswith('untrusted/.hg/hgrc'):
890 891 > return False
891 892 > return super(untrustedui, self)._trusted(fp, f)
892 893 > ui.__class__ = untrustedui
893 894 > EOF
894 895 $ cat << EOF >> $HGRCPATH
895 896 > [extensions]
896 897 > untrusted=$TESTTMP/untrusted.py
897 898 > EOF
898 899 $ hg init untrusted
899 900 $ cd untrusted
900 901
901 902 Non-blocking hook
902 903 -----------------
903 904
904 905 $ cat << EOF >> .hg/hgrc
905 906 > [hooks]
906 907 > txnclose.testing=echo txnclose hook called
907 908 > EOF
908 909 $ touch a && hg commit -Aqm a
909 910 warning: untrusted hook txnclose.testing not executed
910 911 $ hg log
911 912 changeset: 0:3903775176ed
912 913 tag: tip
913 914 user: test
914 915 date: Thu Jan 01 00:00:00 1970 +0000
915 916 summary: a
916 917
917 918
918 919 Non-blocking hook
919 920 -----------------
920 921
921 922 $ cat << EOF >> .hg/hgrc
922 923 > [hooks]
923 924 > pretxnclose.testing=echo pre-txnclose hook called
924 925 > EOF
925 926 $ touch b && hg commit -Aqm a
926 927 transaction abort!
927 928 rollback completed
928 929 abort: untrusted hook pretxnclose.testing not executed
929 930 (see 'hg help config.trusted')
930 931 [255]
931 932 $ hg log
932 933 changeset: 0:3903775176ed
933 934 tag: tip
934 935 user: test
935 936 date: Thu Jan 01 00:00:00 1970 +0000
936 937 summary: a
937 938
@@ -1,157 +1,157 b''
1 1 #require unix-permissions
2 2
3 3 test that new files created in .hg inherit the permissions from .hg/store
4 4
5 5 $ mkdir dir
6 6
7 7 just in case somebody has a strange $TMPDIR
8 8
9 9 $ chmod g-s dir
10 10 $ cd dir
11 11
12 12 $ cat >printmodes.py <<EOF
13 13 > import os, sys
14 14 >
15 15 > allnames = []
16 16 > isdir = {}
17 17 > for root, dirs, files in os.walk(sys.argv[1]):
18 18 > for d in dirs:
19 19 > name = os.path.join(root, d)
20 20 > isdir[name] = 1
21 21 > allnames.append(name)
22 22 > for f in files:
23 23 > name = os.path.join(root, f)
24 24 > allnames.append(name)
25 25 > allnames.sort()
26 26 > for name in allnames:
27 27 > suffix = name in isdir and '/' or ''
28 > print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
28 > print('%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix))
29 29 > EOF
30 30
31 31 $ cat >mode.py <<EOF
32 32 > import sys
33 33 > import os
34 > print '%05o' % os.lstat(sys.argv[1]).st_mode
34 > print('%05o' % os.lstat(sys.argv[1]).st_mode)
35 35 > EOF
36 36
37 37 $ umask 077
38 38
39 39 $ hg init repo
40 40 $ cd repo
41 41
42 42 $ chmod 0770 .hg/store
43 43
44 44 before commit
45 45 store can be written by the group, other files cannot
46 46 store is setgid
47 47
48 48 $ $PYTHON ../printmodes.py .
49 49 00700 ./.hg/
50 50 00600 ./.hg/00changelog.i
51 51 00600 ./.hg/requires
52 52 00770 ./.hg/store/
53 53
54 54 $ mkdir dir
55 55 $ touch foo dir/bar
56 56 $ hg ci -qAm 'add files'
57 57
58 58 after commit
59 59 working dir files can only be written by the owner
60 60 files created in .hg can be written by the group
61 61 (in particular, store/**, dirstate, branch cache file, undo files)
62 62 new directories are setgid
63 63
64 64 $ $PYTHON ../printmodes.py .
65 65 00700 ./.hg/
66 66 00600 ./.hg/00changelog.i
67 67 00770 ./.hg/cache/
68 68 00660 ./.hg/cache/branch2-served
69 69 00660 ./.hg/cache/rbc-names-v1
70 70 00660 ./.hg/cache/rbc-revs-v1
71 71 00660 ./.hg/dirstate
72 72 00660 ./.hg/fsmonitor.state (fsmonitor !)
73 73 00660 ./.hg/last-message.txt
74 74 00600 ./.hg/requires
75 75 00770 ./.hg/store/
76 76 00660 ./.hg/store/00changelog.i
77 77 00660 ./.hg/store/00manifest.i
78 78 00770 ./.hg/store/data/
79 79 00770 ./.hg/store/data/dir/
80 80 00660 ./.hg/store/data/dir/bar.i
81 81 00660 ./.hg/store/data/foo.i
82 82 00660 ./.hg/store/fncache
83 83 00660 ./.hg/store/phaseroots
84 84 00660 ./.hg/store/undo
85 85 00660 ./.hg/store/undo.backupfiles
86 86 00660 ./.hg/store/undo.phaseroots
87 87 00660 ./.hg/undo.backup.dirstate
88 88 00660 ./.hg/undo.bookmarks
89 89 00660 ./.hg/undo.branch
90 90 00660 ./.hg/undo.desc
91 91 00660 ./.hg/undo.dirstate
92 92 00700 ./dir/
93 93 00600 ./dir/bar
94 94 00600 ./foo
95 95
96 96 $ umask 007
97 97 $ hg init ../push
98 98
99 99 before push
100 100 group can write everything
101 101
102 102 $ $PYTHON ../printmodes.py ../push
103 103 00770 ../push/.hg/
104 104 00660 ../push/.hg/00changelog.i
105 105 00660 ../push/.hg/requires
106 106 00770 ../push/.hg/store/
107 107
108 108 $ umask 077
109 109 $ hg -q push ../push
110 110
111 111 after push
112 112 group can still write everything
113 113
114 114 $ $PYTHON ../printmodes.py ../push
115 115 00770 ../push/.hg/
116 116 00660 ../push/.hg/00changelog.i
117 117 00770 ../push/.hg/cache/
118 118 00660 ../push/.hg/cache/branch2-base
119 119 00660 ../push/.hg/dirstate
120 120 00660 ../push/.hg/requires
121 121 00770 ../push/.hg/store/
122 122 00660 ../push/.hg/store/00changelog.i
123 123 00660 ../push/.hg/store/00manifest.i
124 124 00770 ../push/.hg/store/data/
125 125 00770 ../push/.hg/store/data/dir/
126 126 00660 ../push/.hg/store/data/dir/bar.i
127 127 00660 ../push/.hg/store/data/foo.i
128 128 00660 ../push/.hg/store/fncache
129 129 00660 ../push/.hg/store/undo
130 130 00660 ../push/.hg/store/undo.backupfiles
131 131 00660 ../push/.hg/store/undo.phaseroots
132 132 00660 ../push/.hg/undo.bookmarks
133 133 00660 ../push/.hg/undo.branch
134 134 00660 ../push/.hg/undo.desc
135 135 00660 ../push/.hg/undo.dirstate
136 136
137 137
138 138 Test that we don't lose the setgid bit when we call chmod.
139 139 Not all systems support setgid directories (e.g. HFS+), so
140 140 just check that directories have the same mode.
141 141
142 142 $ cd ..
143 143 $ hg init setgid
144 144 $ cd setgid
145 145 $ chmod g+rwx .hg/store
146 146 $ chmod g+s .hg/store 2> /dev/null || true
147 147 $ mkdir dir
148 148 $ touch dir/file
149 149 $ hg ci -qAm 'add dir/file'
150 150 $ storemode=`$PYTHON ../mode.py .hg/store`
151 151 $ dirmode=`$PYTHON ../mode.py .hg/store/data/dir`
152 152 $ if [ "$storemode" != "$dirmode" ]; then
153 153 > echo "$storemode != $dirmode"
154 154 > fi
155 155 $ cd ..
156 156
157 157 $ cd .. # g-s dir
@@ -1,29 +1,29 b''
1 1 #require no-pure
2 2
3 3 A script to generate nasty diff worst-case scenarios:
4 4
5 5 $ cat > s.py <<EOF
6 6 > import random
7 7 > for x in xrange(100000):
8 8 > print
9 9 > if random.randint(0, 100) >= 50:
10 10 > x += 1
11 > print hex(x)
11 > print(hex(x))
12 12 > EOF
13 13
14 14 $ hg init a
15 15 $ cd a
16 16
17 17 Check in a big file:
18 18
19 19 $ $PYTHON ../s.py > a
20 20 $ hg ci -qAm0
21 21
22 22 Modify it:
23 23
24 24 $ $PYTHON ../s.py > a
25 25
26 26 Time a check-in, should never take more than 10 seconds user time:
27 27
28 28 $ hg ci --time -m1
29 29 time: real .* secs .user [0-9][.].* sys .* (re)
@@ -1,259 +1,259 b''
1 1 Create user cache directory
2 2
3 3 $ USERCACHE=`pwd`/cache; export USERCACHE
4 4 $ cat <<EOF >> ${HGRCPATH}
5 5 > [extensions]
6 6 > hgext.largefiles=
7 7 > [largefiles]
8 8 > usercache=${USERCACHE}
9 9 > EOF
10 10 $ mkdir -p ${USERCACHE}
11 11
12 12 Create source repo, and commit adding largefile.
13 13
14 14 $ hg init src
15 15 $ cd src
16 16 $ echo large > large
17 17 $ hg add --large large
18 18 $ hg commit -m 'add largefile'
19 19 $ hg rm large
20 20 $ hg commit -m 'branchhead without largefile' large
21 21 $ hg up -qr 0
22 22 $ rm large
23 23 $ echo "0000000000000000000000000000000000000000" > .hglf/large
24 24 $ hg commit -m 'commit missing file with corrupt standin' large
25 25 abort: large: file not found!
26 26 [255]
27 27 $ hg up -Cqr 0
28 28 $ cd ..
29 29
30 30 Discard all cached largefiles in USERCACHE
31 31
32 32 $ rm -rf ${USERCACHE}
33 33
34 34 Create mirror repo, and pull from source without largefile:
35 35 "pull" is used instead of "clone" for suppression of (1) updating to
36 36 tip (= caching largefile from source repo), and (2) recording source
37 37 repo as "default" path in .hg/hgrc.
38 38
39 39 $ hg init mirror
40 40 $ cd mirror
41 41 $ hg pull ../src
42 42 pulling from ../src
43 43 requesting all changes
44 44 adding changesets
45 45 adding manifests
46 46 adding file changes
47 47 added 2 changesets with 1 changes to 1 files
48 48 (run 'hg update' to get a working copy)
49 49
50 50 Update working directory to "tip", which requires largefile("large"),
51 51 but there is no cache file for it. So, hg must treat it as
52 52 "missing"(!) file.
53 53
54 54 $ hg update -r0
55 55 getting changed largefiles
56 56 large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob)
57 57 0 largefiles updated, 0 removed
58 58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 59 $ hg status
60 60 ! large
61 61
62 62 Update working directory to null: this cleanup .hg/largefiles/dirstate
63 63
64 64 $ hg update null
65 65 getting changed largefiles
66 66 0 largefiles updated, 0 removed
67 67 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
68 68
69 69 Update working directory to tip, again.
70 70
71 71 $ hg update -r0
72 72 getting changed largefiles
73 73 large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob)
74 74 0 largefiles updated, 0 removed
75 75 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
76 76 $ hg status
77 77 ! large
78 78 $ cd ..
79 79
80 80 Verify that largefiles from pulled branchheads are fetched, also to an empty repo
81 81
82 82 $ hg init mirror2
83 83 $ hg -R mirror2 pull src -r0
84 84 pulling from src
85 85 adding changesets
86 86 adding manifests
87 87 adding file changes
88 88 added 1 changesets with 1 changes to 1 files
89 89 (run 'hg update' to get a working copy)
90 90
91 91 #if unix-permissions
92 92
93 93 Portable way to print file permissions:
94 94
95 95 $ cat > ls-l.py <<EOF
96 96 > #!$PYTHON
97 97 > import sys, os
98 98 > path = sys.argv[1]
99 > print '%03o' % (os.lstat(path).st_mode & 0777)
99 > print('%03o' % (os.lstat(path).st_mode & 0777))
100 100 > EOF
101 101 $ chmod +x ls-l.py
102 102
103 103 Test that files in .hg/largefiles inherit mode from .hg/store, not
104 104 from file in working copy:
105 105
106 106 $ cd src
107 107 $ chmod 750 .hg/store
108 108 $ chmod 660 large
109 109 $ echo change >> large
110 110 $ hg commit -m change
111 111 created new head
112 112 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
113 113 640
114 114
115 115 Test permission of with files in .hg/largefiles created by update:
116 116
117 117 $ cd ../mirror
118 118 $ rm -r "$USERCACHE" .hg/largefiles # avoid links
119 119 $ chmod 750 .hg/store
120 120 $ hg pull ../src --update -q
121 121 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
122 122 640
123 123
124 124 Test permission of files created by push:
125 125
126 126 $ hg serve -R ../src -d -p $HGPORT --pid-file hg.pid \
127 127 > --config "web.allow_push=*" --config web.push_ssl=no
128 128 $ cat hg.pid >> $DAEMON_PIDS
129 129
130 130 $ echo change >> large
131 131 $ hg commit -m change
132 132
133 133 $ rm -r "$USERCACHE"
134 134
135 135 $ hg push -q http://localhost:$HGPORT/
136 136
137 137 $ ../ls-l.py ../src/.hg/largefiles/b734e14a0971e370408ab9bce8d56d8485e368a9
138 138 640
139 139
140 140 $ cd ..
141 141
142 142 #endif
143 143
144 144 Test issue 4053 (remove --after on a deleted, uncommitted file shouldn't say
145 145 it is missing, but a remove on a nonexistent unknown file still should. Same
146 146 for a forget.)
147 147
148 148 $ cd src
149 149 $ touch x
150 150 $ hg add x
151 151 $ mv x y
152 152 $ hg remove -A x y ENOENT
153 153 ENOENT: * (glob)
154 154 not removing y: file is untracked
155 155 [1]
156 156 $ hg add y
157 157 $ mv y z
158 158 $ hg forget y z ENOENT
159 159 ENOENT: * (glob)
160 160 not removing z: file is already untracked
161 161 [1]
162 162
163 163 Largefiles are accessible from the share's store
164 164 $ cd ..
165 165 $ hg share -q src share_dst --config extensions.share=
166 166 $ hg -R share_dst update -r0
167 167 getting changed largefiles
168 168 1 largefiles updated, 0 removed
169 169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 170
171 171 $ echo modified > share_dst/large
172 172 $ hg -R share_dst ci -m modified
173 173 created new head
174 174
175 175 Only dirstate is in the local store for the share, and the largefile is in the
176 176 share source's local store. Avoid the extra largefiles added in the unix
177 177 conditional above.
178 178 $ hash=`hg -R share_dst cat share_dst/.hglf/large`
179 179 $ echo $hash
180 180 e2fb5f2139d086ded2cb600d5a91a196e76bf020
181 181
182 182 $ find share_dst/.hg/largefiles/* | sort
183 183 share_dst/.hg/largefiles/dirstate
184 184
185 185 $ find src/.hg/largefiles/* | egrep "(dirstate|$hash)" | sort
186 186 src/.hg/largefiles/dirstate
187 187 src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
188 188
189 189 Verify that backwards compatibility is maintained for old storage layout
190 190 $ mv src/.hg/largefiles/$hash share_dst/.hg/largefiles
191 191 $ hg verify --quiet --lfa -R share_dst --config largefiles.usercache=
192 192
193 193 Inject corruption into the largefiles store and see how update handles that:
194 194
195 195 $ cd src
196 196 $ hg up -qC tip
197 197 $ cat large
198 198 modified
199 199 $ rm large
200 200 $ cat .hglf/large
201 201 e2fb5f2139d086ded2cb600d5a91a196e76bf020
202 202 $ mv .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 ..
203 203 $ echo corruption > .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
204 204 $ hg up -C
205 205 getting changed largefiles
206 206 large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27 (glob)
207 207 0 largefiles updated, 0 removed
208 208 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
209 209 updated to "cd24c147f45c: modified"
210 210 [12] other heads for branch "default" (re)
211 211 $ hg st
212 212 ! large
213 213 ? z
214 214 $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
215 215
216 216 #if serve
217 217
218 218 Test coverage of error handling from putlfile:
219 219
220 220 $ mkdir $TESTTMP/mirrorcache
221 221 $ hg serve -R ../mirror -d -p $HGPORT1 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache
222 222 $ cat hg.pid >> $DAEMON_PIDS
223 223
224 224 $ hg push http://localhost:$HGPORT1 -f --config files.usercache=nocache
225 225 pushing to http://localhost:$HGPORT1/
226 226 searching for changes
227 227 abort: remotestore: could not open file $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020: HTTP Error 403: ssl required (glob)
228 228 [255]
229 229
230 230 $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
231 231
232 232 Test coverage of 'missing from store':
233 233
234 234 $ hg serve -R ../mirror -d -p $HGPORT2 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache --config "web.allow_push=*" --config web.push_ssl=no
235 235 $ cat hg.pid >> $DAEMON_PIDS
236 236
237 237 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache
238 238 pushing to http://localhost:$HGPORT2/
239 239 searching for changes
240 240 abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
241 241 [255]
242 242
243 243 Verify that --lfrev controls which revisions are checked for largefiles to push
244 244
245 245 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev tip
246 246 pushing to http://localhost:$HGPORT2/
247 247 searching for changes
248 248 abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
249 249 [255]
250 250
251 251 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev null
252 252 pushing to http://localhost:$HGPORT2/
253 253 searching for changes
254 254 remote: adding changesets
255 255 remote: adding manifests
256 256 remote: adding file changes
257 257 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
258 258
259 259 #endif
@@ -1,2391 +1,2391 b''
1 1 Log on empty repository: checking consistency
2 2
3 3 $ hg init empty
4 4 $ cd empty
5 5 $ hg log
6 6 $ hg log -r 1
7 7 abort: unknown revision '1'!
8 8 [255]
9 9 $ hg log -r -1:0
10 10 abort: unknown revision '-1'!
11 11 [255]
12 12 $ hg log -r 'branch(name)'
13 13 abort: unknown revision 'name'!
14 14 [255]
15 15 $ hg log -r null -q
16 16 -1:000000000000
17 17
18 18 The g is crafted to have 2 filelog topological heads in a linear
19 19 changeset graph
20 20
21 21 $ hg init a
22 22 $ cd a
23 23 $ echo a > a
24 24 $ echo f > f
25 25 $ hg ci -Ama -d '1 0'
26 26 adding a
27 27 adding f
28 28
29 29 $ hg cp a b
30 30 $ hg cp f g
31 31 $ hg ci -mb -d '2 0'
32 32
33 33 $ mkdir dir
34 34 $ hg mv b dir
35 35 $ echo g >> g
36 36 $ echo f >> f
37 37 $ hg ci -mc -d '3 0'
38 38
39 39 $ hg mv a b
40 40 $ hg cp -f f g
41 41 $ echo a > d
42 42 $ hg add d
43 43 $ hg ci -md -d '4 0'
44 44
45 45 $ hg mv dir/b e
46 46 $ hg ci -me -d '5 0'
47 47
48 48 Make sure largefiles doesn't interfere with logging a regular file
49 49 $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles=
50 50 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
51 51 updated patterns: .hglf/a, a
52 52 0: a
53 53 $ hg log a
54 54 changeset: 0:9161b9aeaf16
55 55 user: test
56 56 date: Thu Jan 01 00:00:01 1970 +0000
57 57 summary: a
58 58
59 59 $ hg log glob:a*
60 60 changeset: 3:2ca5ba701980
61 61 user: test
62 62 date: Thu Jan 01 00:00:04 1970 +0000
63 63 summary: d
64 64
65 65 changeset: 0:9161b9aeaf16
66 66 user: test
67 67 date: Thu Jan 01 00:00:01 1970 +0000
68 68 summary: a
69 69
70 70 $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles=
71 71 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
72 72 updated patterns: glob:.hglf/a*, glob:a*
73 73 3: d
74 74 0: a
75 75
76 76 log on directory
77 77
78 78 $ hg log dir
79 79 changeset: 4:7e4639b4691b
80 80 tag: tip
81 81 user: test
82 82 date: Thu Jan 01 00:00:05 1970 +0000
83 83 summary: e
84 84
85 85 changeset: 2:f8954cd4dc1f
86 86 user: test
87 87 date: Thu Jan 01 00:00:03 1970 +0000
88 88 summary: c
89 89
90 90 $ hg log somethingthatdoesntexist dir
91 91 changeset: 4:7e4639b4691b
92 92 tag: tip
93 93 user: test
94 94 date: Thu Jan 01 00:00:05 1970 +0000
95 95 summary: e
96 96
97 97 changeset: 2:f8954cd4dc1f
98 98 user: test
99 99 date: Thu Jan 01 00:00:03 1970 +0000
100 100 summary: c
101 101
102 102
103 103 -f, non-existent directory
104 104
105 105 $ hg log -f dir
106 106 abort: cannot follow file not in parent revision: "dir"
107 107 [255]
108 108
109 109 -f, directory
110 110
111 111 $ hg up -q 3
112 112 $ hg log -f dir
113 113 changeset: 2:f8954cd4dc1f
114 114 user: test
115 115 date: Thu Jan 01 00:00:03 1970 +0000
116 116 summary: c
117 117
118 118 -f, directory with --patch
119 119
120 120 $ hg log -f dir -p
121 121 changeset: 2:f8954cd4dc1f
122 122 user: test
123 123 date: Thu Jan 01 00:00:03 1970 +0000
124 124 summary: c
125 125
126 126 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
127 127 --- /dev/null* (glob)
128 128 +++ b/dir/b* (glob)
129 129 @@ -0,0 +1,1 @@
130 130 +a
131 131
132 132
133 133 -f, pattern
134 134
135 135 $ hg log -f -I 'dir**' -p
136 136 changeset: 2:f8954cd4dc1f
137 137 user: test
138 138 date: Thu Jan 01 00:00:03 1970 +0000
139 139 summary: c
140 140
141 141 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
142 142 --- /dev/null* (glob)
143 143 +++ b/dir/b* (glob)
144 144 @@ -0,0 +1,1 @@
145 145 +a
146 146
147 147 $ hg up -q 4
148 148
149 149 -f, a wrong style
150 150
151 151 $ hg log -f -l1 --style something
152 152 abort: style 'something' not found
153 153 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
154 154 [255]
155 155
156 156 -f, phases style
157 157
158 158
159 159 $ hg log -f -l1 --style phases
160 160 changeset: 4:7e4639b4691b
161 161 tag: tip
162 162 phase: draft
163 163 user: test
164 164 date: Thu Jan 01 00:00:05 1970 +0000
165 165 summary: e
166 166
167 167
168 168 $ hg log -f -l1 --style phases -q
169 169 4:7e4639b4691b
170 170
171 171 -f, but no args
172 172
173 173 $ hg log -f
174 174 changeset: 4:7e4639b4691b
175 175 tag: tip
176 176 user: test
177 177 date: Thu Jan 01 00:00:05 1970 +0000
178 178 summary: e
179 179
180 180 changeset: 3:2ca5ba701980
181 181 user: test
182 182 date: Thu Jan 01 00:00:04 1970 +0000
183 183 summary: d
184 184
185 185 changeset: 2:f8954cd4dc1f
186 186 user: test
187 187 date: Thu Jan 01 00:00:03 1970 +0000
188 188 summary: c
189 189
190 190 changeset: 1:d89b0a12d229
191 191 user: test
192 192 date: Thu Jan 01 00:00:02 1970 +0000
193 193 summary: b
194 194
195 195 changeset: 0:9161b9aeaf16
196 196 user: test
197 197 date: Thu Jan 01 00:00:01 1970 +0000
198 198 summary: a
199 199
200 200
201 201 one rename
202 202
203 203 $ hg up -q 2
204 204 $ hg log -vf a
205 205 changeset: 0:9161b9aeaf16
206 206 user: test
207 207 date: Thu Jan 01 00:00:01 1970 +0000
208 208 files: a f
209 209 description:
210 210 a
211 211
212 212
213 213
214 214 many renames
215 215
216 216 $ hg up -q tip
217 217 $ hg log -vf e
218 218 changeset: 4:7e4639b4691b
219 219 tag: tip
220 220 user: test
221 221 date: Thu Jan 01 00:00:05 1970 +0000
222 222 files: dir/b e
223 223 description:
224 224 e
225 225
226 226
227 227 changeset: 2:f8954cd4dc1f
228 228 user: test
229 229 date: Thu Jan 01 00:00:03 1970 +0000
230 230 files: b dir/b f g
231 231 description:
232 232 c
233 233
234 234
235 235 changeset: 1:d89b0a12d229
236 236 user: test
237 237 date: Thu Jan 01 00:00:02 1970 +0000
238 238 files: b g
239 239 description:
240 240 b
241 241
242 242
243 243 changeset: 0:9161b9aeaf16
244 244 user: test
245 245 date: Thu Jan 01 00:00:01 1970 +0000
246 246 files: a f
247 247 description:
248 248 a
249 249
250 250
251 251
252 252
253 253 log -pf dir/b
254 254
255 255 $ hg up -q 3
256 256 $ hg log -pf dir/b
257 257 changeset: 2:f8954cd4dc1f
258 258 user: test
259 259 date: Thu Jan 01 00:00:03 1970 +0000
260 260 summary: c
261 261
262 262 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
263 263 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
264 264 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
265 265 @@ -0,0 +1,1 @@
266 266 +a
267 267
268 268 changeset: 1:d89b0a12d229
269 269 user: test
270 270 date: Thu Jan 01 00:00:02 1970 +0000
271 271 summary: b
272 272
273 273 diff -r 9161b9aeaf16 -r d89b0a12d229 b
274 274 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
275 275 +++ b/b Thu Jan 01 00:00:02 1970 +0000
276 276 @@ -0,0 +1,1 @@
277 277 +a
278 278
279 279 changeset: 0:9161b9aeaf16
280 280 user: test
281 281 date: Thu Jan 01 00:00:01 1970 +0000
282 282 summary: a
283 283
284 284 diff -r 000000000000 -r 9161b9aeaf16 a
285 285 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
286 286 +++ b/a Thu Jan 01 00:00:01 1970 +0000
287 287 @@ -0,0 +1,1 @@
288 288 +a
289 289
290 290
291 291 log -pf b inside dir
292 292
293 293 $ hg --cwd=dir log -pf b
294 294 changeset: 2:f8954cd4dc1f
295 295 user: test
296 296 date: Thu Jan 01 00:00:03 1970 +0000
297 297 summary: c
298 298
299 299 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
300 300 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
301 301 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
302 302 @@ -0,0 +1,1 @@
303 303 +a
304 304
305 305 changeset: 1:d89b0a12d229
306 306 user: test
307 307 date: Thu Jan 01 00:00:02 1970 +0000
308 308 summary: b
309 309
310 310 diff -r 9161b9aeaf16 -r d89b0a12d229 b
311 311 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
312 312 +++ b/b Thu Jan 01 00:00:02 1970 +0000
313 313 @@ -0,0 +1,1 @@
314 314 +a
315 315
316 316 changeset: 0:9161b9aeaf16
317 317 user: test
318 318 date: Thu Jan 01 00:00:01 1970 +0000
319 319 summary: a
320 320
321 321 diff -r 000000000000 -r 9161b9aeaf16 a
322 322 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
323 323 +++ b/a Thu Jan 01 00:00:01 1970 +0000
324 324 @@ -0,0 +1,1 @@
325 325 +a
326 326
327 327
328 328 log -pf, but no args
329 329
330 330 $ hg log -pf
331 331 changeset: 3:2ca5ba701980
332 332 user: test
333 333 date: Thu Jan 01 00:00:04 1970 +0000
334 334 summary: d
335 335
336 336 diff -r f8954cd4dc1f -r 2ca5ba701980 a
337 337 --- a/a Thu Jan 01 00:00:03 1970 +0000
338 338 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
339 339 @@ -1,1 +0,0 @@
340 340 -a
341 341 diff -r f8954cd4dc1f -r 2ca5ba701980 b
342 342 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
343 343 +++ b/b Thu Jan 01 00:00:04 1970 +0000
344 344 @@ -0,0 +1,1 @@
345 345 +a
346 346 diff -r f8954cd4dc1f -r 2ca5ba701980 d
347 347 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
348 348 +++ b/d Thu Jan 01 00:00:04 1970 +0000
349 349 @@ -0,0 +1,1 @@
350 350 +a
351 351 diff -r f8954cd4dc1f -r 2ca5ba701980 g
352 352 --- a/g Thu Jan 01 00:00:03 1970 +0000
353 353 +++ b/g Thu Jan 01 00:00:04 1970 +0000
354 354 @@ -1,2 +1,2 @@
355 355 f
356 356 -g
357 357 +f
358 358
359 359 changeset: 2:f8954cd4dc1f
360 360 user: test
361 361 date: Thu Jan 01 00:00:03 1970 +0000
362 362 summary: c
363 363
364 364 diff -r d89b0a12d229 -r f8954cd4dc1f b
365 365 --- a/b Thu Jan 01 00:00:02 1970 +0000
366 366 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
367 367 @@ -1,1 +0,0 @@
368 368 -a
369 369 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
370 370 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
371 371 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
372 372 @@ -0,0 +1,1 @@
373 373 +a
374 374 diff -r d89b0a12d229 -r f8954cd4dc1f f
375 375 --- a/f Thu Jan 01 00:00:02 1970 +0000
376 376 +++ b/f Thu Jan 01 00:00:03 1970 +0000
377 377 @@ -1,1 +1,2 @@
378 378 f
379 379 +f
380 380 diff -r d89b0a12d229 -r f8954cd4dc1f g
381 381 --- a/g Thu Jan 01 00:00:02 1970 +0000
382 382 +++ b/g Thu Jan 01 00:00:03 1970 +0000
383 383 @@ -1,1 +1,2 @@
384 384 f
385 385 +g
386 386
387 387 changeset: 1:d89b0a12d229
388 388 user: test
389 389 date: Thu Jan 01 00:00:02 1970 +0000
390 390 summary: b
391 391
392 392 diff -r 9161b9aeaf16 -r d89b0a12d229 b
393 393 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
394 394 +++ b/b Thu Jan 01 00:00:02 1970 +0000
395 395 @@ -0,0 +1,1 @@
396 396 +a
397 397 diff -r 9161b9aeaf16 -r d89b0a12d229 g
398 398 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
399 399 +++ b/g Thu Jan 01 00:00:02 1970 +0000
400 400 @@ -0,0 +1,1 @@
401 401 +f
402 402
403 403 changeset: 0:9161b9aeaf16
404 404 user: test
405 405 date: Thu Jan 01 00:00:01 1970 +0000
406 406 summary: a
407 407
408 408 diff -r 000000000000 -r 9161b9aeaf16 a
409 409 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
410 410 +++ b/a Thu Jan 01 00:00:01 1970 +0000
411 411 @@ -0,0 +1,1 @@
412 412 +a
413 413 diff -r 000000000000 -r 9161b9aeaf16 f
414 414 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
415 415 +++ b/f Thu Jan 01 00:00:01 1970 +0000
416 416 @@ -0,0 +1,1 @@
417 417 +f
418 418
419 419
420 420 log -vf dir/b
421 421
422 422 $ hg log -vf dir/b
423 423 changeset: 2:f8954cd4dc1f
424 424 user: test
425 425 date: Thu Jan 01 00:00:03 1970 +0000
426 426 files: b dir/b f g
427 427 description:
428 428 c
429 429
430 430
431 431 changeset: 1:d89b0a12d229
432 432 user: test
433 433 date: Thu Jan 01 00:00:02 1970 +0000
434 434 files: b g
435 435 description:
436 436 b
437 437
438 438
439 439 changeset: 0:9161b9aeaf16
440 440 user: test
441 441 date: Thu Jan 01 00:00:01 1970 +0000
442 442 files: a f
443 443 description:
444 444 a
445 445
446 446
447 447
448 448
449 449 -f and multiple filelog heads
450 450
451 451 $ hg up -q 2
452 452 $ hg log -f g --template '{rev}\n'
453 453 2
454 454 1
455 455 0
456 456 $ hg up -q tip
457 457 $ hg log -f g --template '{rev}\n'
458 458 3
459 459 2
460 460 0
461 461
462 462
463 463 log copies with --copies
464 464
465 465 $ hg log -vC --template '{rev} {file_copies}\n'
466 466 4 e (dir/b)
467 467 3 b (a)g (f)
468 468 2 dir/b (b)
469 469 1 b (a)g (f)
470 470 0
471 471
472 472 log copies switch without --copies, with old filecopy template
473 473
474 474 $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n'
475 475 4
476 476 3
477 477 2
478 478 1
479 479 0
480 480
481 481 log copies switch with --copies
482 482
483 483 $ hg log -vC --template '{rev} {file_copies_switch}\n'
484 484 4 e (dir/b)
485 485 3 b (a)g (f)
486 486 2 dir/b (b)
487 487 1 b (a)g (f)
488 488 0
489 489
490 490
491 491 log copies with hardcoded style and with --style=default
492 492
493 493 $ hg log -vC -r4
494 494 changeset: 4:7e4639b4691b
495 495 tag: tip
496 496 user: test
497 497 date: Thu Jan 01 00:00:05 1970 +0000
498 498 files: dir/b e
499 499 copies: e (dir/b)
500 500 description:
501 501 e
502 502
503 503
504 504 $ hg log -vC -r4 --style=default
505 505 changeset: 4:7e4639b4691b
506 506 tag: tip
507 507 user: test
508 508 date: Thu Jan 01 00:00:05 1970 +0000
509 509 files: dir/b e
510 510 copies: e (dir/b)
511 511 description:
512 512 e
513 513
514 514
515 515 $ hg log -vC -r4 -Tjson
516 516 [
517 517 {
518 518 "rev": 4,
519 519 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
520 520 "branch": "default",
521 521 "phase": "draft",
522 522 "user": "test",
523 523 "date": [5, 0],
524 524 "desc": "e",
525 525 "bookmarks": [],
526 526 "tags": ["tip"],
527 527 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
528 528 "files": ["dir/b", "e"],
529 529 "copies": {"e": "dir/b"}
530 530 }
531 531 ]
532 532
533 533 log copies, non-linear manifest
534 534
535 535 $ hg up -C 3
536 536 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
537 537 $ hg mv dir/b e
538 538 $ echo foo > foo
539 539 $ hg ci -Ame2 -d '6 0'
540 540 adding foo
541 541 created new head
542 542 $ hg log -v --template '{rev} {file_copies}\n' -r 5
543 543 5 e (dir/b)
544 544
545 545
546 546 log copies, execute bit set
547 547
548 548 #if execbit
549 549 $ chmod +x e
550 550 $ hg ci -me3 -d '7 0'
551 551 $ hg log -v --template '{rev} {file_copies}\n' -r 6
552 552 6
553 553 #endif
554 554
555 555
556 556 log -p d
557 557
558 558 $ hg log -pv d
559 559 changeset: 3:2ca5ba701980
560 560 user: test
561 561 date: Thu Jan 01 00:00:04 1970 +0000
562 562 files: a b d g
563 563 description:
564 564 d
565 565
566 566
567 567 diff -r f8954cd4dc1f -r 2ca5ba701980 d
568 568 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
569 569 +++ b/d Thu Jan 01 00:00:04 1970 +0000
570 570 @@ -0,0 +1,1 @@
571 571 +a
572 572
573 573
574 574
575 575 log --removed file
576 576
577 577 $ hg log --removed -v a
578 578 changeset: 3:2ca5ba701980
579 579 user: test
580 580 date: Thu Jan 01 00:00:04 1970 +0000
581 581 files: a b d g
582 582 description:
583 583 d
584 584
585 585
586 586 changeset: 0:9161b9aeaf16
587 587 user: test
588 588 date: Thu Jan 01 00:00:01 1970 +0000
589 589 files: a f
590 590 description:
591 591 a
592 592
593 593
594 594
595 595 log --removed revrange file
596 596
597 597 $ hg log --removed -v -r0:2 a
598 598 changeset: 0:9161b9aeaf16
599 599 user: test
600 600 date: Thu Jan 01 00:00:01 1970 +0000
601 601 files: a f
602 602 description:
603 603 a
604 604
605 605
606 606 $ cd ..
607 607
608 608 log --follow tests
609 609
610 610 $ hg init follow
611 611 $ cd follow
612 612
613 613 $ echo base > base
614 614 $ hg ci -Ambase -d '1 0'
615 615 adding base
616 616
617 617 $ echo r1 >> base
618 618 $ hg ci -Amr1 -d '1 0'
619 619 $ echo r2 >> base
620 620 $ hg ci -Amr2 -d '1 0'
621 621
622 622 $ hg up -C 1
623 623 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
624 624 $ echo b1 > b1
625 625
626 626 log -r "follow('set:clean()')"
627 627
628 628 $ hg log -r "follow('set:clean()')"
629 629 changeset: 0:67e992f2c4f3
630 630 user: test
631 631 date: Thu Jan 01 00:00:01 1970 +0000
632 632 summary: base
633 633
634 634 changeset: 1:3d5bf5654eda
635 635 user: test
636 636 date: Thu Jan 01 00:00:01 1970 +0000
637 637 summary: r1
638 638
639 639
640 640 $ hg ci -Amb1 -d '1 0'
641 641 adding b1
642 642 created new head
643 643
644 644
645 645 log -f
646 646
647 647 $ hg log -f
648 648 changeset: 3:e62f78d544b4
649 649 tag: tip
650 650 parent: 1:3d5bf5654eda
651 651 user: test
652 652 date: Thu Jan 01 00:00:01 1970 +0000
653 653 summary: b1
654 654
655 655 changeset: 1:3d5bf5654eda
656 656 user: test
657 657 date: Thu Jan 01 00:00:01 1970 +0000
658 658 summary: r1
659 659
660 660 changeset: 0:67e992f2c4f3
661 661 user: test
662 662 date: Thu Jan 01 00:00:01 1970 +0000
663 663 summary: base
664 664
665 665
666 666 log -r follow('glob:b*')
667 667
668 668 $ hg log -r "follow('glob:b*')"
669 669 changeset: 0:67e992f2c4f3
670 670 user: test
671 671 date: Thu Jan 01 00:00:01 1970 +0000
672 672 summary: base
673 673
674 674 changeset: 1:3d5bf5654eda
675 675 user: test
676 676 date: Thu Jan 01 00:00:01 1970 +0000
677 677 summary: r1
678 678
679 679 changeset: 3:e62f78d544b4
680 680 tag: tip
681 681 parent: 1:3d5bf5654eda
682 682 user: test
683 683 date: Thu Jan 01 00:00:01 1970 +0000
684 684 summary: b1
685 685
686 686 log -f -r '1 + 4'
687 687
688 688 $ hg up -C 0
689 689 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
690 690 $ echo b2 > b2
691 691 $ hg ci -Amb2 -d '1 0'
692 692 adding b2
693 693 created new head
694 694 $ hg log -f -r '1 + 4'
695 695 changeset: 4:ddb82e70d1a1
696 696 tag: tip
697 697 parent: 0:67e992f2c4f3
698 698 user: test
699 699 date: Thu Jan 01 00:00:01 1970 +0000
700 700 summary: b2
701 701
702 702 changeset: 1:3d5bf5654eda
703 703 user: test
704 704 date: Thu Jan 01 00:00:01 1970 +0000
705 705 summary: r1
706 706
707 707 changeset: 0:67e992f2c4f3
708 708 user: test
709 709 date: Thu Jan 01 00:00:01 1970 +0000
710 710 summary: base
711 711
712 712 log -r "follow('set:grep(b2)')"
713 713
714 714 $ hg log -r "follow('set:grep(b2)')"
715 715 changeset: 4:ddb82e70d1a1
716 716 tag: tip
717 717 parent: 0:67e992f2c4f3
718 718 user: test
719 719 date: Thu Jan 01 00:00:01 1970 +0000
720 720 summary: b2
721 721
722 722 log -r "follow('set:grep(b2)', 4)"
723 723
724 724 $ hg up -qC 0
725 725 $ hg log -r "follow('set:grep(b2)', 4)"
726 726 changeset: 4:ddb82e70d1a1
727 727 tag: tip
728 728 parent: 0:67e992f2c4f3
729 729 user: test
730 730 date: Thu Jan 01 00:00:01 1970 +0000
731 731 summary: b2
732 732
733 733 $ hg up -qC 4
734 734
735 735 log -f -r null
736 736
737 737 $ hg log -f -r null
738 738 changeset: -1:000000000000
739 739 user:
740 740 date: Thu Jan 01 00:00:00 1970 +0000
741 741
742 742 $ hg log -f -r null -G
743 743 o changeset: -1:000000000000
744 744 user:
745 745 date: Thu Jan 01 00:00:00 1970 +0000
746 746
747 747
748 748
749 749 log -f with null parent
750 750
751 751 $ hg up -C null
752 752 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
753 753 $ hg log -f
754 754
755 755
756 756 log -r . with two parents
757 757
758 758 $ hg up -C 3
759 759 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
760 760 $ hg merge tip
761 761 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
762 762 (branch merge, don't forget to commit)
763 763 $ hg log -r .
764 764 changeset: 3:e62f78d544b4
765 765 parent: 1:3d5bf5654eda
766 766 user: test
767 767 date: Thu Jan 01 00:00:01 1970 +0000
768 768 summary: b1
769 769
770 770
771 771
772 772 log -r . with one parent
773 773
774 774 $ hg ci -mm12 -d '1 0'
775 775 $ hg log -r .
776 776 changeset: 5:302e9dd6890d
777 777 tag: tip
778 778 parent: 3:e62f78d544b4
779 779 parent: 4:ddb82e70d1a1
780 780 user: test
781 781 date: Thu Jan 01 00:00:01 1970 +0000
782 782 summary: m12
783 783
784 784
785 785 $ echo postm >> b1
786 786 $ hg ci -Amb1.1 -d'1 0'
787 787
788 788
789 789 log --follow-first
790 790
791 791 $ hg log --follow-first
792 792 changeset: 6:2404bbcab562
793 793 tag: tip
794 794 user: test
795 795 date: Thu Jan 01 00:00:01 1970 +0000
796 796 summary: b1.1
797 797
798 798 changeset: 5:302e9dd6890d
799 799 parent: 3:e62f78d544b4
800 800 parent: 4:ddb82e70d1a1
801 801 user: test
802 802 date: Thu Jan 01 00:00:01 1970 +0000
803 803 summary: m12
804 804
805 805 changeset: 3:e62f78d544b4
806 806 parent: 1:3d5bf5654eda
807 807 user: test
808 808 date: Thu Jan 01 00:00:01 1970 +0000
809 809 summary: b1
810 810
811 811 changeset: 1:3d5bf5654eda
812 812 user: test
813 813 date: Thu Jan 01 00:00:01 1970 +0000
814 814 summary: r1
815 815
816 816 changeset: 0:67e992f2c4f3
817 817 user: test
818 818 date: Thu Jan 01 00:00:01 1970 +0000
819 819 summary: base
820 820
821 821
822 822
823 823 log -P 2
824 824
825 825 $ hg log -P 2
826 826 changeset: 6:2404bbcab562
827 827 tag: tip
828 828 user: test
829 829 date: Thu Jan 01 00:00:01 1970 +0000
830 830 summary: b1.1
831 831
832 832 changeset: 5:302e9dd6890d
833 833 parent: 3:e62f78d544b4
834 834 parent: 4:ddb82e70d1a1
835 835 user: test
836 836 date: Thu Jan 01 00:00:01 1970 +0000
837 837 summary: m12
838 838
839 839 changeset: 4:ddb82e70d1a1
840 840 parent: 0:67e992f2c4f3
841 841 user: test
842 842 date: Thu Jan 01 00:00:01 1970 +0000
843 843 summary: b2
844 844
845 845 changeset: 3:e62f78d544b4
846 846 parent: 1:3d5bf5654eda
847 847 user: test
848 848 date: Thu Jan 01 00:00:01 1970 +0000
849 849 summary: b1
850 850
851 851
852 852
853 853 log -r tip -p --git
854 854
855 855 $ hg log -r tip -p --git
856 856 changeset: 6:2404bbcab562
857 857 tag: tip
858 858 user: test
859 859 date: Thu Jan 01 00:00:01 1970 +0000
860 860 summary: b1.1
861 861
862 862 diff --git a/b1 b/b1
863 863 --- a/b1
864 864 +++ b/b1
865 865 @@ -1,1 +1,2 @@
866 866 b1
867 867 +postm
868 868
869 869
870 870
871 871 log -r ""
872 872
873 873 $ hg log -r ''
874 874 hg: parse error: empty query
875 875 [255]
876 876
877 877 log -r <some unknown node id>
878 878
879 879 $ hg log -r 1000000000000000000000000000000000000000
880 880 abort: unknown revision '1000000000000000000000000000000000000000'!
881 881 [255]
882 882
883 883 log -k r1
884 884
885 885 $ hg log -k r1
886 886 changeset: 1:3d5bf5654eda
887 887 user: test
888 888 date: Thu Jan 01 00:00:01 1970 +0000
889 889 summary: r1
890 890
891 891 log -p -l2 --color=always
892 892
893 893 $ hg --config extensions.color= --config color.mode=ansi \
894 894 > log -p -l2 --color=always
895 895 \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
896 896 tag: tip
897 897 user: test
898 898 date: Thu Jan 01 00:00:01 1970 +0000
899 899 summary: b1.1
900 900
901 901 \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc)
902 902 \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
903 903 \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
904 904 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
905 905 b1
906 906 \x1b[0;32m+postm\x1b[0m (esc)
907 907
908 908 \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
909 909 parent: 3:e62f78d544b4
910 910 parent: 4:ddb82e70d1a1
911 911 user: test
912 912 date: Thu Jan 01 00:00:01 1970 +0000
913 913 summary: m12
914 914
915 915 \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc)
916 916 \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc)
917 917 \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
918 918 \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc)
919 919 \x1b[0;32m+b2\x1b[0m (esc)
920 920
921 921
922 922
923 923 log -r tip --stat
924 924
925 925 $ hg log -r tip --stat
926 926 changeset: 6:2404bbcab562
927 927 tag: tip
928 928 user: test
929 929 date: Thu Jan 01 00:00:01 1970 +0000
930 930 summary: b1.1
931 931
932 932 b1 | 1 +
933 933 1 files changed, 1 insertions(+), 0 deletions(-)
934 934
935 935
936 936 $ cd ..
937 937
938 938 log --follow --patch FILE in repository where linkrev isn't trustworthy
939 939 (issue5376)
940 940
941 941 $ hg init follow-dup
942 942 $ cd follow-dup
943 943 $ cat <<EOF >> .hg/hgrc
944 944 > [ui]
945 945 > logtemplate = '=== {rev}: {desc}\n'
946 946 > [diff]
947 947 > nodates = True
948 948 > EOF
949 949 $ echo 0 >> a
950 950 $ hg ci -qAm 'a0'
951 951 $ echo 1 >> a
952 952 $ hg ci -m 'a1'
953 953 $ hg up -q 0
954 954 $ echo 1 >> a
955 955 $ touch b
956 956 $ hg ci -qAm 'a1 with b'
957 957 $ echo 3 >> a
958 958 $ hg ci -m 'a3'
959 959
960 960 fctx.rev() == 2, but fctx.linkrev() == 1
961 961
962 962 $ hg log -pf a
963 963 === 3: a3
964 964 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
965 965 --- a/a
966 966 +++ b/a
967 967 @@ -1,2 +1,3 @@
968 968 0
969 969 1
970 970 +3
971 971
972 972 === 2: a1 with b
973 973 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
974 974 --- a/a
975 975 +++ b/a
976 976 @@ -1,1 +1,2 @@
977 977 0
978 978 +1
979 979
980 980 === 0: a0
981 981 diff -r 000000000000 -r 49b5e81287e2 a
982 982 --- /dev/null
983 983 +++ b/a
984 984 @@ -0,0 +1,1 @@
985 985 +0
986 986
987 987
988 988 fctx.introrev() == 2, but fctx.linkrev() == 1
989 989
990 990 $ hg up -q 2
991 991 $ hg log -pf a
992 992 === 2: a1 with b
993 993 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
994 994 --- a/a
995 995 +++ b/a
996 996 @@ -1,1 +1,2 @@
997 997 0
998 998 +1
999 999
1000 1000 === 0: a0
1001 1001 diff -r 000000000000 -r 49b5e81287e2 a
1002 1002 --- /dev/null
1003 1003 +++ b/a
1004 1004 @@ -0,0 +1,1 @@
1005 1005 +0
1006 1006
1007 1007
1008 1008 $ cd ..
1009 1009
1010 1010 Test that log should respect the order of -rREV even if multiple OR conditions
1011 1011 are specified (issue5100):
1012 1012
1013 1013 $ hg init revorder
1014 1014 $ cd revorder
1015 1015
1016 1016 $ hg branch -q b0
1017 1017 $ echo 0 >> f0
1018 1018 $ hg ci -qAm k0 -u u0
1019 1019 $ hg branch -q b1
1020 1020 $ echo 1 >> f1
1021 1021 $ hg ci -qAm k1 -u u1
1022 1022 $ hg branch -q b2
1023 1023 $ echo 2 >> f2
1024 1024 $ hg ci -qAm k2 -u u2
1025 1025
1026 1026 $ hg update -q b2
1027 1027 $ echo 3 >> f2
1028 1028 $ hg ci -qAm k2 -u u2
1029 1029 $ hg update -q b1
1030 1030 $ echo 4 >> f1
1031 1031 $ hg ci -qAm k1 -u u1
1032 1032 $ hg update -q b0
1033 1033 $ echo 5 >> f0
1034 1034 $ hg ci -qAm k0 -u u0
1035 1035
1036 1036 summary of revisions:
1037 1037
1038 1038 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
1039 1039 @ 5 b0 u0 k0 f0
1040 1040 |
1041 1041 | o 4 b1 u1 k1 f1
1042 1042 | |
1043 1043 | | o 3 b2 u2 k2 f2
1044 1044 | | |
1045 1045 | | o 2 b2 u2 k2 f2
1046 1046 | |/
1047 1047 | o 1 b1 u1 k1 f1
1048 1048 |/
1049 1049 o 0 b0 u0 k0 f0
1050 1050
1051 1051
1052 1052 log -b BRANCH in ascending order:
1053 1053
1054 1054 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
1055 1055 0 b0
1056 1056 1 b1
1057 1057 4 b1
1058 1058 5 b0
1059 1059 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
1060 1060 0 b0
1061 1061 1 b1
1062 1062 4 b1
1063 1063 5 b0
1064 1064
1065 1065 log --only-branch BRANCH in descending order:
1066 1066
1067 1067 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
1068 1068 4 b1
1069 1069 3 b2
1070 1070 2 b2
1071 1071 1 b1
1072 1072 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
1073 1073 4 b1
1074 1074 3 b2
1075 1075 2 b2
1076 1076 1 b1
1077 1077
1078 1078 log -u USER in ascending order, against compound set:
1079 1079
1080 1080 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
1081 1081 0 u0
1082 1082 2 u2
1083 1083 3 u2
1084 1084 5 u0
1085 1085 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
1086 1086 0 u0
1087 1087 2 u2
1088 1088 3 u2
1089 1089 5 u0
1090 1090
1091 1091 log -k TEXT in descending order, against compound set:
1092 1092
1093 1093 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1094 1094 5 k0
1095 1095 3 k2
1096 1096 2 k2
1097 1097 1 k1
1098 1098 0 k0
1099 1099 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1100 1100 5 k0
1101 1101 3 k2
1102 1102 2 k2
1103 1103 1 k1
1104 1104 0 k0
1105 1105
1106 1106 log FILE in ascending order, against dagrange:
1107 1107
1108 1108 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1109 1109 1 f1
1110 1110 2 f2
1111 1111 3 f2
1112 1112 4 f1
1113 1113 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1114 1114 1 f1
1115 1115 2 f2
1116 1116 3 f2
1117 1117 4 f1
1118 1118
1119 1119 $ cd ..
1120 1120
1121 1121 User
1122 1122
1123 1123 $ hg init usertest
1124 1124 $ cd usertest
1125 1125
1126 1126 $ echo a > a
1127 1127 $ hg ci -A -m "a" -u "User One <user1@example.org>"
1128 1128 adding a
1129 1129 $ echo b > b
1130 1130 $ hg ci -A -m "b" -u "User Two <user2@example.org>"
1131 1131 adding b
1132 1132
1133 1133 $ hg log -u "User One <user1@example.org>"
1134 1134 changeset: 0:29a4c94f1924
1135 1135 user: User One <user1@example.org>
1136 1136 date: Thu Jan 01 00:00:00 1970 +0000
1137 1137 summary: a
1138 1138
1139 1139 $ hg log -u "user1" -u "user2"
1140 1140 changeset: 1:e834b5e69c0e
1141 1141 tag: tip
1142 1142 user: User Two <user2@example.org>
1143 1143 date: Thu Jan 01 00:00:00 1970 +0000
1144 1144 summary: b
1145 1145
1146 1146 changeset: 0:29a4c94f1924
1147 1147 user: User One <user1@example.org>
1148 1148 date: Thu Jan 01 00:00:00 1970 +0000
1149 1149 summary: a
1150 1150
1151 1151 $ hg log -u "user3"
1152 1152
1153 1153 $ cd ..
1154 1154
1155 1155 $ hg init branches
1156 1156 $ cd branches
1157 1157
1158 1158 $ echo a > a
1159 1159 $ hg ci -A -m "commit on default"
1160 1160 adding a
1161 1161 $ hg branch test
1162 1162 marked working directory as branch test
1163 1163 (branches are permanent and global, did you want a bookmark?)
1164 1164 $ echo b > b
1165 1165 $ hg ci -A -m "commit on test"
1166 1166 adding b
1167 1167
1168 1168 $ hg up default
1169 1169 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1170 1170 $ echo c > c
1171 1171 $ hg ci -A -m "commit on default"
1172 1172 adding c
1173 1173 $ hg up test
1174 1174 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1175 1175 $ echo c > c
1176 1176 $ hg ci -A -m "commit on test"
1177 1177 adding c
1178 1178
1179 1179
1180 1180 log -b default
1181 1181
1182 1182 $ hg log -b default
1183 1183 changeset: 2:c3a4f03cc9a7
1184 1184 parent: 0:24427303d56f
1185 1185 user: test
1186 1186 date: Thu Jan 01 00:00:00 1970 +0000
1187 1187 summary: commit on default
1188 1188
1189 1189 changeset: 0:24427303d56f
1190 1190 user: test
1191 1191 date: Thu Jan 01 00:00:00 1970 +0000
1192 1192 summary: commit on default
1193 1193
1194 1194
1195 1195
1196 1196 log -b test
1197 1197
1198 1198 $ hg log -b test
1199 1199 changeset: 3:f5d8de11c2e2
1200 1200 branch: test
1201 1201 tag: tip
1202 1202 parent: 1:d32277701ccb
1203 1203 user: test
1204 1204 date: Thu Jan 01 00:00:00 1970 +0000
1205 1205 summary: commit on test
1206 1206
1207 1207 changeset: 1:d32277701ccb
1208 1208 branch: test
1209 1209 user: test
1210 1210 date: Thu Jan 01 00:00:00 1970 +0000
1211 1211 summary: commit on test
1212 1212
1213 1213
1214 1214
1215 1215 log -b dummy
1216 1216
1217 1217 $ hg log -b dummy
1218 1218 abort: unknown revision 'dummy'!
1219 1219 [255]
1220 1220
1221 1221
1222 1222 log -b .
1223 1223
1224 1224 $ hg log -b .
1225 1225 changeset: 3:f5d8de11c2e2
1226 1226 branch: test
1227 1227 tag: tip
1228 1228 parent: 1:d32277701ccb
1229 1229 user: test
1230 1230 date: Thu Jan 01 00:00:00 1970 +0000
1231 1231 summary: commit on test
1232 1232
1233 1233 changeset: 1:d32277701ccb
1234 1234 branch: test
1235 1235 user: test
1236 1236 date: Thu Jan 01 00:00:00 1970 +0000
1237 1237 summary: commit on test
1238 1238
1239 1239
1240 1240
1241 1241 log -b default -b test
1242 1242
1243 1243 $ hg log -b default -b test
1244 1244 changeset: 3:f5d8de11c2e2
1245 1245 branch: test
1246 1246 tag: tip
1247 1247 parent: 1:d32277701ccb
1248 1248 user: test
1249 1249 date: Thu Jan 01 00:00:00 1970 +0000
1250 1250 summary: commit on test
1251 1251
1252 1252 changeset: 2:c3a4f03cc9a7
1253 1253 parent: 0:24427303d56f
1254 1254 user: test
1255 1255 date: Thu Jan 01 00:00:00 1970 +0000
1256 1256 summary: commit on default
1257 1257
1258 1258 changeset: 1:d32277701ccb
1259 1259 branch: test
1260 1260 user: test
1261 1261 date: Thu Jan 01 00:00:00 1970 +0000
1262 1262 summary: commit on test
1263 1263
1264 1264 changeset: 0:24427303d56f
1265 1265 user: test
1266 1266 date: Thu Jan 01 00:00:00 1970 +0000
1267 1267 summary: commit on default
1268 1268
1269 1269
1270 1270
1271 1271 log -b default -b .
1272 1272
1273 1273 $ hg log -b default -b .
1274 1274 changeset: 3:f5d8de11c2e2
1275 1275 branch: test
1276 1276 tag: tip
1277 1277 parent: 1:d32277701ccb
1278 1278 user: test
1279 1279 date: Thu Jan 01 00:00:00 1970 +0000
1280 1280 summary: commit on test
1281 1281
1282 1282 changeset: 2:c3a4f03cc9a7
1283 1283 parent: 0:24427303d56f
1284 1284 user: test
1285 1285 date: Thu Jan 01 00:00:00 1970 +0000
1286 1286 summary: commit on default
1287 1287
1288 1288 changeset: 1:d32277701ccb
1289 1289 branch: test
1290 1290 user: test
1291 1291 date: Thu Jan 01 00:00:00 1970 +0000
1292 1292 summary: commit on test
1293 1293
1294 1294 changeset: 0:24427303d56f
1295 1295 user: test
1296 1296 date: Thu Jan 01 00:00:00 1970 +0000
1297 1297 summary: commit on default
1298 1298
1299 1299
1300 1300
1301 1301 log -b . -b test
1302 1302
1303 1303 $ hg log -b . -b test
1304 1304 changeset: 3:f5d8de11c2e2
1305 1305 branch: test
1306 1306 tag: tip
1307 1307 parent: 1:d32277701ccb
1308 1308 user: test
1309 1309 date: Thu Jan 01 00:00:00 1970 +0000
1310 1310 summary: commit on test
1311 1311
1312 1312 changeset: 1:d32277701ccb
1313 1313 branch: test
1314 1314 user: test
1315 1315 date: Thu Jan 01 00:00:00 1970 +0000
1316 1316 summary: commit on test
1317 1317
1318 1318
1319 1319
1320 1320 log -b 2
1321 1321
1322 1322 $ hg log -b 2
1323 1323 changeset: 2:c3a4f03cc9a7
1324 1324 parent: 0:24427303d56f
1325 1325 user: test
1326 1326 date: Thu Jan 01 00:00:00 1970 +0000
1327 1327 summary: commit on default
1328 1328
1329 1329 changeset: 0:24427303d56f
1330 1330 user: test
1331 1331 date: Thu Jan 01 00:00:00 1970 +0000
1332 1332 summary: commit on default
1333 1333
1334 1334 #if gettext
1335 1335
1336 1336 Test that all log names are translated (e.g. branches, bookmarks, tags):
1337 1337
1338 1338 $ hg bookmark babar -r tip
1339 1339
1340 1340 $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip
1341 1341 \xc3\x84nderung: 3:f5d8de11c2e2 (esc)
1342 1342 Zweig: test
1343 1343 Lesezeichen: babar
1344 1344 Marke: tip
1345 1345 Vorg\xc3\xa4nger: 1:d32277701ccb (esc)
1346 1346 Nutzer: test
1347 1347 Datum: Thu Jan 01 00:00:00 1970 +0000
1348 1348 Zusammenfassung: commit on test
1349 1349
1350 1350 $ hg bookmark -d babar
1351 1351
1352 1352 #endif
1353 1353
1354 1354 log -p --cwd dir (in subdir)
1355 1355
1356 1356 $ mkdir dir
1357 1357 $ hg log -p --cwd dir
1358 1358 changeset: 3:f5d8de11c2e2
1359 1359 branch: test
1360 1360 tag: tip
1361 1361 parent: 1:d32277701ccb
1362 1362 user: test
1363 1363 date: Thu Jan 01 00:00:00 1970 +0000
1364 1364 summary: commit on test
1365 1365
1366 1366 diff -r d32277701ccb -r f5d8de11c2e2 c
1367 1367 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1368 1368 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1369 1369 @@ -0,0 +1,1 @@
1370 1370 +c
1371 1371
1372 1372 changeset: 2:c3a4f03cc9a7
1373 1373 parent: 0:24427303d56f
1374 1374 user: test
1375 1375 date: Thu Jan 01 00:00:00 1970 +0000
1376 1376 summary: commit on default
1377 1377
1378 1378 diff -r 24427303d56f -r c3a4f03cc9a7 c
1379 1379 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1380 1380 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1381 1381 @@ -0,0 +1,1 @@
1382 1382 +c
1383 1383
1384 1384 changeset: 1:d32277701ccb
1385 1385 branch: test
1386 1386 user: test
1387 1387 date: Thu Jan 01 00:00:00 1970 +0000
1388 1388 summary: commit on test
1389 1389
1390 1390 diff -r 24427303d56f -r d32277701ccb b
1391 1391 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1392 1392 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1393 1393 @@ -0,0 +1,1 @@
1394 1394 +b
1395 1395
1396 1396 changeset: 0:24427303d56f
1397 1397 user: test
1398 1398 date: Thu Jan 01 00:00:00 1970 +0000
1399 1399 summary: commit on default
1400 1400
1401 1401 diff -r 000000000000 -r 24427303d56f a
1402 1402 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1403 1403 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1404 1404 @@ -0,0 +1,1 @@
1405 1405 +a
1406 1406
1407 1407
1408 1408
1409 1409 log -p -R repo
1410 1410
1411 1411 $ cd dir
1412 1412 $ hg log -p -R .. ../a
1413 1413 changeset: 0:24427303d56f
1414 1414 user: test
1415 1415 date: Thu Jan 01 00:00:00 1970 +0000
1416 1416 summary: commit on default
1417 1417
1418 1418 diff -r 000000000000 -r 24427303d56f a
1419 1419 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1420 1420 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1421 1421 @@ -0,0 +1,1 @@
1422 1422 +a
1423 1423
1424 1424
1425 1425 $ cd ../..
1426 1426
1427 1427 $ hg init follow2
1428 1428 $ cd follow2
1429 1429
1430 1430 # Build the following history:
1431 1431 # tip - o - x - o - x - x
1432 1432 # \ /
1433 1433 # o - o - o - x
1434 1434 # \ /
1435 1435 # o
1436 1436 #
1437 1437 # Where "o" is a revision containing "foo" and
1438 1438 # "x" is a revision without "foo"
1439 1439
1440 1440 $ touch init
1441 1441 $ hg ci -A -m "init, unrelated"
1442 1442 adding init
1443 1443 $ echo 'foo' > init
1444 1444 $ hg ci -m "change, unrelated"
1445 1445 $ echo 'foo' > foo
1446 1446 $ hg ci -A -m "add unrelated old foo"
1447 1447 adding foo
1448 1448 $ hg rm foo
1449 1449 $ hg ci -m "delete foo, unrelated"
1450 1450 $ echo 'related' > foo
1451 1451 $ hg ci -A -m "add foo, related"
1452 1452 adding foo
1453 1453
1454 1454 $ hg up 0
1455 1455 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1456 1456 $ touch branch
1457 1457 $ hg ci -A -m "first branch, unrelated"
1458 1458 adding branch
1459 1459 created new head
1460 1460 $ touch foo
1461 1461 $ hg ci -A -m "create foo, related"
1462 1462 adding foo
1463 1463 $ echo 'change' > foo
1464 1464 $ hg ci -m "change foo, related"
1465 1465
1466 1466 $ hg up 6
1467 1467 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1468 1468 $ echo 'change foo in branch' > foo
1469 1469 $ hg ci -m "change foo in branch, related"
1470 1470 created new head
1471 1471 $ hg merge 7
1472 1472 merging foo
1473 1473 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1474 1474 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1475 1475 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1476 1476 [1]
1477 1477 $ echo 'merge 1' > foo
1478 1478 $ hg resolve -m foo
1479 1479 (no more unresolved files)
1480 1480 $ hg ci -m "First merge, related"
1481 1481
1482 1482 $ hg merge 4
1483 1483 merging foo
1484 1484 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1485 1485 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1486 1486 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1487 1487 [1]
1488 1488 $ echo 'merge 2' > foo
1489 1489 $ hg resolve -m foo
1490 1490 (no more unresolved files)
1491 1491 $ hg ci -m "Last merge, related"
1492 1492
1493 1493 $ hg log --graph
1494 1494 @ changeset: 10:4dae8563d2c5
1495 1495 |\ tag: tip
1496 1496 | | parent: 9:7b35701b003e
1497 1497 | | parent: 4:88176d361b69
1498 1498 | | user: test
1499 1499 | | date: Thu Jan 01 00:00:00 1970 +0000
1500 1500 | | summary: Last merge, related
1501 1501 | |
1502 1502 | o changeset: 9:7b35701b003e
1503 1503 | |\ parent: 8:e5416ad8a855
1504 1504 | | | parent: 7:87fe3144dcfa
1505 1505 | | | user: test
1506 1506 | | | date: Thu Jan 01 00:00:00 1970 +0000
1507 1507 | | | summary: First merge, related
1508 1508 | | |
1509 1509 | | o changeset: 8:e5416ad8a855
1510 1510 | | | parent: 6:dc6c325fe5ee
1511 1511 | | | user: test
1512 1512 | | | date: Thu Jan 01 00:00:00 1970 +0000
1513 1513 | | | summary: change foo in branch, related
1514 1514 | | |
1515 1515 | o | changeset: 7:87fe3144dcfa
1516 1516 | |/ user: test
1517 1517 | | date: Thu Jan 01 00:00:00 1970 +0000
1518 1518 | | summary: change foo, related
1519 1519 | |
1520 1520 | o changeset: 6:dc6c325fe5ee
1521 1521 | | user: test
1522 1522 | | date: Thu Jan 01 00:00:00 1970 +0000
1523 1523 | | summary: create foo, related
1524 1524 | |
1525 1525 | o changeset: 5:73db34516eb9
1526 1526 | | parent: 0:e87515fd044a
1527 1527 | | user: test
1528 1528 | | date: Thu Jan 01 00:00:00 1970 +0000
1529 1529 | | summary: first branch, unrelated
1530 1530 | |
1531 1531 o | changeset: 4:88176d361b69
1532 1532 | | user: test
1533 1533 | | date: Thu Jan 01 00:00:00 1970 +0000
1534 1534 | | summary: add foo, related
1535 1535 | |
1536 1536 o | changeset: 3:dd78ae4afb56
1537 1537 | | user: test
1538 1538 | | date: Thu Jan 01 00:00:00 1970 +0000
1539 1539 | | summary: delete foo, unrelated
1540 1540 | |
1541 1541 o | changeset: 2:c4c64aedf0f7
1542 1542 | | user: test
1543 1543 | | date: Thu Jan 01 00:00:00 1970 +0000
1544 1544 | | summary: add unrelated old foo
1545 1545 | |
1546 1546 o | changeset: 1:e5faa7440653
1547 1547 |/ user: test
1548 1548 | date: Thu Jan 01 00:00:00 1970 +0000
1549 1549 | summary: change, unrelated
1550 1550 |
1551 1551 o changeset: 0:e87515fd044a
1552 1552 user: test
1553 1553 date: Thu Jan 01 00:00:00 1970 +0000
1554 1554 summary: init, unrelated
1555 1555
1556 1556
1557 1557 $ hg --traceback log -f foo
1558 1558 changeset: 10:4dae8563d2c5
1559 1559 tag: tip
1560 1560 parent: 9:7b35701b003e
1561 1561 parent: 4:88176d361b69
1562 1562 user: test
1563 1563 date: Thu Jan 01 00:00:00 1970 +0000
1564 1564 summary: Last merge, related
1565 1565
1566 1566 changeset: 9:7b35701b003e
1567 1567 parent: 8:e5416ad8a855
1568 1568 parent: 7:87fe3144dcfa
1569 1569 user: test
1570 1570 date: Thu Jan 01 00:00:00 1970 +0000
1571 1571 summary: First merge, related
1572 1572
1573 1573 changeset: 8:e5416ad8a855
1574 1574 parent: 6:dc6c325fe5ee
1575 1575 user: test
1576 1576 date: Thu Jan 01 00:00:00 1970 +0000
1577 1577 summary: change foo in branch, related
1578 1578
1579 1579 changeset: 7:87fe3144dcfa
1580 1580 user: test
1581 1581 date: Thu Jan 01 00:00:00 1970 +0000
1582 1582 summary: change foo, related
1583 1583
1584 1584 changeset: 6:dc6c325fe5ee
1585 1585 user: test
1586 1586 date: Thu Jan 01 00:00:00 1970 +0000
1587 1587 summary: create foo, related
1588 1588
1589 1589 changeset: 4:88176d361b69
1590 1590 user: test
1591 1591 date: Thu Jan 01 00:00:00 1970 +0000
1592 1592 summary: add foo, related
1593 1593
1594 1594
1595 1595 Also check when maxrev < lastrevfilelog
1596 1596
1597 1597 $ hg --traceback log -f -r4 foo
1598 1598 changeset: 4:88176d361b69
1599 1599 user: test
1600 1600 date: Thu Jan 01 00:00:00 1970 +0000
1601 1601 summary: add foo, related
1602 1602
1603 1603 changeset: 2:c4c64aedf0f7
1604 1604 user: test
1605 1605 date: Thu Jan 01 00:00:00 1970 +0000
1606 1606 summary: add unrelated old foo
1607 1607
1608 1608 $ cd ..
1609 1609
1610 1610 Issue2383: hg log showing _less_ differences than hg diff
1611 1611
1612 1612 $ hg init issue2383
1613 1613 $ cd issue2383
1614 1614
1615 1615 Create a test repo:
1616 1616
1617 1617 $ echo a > a
1618 1618 $ hg ci -Am0
1619 1619 adding a
1620 1620 $ echo b > b
1621 1621 $ hg ci -Am1
1622 1622 adding b
1623 1623 $ hg co 0
1624 1624 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1625 1625 $ echo b > a
1626 1626 $ hg ci -m2
1627 1627 created new head
1628 1628
1629 1629 Merge:
1630 1630
1631 1631 $ hg merge
1632 1632 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1633 1633 (branch merge, don't forget to commit)
1634 1634
1635 1635 Make sure there's a file listed in the merge to trigger the bug:
1636 1636
1637 1637 $ echo c > a
1638 1638 $ hg ci -m3
1639 1639
1640 1640 Two files shown here in diff:
1641 1641
1642 1642 $ hg diff --rev 2:3
1643 1643 diff -r b09be438c43a -r 8e07aafe1edc a
1644 1644 --- a/a Thu Jan 01 00:00:00 1970 +0000
1645 1645 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1646 1646 @@ -1,1 +1,1 @@
1647 1647 -b
1648 1648 +c
1649 1649 diff -r b09be438c43a -r 8e07aafe1edc b
1650 1650 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1651 1651 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1652 1652 @@ -0,0 +1,1 @@
1653 1653 +b
1654 1654
1655 1655 Diff here should be the same:
1656 1656
1657 1657 $ hg log -vpr 3
1658 1658 changeset: 3:8e07aafe1edc
1659 1659 tag: tip
1660 1660 parent: 2:b09be438c43a
1661 1661 parent: 1:925d80f479bb
1662 1662 user: test
1663 1663 date: Thu Jan 01 00:00:00 1970 +0000
1664 1664 files: a
1665 1665 description:
1666 1666 3
1667 1667
1668 1668
1669 1669 diff -r b09be438c43a -r 8e07aafe1edc a
1670 1670 --- a/a Thu Jan 01 00:00:00 1970 +0000
1671 1671 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1672 1672 @@ -1,1 +1,1 @@
1673 1673 -b
1674 1674 +c
1675 1675 diff -r b09be438c43a -r 8e07aafe1edc b
1676 1676 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1677 1677 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1678 1678 @@ -0,0 +1,1 @@
1679 1679 +b
1680 1680
1681 1681 $ cd ..
1682 1682
1683 1683 'hg log -r rev fn' when last(filelog(fn)) != rev
1684 1684
1685 1685 $ hg init simplelog
1686 1686 $ cd simplelog
1687 1687 $ echo f > a
1688 1688 $ hg ci -Am'a' -d '0 0'
1689 1689 adding a
1690 1690 $ echo f >> a
1691 1691 $ hg ci -Am'a bis' -d '1 0'
1692 1692
1693 1693 $ hg log -r0 a
1694 1694 changeset: 0:9f758d63dcde
1695 1695 user: test
1696 1696 date: Thu Jan 01 00:00:00 1970 +0000
1697 1697 summary: a
1698 1698
1699 1699 enable obsolete to test hidden feature
1700 1700
1701 1701 $ cat >> $HGRCPATH << EOF
1702 1702 > [experimental]
1703 1703 > evolution=createmarkers
1704 1704 > EOF
1705 1705
1706 1706 $ hg log --template='{rev}:{node}\n'
1707 1707 1:a765632148dc55d38c35c4f247c618701886cb2f
1708 1708 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1709 1709 $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
1710 1710 obsoleted 1 changesets
1711 1711 $ hg up null -q
1712 1712 $ hg log --template='{rev}:{node}\n'
1713 1713 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1714 1714 $ hg log --template='{rev}:{node}\n' --hidden
1715 1715 1:a765632148dc55d38c35c4f247c618701886cb2f
1716 1716 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1717 1717 $ hg log -r a
1718 1718 abort: hidden revision 'a'!
1719 1719 (use --hidden to access hidden revisions)
1720 1720 [255]
1721 1721
1722 1722 test that parent prevent a changeset to be hidden
1723 1723
1724 1724 $ hg up 1 -q --hidden
1725 1725 $ hg log --template='{rev}:{node}\n'
1726 1726 1:a765632148dc55d38c35c4f247c618701886cb2f
1727 1727 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1728 1728
1729 1729 test that second parent prevent a changeset to be hidden too
1730 1730
1731 1731 $ hg debugsetparents 0 1 # nothing suitable to merge here
1732 1732 $ hg log --template='{rev}:{node}\n'
1733 1733 1:a765632148dc55d38c35c4f247c618701886cb2f
1734 1734 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1735 1735 $ hg debugsetparents 1
1736 1736 $ hg up -q null
1737 1737
1738 1738 bookmarks prevent a changeset being hidden
1739 1739
1740 1740 $ hg bookmark --hidden -r 1 X
1741 1741 $ hg log --template '{rev}:{node}\n'
1742 1742 1:a765632148dc55d38c35c4f247c618701886cb2f
1743 1743 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1744 1744 $ hg bookmark -d X
1745 1745
1746 1746 divergent bookmarks are not hidden
1747 1747
1748 1748 $ hg bookmark --hidden -r 1 X@foo
1749 1749 $ hg log --template '{rev}:{node}\n'
1750 1750 1:a765632148dc55d38c35c4f247c618701886cb2f
1751 1751 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1752 1752
1753 1753 test hidden revision 0 (issue5385)
1754 1754
1755 1755 $ hg bookmark -d X@foo
1756 1756 $ hg up null -q
1757 1757 $ hg debugobsolete 9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1758 1758 obsoleted 1 changesets
1759 1759 $ echo f > b
1760 1760 $ hg ci -Am'b' -d '2 0'
1761 1761 adding b
1762 1762 $ echo f >> b
1763 1763 $ hg ci -m'b bis' -d '3 0'
1764 1764 $ hg log -T'{rev}:{node}\n'
1765 1765 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1766 1766 2:94375ec45bddd2a824535fc04855bd058c926ec0
1767 1767
1768 1768 $ hg log -T'{rev}:{node}\n' -r:
1769 1769 2:94375ec45bddd2a824535fc04855bd058c926ec0
1770 1770 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1771 1771 $ hg log -T'{rev}:{node}\n' -r:tip
1772 1772 2:94375ec45bddd2a824535fc04855bd058c926ec0
1773 1773 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1774 1774 $ hg log -T'{rev}:{node}\n' -r:0
1775 1775 abort: hidden revision '0'!
1776 1776 (use --hidden to access hidden revisions)
1777 1777 [255]
1778 1778 $ hg log -T'{rev}:{node}\n' -f
1779 1779 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1780 1780 2:94375ec45bddd2a824535fc04855bd058c926ec0
1781 1781
1782 1782 clear extensions configuration
1783 1783 $ echo '[extensions]' >> $HGRCPATH
1784 1784 $ echo "obs=!" >> $HGRCPATH
1785 1785 $ cd ..
1786 1786
1787 1787 test -u/-k for problematic encoding
1788 1788 # unicode: cp932:
1789 1789 # u30A2 0x83 0x41(= 'A')
1790 1790 # u30C2 0x83 0x61(= 'a')
1791 1791
1792 1792 $ hg init problematicencoding
1793 1793 $ cd problematicencoding
1794 1794
1795 1795 $ $PYTHON > setup.sh <<EOF
1796 > print u'''
1796 > print(u'''
1797 1797 > echo a > text
1798 1798 > hg add text
1799 1799 > hg --encoding utf-8 commit -u '\u30A2' -m none
1800 1800 > echo b > text
1801 1801 > hg --encoding utf-8 commit -u '\u30C2' -m none
1802 1802 > echo c > text
1803 1803 > hg --encoding utf-8 commit -u none -m '\u30A2'
1804 1804 > echo d > text
1805 1805 > hg --encoding utf-8 commit -u none -m '\u30C2'
1806 > '''.encode('utf-8')
1806 > '''.encode('utf-8'))
1807 1807 > EOF
1808 1808 $ sh < setup.sh
1809 1809
1810 1810 test in problematic encoding
1811 1811 $ $PYTHON > test.sh <<EOF
1812 > print u'''
1812 > print(u'''
1813 1813 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
1814 1814 > echo ====
1815 1815 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
1816 1816 > echo ====
1817 1817 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
1818 1818 > echo ====
1819 1819 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
1820 > '''.encode('cp932')
1820 > '''.encode('cp932'))
1821 1821 > EOF
1822 1822 $ sh < test.sh
1823 1823 0
1824 1824 ====
1825 1825 1
1826 1826 ====
1827 1827 2
1828 1828 0
1829 1829 ====
1830 1830 3
1831 1831 1
1832 1832
1833 1833 $ cd ..
1834 1834
1835 1835 test hg log on non-existent files and on directories
1836 1836 $ hg init issue1340
1837 1837 $ cd issue1340
1838 1838 $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6
1839 1839 $ echo 1 > d1/f1
1840 1840 $ echo 1 > D2/f1
1841 1841 $ echo 1 > D3.i/f1
1842 1842 $ echo 1 > d4.hg/f1
1843 1843 $ echo 1 > d5.d/f1
1844 1844 $ echo 1 > .d6/f1
1845 1845 $ hg -q add .
1846 1846 $ hg commit -m "a bunch of weird directories"
1847 1847 $ hg log -l1 d1/f1 | grep changeset
1848 1848 changeset: 0:65624cd9070a
1849 1849 $ hg log -l1 f1
1850 1850 $ hg log -l1 . | grep changeset
1851 1851 changeset: 0:65624cd9070a
1852 1852 $ hg log -l1 ./ | grep changeset
1853 1853 changeset: 0:65624cd9070a
1854 1854 $ hg log -l1 d1 | grep changeset
1855 1855 changeset: 0:65624cd9070a
1856 1856 $ hg log -l1 D2 | grep changeset
1857 1857 changeset: 0:65624cd9070a
1858 1858 $ hg log -l1 D2/f1 | grep changeset
1859 1859 changeset: 0:65624cd9070a
1860 1860 $ hg log -l1 D3.i | grep changeset
1861 1861 changeset: 0:65624cd9070a
1862 1862 $ hg log -l1 D3.i/f1 | grep changeset
1863 1863 changeset: 0:65624cd9070a
1864 1864 $ hg log -l1 d4.hg | grep changeset
1865 1865 changeset: 0:65624cd9070a
1866 1866 $ hg log -l1 d4.hg/f1 | grep changeset
1867 1867 changeset: 0:65624cd9070a
1868 1868 $ hg log -l1 d5.d | grep changeset
1869 1869 changeset: 0:65624cd9070a
1870 1870 $ hg log -l1 d5.d/f1 | grep changeset
1871 1871 changeset: 0:65624cd9070a
1872 1872 $ hg log -l1 .d6 | grep changeset
1873 1873 changeset: 0:65624cd9070a
1874 1874 $ hg log -l1 .d6/f1 | grep changeset
1875 1875 changeset: 0:65624cd9070a
1876 1876
1877 1877 issue3772: hg log -r :null showing revision 0 as well
1878 1878
1879 1879 $ hg log -r :null
1880 1880 changeset: 0:65624cd9070a
1881 1881 tag: tip
1882 1882 user: test
1883 1883 date: Thu Jan 01 00:00:00 1970 +0000
1884 1884 summary: a bunch of weird directories
1885 1885
1886 1886 changeset: -1:000000000000
1887 1887 user:
1888 1888 date: Thu Jan 01 00:00:00 1970 +0000
1889 1889
1890 1890 $ hg log -r null:null
1891 1891 changeset: -1:000000000000
1892 1892 user:
1893 1893 date: Thu Jan 01 00:00:00 1970 +0000
1894 1894
1895 1895 working-directory revision requires special treatment
1896 1896
1897 1897 clean:
1898 1898
1899 1899 $ hg log -r 'wdir()' --debug
1900 1900 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
1901 1901 phase: draft
1902 1902 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
1903 1903 parent: -1:0000000000000000000000000000000000000000
1904 1904 user: test
1905 1905 date: [A-Za-z0-9:+ ]+ (re)
1906 1906 extra: branch=default
1907 1907
1908 1908 $ hg log -r 'wdir()' -p --stat
1909 1909 changeset: 2147483647:ffffffffffff
1910 1910 parent: 0:65624cd9070a
1911 1911 user: test
1912 1912 date: [A-Za-z0-9:+ ]+ (re)
1913 1913
1914 1914
1915 1915
1916 1916
1917 1917 dirty:
1918 1918
1919 1919 $ echo 2 >> d1/f1
1920 1920 $ echo 2 > d1/f2
1921 1921 $ hg add d1/f2
1922 1922 $ hg remove .d6/f1
1923 1923 $ hg status
1924 1924 M d1/f1
1925 1925 A d1/f2
1926 1926 R .d6/f1
1927 1927
1928 1928 $ hg log -r 'wdir()'
1929 1929 changeset: 2147483647:ffffffffffff
1930 1930 parent: 0:65624cd9070a
1931 1931 user: test
1932 1932 date: [A-Za-z0-9:+ ]+ (re)
1933 1933
1934 1934 $ hg log -r 'wdir()' -q
1935 1935 2147483647:ffffffffffff
1936 1936
1937 1937 $ hg log -r 'wdir()' --debug
1938 1938 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
1939 1939 phase: draft
1940 1940 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
1941 1941 parent: -1:0000000000000000000000000000000000000000
1942 1942 user: test
1943 1943 date: [A-Za-z0-9:+ ]+ (re)
1944 1944 files: d1/f1
1945 1945 files+: d1/f2
1946 1946 files-: .d6/f1
1947 1947 extra: branch=default
1948 1948
1949 1949 $ hg log -r 'wdir()' -p --stat --git
1950 1950 changeset: 2147483647:ffffffffffff
1951 1951 parent: 0:65624cd9070a
1952 1952 user: test
1953 1953 date: [A-Za-z0-9:+ ]+ (re)
1954 1954
1955 1955 .d6/f1 | 1 -
1956 1956 d1/f1 | 1 +
1957 1957 d1/f2 | 1 +
1958 1958 3 files changed, 2 insertions(+), 1 deletions(-)
1959 1959
1960 1960 diff --git a/.d6/f1 b/.d6/f1
1961 1961 deleted file mode 100644
1962 1962 --- a/.d6/f1
1963 1963 +++ /dev/null
1964 1964 @@ -1,1 +0,0 @@
1965 1965 -1
1966 1966 diff --git a/d1/f1 b/d1/f1
1967 1967 --- a/d1/f1
1968 1968 +++ b/d1/f1
1969 1969 @@ -1,1 +1,2 @@
1970 1970 1
1971 1971 +2
1972 1972 diff --git a/d1/f2 b/d1/f2
1973 1973 new file mode 100644
1974 1974 --- /dev/null
1975 1975 +++ b/d1/f2
1976 1976 @@ -0,0 +1,1 @@
1977 1977 +2
1978 1978
1979 1979 $ hg log -r 'wdir()' -Tjson
1980 1980 [
1981 1981 {
1982 1982 "rev": null,
1983 1983 "node": null,
1984 1984 "branch": "default",
1985 1985 "phase": "draft",
1986 1986 "user": "test",
1987 1987 "date": [*, 0], (glob)
1988 1988 "desc": "",
1989 1989 "bookmarks": [],
1990 1990 "tags": [],
1991 1991 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"]
1992 1992 }
1993 1993 ]
1994 1994
1995 1995 $ hg log -r 'wdir()' -Tjson -q
1996 1996 [
1997 1997 {
1998 1998 "rev": null,
1999 1999 "node": null
2000 2000 }
2001 2001 ]
2002 2002
2003 2003 $ hg log -r 'wdir()' -Tjson --debug
2004 2004 [
2005 2005 {
2006 2006 "rev": null,
2007 2007 "node": null,
2008 2008 "branch": "default",
2009 2009 "phase": "draft",
2010 2010 "user": "test",
2011 2011 "date": [*, 0], (glob)
2012 2012 "desc": "",
2013 2013 "bookmarks": [],
2014 2014 "tags": [],
2015 2015 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2016 2016 "manifest": null,
2017 2017 "extra": {"branch": "default"},
2018 2018 "modified": ["d1/f1"],
2019 2019 "added": ["d1/f2"],
2020 2020 "removed": [".d6/f1"]
2021 2021 }
2022 2022 ]
2023 2023
2024 2024 $ hg revert -aqC
2025 2025
2026 2026 Check that adding an arbitrary name shows up in log automatically
2027 2027
2028 2028 $ cat > ../names.py <<EOF
2029 2029 > """A small extension to test adding arbitrary names to a repo"""
2030 2030 > from mercurial.namespaces import namespace
2031 2031 >
2032 2032 > def reposetup(ui, repo):
2033 2033 > foo = {'foo': repo[0].node()}
2034 2034 > names = lambda r: foo.keys()
2035 2035 > namemap = lambda r, name: foo.get(name)
2036 2036 > nodemap = lambda r, node: [name for name, n in foo.iteritems()
2037 2037 > if n == node]
2038 2038 > ns = namespace("bars", templatename="bar", logname="barlog",
2039 2039 > colorname="barcolor", listnames=names, namemap=namemap,
2040 2040 > nodemap=nodemap)
2041 2041 >
2042 2042 > repo.names.addnamespace(ns)
2043 2043 > EOF
2044 2044
2045 2045 $ hg --config extensions.names=../names.py log -r 0
2046 2046 changeset: 0:65624cd9070a
2047 2047 tag: tip
2048 2048 barlog: foo
2049 2049 user: test
2050 2050 date: Thu Jan 01 00:00:00 1970 +0000
2051 2051 summary: a bunch of weird directories
2052 2052
2053 2053 $ hg --config extensions.names=../names.py \
2054 2054 > --config extensions.color= --config color.log.barcolor=red \
2055 2055 > --color=always log -r 0
2056 2056 \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
2057 2057 tag: tip
2058 2058 \x1b[0;31mbarlog: foo\x1b[0m (esc)
2059 2059 user: test
2060 2060 date: Thu Jan 01 00:00:00 1970 +0000
2061 2061 summary: a bunch of weird directories
2062 2062
2063 2063 $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
2064 2064 foo
2065 2065
2066 2066 $ cd ..
2067 2067
2068 2068 hg log -f dir across branches
2069 2069
2070 2070 $ hg init acrossbranches
2071 2071 $ cd acrossbranches
2072 2072 $ mkdir d
2073 2073 $ echo a > d/a && hg ci -Aqm a
2074 2074 $ echo b > d/a && hg ci -Aqm b
2075 2075 $ hg up -q 0
2076 2076 $ echo b > d/a && hg ci -Aqm c
2077 2077 $ hg log -f d -T '{desc}' -G
2078 2078 @ c
2079 2079 |
2080 2080 o a
2081 2081
2082 2082 Ensure that largefiles doesn't interfere with following a normal file
2083 2083 $ hg --config extensions.largefiles= log -f d -T '{desc}' -G
2084 2084 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
2085 2085 @ c
2086 2086 |
2087 2087 o a
2088 2088
2089 2089 $ hg log -f d/a -T '{desc}' -G
2090 2090 @ c
2091 2091 |
2092 2092 o a
2093 2093
2094 2094 $ cd ..
2095 2095
2096 2096 hg log -f with linkrev pointing to another branch
2097 2097 -------------------------------------------------
2098 2098
2099 2099 create history with a filerev whose linkrev points to another branch
2100 2100
2101 2101 $ hg init branchedlinkrev
2102 2102 $ cd branchedlinkrev
2103 2103 $ echo 1 > a
2104 2104 $ hg commit -Am 'content1'
2105 2105 adding a
2106 2106 $ echo 2 > a
2107 2107 $ hg commit -m 'content2'
2108 2108 $ hg up --rev 'desc(content1)'
2109 2109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2110 2110 $ echo unrelated > unrelated
2111 2111 $ hg commit -Am 'unrelated'
2112 2112 adding unrelated
2113 2113 created new head
2114 2114 $ hg graft -r 'desc(content2)'
2115 2115 grafting 1:2294ae80ad84 "content2"
2116 2116 $ echo 3 > a
2117 2117 $ hg commit -m 'content3'
2118 2118 $ hg log -G
2119 2119 @ changeset: 4:50b9b36e9c5d
2120 2120 | tag: tip
2121 2121 | user: test
2122 2122 | date: Thu Jan 01 00:00:00 1970 +0000
2123 2123 | summary: content3
2124 2124 |
2125 2125 o changeset: 3:15b2327059e5
2126 2126 | user: test
2127 2127 | date: Thu Jan 01 00:00:00 1970 +0000
2128 2128 | summary: content2
2129 2129 |
2130 2130 o changeset: 2:2029acd1168c
2131 2131 | parent: 0:ae0a3c9f9e95
2132 2132 | user: test
2133 2133 | date: Thu Jan 01 00:00:00 1970 +0000
2134 2134 | summary: unrelated
2135 2135 |
2136 2136 | o changeset: 1:2294ae80ad84
2137 2137 |/ user: test
2138 2138 | date: Thu Jan 01 00:00:00 1970 +0000
2139 2139 | summary: content2
2140 2140 |
2141 2141 o changeset: 0:ae0a3c9f9e95
2142 2142 user: test
2143 2143 date: Thu Jan 01 00:00:00 1970 +0000
2144 2144 summary: content1
2145 2145
2146 2146
2147 2147 log -f on the file should list the graft result.
2148 2148
2149 2149 $ hg log -Gf a
2150 2150 @ changeset: 4:50b9b36e9c5d
2151 2151 | tag: tip
2152 2152 | user: test
2153 2153 | date: Thu Jan 01 00:00:00 1970 +0000
2154 2154 | summary: content3
2155 2155 |
2156 2156 o changeset: 3:15b2327059e5
2157 2157 : user: test
2158 2158 : date: Thu Jan 01 00:00:00 1970 +0000
2159 2159 : summary: content2
2160 2160 :
2161 2161 o changeset: 0:ae0a3c9f9e95
2162 2162 user: test
2163 2163 date: Thu Jan 01 00:00:00 1970 +0000
2164 2164 summary: content1
2165 2165
2166 2166
2167 2167 plain log lists the original version
2168 2168 (XXX we should probably list both)
2169 2169
2170 2170 $ hg log -G a
2171 2171 @ changeset: 4:50b9b36e9c5d
2172 2172 : tag: tip
2173 2173 : user: test
2174 2174 : date: Thu Jan 01 00:00:00 1970 +0000
2175 2175 : summary: content3
2176 2176 :
2177 2177 : o changeset: 1:2294ae80ad84
2178 2178 :/ user: test
2179 2179 : date: Thu Jan 01 00:00:00 1970 +0000
2180 2180 : summary: content2
2181 2181 :
2182 2182 o changeset: 0:ae0a3c9f9e95
2183 2183 user: test
2184 2184 date: Thu Jan 01 00:00:00 1970 +0000
2185 2185 summary: content1
2186 2186
2187 2187
2188 2188 hg log -f from the grafted changeset
2189 2189 (The bootstrap should properly take the topology in account)
2190 2190
2191 2191 $ hg up 'desc(content3)^'
2192 2192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2193 2193 $ hg log -Gf a
2194 2194 @ changeset: 3:15b2327059e5
2195 2195 : user: test
2196 2196 : date: Thu Jan 01 00:00:00 1970 +0000
2197 2197 : summary: content2
2198 2198 :
2199 2199 o changeset: 0:ae0a3c9f9e95
2200 2200 user: test
2201 2201 date: Thu Jan 01 00:00:00 1970 +0000
2202 2202 summary: content1
2203 2203
2204 2204
2205 2205 Test that we use the first non-hidden changeset in that case.
2206 2206
2207 2207 (hide the changeset)
2208 2208
2209 2209 $ hg log -T '{node}\n' -r 1
2210 2210 2294ae80ad8447bc78383182eeac50cb049df623
2211 2211 $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
2212 2212 obsoleted 1 changesets
2213 2213 $ hg log -G
2214 2214 o changeset: 4:50b9b36e9c5d
2215 2215 | tag: tip
2216 2216 | user: test
2217 2217 | date: Thu Jan 01 00:00:00 1970 +0000
2218 2218 | summary: content3
2219 2219 |
2220 2220 @ changeset: 3:15b2327059e5
2221 2221 | user: test
2222 2222 | date: Thu Jan 01 00:00:00 1970 +0000
2223 2223 | summary: content2
2224 2224 |
2225 2225 o changeset: 2:2029acd1168c
2226 2226 | parent: 0:ae0a3c9f9e95
2227 2227 | user: test
2228 2228 | date: Thu Jan 01 00:00:00 1970 +0000
2229 2229 | summary: unrelated
2230 2230 |
2231 2231 o changeset: 0:ae0a3c9f9e95
2232 2232 user: test
2233 2233 date: Thu Jan 01 00:00:00 1970 +0000
2234 2234 summary: content1
2235 2235
2236 2236
2237 2237 Check that log on the file does not drop the file revision.
2238 2238
2239 2239 $ hg log -G a
2240 2240 o changeset: 4:50b9b36e9c5d
2241 2241 | tag: tip
2242 2242 | user: test
2243 2243 | date: Thu Jan 01 00:00:00 1970 +0000
2244 2244 | summary: content3
2245 2245 |
2246 2246 @ changeset: 3:15b2327059e5
2247 2247 : user: test
2248 2248 : date: Thu Jan 01 00:00:00 1970 +0000
2249 2249 : summary: content2
2250 2250 :
2251 2251 o changeset: 0:ae0a3c9f9e95
2252 2252 user: test
2253 2253 date: Thu Jan 01 00:00:00 1970 +0000
2254 2254 summary: content1
2255 2255
2256 2256
2257 2257 Even when a head revision is linkrev-shadowed.
2258 2258
2259 2259 $ hg log -T '{node}\n' -r 4
2260 2260 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2261 2261 $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2262 2262 obsoleted 1 changesets
2263 2263 $ hg log -G a
2264 2264 @ changeset: 3:15b2327059e5
2265 2265 : tag: tip
2266 2266 : user: test
2267 2267 : date: Thu Jan 01 00:00:00 1970 +0000
2268 2268 : summary: content2
2269 2269 :
2270 2270 o changeset: 0:ae0a3c9f9e95
2271 2271 user: test
2272 2272 date: Thu Jan 01 00:00:00 1970 +0000
2273 2273 summary: content1
2274 2274
2275 2275
2276 2276 $ cd ..
2277 2277
2278 2278 Even when the file revision is missing from some head:
2279 2279
2280 2280 $ hg init issue4490
2281 2281 $ cd issue4490
2282 2282 $ echo '[experimental]' >> .hg/hgrc
2283 2283 $ echo 'evolution=createmarkers' >> .hg/hgrc
2284 2284 $ echo a > a
2285 2285 $ hg ci -Am0
2286 2286 adding a
2287 2287 $ echo b > b
2288 2288 $ hg ci -Am1
2289 2289 adding b
2290 2290 $ echo B > b
2291 2291 $ hg ci --amend -m 1
2292 2292 $ hg up 0
2293 2293 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2294 2294 $ echo c > c
2295 2295 $ hg ci -Am2
2296 2296 adding c
2297 2297 created new head
2298 2298 $ hg up 'head() and not .'
2299 2299 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2300 2300 $ hg log -G
2301 2301 o changeset: 4:db815d6d32e6
2302 2302 | tag: tip
2303 2303 | parent: 0:f7b1eb17ad24
2304 2304 | user: test
2305 2305 | date: Thu Jan 01 00:00:00 1970 +0000
2306 2306 | summary: 2
2307 2307 |
2308 2308 | @ changeset: 3:9bc8ce7f9356
2309 2309 |/ parent: 0:f7b1eb17ad24
2310 2310 | user: test
2311 2311 | date: Thu Jan 01 00:00:00 1970 +0000
2312 2312 | summary: 1
2313 2313 |
2314 2314 o changeset: 0:f7b1eb17ad24
2315 2315 user: test
2316 2316 date: Thu Jan 01 00:00:00 1970 +0000
2317 2317 summary: 0
2318 2318
2319 2319 $ hg log -f -G b
2320 2320 @ changeset: 3:9bc8ce7f9356
2321 2321 | parent: 0:f7b1eb17ad24
2322 2322 ~ user: test
2323 2323 date: Thu Jan 01 00:00:00 1970 +0000
2324 2324 summary: 1
2325 2325
2326 2326 $ hg log -G b
2327 2327 @ changeset: 3:9bc8ce7f9356
2328 2328 | parent: 0:f7b1eb17ad24
2329 2329 ~ user: test
2330 2330 date: Thu Jan 01 00:00:00 1970 +0000
2331 2331 summary: 1
2332 2332
2333 2333 $ cd ..
2334 2334
2335 2335 Check proper report when the manifest changes but not the file issue4499
2336 2336 ------------------------------------------------------------------------
2337 2337
2338 2338 $ hg init issue4499
2339 2339 $ cd issue4499
2340 2340 $ for f in A B C D F E G H I J K L M N O P Q R S T U; do
2341 2341 > echo 1 > $f;
2342 2342 > hg add $f;
2343 2343 > done
2344 2344 $ hg commit -m 'A1B1C1'
2345 2345 $ echo 2 > A
2346 2346 $ echo 2 > B
2347 2347 $ echo 2 > C
2348 2348 $ hg commit -m 'A2B2C2'
2349 2349 $ hg up 0
2350 2350 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2351 2351 $ echo 3 > A
2352 2352 $ echo 2 > B
2353 2353 $ echo 2 > C
2354 2354 $ hg commit -m 'A3B2C2'
2355 2355 created new head
2356 2356
2357 2357 $ hg log -G
2358 2358 @ changeset: 2:fe5fc3d0eb17
2359 2359 | tag: tip
2360 2360 | parent: 0:abf4f0e38563
2361 2361 | user: test
2362 2362 | date: Thu Jan 01 00:00:00 1970 +0000
2363 2363 | summary: A3B2C2
2364 2364 |
2365 2365 | o changeset: 1:07dcc6b312c0
2366 2366 |/ user: test
2367 2367 | date: Thu Jan 01 00:00:00 1970 +0000
2368 2368 | summary: A2B2C2
2369 2369 |
2370 2370 o changeset: 0:abf4f0e38563
2371 2371 user: test
2372 2372 date: Thu Jan 01 00:00:00 1970 +0000
2373 2373 summary: A1B1C1
2374 2374
2375 2375
2376 2376 Log -f on B should reports current changesets
2377 2377
2378 2378 $ hg log -fG B
2379 2379 @ changeset: 2:fe5fc3d0eb17
2380 2380 | tag: tip
2381 2381 | parent: 0:abf4f0e38563
2382 2382 | user: test
2383 2383 | date: Thu Jan 01 00:00:00 1970 +0000
2384 2384 | summary: A3B2C2
2385 2385 |
2386 2386 o changeset: 0:abf4f0e38563
2387 2387 user: test
2388 2388 date: Thu Jan 01 00:00:00 1970 +0000
2389 2389 summary: A1B1C1
2390 2390
2391 2391 $ cd ..
@@ -1,63 +1,64 b''
1 1 $ cat > echo.py <<EOF
2 2 > #!$PYTHON
3 > from __future__ import print_function
3 4 > import os, sys
4 5 > try:
5 6 > import msvcrt
6 7 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
7 8 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
8 9 > except ImportError:
9 10 > pass
10 11 >
11 12 > for k in ('HG_FILE', 'HG_MY_ISLINK', 'HG_OTHER_ISLINK', 'HG_BASE_ISLINK'):
12 > print k, os.environ[k]
13 > print(k, os.environ[k])
13 14 > EOF
14 15
15 16 Create 2 heads containing the same file, once as
16 17 a file, once as a link. Bundle was generated with:
17 18
18 19 # hg init t
19 20 # cd t
20 21 # echo a > a
21 22 # hg ci -qAm t0 -d '0 0'
22 23 # echo l > l
23 24 # hg ci -qAm t1 -d '1 0'
24 25 # hg up -C 0
25 26 # ln -s a l
26 27 # hg ci -qAm t2 -d '2 0'
27 28 # echo l2 > l2
28 29 # hg ci -qAm t3 -d '3 0'
29 30
30 31 $ hg init t
31 32 $ cd t
32 33 $ hg -q pull "$TESTDIR/bundles/test-merge-symlinks.hg"
33 34 $ hg up -C 3
34 35 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 36
36 37 Merge them and display *_ISLINK vars
37 38 merge heads
38 39
39 40 $ hg merge --tool="$PYTHON ../echo.py"
40 41 merging l
41 42 HG_FILE l
42 43 HG_MY_ISLINK 1
43 44 HG_OTHER_ISLINK 0
44 45 HG_BASE_ISLINK 0
45 46 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
46 47 (branch merge, don't forget to commit)
47 48
48 49 Test working directory symlink bit calculation wrt copies,
49 50 especially on non-supporting systems.
50 51 merge working directory
51 52
52 53 $ hg up -C 2
53 54 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
54 55 $ hg copy l l2
55 56 $ HGMERGE="$PYTHON ../echo.py" hg up 3
56 57 merging l2
57 58 HG_FILE l2
58 59 HG_MY_ISLINK 1
59 60 HG_OTHER_ISLINK 0
60 61 HG_BASE_ISLINK 0
61 62 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
62 63
63 64 $ cd ..
@@ -1,423 +1,424 b''
1 1 $ cat <<EOF > merge
2 > from __future__ import print_function
2 3 > import sys, os
3 4 >
4 5 > try:
5 6 > import msvcrt
6 7 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
7 8 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
8 9 > except ImportError:
9 10 > pass
10 11 >
11 > print "merging for", os.path.basename(sys.argv[1])
12 > print("merging for", os.path.basename(sys.argv[1]))
12 13 > EOF
13 14 $ HGMERGE="$PYTHON ../merge"; export HGMERGE
14 15
15 16 $ hg init t
16 17 $ cd t
17 18 $ echo This is file a1 > a
18 19 $ hg add a
19 20 $ hg commit -m "commit #0"
20 21 $ echo This is file b1 > b
21 22 $ hg add b
22 23 $ hg commit -m "commit #1"
23 24
24 25 $ hg update 0
25 26 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
26 27
27 28 Test interrupted updates by having a non-empty dir with the same name as one
28 29 of the files in a commit we're updating to
29 30
30 31 $ mkdir b && touch b/nonempty
31 32 $ hg up
32 33 abort: *: '$TESTTMP/t/b' (glob)
33 34 [255]
34 35 $ hg ci
35 36 abort: last update was interrupted
36 37 (use 'hg update' to get a consistent checkout)
37 38 [255]
38 39 $ hg sum
39 40 parent: 0:538afb845929
40 41 commit #0
41 42 branch: default
42 43 commit: 1 unknown (interrupted update)
43 44 update: 1 new changesets (update)
44 45 phases: 2 draft
45 46 $ rm b/nonempty
46 47 $ hg up
47 48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 49 $ hg sum
49 50 parent: 1:b8bb4a988f25 tip
50 51 commit #1
51 52 branch: default
52 53 commit: (clean)
53 54 update: (current)
54 55 phases: 2 draft
55 56
56 57 Prepare a basic merge
57 58
58 59 $ hg up 0
59 60 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
60 61 $ echo This is file c1 > c
61 62 $ hg add c
62 63 $ hg commit -m "commit #2"
63 64 created new head
64 65 $ echo This is file b1 > b
65 66 no merges expected
66 67 $ hg merge -P 1
67 68 changeset: 1:b8bb4a988f25
68 69 user: test
69 70 date: Thu Jan 01 00:00:00 1970 +0000
70 71 summary: commit #1
71 72
72 73 $ hg merge 1
73 74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 75 (branch merge, don't forget to commit)
75 76 $ hg diff --nodates
76 77 diff -r 49035e18a8e6 b
77 78 --- /dev/null
78 79 +++ b/b
79 80 @@ -0,0 +1,1 @@
80 81 +This is file b1
81 82 $ hg status
82 83 M b
83 84 $ cd ..; rm -r t
84 85
85 86 $ hg init t
86 87 $ cd t
87 88 $ echo This is file a1 > a
88 89 $ hg add a
89 90 $ hg commit -m "commit #0"
90 91 $ echo This is file b1 > b
91 92 $ hg add b
92 93 $ hg commit -m "commit #1"
93 94
94 95 $ hg update 0
95 96 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
96 97 $ echo This is file c1 > c
97 98 $ hg add c
98 99 $ hg commit -m "commit #2"
99 100 created new head
100 101 $ echo This is file b2 > b
101 102 merge should fail
102 103 $ hg merge 1
103 104 b: untracked file differs
104 105 abort: untracked files in working directory differ from files in requested revision
105 106 [255]
106 107
107 108 #if symlink
108 109 symlinks to directories should be treated as regular files (issue5027)
109 110 $ rm b
110 111 $ ln -s 'This is file b2' b
111 112 $ hg merge 1
112 113 b: untracked file differs
113 114 abort: untracked files in working directory differ from files in requested revision
114 115 [255]
115 116 symlinks shouldn't be followed
116 117 $ rm b
117 118 $ echo This is file b1 > .hg/b
118 119 $ ln -s .hg/b b
119 120 $ hg merge 1
120 121 b: untracked file differs
121 122 abort: untracked files in working directory differ from files in requested revision
122 123 [255]
123 124
124 125 $ rm b
125 126 $ echo This is file b2 > b
126 127 #endif
127 128
128 129 bad config
129 130 $ hg merge 1 --config merge.checkunknown=x
130 131 abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn')
131 132 [255]
132 133 this merge should fail
133 134 $ hg merge 1 --config merge.checkunknown=abort
134 135 b: untracked file differs
135 136 abort: untracked files in working directory differ from files in requested revision
136 137 [255]
137 138
138 139 this merge should warn
139 140 $ hg merge 1 --config merge.checkunknown=warn
140 141 b: replacing untracked file
141 142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
142 143 (branch merge, don't forget to commit)
143 144 $ cat b.orig
144 145 This is file b2
145 146 $ hg up --clean 2
146 147 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
147 148 $ mv b.orig b
148 149
149 150 this merge should silently ignore
150 151 $ cat b
151 152 This is file b2
152 153 $ hg merge 1 --config merge.checkunknown=ignore
153 154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 155 (branch merge, don't forget to commit)
155 156
156 157 merge.checkignored
157 158 $ hg up --clean 1
158 159 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
159 160 $ cat >> .hgignore << EOF
160 161 > remoteignored
161 162 > EOF
162 163 $ echo This is file localignored3 > localignored
163 164 $ echo This is file remoteignored3 > remoteignored
164 165 $ hg add .hgignore localignored remoteignored
165 166 $ hg commit -m "commit #3"
166 167
167 168 $ hg up 2
168 169 1 files updated, 0 files merged, 4 files removed, 0 files unresolved
169 170 $ cat >> .hgignore << EOF
170 171 > localignored
171 172 > EOF
172 173 $ hg add .hgignore
173 174 $ hg commit -m "commit #4"
174 175
175 176 remote .hgignore shouldn't be used for determining whether a file is ignored
176 177 $ echo This is file remoteignored4 > remoteignored
177 178 $ hg merge 3 --config merge.checkignored=ignore --config merge.checkunknown=abort
178 179 remoteignored: untracked file differs
179 180 abort: untracked files in working directory differ from files in requested revision
180 181 [255]
181 182 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore
182 183 merging .hgignore
183 184 merging for .hgignore
184 185 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
185 186 (branch merge, don't forget to commit)
186 187 $ cat remoteignored
187 188 This is file remoteignored3
188 189 $ cat remoteignored.orig
189 190 This is file remoteignored4
190 191 $ rm remoteignored.orig
191 192
192 193 local .hgignore should be used for that
193 194 $ hg up --clean 4
194 195 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
195 196 $ echo This is file localignored4 > localignored
196 197 also test other conflicting files to see we output the full set of warnings
197 198 $ echo This is file b2 > b
198 199 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=abort
199 200 b: untracked file differs
200 201 localignored: untracked file differs
201 202 abort: untracked files in working directory differ from files in requested revision
202 203 [255]
203 204 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore
204 205 localignored: untracked file differs
205 206 abort: untracked files in working directory differ from files in requested revision
206 207 [255]
207 208 $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=abort
208 209 b: untracked file differs
209 210 abort: untracked files in working directory differ from files in requested revision
210 211 [255]
211 212 $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=warn
212 213 b: replacing untracked file
213 214 localignored: replacing untracked file
214 215 merging .hgignore
215 216 merging for .hgignore
216 217 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
217 218 (branch merge, don't forget to commit)
218 219 $ cat localignored
219 220 This is file localignored3
220 221 $ cat localignored.orig
221 222 This is file localignored4
222 223 $ rm localignored.orig
223 224
224 225 $ cat b.orig
225 226 This is file b2
226 227 $ hg up --clean 2
227 228 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
228 229 $ mv b.orig b
229 230
230 231 this merge of b should work
231 232 $ cat b
232 233 This is file b2
233 234 $ hg merge -f 1
234 235 merging b
235 236 merging for b
236 237 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
237 238 (branch merge, don't forget to commit)
238 239 $ hg diff --nodates
239 240 diff -r 49035e18a8e6 b
240 241 --- /dev/null
241 242 +++ b/b
242 243 @@ -0,0 +1,1 @@
243 244 +This is file b2
244 245 $ hg status
245 246 M b
246 247 $ cd ..; rm -r t
247 248
248 249 $ hg init t
249 250 $ cd t
250 251 $ echo This is file a1 > a
251 252 $ hg add a
252 253 $ hg commit -m "commit #0"
253 254 $ echo This is file b1 > b
254 255 $ hg add b
255 256 $ hg commit -m "commit #1"
256 257 $ echo This is file b22 > b
257 258 $ hg commit -m "commit #2"
258 259 $ hg update 1
259 260 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
260 261 $ echo This is file c1 > c
261 262 $ hg add c
262 263 $ hg commit -m "commit #3"
263 264 created new head
264 265
265 266 Contents of b should be "this is file b1"
266 267 $ cat b
267 268 This is file b1
268 269
269 270 $ echo This is file b22 > b
270 271 merge fails
271 272 $ hg merge 2
272 273 abort: uncommitted changes
273 274 (use 'hg status' to list changes)
274 275 [255]
275 276 merge expected!
276 277 $ hg merge -f 2
277 278 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 279 (branch merge, don't forget to commit)
279 280 $ hg diff --nodates
280 281 diff -r 85de557015a8 b
281 282 --- a/b
282 283 +++ b/b
283 284 @@ -1,1 +1,1 @@
284 285 -This is file b1
285 286 +This is file b22
286 287 $ hg status
287 288 M b
288 289 $ cd ..; rm -r t
289 290
290 291 $ hg init t
291 292 $ cd t
292 293 $ echo This is file a1 > a
293 294 $ hg add a
294 295 $ hg commit -m "commit #0"
295 296 $ echo This is file b1 > b
296 297 $ hg add b
297 298 $ hg commit -m "commit #1"
298 299 $ echo This is file b22 > b
299 300 $ hg commit -m "commit #2"
300 301 $ hg update 1
301 302 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
302 303 $ echo This is file c1 > c
303 304 $ hg add c
304 305 $ hg commit -m "commit #3"
305 306 created new head
306 307 $ echo This is file b33 > b
307 308 merge of b should fail
308 309 $ hg merge 2
309 310 abort: uncommitted changes
310 311 (use 'hg status' to list changes)
311 312 [255]
312 313 merge of b expected
313 314 $ hg merge -f 2
314 315 merging b
315 316 merging for b
316 317 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
317 318 (branch merge, don't forget to commit)
318 319 $ hg diff --nodates
319 320 diff -r 85de557015a8 b
320 321 --- a/b
321 322 +++ b/b
322 323 @@ -1,1 +1,1 @@
323 324 -This is file b1
324 325 +This is file b33
325 326 $ hg status
326 327 M b
327 328
328 329 Test for issue2364
329 330
330 331 $ hg up -qC .
331 332 $ hg rm b
332 333 $ hg ci -md
333 334 $ hg revert -r -2 b
334 335 $ hg up -q -- -2
335 336
336 337 Test that updated files are treated as "modified", when
337 338 'merge.update()' is aborted before 'merge.recordupdates()' (= parents
338 339 aren't changed), even if none of mode, size and timestamp of them
339 340 isn't changed on the filesystem (see also issue4583).
340 341
341 342 $ cat > $TESTTMP/abort.py <<EOF
342 343 > # emulate aborting before "recordupdates()". in this case, files
343 344 > # are changed without updating dirstate
344 345 > from mercurial import extensions, merge, error
345 346 > def applyupdates(orig, *args, **kwargs):
346 347 > orig(*args, **kwargs)
347 348 > raise error.Abort('intentional aborting')
348 349 > def extsetup(ui):
349 350 > extensions.wrapfunction(merge, "applyupdates", applyupdates)
350 351 > EOF
351 352
352 353 $ cat >> .hg/hgrc <<EOF
353 354 > [fakedirstatewritetime]
354 355 > # emulate invoking dirstate.write() via repo.status()
355 356 > # at 2000-01-01 00:00
356 357 > fakenow = 200001010000
357 358 > EOF
358 359
359 360 (file gotten from other revision)
360 361
361 362 $ hg update -q -C 2
362 363 $ echo 'THIS IS FILE B5' > b
363 364 $ hg commit -m 'commit #5'
364 365
365 366 $ hg update -q -C 3
366 367 $ cat b
367 368 This is file b1
368 369 $ touch -t 200001010000 b
369 370 $ hg debugrebuildstate
370 371
371 372 $ cat >> .hg/hgrc <<EOF
372 373 > [extensions]
373 374 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
374 375 > abort = $TESTTMP/abort.py
375 376 > EOF
376 377 $ hg merge 5
377 378 abort: intentional aborting
378 379 [255]
379 380 $ cat >> .hg/hgrc <<EOF
380 381 > [extensions]
381 382 > fakedirstatewritetime = !
382 383 > abort = !
383 384 > EOF
384 385
385 386 $ cat b
386 387 THIS IS FILE B5
387 388 $ touch -t 200001010000 b
388 389 $ hg status -A b
389 390 M b
390 391
391 392 (file merged from other revision)
392 393
393 394 $ hg update -q -C 3
394 395 $ echo 'this is file b6' > b
395 396 $ hg commit -m 'commit #6'
396 397 created new head
397 398
398 399 $ cat b
399 400 this is file b6
400 401 $ touch -t 200001010000 b
401 402 $ hg debugrebuildstate
402 403
403 404 $ cat >> .hg/hgrc <<EOF
404 405 > [extensions]
405 406 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
406 407 > abort = $TESTTMP/abort.py
407 408 > EOF
408 409 $ hg merge --tool internal:other 5
409 410 abort: intentional aborting
410 411 [255]
411 412 $ cat >> .hg/hgrc <<EOF
412 413 > [extensions]
413 414 > fakedirstatewritetime = !
414 415 > abort = !
415 416 > EOF
416 417
417 418 $ cat b
418 419 THIS IS FILE B5
419 420 $ touch -t 200001010000 b
420 421 $ hg status -A b
421 422 M b
422 423
423 424 $ cd ..
@@ -1,70 +1,70 b''
1 1 $ cat <<EOF > merge
2 2 > import sys, os
3 > print "merging for", os.path.basename(sys.argv[1])
3 > print("merging for", os.path.basename(sys.argv[1]))
4 4 > EOF
5 5 $ HGMERGE="$PYTHON ../merge"; export HGMERGE
6 6
7 7 $ hg init A1
8 8 $ cd A1
9 9 $ echo This is file foo1 > foo
10 10 $ echo This is file bar1 > bar
11 11 $ hg add foo bar
12 12 $ hg commit -m "commit text"
13 13
14 14 $ cd ..
15 15 $ hg clone A1 B1
16 16 updating to branch default
17 17 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 18
19 19 $ cd A1
20 20 $ rm bar
21 21 $ hg remove bar
22 22 $ hg commit -m "commit test"
23 23
24 24 $ cd ../B1
25 25 $ echo This is file foo22 > foo
26 26 $ hg commit -m "commit test"
27 27
28 28 $ cd ..
29 29 $ hg clone A1 A2
30 30 updating to branch default
31 31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 32 $ hg clone B1 B2
33 33 updating to branch default
34 34 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 35
36 36 $ cd A1
37 37 $ hg pull ../B1
38 38 pulling from ../B1
39 39 searching for changes
40 40 adding changesets
41 41 adding manifests
42 42 adding file changes
43 43 added 1 changesets with 1 changes to 1 files (+1 heads)
44 44 (run 'hg heads' to see heads, 'hg merge' to merge)
45 45 $ hg merge
46 46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 47 (branch merge, don't forget to commit)
48 48 $ hg commit -m "commit test"
49 49 bar should remain deleted.
50 50 $ hg manifest --debug
51 51 f9b0e817f6a48de3564c6b2957687c5e7297c5a0 644 foo
52 52
53 53 $ cd ../B2
54 54 $ hg pull ../A2
55 55 pulling from ../A2
56 56 searching for changes
57 57 adding changesets
58 58 adding manifests
59 59 adding file changes
60 60 added 1 changesets with 0 changes to 0 files (+1 heads)
61 61 (run 'hg heads' to see heads, 'hg merge' to merge)
62 62 $ hg merge
63 63 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
64 64 (branch merge, don't forget to commit)
65 65 $ hg commit -m "commit test"
66 66 bar should remain deleted.
67 67 $ hg manifest --debug
68 68 f9b0e817f6a48de3564c6b2957687c5e7297c5a0 644 foo
69 69
70 70 $ cd ..
@@ -1,211 +1,211 b''
1 1
2 2 Test interactions between mq and patch.eol
3 3
4 4
5 5 $ cat <<EOF >> $HGRCPATH
6 6 > [extensions]
7 7 > mq =
8 8 > [diff]
9 9 > nodates = 1
10 10 > EOF
11 11
12 12 $ cat > makepatch.py <<EOF
13 13 > f = file('eol.diff', 'wb')
14 14 > w = f.write
15 15 > w('test message\n')
16 16 > w('diff --git a/a b/a\n')
17 17 > w('--- a/a\n')
18 18 > w('+++ b/a\n')
19 19 > w('@@ -1,5 +1,5 @@\n')
20 20 > w(' a\n')
21 21 > w('-b\r\n')
22 22 > w('+y\r\n')
23 23 > w(' c\r\n')
24 24 > w(' d\n')
25 25 > w('-e\n')
26 26 > w('\ No newline at end of file\n')
27 27 > w('+z\r\n')
28 28 > w('\ No newline at end of file\r\n')
29 29 > EOF
30 30
31 31 $ cat > cateol.py <<EOF
32 32 > import sys
33 33 > for line in file(sys.argv[1], 'rb'):
34 34 > line = line.replace('\r', '<CR>')
35 35 > line = line.replace('\n', '<LF>')
36 > print line
36 > print(line)
37 37 > EOF
38 38
39 39 $ hg init repo
40 40 $ cd repo
41 41 $ echo '\.diff' > .hgignore
42 42 $ echo '\.rej' >> .hgignore
43 43
44 44
45 45 Test different --eol values
46 46
47 47 $ $PYTHON -c 'file("a", "wb").write("a\nb\nc\nd\ne")'
48 48 $ hg ci -Am adda
49 49 adding .hgignore
50 50 adding a
51 51 $ $PYTHON ../makepatch.py
52 52 $ hg qimport eol.diff
53 53 adding eol.diff to series file
54 54
55 55 should fail in strict mode
56 56
57 57 $ hg qpush
58 58 applying eol.diff
59 59 patching file a
60 60 Hunk #1 FAILED at 0
61 61 1 out of 1 hunks FAILED -- saving rejects to file a.rej
62 62 patch failed, unable to continue (try -v)
63 63 patch failed, rejects left in working directory
64 64 errors during apply, please fix and qrefresh eol.diff
65 65 [2]
66 66 $ hg qpop
67 67 popping eol.diff
68 68 patch queue now empty
69 69
70 70 invalid eol
71 71
72 72 $ hg --config patch.eol='LFCR' qpush
73 73 applying eol.diff
74 74 patch failed, unable to continue (try -v)
75 75 patch failed, rejects left in working directory
76 76 errors during apply, please fix and qrefresh eol.diff
77 77 [2]
78 78 $ hg qpop
79 79 popping eol.diff
80 80 patch queue now empty
81 81
82 82 force LF
83 83
84 84 $ hg --config patch.eol='CRLF' qpush
85 85 applying eol.diff
86 86 now at: eol.diff
87 87 $ hg qrefresh
88 88 $ $PYTHON ../cateol.py .hg/patches/eol.diff
89 89 # HG changeset patch<LF>
90 90 # Parent 0d0bf99a8b7a3842c6f8ef09e34f69156c4bd9d0<LF>
91 91 test message<LF>
92 92 <LF>
93 93 diff -r 0d0bf99a8b7a a<LF>
94 94 --- a/a<LF>
95 95 +++ b/a<LF>
96 96 @@ -1,5 +1,5 @@<LF>
97 97 -a<LF>
98 98 -b<LF>
99 99 -c<LF>
100 100 -d<LF>
101 101 -e<LF>
102 102 \ No newline at end of file<LF>
103 103 +a<CR><LF>
104 104 +y<CR><LF>
105 105 +c<CR><LF>
106 106 +d<CR><LF>
107 107 +z<LF>
108 108 \ No newline at end of file<LF>
109 109 $ $PYTHON ../cateol.py a
110 110 a<CR><LF>
111 111 y<CR><LF>
112 112 c<CR><LF>
113 113 d<CR><LF>
114 114 z
115 115 $ hg qpop
116 116 popping eol.diff
117 117 patch queue now empty
118 118
119 119 push again forcing LF and compare revisions
120 120
121 121 $ hg --config patch.eol='CRLF' qpush
122 122 applying eol.diff
123 123 now at: eol.diff
124 124 $ $PYTHON ../cateol.py a
125 125 a<CR><LF>
126 126 y<CR><LF>
127 127 c<CR><LF>
128 128 d<CR><LF>
129 129 z
130 130 $ hg qpop
131 131 popping eol.diff
132 132 patch queue now empty
133 133
134 134 push again without LF and compare revisions
135 135
136 136 $ hg qpush
137 137 applying eol.diff
138 138 now at: eol.diff
139 139 $ $PYTHON ../cateol.py a
140 140 a<CR><LF>
141 141 y<CR><LF>
142 142 c<CR><LF>
143 143 d<CR><LF>
144 144 z
145 145 $ hg qpop
146 146 popping eol.diff
147 147 patch queue now empty
148 148 $ cd ..
149 149
150 150
151 151 Test .rej file EOL are left unchanged
152 152
153 153 $ hg init testeol
154 154 $ cd testeol
155 155 $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n3\r\n4')"
156 156 $ hg ci -Am adda
157 157 adding a
158 158 $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n33\r\n4')"
159 159 $ hg qnew patch1
160 160 $ hg qpop
161 161 popping patch1
162 162 patch queue now empty
163 163 $ $PYTHON -c "file('a', 'wb').write('1\r\n22\r\n33\r\n4')"
164 164 $ hg ci -m changea
165 165
166 166 $ hg --config 'patch.eol=LF' qpush
167 167 applying patch1
168 168 patching file a
169 169 Hunk #1 FAILED at 0
170 170 1 out of 1 hunks FAILED -- saving rejects to file a.rej
171 171 patch failed, unable to continue (try -v)
172 172 patch failed, rejects left in working directory
173 173 errors during apply, please fix and qrefresh patch1
174 174 [2]
175 175 $ hg qpop
176 176 popping patch1
177 177 patch queue now empty
178 178 $ cat a.rej
179 179 --- a
180 180 +++ a
181 181 @@ -1,4 +1,4 @@
182 182 1\r (esc)
183 183 2\r (esc)
184 184 -3\r (esc)
185 185 +33\r (esc)
186 186 4
187 187 \ No newline at end of file
188 188
189 189 $ hg --config 'patch.eol=auto' qpush
190 190 applying patch1
191 191 patching file a
192 192 Hunk #1 FAILED at 0
193 193 1 out of 1 hunks FAILED -- saving rejects to file a.rej
194 194 patch failed, unable to continue (try -v)
195 195 patch failed, rejects left in working directory
196 196 errors during apply, please fix and qrefresh patch1
197 197 [2]
198 198 $ hg qpop
199 199 popping patch1
200 200 patch queue now empty
201 201 $ cat a.rej
202 202 --- a
203 203 +++ a
204 204 @@ -1,4 +1,4 @@
205 205 1\r (esc)
206 206 2\r (esc)
207 207 -3\r (esc)
208 208 +33\r (esc)
209 209 4
210 210 \ No newline at end of file
211 211 $ cd ..
@@ -1,214 +1,214 b''
1 1
2 2 $ cat <<EOF >> $HGRCPATH
3 3 > [extensions]
4 4 > notify=
5 5 >
6 6 > [hooks]
7 7 > changegroup.notify = python:hgext.notify.hook
8 8 >
9 9 > [notify]
10 10 > sources = push
11 11 > diffstat = False
12 12 > maxsubject = 10
13 13 >
14 14 > [usersubs]
15 15 > foo@bar = *
16 16 >
17 17 > [reposubs]
18 18 > * = baz
19 19 > EOF
20 20 $ hg init a
21 21
22 22 clone
23 23
24 24 $ hg --traceback clone a b
25 25 updating to branch default
26 26 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 27 $ echo a > b/a
28 28
29 29 commit
30 30
31 31 $ hg --traceback --cwd b commit -Ama
32 32 adding a
33 33 $ echo a >> b/a
34 34
35 35 commit
36 36
37 37 $ hg --traceback --cwd b commit -Amb
38 38
39 39 push
40 40
41 41 $ hg --traceback --cwd b push ../a 2>&1 |
42 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
42 > $PYTHON -c 'from __future__ import print_function ; import sys,re; print(re.sub("\n\t", " ", sys.stdin.read()), end="")'
43 43 pushing to ../a
44 44 searching for changes
45 45 adding changesets
46 46 adding manifests
47 47 adding file changes
48 48 added 2 changesets with 2 changes to 1 files
49 49 Content-Type: text/plain; charset="us-ascii"
50 50 MIME-Version: 1.0
51 51 Content-Transfer-Encoding: 7bit
52 52 Date: * (glob)
53 53 Subject: * (glob)
54 54 From: test
55 55 X-Hg-Notification: changeset cb9a9f314b8b
56 56 Message-Id: <*> (glob)
57 57 To: baz, foo@bar
58 58
59 59 changeset cb9a9f314b8b in $TESTTMP/a (glob)
60 60 details: $TESTTMP/a?cmd=changeset;node=cb9a9f314b8b
61 61 summary: a
62 62
63 63 changeset ba677d0156c1 in $TESTTMP/a (glob)
64 64 details: $TESTTMP/a?cmd=changeset;node=ba677d0156c1
65 65 summary: b
66 66
67 67 diffs (6 lines):
68 68
69 69 diff -r 000000000000 -r ba677d0156c1 a
70 70 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
71 71 +++ b/a Thu Jan 01 00:00:00 1970 +0000
72 72 @@ -0,0 +1,2 @@
73 73 +a
74 74 +a
75 75 $ hg --cwd a rollback
76 76 repository tip rolled back to revision -1 (undo push)
77 77
78 78 unbundle with unrelated source
79 79
80 80 $ hg --cwd b bundle ../test.hg ../a
81 81 searching for changes
82 82 2 changesets found
83 83 $ hg --cwd a unbundle ../test.hg
84 84 adding changesets
85 85 adding manifests
86 86 adding file changes
87 87 added 2 changesets with 2 changes to 1 files
88 88 (run 'hg update' to get a working copy)
89 89 $ hg --cwd a rollback
90 90 repository tip rolled back to revision -1 (undo unbundle)
91 91
92 92 unbundle with correct source
93 93
94 94 $ hg --config notify.sources=unbundle --cwd a unbundle ../test.hg 2>&1 |
95 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
95 > $PYTHON -c 'from __future__ import print_function ; import sys,re; print(re.sub("\n\t", " ", sys.stdin.read()), end="")'
96 96 adding changesets
97 97 adding manifests
98 98 adding file changes
99 99 added 2 changesets with 2 changes to 1 files
100 100 Content-Type: text/plain; charset="us-ascii"
101 101 MIME-Version: 1.0
102 102 Content-Transfer-Encoding: 7bit
103 103 Date: * (glob)
104 104 Subject: * (glob)
105 105 From: test
106 106 X-Hg-Notification: changeset cb9a9f314b8b
107 107 Message-Id: <*> (glob)
108 108 To: baz, foo@bar
109 109
110 110 changeset cb9a9f314b8b in $TESTTMP/a (glob)
111 111 details: $TESTTMP/a?cmd=changeset;node=cb9a9f314b8b
112 112 summary: a
113 113
114 114 changeset ba677d0156c1 in $TESTTMP/a (glob)
115 115 details: $TESTTMP/a?cmd=changeset;node=ba677d0156c1
116 116 summary: b
117 117
118 118 diffs (6 lines):
119 119
120 120 diff -r 000000000000 -r ba677d0156c1 a
121 121 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
122 122 +++ b/a Thu Jan 01 00:00:00 1970 +0000
123 123 @@ -0,0 +1,2 @@
124 124 +a
125 125 +a
126 126 (run 'hg update' to get a working copy)
127 127
128 128 Check that using the first committer as the author of a changeset works:
129 129 Check that the config option works.
130 130 Check that the first committer is indeed used for "From:".
131 131 Check that the merge user is NOT used for "From:"
132 132
133 133 Create new file
134 134
135 135 $ echo a > b/b
136 136 $ echo b >> b/b
137 137 $ echo c >> b/b
138 138 $ hg --traceback --cwd b commit -Amnewfile -u committer_1
139 139 adding b
140 140
141 141 commit as one user
142 142
143 143 $ echo x > b/b
144 144 $ echo b >> b/b
145 145 $ echo c >> b/b
146 146 $ hg --traceback --cwd b commit -Amx -u committer_2
147 147
148 148 commit as other user, change file so we can do an (automatic) merge
149 149
150 150 $ hg --cwd b up 2
151 151 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
152 152 $ echo a > b/b
153 153 $ echo b >> b/b
154 154 $ echo y >> b/b
155 155 $ hg --traceback --cwd b commit -Amy -u committer_3
156 156 created new head
157 157
158 158 merge as a different user
159 159
160 160 $ hg --cwd b merge --config notify.fromauthor=True
161 161 merging b
162 162 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
163 163 (branch merge, don't forget to commit)
164 164
165 165 $ hg --traceback --cwd b commit -Am "merged"
166 166
167 167 push
168 168
169 169 $ hg --traceback --cwd b --config notify.fromauthor=True push ../a 2>&1 |
170 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
170 > $PYTHON -c 'from __future__ import print_function ; import sys,re; print(re.sub("\n\t", " ", sys.stdin.read()), end="")'
171 171 pushing to ../a
172 172 searching for changes
173 173 adding changesets
174 174 adding manifests
175 175 adding file changes
176 176 added 4 changesets with 4 changes to 1 files
177 177 Content-Type: text/plain; charset="us-ascii"
178 178 MIME-Version: 1.0
179 179 Content-Transfer-Encoding: 7bit
180 180 Date: * (glob)
181 181 Subject: * (glob)
182 182 From: committer_1
183 183 X-Hg-Notification: changeset 84e487dddc58
184 184 Message-Id: <*> (glob)
185 185 To: baz, foo@bar
186 186
187 187 changeset 84e487dddc58 in $TESTTMP/a (glob)
188 188 details: $TESTTMP/a?cmd=changeset;node=84e487dddc58
189 189 summary: newfile
190 190
191 191 changeset b29c7a2b6b0c in $TESTTMP/a (glob)
192 192 details: $TESTTMP/a?cmd=changeset;node=b29c7a2b6b0c
193 193 summary: x
194 194
195 195 changeset 0957c7d64886 in $TESTTMP/a (glob)
196 196 details: $TESTTMP/a?cmd=changeset;node=0957c7d64886
197 197 summary: y
198 198
199 199 changeset 485b4e6b0249 in $TESTTMP/a (glob)
200 200 details: $TESTTMP/a?cmd=changeset;node=485b4e6b0249
201 201 summary: merged
202 202
203 203 diffs (7 lines):
204 204
205 205 diff -r ba677d0156c1 -r 485b4e6b0249 b
206 206 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
207 207 +++ b/b Thu Jan 01 00:00:00 1970 +0000
208 208 @@ -0,0 +1,3 @@
209 209 +x
210 210 +b
211 211 +y
212 212 $ hg --cwd a rollback
213 213 repository tip rolled back to revision 1 (undo push)
214 214
General Comments 0
You need to be logged in to leave comments. Login now