##// END OF EJS Templates
check-code: fix check for trailing whitespace on continued lines too...
Mads Kiilerich -
r17347:2da47de3 default
parent child Browse files
Show More
@@ -1,450 +1,450
1 1 #!/usr/bin/env python
2 2 #
3 3 # check-code - a style and portability checker for Mercurial
4 4 #
5 5 # Copyright 2010 Matt Mackall <mpm@selenic.com>
6 6 #
7 7 # This software may be used and distributed according to the terms of the
8 8 # GNU General Public License version 2 or any later version.
9 9
10 10 import re, glob, os, sys
11 11 import keyword
12 12 import optparse
13 13
14 14 def repquote(m):
15 15 t = re.sub(r"\w", "x", m.group('text'))
16 16 t = re.sub(r"[^\s\nx]", "o", t)
17 17 return m.group('quote') + t + m.group('quote')
18 18
19 19 def reppython(m):
20 20 comment = m.group('comment')
21 21 if comment:
22 22 return "#" * len(comment)
23 23 return repquote(m)
24 24
25 25 def repcomment(m):
26 26 return m.group(1) + "#" * len(m.group(2))
27 27
28 28 def repccomment(m):
29 29 t = re.sub(r"((?<=\n) )|\S", "x", m.group(2))
30 30 return m.group(1) + t + "*/"
31 31
32 32 def repcallspaces(m):
33 33 t = re.sub(r"\n\s+", "\n", m.group(2))
34 34 return m.group(1) + t
35 35
36 36 def repinclude(m):
37 37 return m.group(1) + "<foo>"
38 38
39 39 def rephere(m):
40 40 t = re.sub(r"\S", "x", m.group(2))
41 41 return m.group(1) + t
42 42
43 43
44 44 testpats = [
45 45 [
46 46 (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"),
47 47 (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
48 48 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
49 49 (r'sed.*-i', "don't use 'sed -i', use a temporary file"),
50 50 (r'\becho\b.*\\n', "don't use 'echo \\n', use printf"),
51 51 (r'echo -n', "don't use 'echo -n', use printf"),
52 52 (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"),
53 53 (r'head -c', "don't use 'head -c', use 'dd'"),
54 54 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
55 55 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
56 56 (r'printf.*\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"),
57 57 (r'printf.*\\x', "don't use printf \\x, use Python"),
58 58 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
59 59 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
60 60 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
61 61 "use egrep for extended grep syntax"),
62 62 (r'/bin/', "don't use explicit paths for tools"),
63 63 (r'[^\n]\Z', "no trailing newline"),
64 64 (r'export.*=', "don't export and assign at once"),
65 65 (r'^source\b', "don't use 'source', use '.'"),
66 66 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
67 67 (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
68 68 (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
69 69 (r'^stop\(\)', "don't use 'stop' as a shell function name"),
70 70 (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
71 71 (r'^alias\b.*=', "don't use alias, use a function"),
72 72 (r'if\s*!', "don't use '!' to negate exit status"),
73 73 (r'/dev/u?random', "don't use entropy, use /dev/zero"),
74 74 (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
75 75 (r'^( *)\t', "don't use tabs to indent"),
76 76 ],
77 77 # warnings
78 78 [
79 79 (r'^function', "don't use 'function', use old style"),
80 80 (r'^diff.*-\w*N', "don't use 'diff -N'"),
81 81 (r'\$PWD', "don't use $PWD, use `pwd`"),
82 82 (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"),
83 83 ]
84 84 ]
85 85
86 86 testfilters = [
87 87 (r"( *)(#([^\n]*\S)?)", repcomment),
88 88 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
89 89 ]
90 90
91 91 uprefix = r"^ \$ "
92 92 utestpats = [
93 93 [
94 (r'^(\S.*|| \$ .*)[ \t]\n', "trailing whitespace on non-output"),
94 (r'^(\S.*|| [$>] .*)[ \t]\n', "trailing whitespace on non-output"),
95 95 (uprefix + r'.*\|\s*sed[^|>\n]*\n',
96 96 "use regex test output patterns instead of sed"),
97 97 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
98 98 (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"),
99 99 (uprefix + r'.*\|\| echo.*(fail|error)',
100 100 "explicit exit code checks unnecessary"),
101 101 (uprefix + r'set -e', "don't use set -e"),
102 102 (uprefix + r'\s', "don't indent commands, use > for continued lines"),
103 103 (r'^ saved backup bundle to \$TESTTMP.*\.hg$',
104 104 "use (glob) to match Windows paths too"),
105 105 ],
106 106 # warnings
107 107 []
108 108 ]
109 109
110 110 for i in [0, 1]:
111 111 for p, m in testpats[i]:
112 112 if p.startswith(r'^'):
113 113 p = r"^ [$>] (%s)" % p[1:]
114 114 else:
115 115 p = r"^ [$>] .*(%s)" % p
116 116 utestpats[i].append((p, m))
117 117
118 118 utestfilters = [
119 119 (r"( *)(#([^\n]*\S)?)", repcomment),
120 120 ]
121 121
122 122 pypats = [
123 123 [
124 124 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
125 125 "tuple parameter unpacking not available in Python 3+"),
126 126 (r'lambda\s*\(.*,.*\)',
127 127 "tuple parameter unpacking not available in Python 3+"),
128 128 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
129 129 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
130 130 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
131 131 (r'^\s*\t', "don't use tabs"),
132 132 (r'\S;\s*\n', "semicolon"),
133 133 (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"),
134 134 (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"),
135 135 (r'\w,\w', "missing whitespace after ,"),
136 136 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
137 137 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"),
138 138 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
139 139 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'),
140 140 (r'.{81}', "line too long"),
141 141 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
142 142 (r'[^\n]\Z', "no trailing newline"),
143 143 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
144 144 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=',
145 145 # "don't use underbars in identifiers"),
146 146 (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ',
147 147 "don't use camelcase in identifiers"),
148 148 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
149 149 "linebreak after :"),
150 150 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"),
151 151 (r'class\s[^( \n]+\(\):',
152 152 "class foo() not available in Python 2.4, use class foo(object)"),
153 153 (r'\b(%s)\(' % '|'.join(keyword.kwlist),
154 154 "Python keyword is not a function"),
155 155 (r',]', "unneeded trailing ',' in list"),
156 156 # (r'class\s[A-Z][^\(]*\((?!Exception)',
157 157 # "don't capitalize non-exception classes"),
158 158 # (r'in range\(', "use xrange"),
159 159 # (r'^\s*print\s+', "avoid using print in core and extensions"),
160 160 (r'[\x80-\xff]', "non-ASCII character literal"),
161 161 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
162 162 (r'^\s*with\s+', "with not available in Python 2.4"),
163 163 (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"),
164 164 (r'^\s*except.* as .*:', "except as not available in Python 2.4"),
165 165 (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"),
166 166 (r'(?<!def)\s+(any|all|format)\(',
167 167 "any/all/format not available in Python 2.4"),
168 168 (r'(?<!def)\s+(callable)\(',
169 169 "callable not available in Python 3, use getattr(f, '__call__', None)"),
170 170 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
171 171 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
172 172 "gratuitous whitespace after Python keyword"),
173 173 (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"),
174 174 # (r'\s\s=', "gratuitous whitespace before ="),
175 175 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S',
176 176 "missing whitespace around operator"),
177 177 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\s',
178 178 "missing whitespace around operator"),
179 179 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S',
180 180 "missing whitespace around operator"),
181 181 (r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]',
182 182 "wrong whitespace around ="),
183 183 (r'raise Exception', "don't raise generic exceptions"),
184 184 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
185 185 (r' [=!]=\s+(True|False|None)',
186 186 "comparison with singleton, use 'is' or 'is not' instead"),
187 187 (r'^\s*(while|if) [01]:',
188 188 "use True/False for constant Boolean expression"),
189 189 (r'(?:(?<!def)\s+|\()hasattr',
190 190 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
191 191 (r'opener\([^)]*\).read\(',
192 192 "use opener.read() instead"),
193 193 (r'BaseException', 'not in Py2.4, use Exception'),
194 194 (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'),
195 195 (r'opener\([^)]*\).write\(',
196 196 "use opener.write() instead"),
197 197 (r'[\s\(](open|file)\([^)]*\)\.read\(',
198 198 "use util.readfile() instead"),
199 199 (r'[\s\(](open|file)\([^)]*\)\.write\(',
200 200 "use util.readfile() instead"),
201 201 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
202 202 "always assign an opened file to a variable, and close it afterwards"),
203 203 (r'[\s\(](open|file)\([^)]*\)\.',
204 204 "always assign an opened file to a variable, and close it afterwards"),
205 205 (r'(?i)descendent', "the proper spelling is descendAnt"),
206 206 (r'\.debug\(\_', "don't mark debug messages for translation"),
207 207 (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"),
208 208 (r'^\s*except\s*:', "warning: naked except clause", r'#.*re-raises'),
209 209 (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"),
210 210 ],
211 211 # warnings
212 212 [
213 213 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
214 214 "warning: unwrapped ui message"),
215 215 ]
216 216 ]
217 217
218 218 pyfilters = [
219 219 (r"""(?msx)(?P<comment>\#.*?$)|
220 220 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
221 221 (?P<text>(([^\\]|\\.)*?))
222 222 (?P=quote))""", reppython),
223 223 ]
224 224
225 225 cpats = [
226 226 [
227 227 (r'//', "don't use //-style comments"),
228 228 (r'^ ', "don't use spaces to indent"),
229 229 (r'\S\t', "don't use tabs except for indent"),
230 230 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
231 231 (r'.{81}', "line too long"),
232 232 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
233 233 (r'return\(', "return is not a function"),
234 234 (r' ;', "no space before ;"),
235 235 (r'\w+\* \w+', "use int *foo, not int* foo"),
236 236 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
237 237 (r'\w+ (\+\+|--)', "use foo++, not foo ++"),
238 238 (r'\w,\w', "missing whitespace after ,"),
239 239 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
240 240 (r'^#\s+\w', "use #foo, not # foo"),
241 241 (r'[^\n]\Z', "no trailing newline"),
242 242 (r'^\s*#import\b', "use only #include in standard C code"),
243 243 ],
244 244 # warnings
245 245 []
246 246 ]
247 247
248 248 cfilters = [
249 249 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
250 250 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
251 251 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
252 252 (r'(\()([^)]+\))', repcallspaces),
253 253 ]
254 254
255 255 inutilpats = [
256 256 [
257 257 (r'\bui\.', "don't use ui in util"),
258 258 ],
259 259 # warnings
260 260 []
261 261 ]
262 262
263 263 inrevlogpats = [
264 264 [
265 265 (r'\brepo\.', "don't use repo in revlog"),
266 266 ],
267 267 # warnings
268 268 []
269 269 ]
270 270
271 271 checks = [
272 272 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
273 273 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
274 274 ('c', r'.*\.c$', cfilters, cpats),
275 275 ('unified test', r'.*\.t$', utestfilters, utestpats),
276 276 ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters,
277 277 inrevlogpats),
278 278 ('layering violation ui in util', r'mercurial/util\.py', pyfilters,
279 279 inutilpats),
280 280 ]
281 281
282 282 class norepeatlogger(object):
283 283 def __init__(self):
284 284 self._lastseen = None
285 285
286 286 def log(self, fname, lineno, line, msg, blame):
287 287 """print error related a to given line of a given file.
288 288
289 289 The faulty line will also be printed but only once in the case
290 290 of multiple errors.
291 291
292 292 :fname: filename
293 293 :lineno: line number
294 294 :line: actual content of the line
295 295 :msg: error message
296 296 """
297 297 msgid = fname, lineno, line
298 298 if msgid != self._lastseen:
299 299 if blame:
300 300 print "%s:%d (%s):" % (fname, lineno, blame)
301 301 else:
302 302 print "%s:%d:" % (fname, lineno)
303 303 print " > %s" % line
304 304 self._lastseen = msgid
305 305 print " " + msg
306 306
307 307 _defaultlogger = norepeatlogger()
308 308
309 309 def getblame(f):
310 310 lines = []
311 311 for l in os.popen('hg annotate -un %s' % f):
312 312 start, line = l.split(':', 1)
313 313 user, rev = start.split()
314 314 lines.append((line[1:-1], user, rev))
315 315 return lines
316 316
317 317 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
318 318 blame=False, debug=False, lineno=True):
319 319 """checks style and portability of a given file
320 320
321 321 :f: filepath
322 322 :logfunc: function used to report error
323 323 logfunc(filename, linenumber, linecontent, errormessage)
324 324 :maxerr: number of error to display before arborting.
325 325 Set to false (default) to report all errors
326 326
327 327 return True if no error is found, False otherwise.
328 328 """
329 329 blamecache = None
330 330 result = True
331 331 for name, match, filters, pats in checks:
332 332 if debug:
333 333 print name, f
334 334 fc = 0
335 335 if not re.match(match, f):
336 336 if debug:
337 337 print "Skipping %s for %s it doesn't match %s" % (
338 338 name, match, f)
339 339 continue
340 340 fp = open(f)
341 341 pre = post = fp.read()
342 342 fp.close()
343 343 if "no-" + "check-code" in pre:
344 344 if debug:
345 345 print "Skipping %s for %s it has no- and check-code" % (
346 346 name, f)
347 347 break
348 348 for p, r in filters:
349 349 post = re.sub(p, r, post)
350 350 if warnings:
351 351 pats = pats[0] + pats[1]
352 352 else:
353 353 pats = pats[0]
354 354 # print post # uncomment to show filtered version
355 355
356 356 if debug:
357 357 print "Checking %s for %s" % (name, f)
358 358
359 359 prelines = None
360 360 errors = []
361 361 for pat in pats:
362 362 if len(pat) == 3:
363 363 p, msg, ignore = pat
364 364 else:
365 365 p, msg = pat
366 366 ignore = None
367 367
368 368 # fix-up regexes for multiline searches
369 369 po = p
370 370 # \s doesn't match \n
371 371 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
372 372 # [^...] doesn't match newline
373 373 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
374 374
375 375 #print po, '=>', p
376 376
377 377 pos = 0
378 378 n = 0
379 379 for m in re.finditer(p, post, re.MULTILINE):
380 380 if prelines is None:
381 381 prelines = pre.splitlines()
382 382 postlines = post.splitlines(True)
383 383
384 384 start = m.start()
385 385 while n < len(postlines):
386 386 step = len(postlines[n])
387 387 if pos + step > start:
388 388 break
389 389 pos += step
390 390 n += 1
391 391 l = prelines[n]
392 392
393 393 if "check-code" + "-ignore" in l:
394 394 if debug:
395 395 print "Skipping %s for %s:%s (check-code -ignore)" % (
396 396 name, f, n)
397 397 continue
398 398 elif ignore and re.search(ignore, l, re.MULTILINE):
399 399 continue
400 400 bd = ""
401 401 if blame:
402 402 bd = 'working directory'
403 403 if not blamecache:
404 404 blamecache = getblame(f)
405 405 if n < len(blamecache):
406 406 bl, bu, br = blamecache[n]
407 407 if bl == l:
408 408 bd = '%s@%s' % (bu, br)
409 409 errors.append((f, lineno and n + 1, l, msg, bd))
410 410 result = False
411 411
412 412 errors.sort()
413 413 for e in errors:
414 414 logfunc(*e)
415 415 fc += 1
416 416 if maxerr and fc >= maxerr:
417 417 print " (too many errors, giving up)"
418 418 break
419 419
420 420 return result
421 421
422 422 if __name__ == "__main__":
423 423 parser = optparse.OptionParser("%prog [options] [files]")
424 424 parser.add_option("-w", "--warnings", action="store_true",
425 425 help="include warning-level checks")
426 426 parser.add_option("-p", "--per-file", type="int",
427 427 help="max warnings per file")
428 428 parser.add_option("-b", "--blame", action="store_true",
429 429 help="use annotate to generate blame info")
430 430 parser.add_option("", "--debug", action="store_true",
431 431 help="show debug information")
432 432 parser.add_option("", "--nolineno", action="store_false",
433 433 dest='lineno', help="don't show line numbers")
434 434
435 435 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False,
436 436 lineno=True)
437 437 (options, args) = parser.parse_args()
438 438
439 439 if len(args) == 0:
440 440 check = glob.glob("*")
441 441 else:
442 442 check = args
443 443
444 444 ret = 0
445 445 for f in check:
446 446 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
447 447 blame=options.blame, debug=options.debug,
448 448 lineno=options.lineno):
449 449 ret = 1
450 450 sys.exit(ret)
@@ -1,322 +1,322
1 1 $ HGMERGE=true; export HGMERGE
2 2
3 3 init
4 4
5 5 $ hg init repo
6 6 $ cd repo
7 7
8 8 commit
9 9
10 10 $ echo 'a' > a
11 11 $ hg ci -A -m test -u nobody -d '1 0'
12 12 adding a
13 13
14 14 annotate -c
15 15
16 16 $ hg annotate -c a
17 17 8435f90966e4: a
18 18
19 19 annotate -cl
20 20
21 21 $ hg annotate -cl a
22 22 8435f90966e4:1: a
23 23
24 24 annotate -d
25 25
26 26 $ hg annotate -d a
27 27 Thu Jan 01 00:00:01 1970 +0000: a
28 28
29 29 annotate -n
30 30
31 31 $ hg annotate -n a
32 32 0: a
33 33
34 34 annotate -nl
35 35
36 36 $ hg annotate -nl a
37 37 0:1: a
38 38
39 39 annotate -u
40 40
41 41 $ hg annotate -u a
42 42 nobody: a
43 43
44 44 annotate -cdnu
45 45
46 46 $ hg annotate -cdnu a
47 47 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
48 48
49 49 annotate -cdnul
50 50
51 51 $ hg annotate -cdnul a
52 52 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
53 53
54 54 $ cat <<EOF >>a
55 55 > a
56 56 > a
57 57 > EOF
58 58 $ hg ci -ma1 -d '1 0'
59 59 $ hg cp a b
60 60 $ hg ci -mb -d '1 0'
61 61 $ cat <<EOF >> b
62 62 > b4
63 63 > b5
64 64 > b6
65 65 > EOF
66 66 $ hg ci -mb2 -d '2 0'
67 67
68 68 annotate -n b
69 69
70 70 $ hg annotate -n b
71 71 0: a
72 72 1: a
73 73 1: a
74 74 3: b4
75 75 3: b5
76 76 3: b6
77 77
78 78 annotate --no-follow b
79 79
80 80 $ hg annotate --no-follow b
81 81 2: a
82 82 2: a
83 83 2: a
84 84 3: b4
85 85 3: b5
86 86 3: b6
87 87
88 88 annotate -nl b
89 89
90 90 $ hg annotate -nl b
91 91 0:1: a
92 92 1:2: a
93 93 1:3: a
94 94 3:4: b4
95 95 3:5: b5
96 96 3:6: b6
97 97
98 98 annotate -nf b
99 99
100 100 $ hg annotate -nf b
101 101 0 a: a
102 102 1 a: a
103 103 1 a: a
104 104 3 b: b4
105 105 3 b: b5
106 106 3 b: b6
107 107
108 108 annotate -nlf b
109 109
110 110 $ hg annotate -nlf b
111 111 0 a:1: a
112 112 1 a:2: a
113 113 1 a:3: a
114 114 3 b:4: b4
115 115 3 b:5: b5
116 116 3 b:6: b6
117 117
118 118 $ hg up -C 2
119 119 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 120 $ cat <<EOF >> b
121 121 > b4
122 122 > c
123 123 > b5
124 124 > EOF
125 125 $ hg ci -mb2.1 -d '2 0'
126 126 created new head
127 127 $ hg merge
128 128 merging b
129 129 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
130 130 (branch merge, don't forget to commit)
131 131 $ hg ci -mmergeb -d '3 0'
132 132
133 133 annotate after merge
134 134
135 135 $ hg annotate -nf b
136 136 0 a: a
137 137 1 a: a
138 138 1 a: a
139 139 3 b: b4
140 140 4 b: c
141 141 3 b: b5
142 142
143 143 annotate after merge with -l
144 144
145 145 $ hg annotate -nlf b
146 146 0 a:1: a
147 147 1 a:2: a
148 148 1 a:3: a
149 149 3 b:4: b4
150 150 4 b:5: c
151 151 3 b:5: b5
152 152
153 153 $ hg up -C 1
154 154 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
155 155 $ hg cp a b
156 156 $ cat <<EOF > b
157 157 > a
158 158 > z
159 159 > a
160 160 > EOF
161 161 $ hg ci -mc -d '3 0'
162 162 created new head
163 163 $ hg merge
164 164 merging b
165 165 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
166 166 (branch merge, don't forget to commit)
167 167 $ cat <<EOF >> b
168 168 > b4
169 169 > c
170 170 > b5
171 171 > EOF
172 172 $ echo d >> b
173 173 $ hg ci -mmerge2 -d '4 0'
174 174
175 175 annotate after rename merge
176 176
177 177 $ hg annotate -nf b
178 178 0 a: a
179 179 6 b: z
180 180 1 a: a
181 181 3 b: b4
182 182 4 b: c
183 183 3 b: b5
184 184 7 b: d
185 185
186 186 annotate after rename merge with -l
187 187
188 188 $ hg annotate -nlf b
189 189 0 a:1: a
190 190 6 b:2: z
191 191 1 a:3: a
192 192 3 b:4: b4
193 193 4 b:5: c
194 194 3 b:5: b5
195 195 7 b:7: d
196 196
197 197 Issue2807: alignment of line numbers with -l
198 198
199 199 $ echo more >> b
200 200 $ hg ci -mmore -d '5 0'
201 201 $ echo more >> b
202 202 $ hg ci -mmore -d '6 0'
203 203 $ echo more >> b
204 204 $ hg ci -mmore -d '7 0'
205 205 $ hg annotate -nlf b
206 206 0 a: 1: a
207 207 6 b: 2: z
208 208 1 a: 3: a
209 209 3 b: 4: b4
210 210 4 b: 5: c
211 211 3 b: 5: b5
212 212 7 b: 7: d
213 213 8 b: 8: more
214 214 9 b: 9: more
215 215 10 b:10: more
216 216
217 217 linkrev vs rev
218 218
219 219 $ hg annotate -r tip -n a
220 220 0: a
221 221 1: a
222 222 1: a
223 223
224 224 linkrev vs rev with -l
225 225
226 226 $ hg annotate -r tip -nl a
227 227 0:1: a
228 228 1:2: a
229 229 1:3: a
230 230
231 231 Issue589: "undelete" sequence leads to crash
232 232
233 233 annotate was crashing when trying to --follow something
234 234
235 235 like A -> B -> A
236 236
237 237 generate ABA rename configuration
238 238
239 239 $ echo foo > foo
240 240 $ hg add foo
241 241 $ hg ci -m addfoo
242 242 $ hg rename foo bar
243 243 $ hg ci -m renamefoo
244 244 $ hg rename bar foo
245 245 $ hg ci -m renamebar
246 246
247 247 annotate after ABA with follow
248 248
249 249 $ hg annotate --follow foo
250 250 foo: foo
251 251
252 252 missing file
253 253
254 254 $ hg ann nosuchfile
255 255 abort: nosuchfile: no such file in rev e9e6b4fa872f
256 256 [255]
257 257
258 258 annotate file without '\n' on last line
259 259
260 260 $ printf "" > c
261 261 $ hg ci -A -m test -u nobody -d '1 0'
262 262 adding c
263 263 $ hg annotate c
264 264 $ printf "a\nb" > c
265 265 $ hg ci -m test
266 266 $ hg annotate c
267 267 [0-9]+: a (re)
268 268 [0-9]+: b (re)
269 269
270 270 Test annotate with whitespace options
271 271
272 272 $ cd ..
273 273 $ hg init repo-ws
274 274 $ cd repo-ws
275 275 $ cat > a <<EOF
276 276 > aa
277 277 >
278 278 > b b
279 279 > EOF
280 280 $ hg ci -Am "adda"
281 281 adding a
282 $ cat > a <<EOF
282 $ sed 's/EOL$//g' > a <<EOF
283 283 > a a
284 284 >
285 >
285 > EOL
286 286 > b b
287 287 > EOF
288 288 $ hg ci -m "changea"
289 289
290 290 Annotate with no option
291 291
292 292 $ hg annotate a
293 293 1: a a
294 294 0:
295 295 1:
296 296 1: b b
297 297
298 298 Annotate with --ignore-space-change
299 299
300 300 $ hg annotate --ignore-space-change a
301 301 1: a a
302 302 1:
303 303 0:
304 304 0: b b
305 305
306 306 Annotate with --ignore-all-space
307 307
308 308 $ hg annotate --ignore-all-space a
309 309 0: a a
310 310 0:
311 311 1:
312 312 0: b b
313 313
314 314 Annotate with --ignore-blank-lines (similar to no options case)
315 315
316 316 $ hg annotate --ignore-blank-lines a
317 317 1: a a
318 318 0:
319 319 1:
320 320 1: b b
321 321
322 322 $ cd ..
@@ -1,103 +1,103
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 3
4 4 $ cat >> $HGRCPATH <<EOF
5 5 > [extensions]
6 > convert =
6 > convert =
7 7 > graphlog =
8 8 > EOF
9 9
10 10 $ svnadmin create svn-repo
11 11 $ svnadmin load -q svn-repo < "$TESTDIR/svn/branches.svndump"
12 12
13 13 Convert trunk and branches
14 14
15 15 $ cat > branchmap <<EOF
16 16 > old3 newbranch
17 >
17 >
18 18 >
19 19 > EOF
20 20 $ hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg
21 21 initializing destination A-hg repository
22 22 scanning source...
23 23 sorting...
24 24 converting...
25 25 10 init projA
26 26 9 hello
27 27 8 branch trunk, remove c and dir
28 28 7 change a
29 29 6 change b
30 30 5 move and update c
31 31 4 move and update c
32 32 3 change b again
33 33 2 move to old2
34 34 1 move back to old
35 35 0 last change to a
36 36
37 37 Test template keywords
38 38
39 39 $ hg -R A-hg log --template '{rev} {svnuuid}{svnpath}@{svnrev}\n'
40 40 10 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@10
41 41 9 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@9
42 42 8 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old2@8
43 43 7 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@7
44 44 6 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@6
45 45 5 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@6
46 46 4 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@5
47 47 3 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@4
48 48 2 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@3
49 49 1 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@2
50 50 0 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@1
51 51
52 52 Convert again
53 53
54 54 $ hg convert --branchmap=branchmap --datesort svn-repo A-hg
55 55 scanning source...
56 56 sorting...
57 57 converting...
58 58 0 branch trunk@1 into old3
59 59
60 60 $ cd A-hg
61 61 $ hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
62 62 o branch=newbranch 11 branch trunk@1 into old3 files:
63 63 |
64 64 | o branch= 10 last change to a files: a
65 65 | |
66 66 | | o branch=old 9 move back to old files:
67 67 | | |
68 68 | | o branch=old2 8 move to old2 files:
69 69 | | |
70 70 | | o branch=old 7 change b again files: b
71 71 | | |
72 72 | o | branch= 6 move and update c files: b
73 73 | | |
74 74 | | o branch=old 5 move and update c files: c
75 75 | | |
76 76 | | o branch=old 4 change b files: b
77 77 | | |
78 78 | o | branch= 3 change a files: a
79 79 | | |
80 80 | | o branch=old 2 branch trunk, remove c and dir files: c
81 81 | |/
82 82 | o branch= 1 hello files: a b c dir/e
83 83 |/
84 84 o branch= 0 init projA files:
85 85
86 86
87 87 $ hg branches
88 88 newbranch 11:a6d7cc050ad1
89 89 default 10:6e2b33404495
90 90 old 9:93c4b0f99529
91 91 old2 8:b52884d7bead (inactive)
92 92 $ hg tags -q
93 93 tip
94 94 $ cd ..
95 95
96 96 Test hg failing to call itself
97 97
98 98 $ HG=foobar hg convert svn-repo B-hg
99 99 * (glob)
100 100 initializing destination B-hg repository
101 101 abort: Mercurial failed to run itself, check hg executable is in PATH
102 102 [255]
103 103
@@ -1,135 +1,135
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 3
4 4 $ cat >> $HGRCPATH <<EOF
5 5 > [extensions]
6 > convert =
6 > convert =
7 7 > graphlog =
8 8 > EOF
9 9
10 10 $ svnadmin create svn-repo
11 11 $ svnadmin load -q svn-repo < "$TESTDIR/svn/encoding.svndump"
12 12
13 13 Convert while testing all possible outputs
14 14
15 15 $ hg --debug convert svn-repo A-hg
16 16 initializing destination A-hg repository
17 17 reparent to file://*/svn-repo (glob)
18 18 run hg sink pre-conversion action
19 19 scanning source...
20 20 found trunk at 'trunk'
21 21 found tags at 'tags'
22 22 found branches at 'branches'
23 23 found branch branch\xc3\xa9 at 5 (esc)
24 24 found branch branch\xc3\xa9e at 6 (esc)
25 25 scanning: 1 revisions
26 26 reparent to file://*/svn-repo/trunk (glob)
27 27 fetching revision log for "/trunk" from 4 to 0
28 28 parsing revision 4 (2 changes)
29 29 parsing revision 3 (4 changes)
30 30 parsing revision 2 (3 changes)
31 31 parsing revision 1 (3 changes)
32 32 no copyfrom path, don't know what to do.
33 33 '/branches' is not under '/trunk', ignoring
34 34 '/tags' is not under '/trunk', ignoring
35 35 scanning: 2 revisions
36 36 reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
37 37 fetching revision log for "/branches/branch\xc3\xa9" from 5 to 0 (esc)
38 38 parsing revision 5 (1 changes)
39 39 reparent to file://*/svn-repo (glob)
40 40 reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
41 41 found parent of branch /branches/branch\xc3\xa9 at 4: /trunk (esc)
42 42 scanning: 3 revisions
43 43 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
44 44 fetching revision log for "/branches/branch\xc3\xa9e" from 6 to 0 (esc)
45 45 parsing revision 6 (1 changes)
46 46 reparent to file://*/svn-repo (glob)
47 47 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
48 48 found parent of branch /branches/branch\xc3\xa9e at 5: /branches/branch\xc3\xa9 (esc)
49 49 scanning: 4 revisions
50 50 scanning: 5 revisions
51 51 scanning: 6 revisions
52 52 sorting...
53 53 converting...
54 54 5 init projA
55 55 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@1
56 56 converting: 0/6 revisions (0.00%)
57 57 4 hello
58 58 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@2
59 59 converting: 1/6 revisions (16.67%)
60 60 reparent to file://*/svn-repo/trunk (glob)
61 61 scanning paths: /trunk/\xc3\xa0 0/3 (0.00%) (esc)
62 62 scanning paths: /trunk/\xc3\xa0/e\xcc\x81 1/3 (33.33%) (esc)
63 63 scanning paths: /trunk/\xc3\xa9 2/3 (66.67%) (esc)
64 64 \xc3\xa0/e\xcc\x81 (esc)
65 65 getting files: \xc3\xa0/e\xcc\x81 1/2 (50.00%) (esc)
66 66 \xc3\xa9 (esc)
67 67 getting files: \xc3\xa9 2/2 (100.00%) (esc)
68 68 3 copy files
69 69 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@3
70 70 converting: 2/6 revisions (33.33%)
71 71 scanning paths: /trunk/\xc3\xa0 0/4 (0.00%) (esc)
72 72 gone from -1
73 73 reparent to file://*/svn-repo (glob)
74 74 reparent to file://*/svn-repo/trunk (glob)
75 75 scanning paths: /trunk/\xc3\xa8 1/4 (25.00%) (esc)
76 76 copied to \xc3\xa8 from \xc3\xa9@2 (esc)
77 77 scanning paths: /trunk/\xc3\xa9 2/4 (50.00%) (esc)
78 78 gone from -1
79 79 reparent to file://*/svn-repo (glob)
80 80 reparent to file://*/svn-repo/trunk (glob)
81 81 scanning paths: /trunk/\xc3\xb9 3/4 (75.00%) (esc)
82 82 mark /trunk/\xc3\xb9 came from \xc3\xa0:2 (esc)
83 83 \xc3\xa0/e\xcc\x81 (esc)
84 84 getting files: \xc3\xa0/e\xcc\x81 1/4 (25.00%) (esc)
85 85 \xc3\xa8 (esc)
86 86 getting files: \xc3\xa8 2/4 (50.00%) (esc)
87 87 \xc3\xa8: copy \xc3\xa9:6b67ccefd5ce6de77e7ead4f5292843a0255329f (esc)
88 88 \xc3\xa9 (esc)
89 89 getting files: \xc3\xa9 3/4 (75.00%) (esc)
90 90 \xc3\xb9/e\xcc\x81 (esc)
91 91 getting files: \xc3\xb9/e\xcc\x81 4/4 (100.00%) (esc)
92 92 \xc3\xb9/e\xcc\x81: copy \xc3\xa0/e\xcc\x81:a9092a3d84a37b9993b5c73576f6de29b7ea50f6 (esc)
93 93 2 remove files
94 94 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@4
95 95 converting: 3/6 revisions (50.00%)
96 96 scanning paths: /trunk/\xc3\xa8 0/2 (0.00%) (esc)
97 97 gone from -1
98 98 reparent to file://*/svn-repo (glob)
99 99 reparent to file://*/svn-repo/trunk (glob)
100 100 scanning paths: /trunk/\xc3\xb9 1/2 (50.00%) (esc)
101 101 gone from -1
102 102 reparent to file://*/svn-repo (glob)
103 103 reparent to file://*/svn-repo/trunk (glob)
104 104 \xc3\xa8 (esc)
105 105 getting files: \xc3\xa8 1/2 (50.00%) (esc)
106 106 \xc3\xb9/e\xcc\x81 (esc)
107 107 getting files: \xc3\xb9/e\xcc\x81 2/2 (100.00%) (esc)
108 108 1 branch to branch?
109 109 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?@5
110 110 converting: 4/6 revisions (66.67%)
111 111 reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
112 112 scanning paths: /branches/branch\xc3\xa9 0/1 (0.00%) (esc)
113 113 0 branch to branch?e
114 114 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?e@6
115 115 converting: 5/6 revisions (83.33%)
116 116 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
117 117 scanning paths: /branches/branch\xc3\xa9e 0/1 (0.00%) (esc)
118 118 reparent to file://*/svn-repo (glob)
119 119 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
120 120 reparent to file://*/svn-repo (glob)
121 121 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
122 122 updating tags
123 123 .hgtags
124 124 run hg sink post-conversion action
125 125 $ cd A-hg
126 126 $ hg up
127 127 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
128 128
129 129 Check tags are in UTF-8
130 130
131 131 $ cat .hgtags
132 132 e94e4422020e715add80525e8f0f46c9968689f1 branch\xc3\xa9e (esc)
133 133 f7e66f98380ed1e53a797c5c7a7a2616a7ab377d branch\xc3\xa9 (esc)
134 134
135 135 $ cd ..
@@ -1,243 +1,243
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 3
4 4 $ cat >> $HGRCPATH <<EOF
5 5 > [extensions]
6 > convert =
6 > convert =
7 7 > graphlog =
8 8 > EOF
9 9
10 10 $ svnadmin create svn-repo
11 11 $ svnadmin load -q svn-repo < "$TESTDIR/svn/move.svndump"
12 12 $ SVNREPOPATH=`pwd`/svn-repo
13 13 #if windows
14 14 $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
15 15 #else
16 16 $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
17 17 #endif
18 18
19 19 Convert trunk and branches
20 20
21 21 $ hg convert --datesort "$SVNREPOURL"/subproject A-hg
22 22 initializing destination A-hg repository
23 23 scanning source...
24 24 sorting...
25 25 converting...
26 26 13 createtrunk
27 27 12 moved1
28 28 11 moved1
29 29 10 moved2
30 30 9 changeb and rm d2
31 31 8 changeb and rm d2
32 32 7 moved1again
33 33 6 moved1again
34 34 5 copyfilefrompast
35 35 4 copydirfrompast
36 36 3 add d3
37 37 2 copy dir and remove subdir
38 38 1 add d4old
39 39 0 rename d4old into d4new
40 40
41 41 $ cd A-hg
42 42 $ hg glog --template '{rev} {desc|firstline} files: {files}\n'
43 43 o 13 rename d4old into d4new files: d4new/g d4old/g
44 44 |
45 45 o 12 add d4old files: d4old/g
46 46 |
47 47 o 11 copy dir and remove subdir files: d3/d31/e d4/d31/e d4/f
48 48 |
49 49 o 10 add d3 files: d3/d31/e d3/f
50 50 |
51 51 o 9 copydirfrompast files: d2/d
52 52 |
53 53 o 8 copyfilefrompast files: d
54 54 |
55 55 o 7 moved1again files: d1/b d1/c
56 56 |
57 57 | o 6 moved1again files:
58 58 | |
59 59 o | 5 changeb and rm d2 files: d1/b d2/d
60 60 | |
61 61 | o 4 changeb and rm d2 files: b
62 62 | |
63 63 o | 3 moved2 files: d2/d
64 64 | |
65 65 o | 2 moved1 files: d1/b d1/c
66 66 | |
67 67 | o 1 moved1 files: b c
68 68 |
69 69 o 0 createtrunk files:
70 70
71 71
72 72 Check move copy records
73 73
74 74 $ hg st --rev 12:13 --copies
75 75 A d4new/g
76 76 d4old/g
77 77 R d4old/g
78 78
79 79 Check branches
80 80
81 81 $ hg branches
82 82 default 13:* (glob)
83 83 d1 6:* (glob)
84 84 $ cd ..
85 85
86 86 $ mkdir test-replace
87 87 $ cd test-replace
88 88 $ svnadmin create svn-repo
89 89 $ svnadmin load -q svn-repo < "$TESTDIR/svn/replace.svndump"
90 90
91 91 Convert files being replaced by directories
92 92
93 93 $ hg convert svn-repo hg-repo
94 94 initializing destination hg-repo repository
95 95 scanning source...
96 96 sorting...
97 97 converting...
98 98 6 initial
99 99 5 clobber symlink
100 100 4 clobber1
101 101 3 clobber2
102 102 2 adddb
103 103 1 branch
104 104 0 clobberdir
105 105
106 106 $ cd hg-repo
107 107
108 108 Manifest before
109 109
110 110 $ hg -v manifest -r 1
111 111 644 a
112 112 644 d/b
113 113 644 d2/a
114 114 644 @ dlink
115 115 644 @ dlink2
116 116 644 dlink3
117 117
118 118 Manifest after clobber1
119 119
120 120 $ hg -v manifest -r 2
121 121 644 a/b
122 122 644 d/b
123 123 644 d2/a
124 124 644 dlink/b
125 125 644 @ dlink2
126 126 644 dlink3
127 127
128 128 Manifest after clobber2
129 129
130 130 $ hg -v manifest -r 3
131 131 644 a/b
132 132 644 d/b
133 133 644 d2/a
134 134 644 dlink/b
135 135 644 @ dlink2
136 136 644 @ dlink3
137 137
138 138 Manifest after clobberdir
139 139
140 140 $ hg -v manifest -r 6
141 141 644 a/b
142 142 644 d/b
143 143 644 d2/a
144 144 644 d2/c
145 145 644 dlink/b
146 146 644 @ dlink2
147 147 644 @ dlink3
148 148
149 149 Try updating
150 150
151 151 $ hg up -qC default
152 152 $ cd ..
153 153
154 154 Test convert progress bar'
155 155
156 156 $ cat >> $HGRCPATH <<EOF
157 157 > [extensions]
158 > progress =
158 > progress =
159 159 > [progress]
160 160 > assume-tty = 1
161 161 > delay = 0
162 162 > changedelay = 0
163 163 > format = topic bar number
164 164 > refresh = 0
165 165 > width = 60
166 166 > EOF
167 167
168 168 $ hg convert svn-repo hg-progress 2>&1 | "$TESTDIR/filtercr.py"
169 169
170 170 scanning [ <=> ] 1
171 171 scanning [ <=> ] 2
172 172 scanning [ <=> ] 3
173 173 scanning [ <=> ] 4
174 174 scanning [ <=> ] 5
175 175 scanning [ <=> ] 6
176 176 scanning [ <=> ] 7
177 177
178 178 converting [ ] 0/7
179 179 getting files [=====> ] 1/6
180 180 getting files [============> ] 2/6
181 181 getting files [==================> ] 3/6
182 182 getting files [=========================> ] 4/6
183 183 getting files [===============================> ] 5/6
184 184 getting files [======================================>] 6/6
185 185
186 186 converting [=====> ] 1/7
187 187 scanning paths [ ] 0/1
188 188 getting files [======================================>] 1/1
189 189
190 190 converting [===========> ] 2/7
191 191 scanning paths [ ] 0/2
192 192 scanning paths [==================> ] 1/2
193 193 getting files [========> ] 1/4
194 194 getting files [==================> ] 2/4
195 195 getting files [============================> ] 3/4
196 196 getting files [======================================>] 4/4
197 197
198 198 converting [=================> ] 3/7
199 199 scanning paths [ ] 0/1
200 200 getting files [======================================>] 1/1
201 201
202 202 converting [=======================> ] 4/7
203 203 scanning paths [ ] 0/1
204 204 getting files [======================================>] 1/1
205 205
206 206 converting [=============================> ] 5/7
207 207 scanning paths [ ] 0/3
208 208 scanning paths [===========> ] 1/3
209 209 scanning paths [========================> ] 2/3
210 210 getting files [===> ] 1/8
211 211 getting files [========> ] 2/8
212 212 getting files [=============> ] 3/8
213 213 getting files [==================> ] 4/8
214 214 getting files [=======================> ] 5/8
215 215 getting files [============================> ] 6/8
216 216 getting files [=================================> ] 7/8
217 217 getting files [======================================>] 8/8
218 218
219 219 converting [===================================> ] 6/7
220 220 scanning paths [ ] 0/1
221 221 getting files [===> ] 1/8
222 222 getting files [========> ] 2/8
223 223 getting files [=============> ] 3/8
224 224 getting files [==================> ] 4/8
225 225 getting files [=======================> ] 5/8
226 226 getting files [============================> ] 6/8
227 227 getting files [=================================> ] 7/8
228 228 getting files [======================================>] 8/8
229 229
230 230 initializing destination hg-progress repository
231 231 scanning source...
232 232 sorting...
233 233 converting...
234 234 6 initial
235 235 5 clobber symlink
236 236 4 clobber1
237 237 3 clobber2
238 238 2 adddb
239 239 1 branch
240 240 0 clobberdir
241 241
242 242
243 243 $ cd ..
@@ -1,432 +1,432
1 1 $ "$TESTDIR/hghave" svn13 || exit 80
2 2
3 3 $ svnupanddisplay()
4 4 > {
5 5 > (
6 6 > cd $1;
7 7 > svn up -q;
8 8 > svn st -v | sed 's/ */ /g' | sort
9 9 > limit=''
10 10 > if [ $2 -gt 0 ]; then
11 11 > limit="--limit=$2"
12 12 > fi
13 13 > svn log --xml -v $limit | python "$TESTDIR/svnxml.py"
14 14 > )
15 15 > }
16 16
17 17 $ cat >> $HGRCPATH <<EOF
18 18 > [extensions]
19 > convert =
19 > convert =
20 20 > graphlog =
21 21 > EOF
22 22
23 23 $ hg init a
24 24
25 25 Add
26 26
27 27 $ echo a > a/a
28 28 $ mkdir -p a/d1/d2
29 29 $ echo b > a/d1/d2/b
30 30 $ hg --cwd a ci -d '0 0' -A -m 'add a file'
31 31 adding a
32 32 adding d1/d2/b
33 33
34 34 Modify
35 35
36 36 $ "$TESTDIR/svn-safe-append.py" a a/a
37 37 $ hg --cwd a ci -d '1 0' -m 'modify a file'
38 38 $ hg --cwd a tip -q
39 39 1:e0e2b8a9156b
40 40
41 41 $ hg convert -d svn a
42 42 assuming destination a-hg
43 43 initializing svn repository 'a-hg'
44 44 initializing svn working copy 'a-hg-wc'
45 45 scanning source...
46 46 sorting...
47 47 converting...
48 48 1 add a file
49 49 0 modify a file
50 50 $ svnupanddisplay a-hg-wc 2
51 51 2 1 test d1
52 52 2 1 test d1/d2 (glob)
53 53 2 1 test d1/d2/b (glob)
54 54 2 2 test .
55 55 2 2 test a
56 56 revision: 2
57 57 author: test
58 58 msg: modify a file
59 59 M /a
60 60 revision: 1
61 61 author: test
62 62 msg: add a file
63 63 A /a
64 64 A /d1
65 65 A /d1/d2
66 66 A /d1/d2/b
67 67 $ ls a a-hg-wc
68 68 a:
69 69 a
70 70 d1
71 71
72 72 a-hg-wc:
73 73 a
74 74 d1
75 75 $ cmp a/a a-hg-wc/a
76 76
77 77 Rename
78 78
79 79 $ hg --cwd a mv a b
80 80 $ hg --cwd a ci -d '2 0' -m 'rename a file'
81 81 $ hg --cwd a tip -q
82 82 2:eb5169441d43
83 83
84 84 $ hg convert -d svn a
85 85 assuming destination a-hg
86 86 initializing svn working copy 'a-hg-wc'
87 87 scanning source...
88 88 sorting...
89 89 converting...
90 90 0 rename a file
91 91 $ svnupanddisplay a-hg-wc 1
92 92 3 1 test d1
93 93 3 1 test d1/d2 (glob)
94 94 3 1 test d1/d2/b (glob)
95 95 3 3 test .
96 96 3 3 test b
97 97 revision: 3
98 98 author: test
99 99 msg: rename a file
100 100 D /a
101 101 A /b (from /a@2)
102 102 $ ls a a-hg-wc
103 103 a:
104 104 b
105 105 d1
106 106
107 107 a-hg-wc:
108 108 b
109 109 d1
110 110
111 111 Copy
112 112
113 113 $ hg --cwd a cp b c
114 114
115 115 $ hg --cwd a ci -d '3 0' -m 'copy a file'
116 116 $ hg --cwd a tip -q
117 117 3:60effef6ab48
118 118
119 119 $ hg convert -d svn a
120 120 assuming destination a-hg
121 121 initializing svn working copy 'a-hg-wc'
122 122 scanning source...
123 123 sorting...
124 124 converting...
125 125 0 copy a file
126 126 $ svnupanddisplay a-hg-wc 1
127 127 4 1 test d1
128 128 4 1 test d1/d2 (glob)
129 129 4 1 test d1/d2/b (glob)
130 130 4 3 test b
131 131 4 4 test .
132 132 4 4 test c
133 133 revision: 4
134 134 author: test
135 135 msg: copy a file
136 136 A /c (from /b@3)
137 137 $ ls a a-hg-wc
138 138 a:
139 139 b
140 140 c
141 141 d1
142 142
143 143 a-hg-wc:
144 144 b
145 145 c
146 146 d1
147 147
148 148 $ hg --cwd a rm b
149 149
150 150 Remove
151 151
152 152 $ hg --cwd a ci -d '4 0' -m 'remove a file'
153 153 $ hg --cwd a tip -q
154 154 4:87bbe3013fb6
155 155
156 156 $ hg convert -d svn a
157 157 assuming destination a-hg
158 158 initializing svn working copy 'a-hg-wc'
159 159 scanning source...
160 160 sorting...
161 161 converting...
162 162 0 remove a file
163 163 $ svnupanddisplay a-hg-wc 1
164 164 5 1 test d1
165 165 5 1 test d1/d2 (glob)
166 166 5 1 test d1/d2/b (glob)
167 167 5 4 test c
168 168 5 5 test .
169 169 revision: 5
170 170 author: test
171 171 msg: remove a file
172 172 D /b
173 173 $ ls a a-hg-wc
174 174 a:
175 175 c
176 176 d1
177 177
178 178 a-hg-wc:
179 179 c
180 180 d1
181 181
182 182 Executable
183 183
184 184 #if execbit
185 185 $ chmod +x a/c
186 186 #else
187 187 $ echo fake >> a/c
188 188 #endif
189 189 $ hg --cwd a ci -d '5 0' -m 'make a file executable'
190 190 #if execbit
191 191 $ hg --cwd a tip -q
192 192 5:ff42e473c340
193 193 #else
194 194 $ hg --cwd a tip -q
195 195 5:817a700c8cf1
196 196 #endif
197 197
198 198 $ hg convert -d svn a
199 199 assuming destination a-hg
200 200 initializing svn working copy 'a-hg-wc'
201 201 scanning source...
202 202 sorting...
203 203 converting...
204 204 0 make a file executable
205 205 $ svnupanddisplay a-hg-wc 1
206 206 6 1 test d1
207 207 6 1 test d1/d2 (glob)
208 208 6 1 test d1/d2/b (glob)
209 209 6 6 test .
210 210 6 6 test c
211 211 revision: 6
212 212 author: test
213 213 msg: make a file executable
214 214 M /c
215 215 #if execbit
216 216 $ test -x a-hg-wc/c
217 217 #endif
218 218
219 219 #if symlink
220 220
221 221 Symlinks
222 222
223 223 $ ln -s a/missing a/link
224 224 $ hg --cwd a commit -Am 'add symlink'
225 225 adding link
226 226 $ hg --cwd a mv link newlink
227 227 $ hg --cwd a commit -m 'move symlink'
228 228 $ hg convert -d svn a
229 229 assuming destination a-hg
230 230 initializing svn working copy 'a-hg-wc'
231 231 scanning source...
232 232 sorting...
233 233 converting...
234 234 1 add symlink
235 235 0 move symlink
236 236 $ svnupanddisplay a-hg-wc 1
237 237 8 1 test d1
238 238 8 1 test d1/d2
239 239 8 1 test d1/d2/b
240 240 8 6 test c
241 241 8 8 test .
242 242 8 8 test newlink
243 243 revision: 8
244 244 author: test
245 245 msg: move symlink
246 246 D /link
247 247 A /newlink (from /link@7)
248 248
249 249 #endif
250 250
251 251 $ rm -rf a a-hg a-hg-wc
252 252
253 253
254 254 Executable in new directory
255 255
256 256 $ hg init a
257 257
258 258 $ mkdir a/d1
259 259 $ echo a > a/d1/a
260 260 #if execbit
261 261 $ chmod +x a/d1/a
262 262 #else
263 263 $ echo fake >> a/d1/a
264 264 #endif
265 265 $ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory'
266 266 adding d1/a
267 267
268 268 $ hg convert -d svn a
269 269 assuming destination a-hg
270 270 initializing svn repository 'a-hg'
271 271 initializing svn working copy 'a-hg-wc'
272 272 scanning source...
273 273 sorting...
274 274 converting...
275 275 0 add executable file in new directory
276 276 $ svnupanddisplay a-hg-wc 1
277 277 1 1 test .
278 278 1 1 test d1
279 279 1 1 test d1/a (glob)
280 280 revision: 1
281 281 author: test
282 282 msg: add executable file in new directory
283 283 A /d1
284 284 A /d1/a
285 285 #if execbit
286 286 $ test -x a-hg-wc/d1/a
287 287 #endif
288 288
289 289 Copy to new directory
290 290
291 291 $ mkdir a/d2
292 292 $ hg --cwd a cp d1/a d2/a
293 293 $ hg --cwd a ci -d '1 0' -A -m 'copy file to new directory'
294 294
295 295 $ hg convert -d svn a
296 296 assuming destination a-hg
297 297 initializing svn working copy 'a-hg-wc'
298 298 scanning source...
299 299 sorting...
300 300 converting...
301 301 0 copy file to new directory
302 302 $ svnupanddisplay a-hg-wc 1
303 303 2 1 test d1
304 304 2 1 test d1/a (glob)
305 305 2 2 test .
306 306 2 2 test d2
307 307 2 2 test d2/a (glob)
308 308 revision: 2
309 309 author: test
310 310 msg: copy file to new directory
311 311 A /d2
312 312 A /d2/a (from /d1/a@1)
313 313
314 314 Branchy history
315 315
316 316 $ hg init b
317 317 $ echo base > b/b
318 318 $ hg --cwd b ci -d '0 0' -Ambase
319 319 adding b
320 320
321 321 $ "$TESTDIR/svn-safe-append.py" left-1 b/b
322 322 $ echo left-1 > b/left-1
323 323 $ hg --cwd b ci -d '1 0' -Amleft-1
324 324 adding left-1
325 325
326 326 $ "$TESTDIR/svn-safe-append.py" left-2 b/b
327 327 $ echo left-2 > b/left-2
328 328 $ hg --cwd b ci -d '2 0' -Amleft-2
329 329 adding left-2
330 330
331 331 $ hg --cwd b up 0
332 332 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
333 333
334 334 $ "$TESTDIR/svn-safe-append.py" right-1 b/b
335 335 $ echo right-1 > b/right-1
336 336 $ hg --cwd b ci -d '3 0' -Amright-1
337 337 adding right-1
338 338 created new head
339 339
340 340 $ "$TESTDIR/svn-safe-append.py" right-2 b/b
341 341 $ echo right-2 > b/right-2
342 342 $ hg --cwd b ci -d '4 0' -Amright-2
343 343 adding right-2
344 344
345 345 $ hg --cwd b up -C 2
346 346 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
347 347 $ hg --cwd b merge
348 348 merging b
349 349 warning: conflicts during merge.
350 350 merging b incomplete! (edit conflicts, then use 'hg resolve --mark')
351 351 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
352 352 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
353 353 [1]
354 354 $ hg --cwd b revert -r 2 b
355 355 $ hg --cwd b resolve -m b
356 356 $ hg --cwd b ci -d '5 0' -m 'merge'
357 357
358 358 Expect 4 changes
359 359
360 360 $ hg convert -d svn b
361 361 assuming destination b-hg
362 362 initializing svn repository 'b-hg'
363 363 initializing svn working copy 'b-hg-wc'
364 364 scanning source...
365 365 sorting...
366 366 converting...
367 367 5 base
368 368 4 left-1
369 369 3 left-2
370 370 2 right-1
371 371 1 right-2
372 372 0 merge
373 373
374 374 $ svnupanddisplay b-hg-wc 0
375 375 4 2 test left-1
376 376 4 3 test b
377 377 4 3 test left-2
378 378 4 4 test .
379 379 4 4 test right-1
380 380 4 4 test right-2
381 381 revision: 4
382 382 author: test
383 383 msg: merge
384 384 A /right-1
385 385 A /right-2
386 386 revision: 3
387 387 author: test
388 388 msg: left-2
389 389 M /b
390 390 A /left-2
391 391 revision: 2
392 392 author: test
393 393 msg: left-1
394 394 M /b
395 395 A /left-1
396 396 revision: 1
397 397 author: test
398 398 msg: base
399 399 A /b
400 400
401 401 Tags are not supported, but must not break conversion
402 402
403 403 $ rm -rf a a-hg a-hg-wc
404 404 $ hg init a
405 405 $ echo a > a/a
406 406 $ hg --cwd a ci -d '0 0' -A -m 'Add file a'
407 407 adding a
408 408 $ hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0
409 409
410 410 $ hg convert -d svn a
411 411 assuming destination a-hg
412 412 initializing svn repository 'a-hg'
413 413 initializing svn working copy 'a-hg-wc'
414 414 scanning source...
415 415 sorting...
416 416 converting...
417 417 1 Add file a
418 418 0 Tagged as v1.0
419 419 writing Subversion tags is not yet implemented
420 420 $ svnupanddisplay a-hg-wc 2
421 421 2 1 test a
422 422 2 2 test .
423 423 2 2 test .hgtags
424 424 revision: 2
425 425 author: test
426 426 msg: Tagged as v1.0
427 427 A /.hgtags
428 428 revision: 1
429 429 author: test
430 430 msg: Add file a
431 431 A /a
432 432 $ rm -rf a a-hg a-hg-wc
@@ -1,203 +1,203
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 3
4 4 $ cat >> $HGRCPATH <<EOF
5 5 > [extensions]
6 > convert =
6 > convert =
7 7 > graphlog =
8 8 > [convert]
9 9 > svn.trunk = mytrunk
10 10 > EOF
11 11
12 12 $ svnadmin create svn-repo
13 13 $ SVNREPOPATH=`pwd`/svn-repo
14 14 #if windows
15 15 $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
16 16 #else
17 17 $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
18 18 #endif
19 19
20 20 Now test that it works with trunk/tags layout, but no branches yet.
21 21
22 22 Initial svn import
23 23
24 24 $ mkdir projB
25 25 $ cd projB
26 26 $ mkdir mytrunk
27 27 $ mkdir tags
28 28 $ cd ..
29 29
30 30 $ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | sort
31 31
32 32 Adding projB/mytrunk (glob)
33 33 Adding projB/tags (glob)
34 34 Committed revision 1.
35 35
36 36 Update svn repository
37 37
38 38 $ svn co "$SVNREPOURL/proj%20B/mytrunk" B
39 39 Checked out revision 1.
40 40 $ cd B
41 41 $ echo hello > 'letter .txt'
42 42 $ svn add 'letter .txt'
43 43 A letter .txt
44 44 $ svn ci -m hello
45 45 Adding letter .txt
46 46 Transmitting file data .
47 47 Committed revision 2.
48 48
49 49 $ "$TESTDIR/svn-safe-append.py" world 'letter .txt'
50 50 $ svn ci -m world
51 51 Sending letter .txt
52 52 Transmitting file data .
53 53 Committed revision 3.
54 54
55 55 $ svn copy -m "tag v0.1" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.1"
56 56
57 57 Committed revision 4.
58 58
59 59 $ "$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt'
60 60 $ svn ci -m "nice day"
61 61 Sending letter .txt
62 62 Transmitting file data .
63 63 Committed revision 5.
64 64 $ cd ..
65 65
66 66 Convert to hg once
67 67
68 68 $ hg convert "$SVNREPOURL/proj%20B" B-hg
69 69 initializing destination B-hg repository
70 70 scanning source...
71 71 sorting...
72 72 converting...
73 73 3 init projB
74 74 2 hello
75 75 1 world
76 76 0 nice day
77 77 updating tags
78 78
79 79 Update svn repository again
80 80
81 81 $ cd B
82 82 $ "$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt'
83 83 $ echo "nice to meet you" > letter2.txt
84 84 $ svn add letter2.txt
85 85 A letter2.txt
86 86 $ svn ci -m "second letter"
87 87 Sending letter .txt
88 88 Adding letter2.txt
89 89 Transmitting file data ..
90 90 Committed revision 6.
91 91
92 92 $ svn copy -m "tag v0.2" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.2"
93 93
94 94 Committed revision 7.
95 95
96 96 $ "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt
97 97 $ svn ci -m "work in progress"
98 98 Sending letter2.txt
99 99 Transmitting file data .
100 100 Committed revision 8.
101 101 $ cd ..
102 102
103 103 $ hg convert -s svn "$SVNREPOURL/proj%20B/non-existent-path" dest
104 104 initializing destination dest repository
105 105 abort: no revision found in module /proj B/non-existent-path
106 106 [255]
107 107
108 108 ########################################
109 109
110 110 Test incremental conversion
111 111
112 112 $ hg convert "$SVNREPOURL/proj%20B" B-hg
113 113 scanning source...
114 114 sorting...
115 115 converting...
116 116 1 second letter
117 117 0 work in progress
118 118 updating tags
119 119
120 120 $ cd B-hg
121 121 $ hg glog --template '{rev} {desc|firstline} files: {files}\n'
122 122 o 7 update tags files: .hgtags
123 123 |
124 124 o 6 work in progress files: letter2.txt
125 125 |
126 126 o 5 second letter files: letter .txt letter2.txt
127 127 |
128 128 o 4 update tags files: .hgtags
129 129 |
130 130 o 3 nice day files: letter .txt
131 131 |
132 132 o 2 world files: letter .txt
133 133 |
134 134 o 1 hello files: letter .txt
135 135 |
136 136 o 0 init projB files:
137 137
138 138 $ hg tags -q
139 139 tip
140 140 v0.2
141 141 v0.1
142 142 $ cd ..
143 143
144 144 Test filemap
145 145 $ echo 'include letter2.txt' > filemap
146 146 $ hg convert --filemap filemap "$SVNREPOURL/proj%20B/mytrunk" fmap
147 147 initializing destination fmap repository
148 148 scanning source...
149 149 sorting...
150 150 converting...
151 151 5 init projB
152 152 4 hello
153 153 3 world
154 154 2 nice day
155 155 1 second letter
156 156 0 work in progress
157 157 $ hg -R fmap branch -q
158 158 default
159 159 $ hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n'
160 160 o 1 work in progress files: letter2.txt
161 161 |
162 162 o 0 second letter files: letter2.txt
163 163
164 164
165 165 Test stop revision
166 166 $ hg convert --rev 1 "$SVNREPOURL/proj%20B/mytrunk" stoprev
167 167 initializing destination stoprev repository
168 168 scanning source...
169 169 sorting...
170 170 converting...
171 171 0 init projB
172 172 $ hg -R stoprev branch -q
173 173 default
174 174
175 175 Check convert_revision extra-records.
176 176 This is also the only place testing more than one extra field in a revision.
177 177
178 178 $ cd stoprev
179 179 $ hg tip --debug | grep extra
180 180 extra: branch=default
181 181 extra: convert_revision=svn:........-....-....-....-............/proj B/mytrunk@1 (re)
182 182 $ cd ..
183 183
184 184 Test converting empty heads (issue3347)
185 185
186 186 $ svnadmin create svn-empty
187 187 $ svnadmin load -q svn-empty < "$TESTDIR/svn/empty.svndump"
188 188 $ hg --config convert.svn.trunk= convert svn-empty
189 189 assuming destination svn-empty-hg
190 190 initializing destination svn-empty-hg repository
191 191 scanning source...
192 192 sorting...
193 193 converting...
194 194 1 init projA
195 195 0 adddir
196 196 $ hg --config convert.svn.trunk= convert "$SVNREPOURL/../svn-empty/trunk"
197 197 assuming destination trunk-hg
198 198 initializing destination trunk-hg repository
199 199 scanning source...
200 200 sorting...
201 201 converting...
202 202 1 init projA
203 203 0 adddir
@@ -1,90 +1,90
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 3
4 4 $ cat >> $HGRCPATH <<EOF
5 5 > [extensions]
6 > convert =
6 > convert =
7 7 > graphlog =
8 8 > EOF
9 9 $ convert()
10 10 > {
11 11 > startrev=$1
12 12 > repopath=A-r$startrev-hg
13 13 > hg convert --config convert.svn.startrev=$startrev \
14 14 > --config convert.svn.trunk=branches/branch1 \
15 15 > --config convert.svn.branches=" " \
16 16 > --config convert.svn.tags= \
17 17 > --datesort svn-repo $repopath
18 18 > hg -R $repopath glog \
19 19 > --template '{rev} {desc|firstline} files: {files}\n'
20 20 > echo
21 21 > }
22 22
23 23 $ svnadmin create svn-repo
24 24 $ svnadmin load -q svn-repo < "$TESTDIR/svn/startrev.svndump"
25 25
26 26 Convert before branching point
27 27
28 28 $ convert 3
29 29 initializing destination A-r3-hg repository
30 30 scanning source...
31 31 sorting...
32 32 converting...
33 33 3 removeb
34 34 2 changeaa
35 35 1 branch, changeaaa
36 36 0 addc,changeaaaa
37 37 o 3 addc,changeaaaa files: a c
38 38 |
39 39 o 2 branch, changeaaa files: a
40 40 |
41 41 o 1 changeaa files: a
42 42 |
43 43 o 0 removeb files: a
44 44
45 45
46 46
47 47 Convert before branching point
48 48
49 49 $ convert 4
50 50 initializing destination A-r4-hg repository
51 51 scanning source...
52 52 sorting...
53 53 converting...
54 54 2 changeaa
55 55 1 branch, changeaaa
56 56 0 addc,changeaaaa
57 57 o 2 addc,changeaaaa files: a c
58 58 |
59 59 o 1 branch, changeaaa files: a
60 60 |
61 61 o 0 changeaa files: a
62 62
63 63
64 64
65 65 Convert at branching point
66 66
67 67 $ convert 5
68 68 initializing destination A-r5-hg repository
69 69 scanning source...
70 70 sorting...
71 71 converting...
72 72 1 branch, changeaaa
73 73 0 addc,changeaaaa
74 74 o 1 addc,changeaaaa files: a c
75 75 |
76 76 o 0 branch, changeaaa files: a
77 77
78 78
79 79
80 80 Convert last revision only
81 81
82 82 $ convert 6
83 83 initializing destination A-r6-hg repository
84 84 scanning source...
85 85 sorting...
86 86 converting...
87 87 0 addc,changeaaaa
88 88 o 0 addc,changeaaaa files: a c
89 89
90 90
@@ -1,67 +1,67
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 3
4 4 $ cat >> $HGRCPATH <<EOF
5 5 > [extensions]
6 > convert =
6 > convert =
7 7 > graphlog =
8 8 > EOF
9 9
10 10 $ svnadmin create svn-repo
11 11 $ svnadmin load -q svn-repo < "$TESTDIR/svn/tags.svndump"
12 12
13 13 Convert
14 14 $ hg convert --datesort svn-repo A-hg
15 15 initializing destination A-hg repository
16 16 scanning source...
17 17 sorting...
18 18 converting...
19 19 5 init projA
20 20 4 adda
21 21 3 changea
22 22 2 changea2
23 23 1 changea3
24 24 0 changea
25 25 updating tags
26 26
27 27 $ cd A-hg
28 28 $ hg glog --template '{rev} {desc|firstline} tags: {tags}\n'
29 29 o 6 update tags tags: tip
30 30 |
31 31 o 5 changea tags: trunk.goodtag
32 32 |
33 33 o 4 changea3 tags:
34 34 |
35 35 o 3 changea2 tags: trunk.v1
36 36 |
37 37 o 2 changea tags:
38 38 |
39 39 o 1 adda tags:
40 40 |
41 41 o 0 init projA tags:
42 42
43 43
44 44 $ hg tags -q
45 45 tip
46 46 trunk.goodtag
47 47 trunk.v1
48 48
49 49 $ cd ..
50 50
51 51 Convert without tags
52 52
53 53 $ hg convert --datesort --config convert.svn.tags= svn-repo A-notags-hg
54 54 initializing destination A-notags-hg repository
55 55 scanning source...
56 56 sorting...
57 57 converting...
58 58 5 init projA
59 59 4 adda
60 60 3 changea
61 61 2 changea2
62 62 1 changea3
63 63 0 changea
64 64
65 65 $ hg -R A-notags-hg tags -q
66 66 tip
67 67
@@ -1,2088 +1,2088
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, revset, 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 = revset.parse(expr)[0]
93 93 > else:
94 94 > tree = []
95 95 > ui.write('%r\n' % (opts.get('rev', []),))
96 96 > ui.write(revset.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 "graphlog=" >> $HGRCPATH
106 106 $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
107 107
108 108 $ hg init repo
109 109 $ cd repo
110 110
111 111 Empty repo:
112 112
113 113 $ hg glog
114 114
115 115
116 116 Building DAG:
117 117
118 118 $ commit 0 "root"
119 119 $ commit 1 "collapse" 0
120 120 $ commit 2 "collapse" 1
121 121 $ commit 3 "collapse" 2
122 122 $ commit 4 "merge two known; one immediate left, one immediate right" 1 3
123 123 $ commit 5 "expand" 3 4
124 124 $ commit 6 "merge two known; one immediate left, one far left" 2 5
125 125 $ commit 7 "expand" 2 5
126 126 $ commit 8 "merge two known; one immediate left, one far right" 0 7
127 127 $ commit 9 "expand" 7 8
128 128 $ commit 10 "merge two known; one immediate left, one near right" 0 6
129 129 $ commit 11 "expand" 6 10
130 130 $ commit 12 "merge two known; one immediate right, one far left" 1 9
131 131 $ commit 13 "expand" 9 11
132 132 $ commit 14 "merge two known; one immediate right, one far right" 0 12
133 133 $ commit 15 "expand" 13 14
134 134 $ commit 16 "merge two known; one immediate right, one near right" 0 1
135 135 $ commit 17 "expand" 12 16
136 136 $ commit 18 "merge two known; two far left" 1 15
137 137 $ commit 19 "expand" 15 17
138 138 $ commit 20 "merge two known; two far right" 0 18
139 139 $ commit 21 "expand" 19 20
140 140 $ commit 22 "merge two known; one far left, one far right" 18 21
141 141 $ commit 23 "merge one known; immediate left" 1 22
142 142 $ commit 24 "merge one known; immediate right" 0 23
143 143 $ commit 25 "merge one known; far left" 21 24
144 144 $ commit 26 "merge one known; far right" 18 25
145 145 $ commit 27 "collapse" 21
146 146 $ commit 28 "merge zero known" 1 26
147 147 $ commit 29 "regular commit" 0
148 148 $ commit 30 "expand" 28 29
149 149 $ commit 31 "expand" 21 30
150 150 $ commit 32 "expand" 27 31
151 151 $ commit 33 "head" 18
152 152 $ commit 34 "head" 32
153 153
154 154
155 155 $ hg glog -q
156 156 @ 34:fea3ac5810e0
157 157 |
158 158 | o 33:68608f5145f9
159 159 | |
160 160 o | 32:d06dffa21a31
161 161 |\ \
162 162 | o \ 31:621d83e11f67
163 163 | |\ \
164 164 | | o \ 30:6e11cd4b648f
165 165 | | |\ \
166 166 | | | o | 29:cd9bb2be7593
167 167 | | | | |
168 168 | | o | | 28:44ecd0b9ae99
169 169 | | |\ \ \
170 170 o | | | | | 27:886ed638191b
171 171 |/ / / / /
172 172 | | o---+ 26:7f25b6c2f0b9
173 173 | | | | |
174 174 +---o | | 25:91da8ed57247
175 175 | | | | |
176 176 | | o | | 24:a9c19a3d96b7
177 177 | | |\| |
178 178 | | o | | 23:a01cddf0766d
179 179 | |/| | |
180 180 +---o---+ 22:e0d9cccacb5d
181 181 | | / /
182 182 o | | | 21:d42a756af44d
183 183 |\ \ \ \
184 184 | o---+-+ 20:d30ed6450e32
185 185 | / / /
186 186 o | | | 19:31ddc2c1573b
187 187 |\ \ \ \
188 188 +---+---o 18:1aa84d96232a
189 189 | | | |
190 190 | o | | 17:44765d7c06e0
191 191 | |\ \ \
192 192 | | o---+ 16:3677d192927d
193 193 | | |/ /
194 194 o | | | 15:1dda3f72782d
195 195 |\ \ \ \
196 196 | o-----+ 14:8eac370358ef
197 197 | |/ / /
198 198 o | | | 13:22d8966a97e3
199 199 |\ \ \ \
200 200 +---o | | 12:86b91144a6e9
201 201 | | |/ /
202 202 | o | | 11:832d76e6bdf2
203 203 | |\ \ \
204 204 | | o---+ 10:74c64d036d72
205 205 | |/ / /
206 206 o | | | 9:7010c0af0a35
207 207 |\ \ \ \
208 208 | o-----+ 8:7a0b11f71937
209 209 |/ / / /
210 210 o | | | 7:b632bb1b1224
211 211 |\ \ \ \
212 212 +---o | | 6:b105a072e251
213 213 | |/ / /
214 214 | o | | 5:4409d547b708
215 215 | |\ \ \
216 216 | | o | | 4:26a8bac39d9f
217 217 | |/|/ /
218 218 | o / / 3:27eef8ed80b4
219 219 |/ / /
220 220 o / / 2:3d9a33b8d1e1
221 221 |/ /
222 222 o / 1:6db2ef61d156
223 223 |/
224 224 o 0:e6eb3150255d
225 225
226 226
227 227 $ hg glog
228 228 @ changeset: 34:fea3ac5810e0
229 229 | tag: tip
230 230 | parent: 32:d06dffa21a31
231 231 | user: test
232 232 | date: Thu Jan 01 00:00:34 1970 +0000
233 233 | summary: (34) head
234 234 |
235 235 | o changeset: 33:68608f5145f9
236 236 | | parent: 18:1aa84d96232a
237 237 | | user: test
238 238 | | date: Thu Jan 01 00:00:33 1970 +0000
239 239 | | summary: (33) head
240 240 | |
241 241 o | changeset: 32:d06dffa21a31
242 242 |\ \ parent: 27:886ed638191b
243 243 | | | parent: 31:621d83e11f67
244 244 | | | user: test
245 245 | | | date: Thu Jan 01 00:00:32 1970 +0000
246 246 | | | summary: (32) expand
247 247 | | |
248 248 | o | changeset: 31:621d83e11f67
249 249 | |\ \ parent: 21:d42a756af44d
250 250 | | | | parent: 30:6e11cd4b648f
251 251 | | | | user: test
252 252 | | | | date: Thu Jan 01 00:00:31 1970 +0000
253 253 | | | | summary: (31) expand
254 254 | | | |
255 255 | | o | changeset: 30:6e11cd4b648f
256 256 | | |\ \ parent: 28:44ecd0b9ae99
257 257 | | | | | parent: 29:cd9bb2be7593
258 258 | | | | | user: test
259 259 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
260 260 | | | | | summary: (30) expand
261 261 | | | | |
262 262 | | | o | changeset: 29:cd9bb2be7593
263 263 | | | | | parent: 0:e6eb3150255d
264 264 | | | | | user: test
265 265 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
266 266 | | | | | summary: (29) regular commit
267 267 | | | | |
268 268 | | o | | changeset: 28:44ecd0b9ae99
269 269 | | |\ \ \ parent: 1:6db2ef61d156
270 270 | | | | | | parent: 26:7f25b6c2f0b9
271 271 | | | | | | user: test
272 272 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
273 273 | | | | | | summary: (28) merge zero known
274 274 | | | | | |
275 275 o | | | | | changeset: 27:886ed638191b
276 276 |/ / / / / parent: 21:d42a756af44d
277 277 | | | | | user: test
278 278 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
279 279 | | | | | summary: (27) collapse
280 280 | | | | |
281 281 | | o---+ changeset: 26:7f25b6c2f0b9
282 282 | | | | | parent: 18:1aa84d96232a
283 283 | | | | | parent: 25:91da8ed57247
284 284 | | | | | user: test
285 285 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
286 286 | | | | | summary: (26) merge one known; far right
287 287 | | | | |
288 288 +---o | | changeset: 25:91da8ed57247
289 289 | | | | | parent: 21:d42a756af44d
290 290 | | | | | parent: 24:a9c19a3d96b7
291 291 | | | | | user: test
292 292 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
293 293 | | | | | summary: (25) merge one known; far left
294 294 | | | | |
295 295 | | o | | changeset: 24:a9c19a3d96b7
296 296 | | |\| | parent: 0:e6eb3150255d
297 297 | | | | | parent: 23:a01cddf0766d
298 298 | | | | | user: test
299 299 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
300 300 | | | | | summary: (24) merge one known; immediate right
301 301 | | | | |
302 302 | | o | | changeset: 23:a01cddf0766d
303 303 | |/| | | parent: 1:6db2ef61d156
304 304 | | | | | parent: 22:e0d9cccacb5d
305 305 | | | | | user: test
306 306 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
307 307 | | | | | summary: (23) merge one known; immediate left
308 308 | | | | |
309 309 +---o---+ changeset: 22:e0d9cccacb5d
310 310 | | | | parent: 18:1aa84d96232a
311 311 | | / / parent: 21:d42a756af44d
312 312 | | | | user: test
313 313 | | | | date: Thu Jan 01 00:00:22 1970 +0000
314 314 | | | | summary: (22) merge two known; one far left, one far right
315 315 | | | |
316 316 o | | | changeset: 21:d42a756af44d
317 317 |\ \ \ \ parent: 19:31ddc2c1573b
318 318 | | | | | parent: 20:d30ed6450e32
319 319 | | | | | user: test
320 320 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
321 321 | | | | | summary: (21) expand
322 322 | | | | |
323 323 | o---+-+ changeset: 20:d30ed6450e32
324 324 | | | | parent: 0:e6eb3150255d
325 325 | / / / parent: 18:1aa84d96232a
326 326 | | | | user: test
327 327 | | | | date: Thu Jan 01 00:00:20 1970 +0000
328 328 | | | | summary: (20) merge two known; two far right
329 329 | | | |
330 330 o | | | changeset: 19:31ddc2c1573b
331 331 |\ \ \ \ parent: 15:1dda3f72782d
332 332 | | | | | parent: 17:44765d7c06e0
333 333 | | | | | user: test
334 334 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
335 335 | | | | | summary: (19) expand
336 336 | | | | |
337 337 +---+---o changeset: 18:1aa84d96232a
338 338 | | | | parent: 1:6db2ef61d156
339 339 | | | | parent: 15:1dda3f72782d
340 340 | | | | user: test
341 341 | | | | date: Thu Jan 01 00:00:18 1970 +0000
342 342 | | | | summary: (18) merge two known; two far left
343 343 | | | |
344 344 | o | | changeset: 17:44765d7c06e0
345 345 | |\ \ \ parent: 12:86b91144a6e9
346 346 | | | | | parent: 16:3677d192927d
347 347 | | | | | user: test
348 348 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
349 349 | | | | | summary: (17) expand
350 350 | | | | |
351 351 | | o---+ changeset: 16:3677d192927d
352 352 | | | | | parent: 0:e6eb3150255d
353 353 | | |/ / parent: 1:6db2ef61d156
354 354 | | | | user: test
355 355 | | | | date: Thu Jan 01 00:00:16 1970 +0000
356 356 | | | | summary: (16) merge two known; one immediate right, one near right
357 357 | | | |
358 358 o | | | changeset: 15:1dda3f72782d
359 359 |\ \ \ \ parent: 13:22d8966a97e3
360 360 | | | | | parent: 14:8eac370358ef
361 361 | | | | | user: test
362 362 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
363 363 | | | | | summary: (15) expand
364 364 | | | | |
365 365 | o-----+ changeset: 14:8eac370358ef
366 366 | | | | | parent: 0:e6eb3150255d
367 367 | |/ / / parent: 12:86b91144a6e9
368 368 | | | | user: test
369 369 | | | | date: Thu Jan 01 00:00:14 1970 +0000
370 370 | | | | summary: (14) merge two known; one immediate right, one far right
371 371 | | | |
372 372 o | | | changeset: 13:22d8966a97e3
373 373 |\ \ \ \ parent: 9:7010c0af0a35
374 374 | | | | | parent: 11:832d76e6bdf2
375 375 | | | | | user: test
376 376 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
377 377 | | | | | summary: (13) expand
378 378 | | | | |
379 379 +---o | | changeset: 12:86b91144a6e9
380 380 | | |/ / parent: 1:6db2ef61d156
381 381 | | | | parent: 9:7010c0af0a35
382 382 | | | | user: test
383 383 | | | | date: Thu Jan 01 00:00:12 1970 +0000
384 384 | | | | summary: (12) merge two known; one immediate right, one far left
385 385 | | | |
386 386 | o | | changeset: 11:832d76e6bdf2
387 387 | |\ \ \ parent: 6:b105a072e251
388 388 | | | | | parent: 10:74c64d036d72
389 389 | | | | | user: test
390 390 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
391 391 | | | | | summary: (11) expand
392 392 | | | | |
393 393 | | o---+ changeset: 10:74c64d036d72
394 394 | | | | | parent: 0:e6eb3150255d
395 395 | |/ / / parent: 6:b105a072e251
396 396 | | | | user: test
397 397 | | | | date: Thu Jan 01 00:00:10 1970 +0000
398 398 | | | | summary: (10) merge two known; one immediate left, one near right
399 399 | | | |
400 400 o | | | changeset: 9:7010c0af0a35
401 401 |\ \ \ \ parent: 7:b632bb1b1224
402 402 | | | | | parent: 8:7a0b11f71937
403 403 | | | | | user: test
404 404 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
405 405 | | | | | summary: (9) expand
406 406 | | | | |
407 407 | o-----+ changeset: 8:7a0b11f71937
408 408 | | | | | parent: 0:e6eb3150255d
409 409 |/ / / / parent: 7:b632bb1b1224
410 410 | | | | user: test
411 411 | | | | date: Thu Jan 01 00:00:08 1970 +0000
412 412 | | | | summary: (8) merge two known; one immediate left, one far right
413 413 | | | |
414 414 o | | | changeset: 7:b632bb1b1224
415 415 |\ \ \ \ parent: 2:3d9a33b8d1e1
416 416 | | | | | parent: 5:4409d547b708
417 417 | | | | | user: test
418 418 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
419 419 | | | | | summary: (7) expand
420 420 | | | | |
421 421 +---o | | changeset: 6:b105a072e251
422 422 | |/ / / parent: 2:3d9a33b8d1e1
423 423 | | | | parent: 5:4409d547b708
424 424 | | | | user: test
425 425 | | | | date: Thu Jan 01 00:00:06 1970 +0000
426 426 | | | | summary: (6) merge two known; one immediate left, one far left
427 427 | | | |
428 428 | o | | changeset: 5:4409d547b708
429 429 | |\ \ \ parent: 3:27eef8ed80b4
430 430 | | | | | parent: 4:26a8bac39d9f
431 431 | | | | | user: test
432 432 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
433 433 | | | | | summary: (5) expand
434 434 | | | | |
435 435 | | o | | changeset: 4:26a8bac39d9f
436 436 | |/|/ / parent: 1:6db2ef61d156
437 437 | | | | parent: 3:27eef8ed80b4
438 438 | | | | user: test
439 439 | | | | date: Thu Jan 01 00:00:04 1970 +0000
440 440 | | | | summary: (4) merge two known; one immediate left, one immediate right
441 441 | | | |
442 442 | o | | changeset: 3:27eef8ed80b4
443 443 |/ / / user: test
444 444 | | | date: Thu Jan 01 00:00:03 1970 +0000
445 445 | | | summary: (3) collapse
446 446 | | |
447 447 o | | changeset: 2:3d9a33b8d1e1
448 448 |/ / user: test
449 449 | | date: Thu Jan 01 00:00:02 1970 +0000
450 450 | | summary: (2) collapse
451 451 | |
452 452 o | changeset: 1:6db2ef61d156
453 453 |/ user: test
454 454 | date: Thu Jan 01 00:00:01 1970 +0000
455 455 | summary: (1) collapse
456 456 |
457 457 o changeset: 0:e6eb3150255d
458 458 user: test
459 459 date: Thu Jan 01 00:00:00 1970 +0000
460 460 summary: (0) root
461 461
462 462
463 463 File glog:
464 464 $ hg glog a
465 465 @ changeset: 34:fea3ac5810e0
466 466 | tag: tip
467 467 | parent: 32:d06dffa21a31
468 468 | user: test
469 469 | date: Thu Jan 01 00:00:34 1970 +0000
470 470 | summary: (34) head
471 471 |
472 472 | o changeset: 33:68608f5145f9
473 473 | | parent: 18:1aa84d96232a
474 474 | | user: test
475 475 | | date: Thu Jan 01 00:00:33 1970 +0000
476 476 | | summary: (33) head
477 477 | |
478 478 o | changeset: 32:d06dffa21a31
479 479 |\ \ parent: 27:886ed638191b
480 480 | | | parent: 31:621d83e11f67
481 481 | | | user: test
482 482 | | | date: Thu Jan 01 00:00:32 1970 +0000
483 483 | | | summary: (32) expand
484 484 | | |
485 485 | o | changeset: 31:621d83e11f67
486 486 | |\ \ parent: 21:d42a756af44d
487 487 | | | | parent: 30:6e11cd4b648f
488 488 | | | | user: test
489 489 | | | | date: Thu Jan 01 00:00:31 1970 +0000
490 490 | | | | summary: (31) expand
491 491 | | | |
492 492 | | o | changeset: 30:6e11cd4b648f
493 493 | | |\ \ parent: 28:44ecd0b9ae99
494 494 | | | | | parent: 29:cd9bb2be7593
495 495 | | | | | user: test
496 496 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
497 497 | | | | | summary: (30) expand
498 498 | | | | |
499 499 | | | o | changeset: 29:cd9bb2be7593
500 500 | | | | | parent: 0:e6eb3150255d
501 501 | | | | | user: test
502 502 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
503 503 | | | | | summary: (29) regular commit
504 504 | | | | |
505 505 | | o | | changeset: 28:44ecd0b9ae99
506 506 | | |\ \ \ parent: 1:6db2ef61d156
507 507 | | | | | | parent: 26:7f25b6c2f0b9
508 508 | | | | | | user: test
509 509 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
510 510 | | | | | | summary: (28) merge zero known
511 511 | | | | | |
512 512 o | | | | | changeset: 27:886ed638191b
513 513 |/ / / / / parent: 21:d42a756af44d
514 514 | | | | | user: test
515 515 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
516 516 | | | | | summary: (27) collapse
517 517 | | | | |
518 518 | | o---+ changeset: 26:7f25b6c2f0b9
519 519 | | | | | parent: 18:1aa84d96232a
520 520 | | | | | parent: 25:91da8ed57247
521 521 | | | | | user: test
522 522 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
523 523 | | | | | summary: (26) merge one known; far right
524 524 | | | | |
525 525 +---o | | changeset: 25:91da8ed57247
526 526 | | | | | parent: 21:d42a756af44d
527 527 | | | | | parent: 24:a9c19a3d96b7
528 528 | | | | | user: test
529 529 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
530 530 | | | | | summary: (25) merge one known; far left
531 531 | | | | |
532 532 | | o | | changeset: 24:a9c19a3d96b7
533 533 | | |\| | parent: 0:e6eb3150255d
534 534 | | | | | parent: 23:a01cddf0766d
535 535 | | | | | user: test
536 536 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
537 537 | | | | | summary: (24) merge one known; immediate right
538 538 | | | | |
539 539 | | o | | changeset: 23:a01cddf0766d
540 540 | |/| | | parent: 1:6db2ef61d156
541 541 | | | | | parent: 22:e0d9cccacb5d
542 542 | | | | | user: test
543 543 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
544 544 | | | | | summary: (23) merge one known; immediate left
545 545 | | | | |
546 546 +---o---+ changeset: 22:e0d9cccacb5d
547 547 | | | | parent: 18:1aa84d96232a
548 548 | | / / parent: 21:d42a756af44d
549 549 | | | | user: test
550 550 | | | | date: Thu Jan 01 00:00:22 1970 +0000
551 551 | | | | summary: (22) merge two known; one far left, one far right
552 552 | | | |
553 553 o | | | changeset: 21:d42a756af44d
554 554 |\ \ \ \ parent: 19:31ddc2c1573b
555 555 | | | | | parent: 20:d30ed6450e32
556 556 | | | | | user: test
557 557 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
558 558 | | | | | summary: (21) expand
559 559 | | | | |
560 560 | o---+-+ changeset: 20:d30ed6450e32
561 561 | | | | parent: 0:e6eb3150255d
562 562 | / / / parent: 18:1aa84d96232a
563 563 | | | | user: test
564 564 | | | | date: Thu Jan 01 00:00:20 1970 +0000
565 565 | | | | summary: (20) merge two known; two far right
566 566 | | | |
567 567 o | | | changeset: 19:31ddc2c1573b
568 568 |\ \ \ \ parent: 15:1dda3f72782d
569 569 | | | | | parent: 17:44765d7c06e0
570 570 | | | | | user: test
571 571 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
572 572 | | | | | summary: (19) expand
573 573 | | | | |
574 574 +---+---o changeset: 18:1aa84d96232a
575 575 | | | | parent: 1:6db2ef61d156
576 576 | | | | parent: 15:1dda3f72782d
577 577 | | | | user: test
578 578 | | | | date: Thu Jan 01 00:00:18 1970 +0000
579 579 | | | | summary: (18) merge two known; two far left
580 580 | | | |
581 581 | o | | changeset: 17:44765d7c06e0
582 582 | |\ \ \ parent: 12:86b91144a6e9
583 583 | | | | | parent: 16:3677d192927d
584 584 | | | | | user: test
585 585 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
586 586 | | | | | summary: (17) expand
587 587 | | | | |
588 588 | | o---+ changeset: 16:3677d192927d
589 589 | | | | | parent: 0:e6eb3150255d
590 590 | | |/ / parent: 1:6db2ef61d156
591 591 | | | | user: test
592 592 | | | | date: Thu Jan 01 00:00:16 1970 +0000
593 593 | | | | summary: (16) merge two known; one immediate right, one near right
594 594 | | | |
595 595 o | | | changeset: 15:1dda3f72782d
596 596 |\ \ \ \ parent: 13:22d8966a97e3
597 597 | | | | | parent: 14:8eac370358ef
598 598 | | | | | user: test
599 599 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
600 600 | | | | | summary: (15) expand
601 601 | | | | |
602 602 | o-----+ changeset: 14:8eac370358ef
603 603 | | | | | parent: 0:e6eb3150255d
604 604 | |/ / / parent: 12:86b91144a6e9
605 605 | | | | user: test
606 606 | | | | date: Thu Jan 01 00:00:14 1970 +0000
607 607 | | | | summary: (14) merge two known; one immediate right, one far right
608 608 | | | |
609 609 o | | | changeset: 13:22d8966a97e3
610 610 |\ \ \ \ parent: 9:7010c0af0a35
611 611 | | | | | parent: 11:832d76e6bdf2
612 612 | | | | | user: test
613 613 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
614 614 | | | | | summary: (13) expand
615 615 | | | | |
616 616 +---o | | changeset: 12:86b91144a6e9
617 617 | | |/ / parent: 1:6db2ef61d156
618 618 | | | | parent: 9:7010c0af0a35
619 619 | | | | user: test
620 620 | | | | date: Thu Jan 01 00:00:12 1970 +0000
621 621 | | | | summary: (12) merge two known; one immediate right, one far left
622 622 | | | |
623 623 | o | | changeset: 11:832d76e6bdf2
624 624 | |\ \ \ parent: 6:b105a072e251
625 625 | | | | | parent: 10:74c64d036d72
626 626 | | | | | user: test
627 627 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
628 628 | | | | | summary: (11) expand
629 629 | | | | |
630 630 | | o---+ changeset: 10:74c64d036d72
631 631 | | | | | parent: 0:e6eb3150255d
632 632 | |/ / / parent: 6:b105a072e251
633 633 | | | | user: test
634 634 | | | | date: Thu Jan 01 00:00:10 1970 +0000
635 635 | | | | summary: (10) merge two known; one immediate left, one near right
636 636 | | | |
637 637 o | | | changeset: 9:7010c0af0a35
638 638 |\ \ \ \ parent: 7:b632bb1b1224
639 639 | | | | | parent: 8:7a0b11f71937
640 640 | | | | | user: test
641 641 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
642 642 | | | | | summary: (9) expand
643 643 | | | | |
644 644 | o-----+ changeset: 8:7a0b11f71937
645 645 | | | | | parent: 0:e6eb3150255d
646 646 |/ / / / parent: 7:b632bb1b1224
647 647 | | | | user: test
648 648 | | | | date: Thu Jan 01 00:00:08 1970 +0000
649 649 | | | | summary: (8) merge two known; one immediate left, one far right
650 650 | | | |
651 651 o | | | changeset: 7:b632bb1b1224
652 652 |\ \ \ \ parent: 2:3d9a33b8d1e1
653 653 | | | | | parent: 5:4409d547b708
654 654 | | | | | user: test
655 655 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
656 656 | | | | | summary: (7) expand
657 657 | | | | |
658 658 +---o | | changeset: 6:b105a072e251
659 659 | |/ / / parent: 2:3d9a33b8d1e1
660 660 | | | | parent: 5:4409d547b708
661 661 | | | | user: test
662 662 | | | | date: Thu Jan 01 00:00:06 1970 +0000
663 663 | | | | summary: (6) merge two known; one immediate left, one far left
664 664 | | | |
665 665 | o | | changeset: 5:4409d547b708
666 666 | |\ \ \ parent: 3:27eef8ed80b4
667 667 | | | | | parent: 4:26a8bac39d9f
668 668 | | | | | user: test
669 669 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
670 670 | | | | | summary: (5) expand
671 671 | | | | |
672 672 | | o | | changeset: 4:26a8bac39d9f
673 673 | |/|/ / parent: 1:6db2ef61d156
674 674 | | | | parent: 3:27eef8ed80b4
675 675 | | | | user: test
676 676 | | | | date: Thu Jan 01 00:00:04 1970 +0000
677 677 | | | | summary: (4) merge two known; one immediate left, one immediate right
678 678 | | | |
679 679 | o | | changeset: 3:27eef8ed80b4
680 680 |/ / / user: test
681 681 | | | date: Thu Jan 01 00:00:03 1970 +0000
682 682 | | | summary: (3) collapse
683 683 | | |
684 684 o | | changeset: 2:3d9a33b8d1e1
685 685 |/ / user: test
686 686 | | date: Thu Jan 01 00:00:02 1970 +0000
687 687 | | summary: (2) collapse
688 688 | |
689 689 o | changeset: 1:6db2ef61d156
690 690 |/ user: test
691 691 | date: Thu Jan 01 00:00:01 1970 +0000
692 692 | summary: (1) collapse
693 693 |
694 694 o changeset: 0:e6eb3150255d
695 695 user: test
696 696 date: Thu Jan 01 00:00:00 1970 +0000
697 697 summary: (0) root
698 698
699 699
700 700 File glog per revset:
701 701
702 702 $ hg glog -r 'file("a")'
703 703 @ changeset: 34:fea3ac5810e0
704 704 | tag: tip
705 705 | parent: 32:d06dffa21a31
706 706 | user: test
707 707 | date: Thu Jan 01 00:00:34 1970 +0000
708 708 | summary: (34) head
709 709 |
710 710 | o changeset: 33:68608f5145f9
711 711 | | parent: 18:1aa84d96232a
712 712 | | user: test
713 713 | | date: Thu Jan 01 00:00:33 1970 +0000
714 714 | | summary: (33) head
715 715 | |
716 716 o | changeset: 32:d06dffa21a31
717 717 |\ \ parent: 27:886ed638191b
718 718 | | | parent: 31:621d83e11f67
719 719 | | | user: test
720 720 | | | date: Thu Jan 01 00:00:32 1970 +0000
721 721 | | | summary: (32) expand
722 722 | | |
723 723 | o | changeset: 31:621d83e11f67
724 724 | |\ \ parent: 21:d42a756af44d
725 725 | | | | parent: 30:6e11cd4b648f
726 726 | | | | user: test
727 727 | | | | date: Thu Jan 01 00:00:31 1970 +0000
728 728 | | | | summary: (31) expand
729 729 | | | |
730 730 | | o | changeset: 30:6e11cd4b648f
731 731 | | |\ \ parent: 28:44ecd0b9ae99
732 732 | | | | | parent: 29:cd9bb2be7593
733 733 | | | | | user: test
734 734 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
735 735 | | | | | summary: (30) expand
736 736 | | | | |
737 737 | | | o | changeset: 29:cd9bb2be7593
738 738 | | | | | parent: 0:e6eb3150255d
739 739 | | | | | user: test
740 740 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
741 741 | | | | | summary: (29) regular commit
742 742 | | | | |
743 743 | | o | | changeset: 28:44ecd0b9ae99
744 744 | | |\ \ \ parent: 1:6db2ef61d156
745 745 | | | | | | parent: 26:7f25b6c2f0b9
746 746 | | | | | | user: test
747 747 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
748 748 | | | | | | summary: (28) merge zero known
749 749 | | | | | |
750 750 o | | | | | changeset: 27:886ed638191b
751 751 |/ / / / / parent: 21:d42a756af44d
752 752 | | | | | user: test
753 753 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
754 754 | | | | | summary: (27) collapse
755 755 | | | | |
756 756 | | o---+ changeset: 26:7f25b6c2f0b9
757 757 | | | | | parent: 18:1aa84d96232a
758 758 | | | | | parent: 25:91da8ed57247
759 759 | | | | | user: test
760 760 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
761 761 | | | | | summary: (26) merge one known; far right
762 762 | | | | |
763 763 +---o | | changeset: 25:91da8ed57247
764 764 | | | | | parent: 21:d42a756af44d
765 765 | | | | | parent: 24:a9c19a3d96b7
766 766 | | | | | user: test
767 767 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
768 768 | | | | | summary: (25) merge one known; far left
769 769 | | | | |
770 770 | | o | | changeset: 24:a9c19a3d96b7
771 771 | | |\| | parent: 0:e6eb3150255d
772 772 | | | | | parent: 23:a01cddf0766d
773 773 | | | | | user: test
774 774 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
775 775 | | | | | summary: (24) merge one known; immediate right
776 776 | | | | |
777 777 | | o | | changeset: 23:a01cddf0766d
778 778 | |/| | | parent: 1:6db2ef61d156
779 779 | | | | | parent: 22:e0d9cccacb5d
780 780 | | | | | user: test
781 781 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
782 782 | | | | | summary: (23) merge one known; immediate left
783 783 | | | | |
784 784 +---o---+ changeset: 22:e0d9cccacb5d
785 785 | | | | parent: 18:1aa84d96232a
786 786 | | / / parent: 21:d42a756af44d
787 787 | | | | user: test
788 788 | | | | date: Thu Jan 01 00:00:22 1970 +0000
789 789 | | | | summary: (22) merge two known; one far left, one far right
790 790 | | | |
791 791 o | | | changeset: 21:d42a756af44d
792 792 |\ \ \ \ parent: 19:31ddc2c1573b
793 793 | | | | | parent: 20:d30ed6450e32
794 794 | | | | | user: test
795 795 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
796 796 | | | | | summary: (21) expand
797 797 | | | | |
798 798 | o---+-+ changeset: 20:d30ed6450e32
799 799 | | | | parent: 0:e6eb3150255d
800 800 | / / / parent: 18:1aa84d96232a
801 801 | | | | user: test
802 802 | | | | date: Thu Jan 01 00:00:20 1970 +0000
803 803 | | | | summary: (20) merge two known; two far right
804 804 | | | |
805 805 o | | | changeset: 19:31ddc2c1573b
806 806 |\ \ \ \ parent: 15:1dda3f72782d
807 807 | | | | | parent: 17:44765d7c06e0
808 808 | | | | | user: test
809 809 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
810 810 | | | | | summary: (19) expand
811 811 | | | | |
812 812 +---+---o changeset: 18:1aa84d96232a
813 813 | | | | parent: 1:6db2ef61d156
814 814 | | | | parent: 15:1dda3f72782d
815 815 | | | | user: test
816 816 | | | | date: Thu Jan 01 00:00:18 1970 +0000
817 817 | | | | summary: (18) merge two known; two far left
818 818 | | | |
819 819 | o | | changeset: 17:44765d7c06e0
820 820 | |\ \ \ parent: 12:86b91144a6e9
821 821 | | | | | parent: 16:3677d192927d
822 822 | | | | | user: test
823 823 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
824 824 | | | | | summary: (17) expand
825 825 | | | | |
826 826 | | o---+ changeset: 16:3677d192927d
827 827 | | | | | parent: 0:e6eb3150255d
828 828 | | |/ / parent: 1:6db2ef61d156
829 829 | | | | user: test
830 830 | | | | date: Thu Jan 01 00:00:16 1970 +0000
831 831 | | | | summary: (16) merge two known; one immediate right, one near right
832 832 | | | |
833 833 o | | | changeset: 15:1dda3f72782d
834 834 |\ \ \ \ parent: 13:22d8966a97e3
835 835 | | | | | parent: 14:8eac370358ef
836 836 | | | | | user: test
837 837 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
838 838 | | | | | summary: (15) expand
839 839 | | | | |
840 840 | o-----+ changeset: 14:8eac370358ef
841 841 | | | | | parent: 0:e6eb3150255d
842 842 | |/ / / parent: 12:86b91144a6e9
843 843 | | | | user: test
844 844 | | | | date: Thu Jan 01 00:00:14 1970 +0000
845 845 | | | | summary: (14) merge two known; one immediate right, one far right
846 846 | | | |
847 847 o | | | changeset: 13:22d8966a97e3
848 848 |\ \ \ \ parent: 9:7010c0af0a35
849 849 | | | | | parent: 11:832d76e6bdf2
850 850 | | | | | user: test
851 851 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
852 852 | | | | | summary: (13) expand
853 853 | | | | |
854 854 +---o | | changeset: 12:86b91144a6e9
855 855 | | |/ / parent: 1:6db2ef61d156
856 856 | | | | parent: 9:7010c0af0a35
857 857 | | | | user: test
858 858 | | | | date: Thu Jan 01 00:00:12 1970 +0000
859 859 | | | | summary: (12) merge two known; one immediate right, one far left
860 860 | | | |
861 861 | o | | changeset: 11:832d76e6bdf2
862 862 | |\ \ \ parent: 6:b105a072e251
863 863 | | | | | parent: 10:74c64d036d72
864 864 | | | | | user: test
865 865 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
866 866 | | | | | summary: (11) expand
867 867 | | | | |
868 868 | | o---+ changeset: 10:74c64d036d72
869 869 | | | | | parent: 0:e6eb3150255d
870 870 | |/ / / parent: 6:b105a072e251
871 871 | | | | user: test
872 872 | | | | date: Thu Jan 01 00:00:10 1970 +0000
873 873 | | | | summary: (10) merge two known; one immediate left, one near right
874 874 | | | |
875 875 o | | | changeset: 9:7010c0af0a35
876 876 |\ \ \ \ parent: 7:b632bb1b1224
877 877 | | | | | parent: 8:7a0b11f71937
878 878 | | | | | user: test
879 879 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
880 880 | | | | | summary: (9) expand
881 881 | | | | |
882 882 | o-----+ changeset: 8:7a0b11f71937
883 883 | | | | | parent: 0:e6eb3150255d
884 884 |/ / / / parent: 7:b632bb1b1224
885 885 | | | | user: test
886 886 | | | | date: Thu Jan 01 00:00:08 1970 +0000
887 887 | | | | summary: (8) merge two known; one immediate left, one far right
888 888 | | | |
889 889 o | | | changeset: 7:b632bb1b1224
890 890 |\ \ \ \ parent: 2:3d9a33b8d1e1
891 891 | | | | | parent: 5:4409d547b708
892 892 | | | | | user: test
893 893 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
894 894 | | | | | summary: (7) expand
895 895 | | | | |
896 896 +---o | | changeset: 6:b105a072e251
897 897 | |/ / / parent: 2:3d9a33b8d1e1
898 898 | | | | parent: 5:4409d547b708
899 899 | | | | user: test
900 900 | | | | date: Thu Jan 01 00:00:06 1970 +0000
901 901 | | | | summary: (6) merge two known; one immediate left, one far left
902 902 | | | |
903 903 | o | | changeset: 5:4409d547b708
904 904 | |\ \ \ parent: 3:27eef8ed80b4
905 905 | | | | | parent: 4:26a8bac39d9f
906 906 | | | | | user: test
907 907 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
908 908 | | | | | summary: (5) expand
909 909 | | | | |
910 910 | | o | | changeset: 4:26a8bac39d9f
911 911 | |/|/ / parent: 1:6db2ef61d156
912 912 | | | | parent: 3:27eef8ed80b4
913 913 | | | | user: test
914 914 | | | | date: Thu Jan 01 00:00:04 1970 +0000
915 915 | | | | summary: (4) merge two known; one immediate left, one immediate right
916 916 | | | |
917 917 | o | | changeset: 3:27eef8ed80b4
918 918 |/ / / user: test
919 919 | | | date: Thu Jan 01 00:00:03 1970 +0000
920 920 | | | summary: (3) collapse
921 921 | | |
922 922 o | | changeset: 2:3d9a33b8d1e1
923 923 |/ / user: test
924 924 | | date: Thu Jan 01 00:00:02 1970 +0000
925 925 | | summary: (2) collapse
926 926 | |
927 927 o | changeset: 1:6db2ef61d156
928 928 |/ user: test
929 929 | date: Thu Jan 01 00:00:01 1970 +0000
930 930 | summary: (1) collapse
931 931 |
932 932 o changeset: 0:e6eb3150255d
933 933 user: test
934 934 date: Thu Jan 01 00:00:00 1970 +0000
935 935 summary: (0) root
936 936
937 937
938 938
939 939 File glog per revset (only merges):
940 940
941 941 $ hg log -G -r 'file("a")' -m
942 942 o changeset: 32:d06dffa21a31
943 943 |\ parent: 27:886ed638191b
944 944 | | parent: 31:621d83e11f67
945 945 | | user: test
946 946 | | date: Thu Jan 01 00:00:32 1970 +0000
947 947 | | summary: (32) expand
948 948 | |
949 949 o | changeset: 31:621d83e11f67
950 950 |\| parent: 21:d42a756af44d
951 951 | | parent: 30:6e11cd4b648f
952 952 | | user: test
953 953 | | date: Thu Jan 01 00:00:31 1970 +0000
954 954 | | summary: (31) expand
955 955 | |
956 956 o | changeset: 30:6e11cd4b648f
957 957 |\ \ parent: 28:44ecd0b9ae99
958 958 | | | parent: 29:cd9bb2be7593
959 959 | | | user: test
960 960 | | | date: Thu Jan 01 00:00:30 1970 +0000
961 961 | | | summary: (30) expand
962 962 | | |
963 963 o | | changeset: 28:44ecd0b9ae99
964 964 |\ \ \ parent: 1:6db2ef61d156
965 965 | | | | parent: 26:7f25b6c2f0b9
966 966 | | | | user: test
967 967 | | | | date: Thu Jan 01 00:00:28 1970 +0000
968 968 | | | | summary: (28) merge zero known
969 969 | | | |
970 970 o | | | changeset: 26:7f25b6c2f0b9
971 971 |\ \ \ \ parent: 18:1aa84d96232a
972 972 | | | | | parent: 25:91da8ed57247
973 973 | | | | | user: test
974 974 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
975 975 | | | | | summary: (26) merge one known; far right
976 976 | | | | |
977 977 | o-----+ changeset: 25:91da8ed57247
978 978 | | | | | parent: 21:d42a756af44d
979 979 | | | | | parent: 24:a9c19a3d96b7
980 980 | | | | | user: test
981 981 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
982 982 | | | | | summary: (25) merge one known; far left
983 983 | | | | |
984 984 | o | | | changeset: 24:a9c19a3d96b7
985 985 | |\ \ \ \ parent: 0:e6eb3150255d
986 986 | | | | | | parent: 23:a01cddf0766d
987 987 | | | | | | user: test
988 988 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000
989 989 | | | | | | summary: (24) merge one known; immediate right
990 990 | | | | | |
991 991 | o---+ | | changeset: 23:a01cddf0766d
992 992 | | | | | | parent: 1:6db2ef61d156
993 993 | | | | | | parent: 22:e0d9cccacb5d
994 994 | | | | | | user: test
995 995 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000
996 996 | | | | | | summary: (23) merge one known; immediate left
997 997 | | | | | |
998 998 | o-------+ changeset: 22:e0d9cccacb5d
999 999 | | | | | | parent: 18:1aa84d96232a
1000 1000 |/ / / / / parent: 21:d42a756af44d
1001 1001 | | | | | user: test
1002 1002 | | | | | date: Thu Jan 01 00:00:22 1970 +0000
1003 1003 | | | | | summary: (22) merge two known; one far left, one far right
1004 1004 | | | | |
1005 1005 | | | | o changeset: 21:d42a756af44d
1006 1006 | | | | |\ parent: 19:31ddc2c1573b
1007 1007 | | | | | | parent: 20:d30ed6450e32
1008 1008 | | | | | | user: test
1009 1009 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000
1010 1010 | | | | | | summary: (21) expand
1011 1011 | | | | | |
1012 1012 +-+-------o changeset: 20:d30ed6450e32
1013 1013 | | | | | parent: 0:e6eb3150255d
1014 1014 | | | | | parent: 18:1aa84d96232a
1015 1015 | | | | | user: test
1016 1016 | | | | | date: Thu Jan 01 00:00:20 1970 +0000
1017 1017 | | | | | summary: (20) merge two known; two far right
1018 1018 | | | | |
1019 1019 | | | | o changeset: 19:31ddc2c1573b
1020 1020 | | | | |\ parent: 15:1dda3f72782d
1021 1021 | | | | | | parent: 17:44765d7c06e0
1022 1022 | | | | | | user: test
1023 1023 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000
1024 1024 | | | | | | summary: (19) expand
1025 1025 | | | | | |
1026 1026 o---+---+ | changeset: 18:1aa84d96232a
1027 1027 | | | | | parent: 1:6db2ef61d156
1028 1028 / / / / / parent: 15:1dda3f72782d
1029 1029 | | | | | user: test
1030 1030 | | | | | date: Thu Jan 01 00:00:18 1970 +0000
1031 1031 | | | | | summary: (18) merge two known; two far left
1032 1032 | | | | |
1033 1033 | | | | o changeset: 17:44765d7c06e0
1034 1034 | | | | |\ parent: 12:86b91144a6e9
1035 1035 | | | | | | parent: 16:3677d192927d
1036 1036 | | | | | | user: test
1037 1037 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000
1038 1038 | | | | | | summary: (17) expand
1039 1039 | | | | | |
1040 1040 +-+-------o changeset: 16:3677d192927d
1041 1041 | | | | | parent: 0:e6eb3150255d
1042 1042 | | | | | parent: 1:6db2ef61d156
1043 1043 | | | | | user: test
1044 1044 | | | | | date: Thu Jan 01 00:00:16 1970 +0000
1045 1045 | | | | | summary: (16) merge two known; one immediate right, one near right
1046 1046 | | | | |
1047 1047 | | | o | changeset: 15:1dda3f72782d
1048 1048 | | | |\ \ parent: 13:22d8966a97e3
1049 1049 | | | | | | parent: 14:8eac370358ef
1050 1050 | | | | | | user: test
1051 1051 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000
1052 1052 | | | | | | summary: (15) expand
1053 1053 | | | | | |
1054 1054 +-------o | changeset: 14:8eac370358ef
1055 1055 | | | | |/ parent: 0:e6eb3150255d
1056 1056 | | | | | parent: 12:86b91144a6e9
1057 1057 | | | | | user: test
1058 1058 | | | | | date: Thu Jan 01 00:00:14 1970 +0000
1059 1059 | | | | | summary: (14) merge two known; one immediate right, one far right
1060 1060 | | | | |
1061 1061 | | | o | changeset: 13:22d8966a97e3
1062 1062 | | | |\ \ parent: 9:7010c0af0a35
1063 1063 | | | | | | parent: 11:832d76e6bdf2
1064 1064 | | | | | | user: test
1065 1065 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000
1066 1066 | | | | | | summary: (13) expand
1067 1067 | | | | | |
1068 1068 | +---+---o changeset: 12:86b91144a6e9
1069 1069 | | | | | parent: 1:6db2ef61d156
1070 1070 | | | | | parent: 9:7010c0af0a35
1071 1071 | | | | | user: test
1072 1072 | | | | | date: Thu Jan 01 00:00:12 1970 +0000
1073 1073 | | | | | summary: (12) merge two known; one immediate right, one far left
1074 1074 | | | | |
1075 1075 | | | | o changeset: 11:832d76e6bdf2
1076 1076 | | | | |\ parent: 6:b105a072e251
1077 1077 | | | | | | parent: 10:74c64d036d72
1078 1078 | | | | | | user: test
1079 1079 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000
1080 1080 | | | | | | summary: (11) expand
1081 1081 | | | | | |
1082 1082 +---------o changeset: 10:74c64d036d72
1083 1083 | | | | |/ parent: 0:e6eb3150255d
1084 1084 | | | | | parent: 6:b105a072e251
1085 1085 | | | | | user: test
1086 1086 | | | | | date: Thu Jan 01 00:00:10 1970 +0000
1087 1087 | | | | | summary: (10) merge two known; one immediate left, one near right
1088 1088 | | | | |
1089 1089 | | | o | changeset: 9:7010c0af0a35
1090 1090 | | | |\ \ parent: 7:b632bb1b1224
1091 1091 | | | | | | parent: 8:7a0b11f71937
1092 1092 | | | | | | user: test
1093 1093 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000
1094 1094 | | | | | | summary: (9) expand
1095 1095 | | | | | |
1096 1096 +-------o | changeset: 8:7a0b11f71937
1097 1097 | | | |/ / parent: 0:e6eb3150255d
1098 1098 | | | | | parent: 7:b632bb1b1224
1099 1099 | | | | | user: test
1100 1100 | | | | | date: Thu Jan 01 00:00:08 1970 +0000
1101 1101 | | | | | summary: (8) merge two known; one immediate left, one far right
1102 1102 | | | | |
1103 1103 | | | o | changeset: 7:b632bb1b1224
1104 1104 | | | |\ \ parent: 2:3d9a33b8d1e1
1105 1105 | | | | | | parent: 5:4409d547b708
1106 1106 | | | | | | user: test
1107 1107 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000
1108 1108 | | | | | | summary: (7) expand
1109 1109 | | | | | |
1110 1110 | | | +---o changeset: 6:b105a072e251
1111 1111 | | | | |/ parent: 2:3d9a33b8d1e1
1112 1112 | | | | | parent: 5:4409d547b708
1113 1113 | | | | | user: test
1114 1114 | | | | | date: Thu Jan 01 00:00:06 1970 +0000
1115 1115 | | | | | summary: (6) merge two known; one immediate left, one far left
1116 1116 | | | | |
1117 1117 | | | o | changeset: 5:4409d547b708
1118 1118 | | | |\ \ parent: 3:27eef8ed80b4
1119 1119 | | | | | | parent: 4:26a8bac39d9f
1120 1120 | | | | | | user: test
1121 1121 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000
1122 1122 | | | | | | summary: (5) expand
1123 1123 | | | | | |
1124 1124 | +---o | | changeset: 4:26a8bac39d9f
1125 1125 | | | |/ / parent: 1:6db2ef61d156
1126 1126 | | | | | parent: 3:27eef8ed80b4
1127 1127 | | | | | user: test
1128 1128 | | | | | date: Thu Jan 01 00:00:04 1970 +0000
1129 1129 | | | | | summary: (4) merge two known; one immediate left, one immediate right
1130 1130 | | | | |
1131 1131
1132 1132
1133 1133 Empty revision range - display nothing:
1134 1134 $ hg glog -r 1..0
1135 1135
1136 1136 $ cd ..
1137 1137
1138 1138 #if no-outer-repo
1139 1139
1140 1140 From outer space:
1141 1141 $ hg glog -l1 repo
1142 1142 @ changeset: 34:fea3ac5810e0
1143 1143 | tag: tip
1144 1144 | parent: 32:d06dffa21a31
1145 1145 | user: test
1146 1146 | date: Thu Jan 01 00:00:34 1970 +0000
1147 1147 | summary: (34) head
1148 1148 |
1149 1149 $ hg glog -l1 repo/a
1150 1150 @ changeset: 34:fea3ac5810e0
1151 1151 | tag: tip
1152 1152 | parent: 32:d06dffa21a31
1153 1153 | user: test
1154 1154 | date: Thu Jan 01 00:00:34 1970 +0000
1155 1155 | summary: (34) head
1156 1156 |
1157 1157 $ hg glog -l1 repo/missing
1158 1158
1159 1159 #endif
1160 1160
1161 1161 File log with revs != cset revs:
1162 1162 $ hg init flog
1163 1163 $ cd flog
1164 1164 $ echo one >one
1165 1165 $ hg add one
1166 1166 $ hg commit -mone
1167 1167 $ echo two >two
1168 1168 $ hg add two
1169 1169 $ hg commit -mtwo
1170 1170 $ echo more >two
1171 1171 $ hg commit -mmore
1172 1172 $ hg glog two
1173 1173 @ changeset: 2:12c28321755b
1174 1174 | tag: tip
1175 1175 | user: test
1176 1176 | date: Thu Jan 01 00:00:00 1970 +0000
1177 1177 | summary: more
1178 1178 |
1179 1179 o changeset: 1:5ac72c0599bf
1180 1180 | user: test
1181 1181 | date: Thu Jan 01 00:00:00 1970 +0000
1182 1182 | summary: two
1183 1183 |
1184 1184
1185 1185 Issue1896: File log with explicit style
1186 1186 $ hg glog --style=default one
1187 1187 o changeset: 0:3d578b4a1f53
1188 1188 user: test
1189 1189 date: Thu Jan 01 00:00:00 1970 +0000
1190 1190 summary: one
1191 1191
1192 1192 Issue2395: glog --style header and footer
1193 1193 $ hg glog --style=xml one
1194 1194 <?xml version="1.0"?>
1195 1195 <log>
1196 1196 o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
1197 1197 <author email="test">test</author>
1198 1198 <date>1970-01-01T00:00:00+00:00</date>
1199 1199 <msg xml:space="preserve">one</msg>
1200 1200 </logentry>
1201 1201 </log>
1202 1202
1203 1203 $ cd ..
1204 1204
1205 1205 Incoming and outgoing:
1206 1206
1207 1207 $ hg clone -U -r31 repo repo2
1208 1208 adding changesets
1209 1209 adding manifests
1210 1210 adding file changes
1211 1211 added 31 changesets with 31 changes to 1 files
1212 1212 $ cd repo2
1213 1213
1214 1214 $ hg incoming --graph ../repo
1215 1215 comparing with ../repo
1216 1216 searching for changes
1217 1217 o changeset: 34:fea3ac5810e0
1218 1218 | tag: tip
1219 1219 | parent: 32:d06dffa21a31
1220 1220 | user: test
1221 1221 | date: Thu Jan 01 00:00:34 1970 +0000
1222 1222 | summary: (34) head
1223 1223 |
1224 1224 | o changeset: 33:68608f5145f9
1225 1225 | parent: 18:1aa84d96232a
1226 1226 | user: test
1227 1227 | date: Thu Jan 01 00:00:33 1970 +0000
1228 1228 | summary: (33) head
1229 1229 |
1230 1230 o changeset: 32:d06dffa21a31
1231 1231 | parent: 27:886ed638191b
1232 1232 | parent: 31:621d83e11f67
1233 1233 | user: test
1234 1234 | date: Thu Jan 01 00:00:32 1970 +0000
1235 1235 | summary: (32) expand
1236 1236 |
1237 1237 o changeset: 27:886ed638191b
1238 1238 parent: 21:d42a756af44d
1239 1239 user: test
1240 1240 date: Thu Jan 01 00:00:27 1970 +0000
1241 1241 summary: (27) collapse
1242 1242
1243 1243 $ cd ..
1244 1244
1245 1245 $ hg -R repo outgoing --graph repo2
1246 1246 comparing with repo2
1247 1247 searching for changes
1248 1248 @ changeset: 34:fea3ac5810e0
1249 1249 | tag: tip
1250 1250 | parent: 32:d06dffa21a31
1251 1251 | user: test
1252 1252 | date: Thu Jan 01 00:00:34 1970 +0000
1253 1253 | summary: (34) head
1254 1254 |
1255 1255 | o changeset: 33:68608f5145f9
1256 1256 | parent: 18:1aa84d96232a
1257 1257 | user: test
1258 1258 | date: Thu Jan 01 00:00:33 1970 +0000
1259 1259 | summary: (33) head
1260 1260 |
1261 1261 o changeset: 32:d06dffa21a31
1262 1262 | parent: 27:886ed638191b
1263 1263 | parent: 31:621d83e11f67
1264 1264 | user: test
1265 1265 | date: Thu Jan 01 00:00:32 1970 +0000
1266 1266 | summary: (32) expand
1267 1267 |
1268 1268 o changeset: 27:886ed638191b
1269 1269 parent: 21:d42a756af44d
1270 1270 user: test
1271 1271 date: Thu Jan 01 00:00:27 1970 +0000
1272 1272 summary: (27) collapse
1273 1273
1274 1274
1275 1275 File + limit with revs != cset revs:
1276 1276 $ cd repo
1277 1277 $ touch b
1278 1278 $ hg ci -Aqm0
1279 1279 $ hg glog -l2 a
1280 1280 o changeset: 34:fea3ac5810e0
1281 1281 | parent: 32:d06dffa21a31
1282 1282 | user: test
1283 1283 | date: Thu Jan 01 00:00:34 1970 +0000
1284 1284 | summary: (34) head
1285 1285 |
1286 1286 | o changeset: 33:68608f5145f9
1287 1287 | | parent: 18:1aa84d96232a
1288 1288 | | user: test
1289 1289 | | date: Thu Jan 01 00:00:33 1970 +0000
1290 1290 | | summary: (33) head
1291 1291 | |
1292 1292
1293 1293 File + limit + -ra:b, (b - a) < limit:
1294 1294 $ hg glog -l3000 -r32:tip a
1295 1295 o changeset: 34:fea3ac5810e0
1296 1296 | parent: 32:d06dffa21a31
1297 1297 | user: test
1298 1298 | date: Thu Jan 01 00:00:34 1970 +0000
1299 1299 | summary: (34) head
1300 1300 |
1301 1301 | o changeset: 33:68608f5145f9
1302 1302 | | parent: 18:1aa84d96232a
1303 1303 | | user: test
1304 1304 | | date: Thu Jan 01 00:00:33 1970 +0000
1305 1305 | | summary: (33) head
1306 1306 | |
1307 1307 o | changeset: 32:d06dffa21a31
1308 1308 |\ \ parent: 27:886ed638191b
1309 1309 | | | parent: 31:621d83e11f67
1310 1310 | | | user: test
1311 1311 | | | date: Thu Jan 01 00:00:32 1970 +0000
1312 1312 | | | summary: (32) expand
1313 1313 | | |
1314 1314
1315 1315 Point out a common and an uncommon unshown parent
1316 1316
1317 1317 $ hg glog -r 'rev(8) or rev(9)'
1318 1318 o changeset: 9:7010c0af0a35
1319 1319 |\ parent: 7:b632bb1b1224
1320 1320 | | parent: 8:7a0b11f71937
1321 1321 | | user: test
1322 1322 | | date: Thu Jan 01 00:00:09 1970 +0000
1323 1323 | | summary: (9) expand
1324 1324 | |
1325 1325 o | changeset: 8:7a0b11f71937
1326 1326 |\| parent: 0:e6eb3150255d
1327 1327 | | parent: 7:b632bb1b1224
1328 1328 | | user: test
1329 1329 | | date: Thu Jan 01 00:00:08 1970 +0000
1330 1330 | | summary: (8) merge two known; one immediate left, one far right
1331 1331 | |
1332 1332
1333 1333 File + limit + -ra:b, b < tip:
1334 1334
1335 1335 $ hg glog -l1 -r32:34 a
1336 1336 o changeset: 34:fea3ac5810e0
1337 1337 | parent: 32:d06dffa21a31
1338 1338 | user: test
1339 1339 | date: Thu Jan 01 00:00:34 1970 +0000
1340 1340 | summary: (34) head
1341 1341 |
1342 1342
1343 1343 file(File) + limit + -ra:b, b < tip:
1344 1344
1345 1345 $ hg glog -l1 -r32:34 -r 'file("a")'
1346 1346 o changeset: 34:fea3ac5810e0
1347 1347 | parent: 32:d06dffa21a31
1348 1348 | user: test
1349 1349 | date: Thu Jan 01 00:00:34 1970 +0000
1350 1350 | summary: (34) head
1351 1351 |
1352 1352
1353 1353 limit(file(File) and a::b), b < tip:
1354 1354
1355 1355 $ hg glog -r 'limit(file("a") and 32::34, 1)'
1356 1356 o changeset: 32:d06dffa21a31
1357 1357 |\ parent: 27:886ed638191b
1358 1358 | | parent: 31:621d83e11f67
1359 1359 | | user: test
1360 1360 | | date: Thu Jan 01 00:00:32 1970 +0000
1361 1361 | | summary: (32) expand
1362 1362 | |
1363 1363
1364 1364 File + limit + -ra:b, b < tip:
1365 1365
1366 1366 $ hg glog -r 'limit(file("a") and 34::32, 1)'
1367 1367
1368 1368 File + limit + -ra:b, b < tip, (b - a) < limit:
1369 1369
1370 1370 $ hg glog -l10 -r33:34 a
1371 1371 o changeset: 34:fea3ac5810e0
1372 1372 | parent: 32:d06dffa21a31
1373 1373 | user: test
1374 1374 | date: Thu Jan 01 00:00:34 1970 +0000
1375 1375 | summary: (34) head
1376 1376 |
1377 1377 | o changeset: 33:68608f5145f9
1378 1378 | | parent: 18:1aa84d96232a
1379 1379 | | user: test
1380 1380 | | date: Thu Jan 01 00:00:33 1970 +0000
1381 1381 | | summary: (33) head
1382 1382 | |
1383 1383
1384 1384 Do not crash or produce strange graphs if history is buggy
1385 1385
1386 1386 $ hg branch branch
1387 1387 marked working directory as branch branch
1388 1388 (branches are permanent and global, did you want a bookmark?)
1389 1389 $ commit 36 "buggy merge: identical parents" 35 35
1390 1390 $ hg glog -l5
1391 1391 @ changeset: 36:08a19a744424
1392 1392 | branch: branch
1393 1393 | tag: tip
1394 1394 | parent: 35:9159c3644c5e
1395 1395 | parent: 35:9159c3644c5e
1396 1396 | user: test
1397 1397 | date: Thu Jan 01 00:00:36 1970 +0000
1398 1398 | summary: (36) buggy merge: identical parents
1399 1399 |
1400 1400 o changeset: 35:9159c3644c5e
1401 1401 | user: test
1402 1402 | date: Thu Jan 01 00:00:00 1970 +0000
1403 1403 | summary: 0
1404 1404 |
1405 1405 o changeset: 34:fea3ac5810e0
1406 1406 | parent: 32:d06dffa21a31
1407 1407 | user: test
1408 1408 | date: Thu Jan 01 00:00:34 1970 +0000
1409 1409 | summary: (34) head
1410 1410 |
1411 1411 | o changeset: 33:68608f5145f9
1412 1412 | | parent: 18:1aa84d96232a
1413 1413 | | user: test
1414 1414 | | date: Thu Jan 01 00:00:33 1970 +0000
1415 1415 | | summary: (33) head
1416 1416 | |
1417 1417 o | changeset: 32:d06dffa21a31
1418 1418 |\ \ parent: 27:886ed638191b
1419 1419 | | | parent: 31:621d83e11f67
1420 1420 | | | user: test
1421 1421 | | | date: Thu Jan 01 00:00:32 1970 +0000
1422 1422 | | | summary: (32) expand
1423 1423 | | |
1424 1424
1425 1425 Test log -G options
1426 1426
1427 1427 $ testlog() {
1428 1428 > hg log -G --print-revset "$@"
1429 1429 > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \
1430 1430 > | sed 's/.*nodetag/nodetag/' > log.nodes
1431 1431 > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
1432 1432 > | sed 's/.*nodetag/nodetag/' > glog.nodes
1433 1433 > diff -u log.nodes glog.nodes | 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 (func
1459 1459 ('symbol', 'user')
1460 1460 ('string', 'test'))
1461 1461 (func
1462 1462 ('symbol', 'user')
1463 1463 ('string', 'not-a-user')))))
1464 1464 $ testlog -b not-a-branch
1465 1465 abort: unknown revision 'not-a-branch'!
1466 1466 abort: unknown revision 'not-a-branch'!
1467 1467 abort: unknown revision 'not-a-branch'!
1468 1468 $ testlog -b 35 -b 36 --only-branch branch
1469 1469 []
1470 1470 (group
1471 1471 (group
1472 1472 (or
1473 1473 (or
1474 1474 (func
1475 1475 ('symbol', 'branch')
1476 1476 ('string', 'default'))
1477 1477 (func
1478 1478 ('symbol', 'branch')
1479 1479 ('string', 'branch')))
1480 1480 (func
1481 1481 ('symbol', 'branch')
1482 1482 ('string', 'branch')))))
1483 1483 $ testlog -k expand -k merge
1484 1484 []
1485 1485 (group
1486 1486 (group
1487 1487 (or
1488 1488 (func
1489 1489 ('symbol', 'keyword')
1490 1490 ('string', 'expand'))
1491 1491 (func
1492 1492 ('symbol', 'keyword')
1493 1493 ('string', 'merge')))))
1494 1494 $ testlog --only-merges
1495 1495 []
1496 1496 (group
1497 1497 (func
1498 1498 ('symbol', 'merge')
1499 1499 None))
1500 1500 $ testlog --no-merges
1501 1501 []
1502 1502 (group
1503 1503 (not
1504 1504 (func
1505 1505 ('symbol', 'merge')
1506 1506 None)))
1507 1507 $ testlog --date '2 0 to 4 0'
1508 1508 []
1509 1509 (group
1510 1510 (func
1511 1511 ('symbol', 'date')
1512 1512 ('string', '2 0 to 4 0')))
1513 1513 $ hg log -G -d 'brace ) in a date'
1514 1514 abort: invalid date: 'brace ) in a date'
1515 1515 [255]
1516 1516 $ testlog --prune 31 --prune 32
1517 1517 []
1518 1518 (group
1519 1519 (group
1520 1520 (and
1521 1521 (not
1522 1522 (group
1523 1523 (or
1524 1524 ('string', '31')
1525 1525 (func
1526 1526 ('symbol', 'ancestors')
1527 1527 ('string', '31')))))
1528 1528 (not
1529 1529 (group
1530 1530 (or
1531 1531 ('string', '32')
1532 1532 (func
1533 1533 ('symbol', 'ancestors')
1534 1534 ('string', '32'))))))))
1535 1535
1536 1536 Dedicated repo for --follow and paths filtering. The g is crafted to
1537 1537 have 2 filelog topological heads in a linear changeset graph.
1538 1538
1539 1539 $ cd ..
1540 1540 $ hg init follow
1541 1541 $ cd follow
1542 1542 $ testlog --follow
1543 1543 []
1544 1544 []
1545 1545 $ echo a > a
1546 1546 $ echo aa > aa
1547 1547 $ echo f > f
1548 1548 $ hg ci -Am "add a" a aa f
1549 1549 $ hg cp a b
1550 1550 $ hg cp f g
1551 1551 $ hg ci -m "copy a b"
1552 1552 $ mkdir dir
1553 1553 $ hg mv b dir
1554 1554 $ echo g >> g
1555 1555 $ echo f >> f
1556 1556 $ hg ci -m "mv b dir/b"
1557 1557 $ hg mv a b
1558 1558 $ hg cp -f f g
1559 1559 $ echo a > d
1560 1560 $ hg add d
1561 1561 $ hg ci -m "mv a b; add d"
1562 1562 $ hg mv dir/b e
1563 1563 $ hg ci -m "mv dir/b e"
1564 1564 $ hg glog --template '({rev}) {desc|firstline}\n'
1565 1565 @ (4) mv dir/b e
1566 1566 |
1567 1567 o (3) mv a b; add d
1568 1568 |
1569 1569 o (2) mv b dir/b
1570 1570 |
1571 1571 o (1) copy a b
1572 1572 |
1573 1573 o (0) add a
1574 1574
1575 1575
1576 1576 $ testlog a
1577 1577 []
1578 1578 (group
1579 1579 (group
1580 1580 (func
1581 1581 ('symbol', 'filelog')
1582 1582 ('string', 'a'))))
1583 1583 $ testlog a b
1584 1584 []
1585 1585 (group
1586 1586 (group
1587 1587 (or
1588 1588 (func
1589 1589 ('symbol', 'filelog')
1590 1590 ('string', 'a'))
1591 1591 (func
1592 1592 ('symbol', 'filelog')
1593 1593 ('string', 'b')))))
1594 1594
1595 1595 Test falling back to slow path for non-existing files
1596 1596
1597 1597 $ testlog a c
1598 1598 []
1599 1599 (group
1600 1600 (func
1601 1601 ('symbol', '_matchfiles')
1602 1602 (list
1603 1603 (list
1604 1604 (list
1605 1605 ('string', 'r:')
1606 1606 ('string', 'd:relpath'))
1607 1607 ('string', 'p:a'))
1608 1608 ('string', 'p:c'))))
1609 1609
1610 1610 Test multiple --include/--exclude/paths
1611 1611
1612 1612 $ testlog --include a --include e --exclude b --exclude e a e
1613 1613 []
1614 1614 (group
1615 1615 (func
1616 1616 ('symbol', '_matchfiles')
1617 1617 (list
1618 1618 (list
1619 1619 (list
1620 1620 (list
1621 1621 (list
1622 1622 (list
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 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 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 file not in parent revision
1657 1657
1658 1658 $ testlog -f a
1659 1659 abort: cannot follow file not in parent revision: "a"
1660 1660 abort: cannot follow file not in parent revision: "a"
1661 1661 abort: cannot follow file not in parent revision: "a"
1662 1662
1663 1663 Test --follow and patterns
1664 1664
1665 1665 $ testlog -f 'glob:*'
1666 1666 abort: can only follow copies/renames for explicit filenames
1667 1667 abort: can only follow copies/renames for explicit filenames
1668 1668 abort: can only follow copies/renames for explicit filenames
1669 1669
1670 1670 Test --follow on a single rename
1671 1671
1672 1672 $ hg up -q 2
1673 1673 $ testlog -f a
1674 1674 []
1675 1675 (group
1676 1676 (group
1677 1677 (func
1678 1678 ('symbol', 'follow')
1679 1679 ('string', 'a'))))
1680 1680
1681 1681 Test --follow and multiple renames
1682 1682
1683 1683 $ hg up -q tip
1684 1684 $ testlog -f e
1685 1685 []
1686 1686 (group
1687 1687 (group
1688 1688 (func
1689 1689 ('symbol', 'follow')
1690 1690 ('string', 'e'))))
1691 1691
1692 1692 Test --follow and multiple filelog heads
1693 1693
1694 1694 $ hg up -q 2
1695 1695 $ testlog -f g
1696 1696 []
1697 1697 (group
1698 1698 (group
1699 1699 (func
1700 1700 ('symbol', 'follow')
1701 1701 ('string', 'g'))))
1702 1702 $ cat log.nodes
1703 1703 nodetag 2
1704 1704 nodetag 1
1705 1705 nodetag 0
1706 1706 $ hg up -q tip
1707 1707 $ testlog -f g
1708 1708 []
1709 1709 (group
1710 1710 (group
1711 1711 (func
1712 1712 ('symbol', 'follow')
1713 1713 ('string', 'g'))))
1714 1714 $ cat log.nodes
1715 1715 nodetag 3
1716 1716 nodetag 2
1717 1717 nodetag 0
1718 1718
1719 1719 Test --follow and multiple files
1720 1720
1721 1721 $ testlog -f g e
1722 1722 []
1723 1723 (group
1724 1724 (group
1725 1725 (or
1726 1726 (func
1727 1727 ('symbol', 'follow')
1728 1728 ('string', 'g'))
1729 1729 (func
1730 1730 ('symbol', 'follow')
1731 1731 ('string', 'e')))))
1732 1732 $ cat log.nodes
1733 1733 nodetag 4
1734 1734 nodetag 3
1735 1735 nodetag 2
1736 1736 nodetag 1
1737 1737 nodetag 0
1738 1738
1739 1739 Test --follow-first
1740 1740
1741 1741 $ hg up -q 3
1742 1742 $ echo ee > e
1743 1743 $ hg ci -Am "add another e" e
1744 1744 created new head
1745 1745 $ hg merge --tool internal:other 4
1746 1746 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
1747 1747 (branch merge, don't forget to commit)
1748 1748 $ echo merge > e
1749 1749 $ hg ci -m "merge 5 and 4"
1750 1750 $ testlog --follow-first
1751 1751 []
1752 1752 (group
1753 1753 (func
1754 1754 ('symbol', '_firstancestors')
1755 1755 ('symbol', '6')))
1756 1756
1757 1757 Cannot compare with log --follow-first FILE as it never worked
1758 1758
1759 1759 $ hg log -G --print-revset --follow-first e
1760 1760 []
1761 1761 (group
1762 1762 (group
1763 1763 (func
1764 1764 ('symbol', '_followfirst')
1765 1765 ('string', 'e'))))
1766 1766 $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
1767 1767 @ 6 merge 5 and 4
1768 1768 |\
1769 1769 o | 5 add another e
1770 1770 | |
1771 1771
1772 1772 Test --copies
1773 1773
1774 1774 $ hg log -G --copies --template "{rev} {desc|firstline} \
1775 1775 > copies: {file_copies_switch}\n"
1776 1776 @ 6 merge 5 and 4 copies:
1777 1777 |\
1778 1778 | o 5 add another e copies:
1779 1779 | |
1780 1780 o | 4 mv dir/b e copies: e (dir/b)
1781 1781 |/
1782 1782 o 3 mv a b; add d copies: b (a)g (f)
1783 1783 |
1784 1784 o 2 mv b dir/b copies: dir/b (b)
1785 1785 |
1786 1786 o 1 copy a b copies: b (a)g (f)
1787 1787 |
1788 1788 o 0 add a copies:
1789 1789
1790 1790 Test "set:..." and parent revision
1791 1791
1792 1792 $ hg up -q 4
1793 1793 $ testlog "set:copied()"
1794 1794 []
1795 1795 (group
1796 1796 (func
1797 1797 ('symbol', '_matchfiles')
1798 1798 (list
1799 1799 (list
1800 1800 ('string', 'r:')
1801 1801 ('string', 'd:relpath'))
1802 1802 ('string', 'p:set:copied()'))))
1803 1803 $ testlog --include "set:copied()"
1804 1804 []
1805 1805 (group
1806 1806 (func
1807 1807 ('symbol', '_matchfiles')
1808 1808 (list
1809 1809 (list
1810 1810 ('string', 'r:')
1811 1811 ('string', 'd:relpath'))
1812 1812 ('string', 'i:set:copied()'))))
1813 1813 $ testlog -r "sort(file('set:copied()'), -rev)"
1814 1814 ["sort(file('set:copied()'), -rev)"]
1815 1815 []
1816 1816
1817 1817 Test --removed
1818 1818
1819 1819 $ testlog --removed
1820 1820 []
1821 1821 []
1822 1822 $ testlog --removed a
1823 1823 []
1824 1824 (group
1825 1825 (func
1826 1826 ('symbol', '_matchfiles')
1827 1827 (list
1828 1828 (list
1829 1829 ('string', 'r:')
1830 1830 ('string', 'd:relpath'))
1831 1831 ('string', 'p:a'))))
1832 1832 $ testlog --removed --follow a
1833 1833 abort: can only follow copies/renames for explicit filenames
1834 1834 abort: can only follow copies/renames for explicit filenames
1835 1835 abort: can only follow copies/renames for explicit filenames
1836 1836
1837 1837 Test --patch and --stat with --follow and --follow-first
1838 1838
1839 1839 $ hg up -q 3
1840 1840 $ hg log -G --git --patch b
1841 1841 o changeset: 1:216d4c92cf98
1842 1842 | user: test
1843 1843 | date: Thu Jan 01 00:00:00 1970 +0000
1844 1844 | summary: copy a b
1845 1845 |
1846 1846 | diff --git a/a b/b
1847 1847 | copy from a
1848 1848 | copy to b
1849 1849 |
1850 1850
1851 1851 $ hg log -G --git --stat b
1852 1852 o changeset: 1:216d4c92cf98
1853 1853 | user: test
1854 1854 | date: Thu Jan 01 00:00:00 1970 +0000
1855 1855 | summary: copy a b
1856 1856 |
1857 1857 | a | 0
1858 1858 | 1 files changed, 0 insertions(+), 0 deletions(-)
1859 1859 |
1860 1860
1861 1861 $ hg log -G --git --patch --follow b
1862 1862 o changeset: 1:216d4c92cf98
1863 1863 | user: test
1864 1864 | date: Thu Jan 01 00:00:00 1970 +0000
1865 1865 | summary: copy a b
1866 1866 |
1867 1867 | diff --git a/a b/b
1868 1868 | copy from a
1869 1869 | copy to b
1870 1870 |
1871 1871 o changeset: 0:f8035bb17114
1872 1872 user: test
1873 1873 date: Thu Jan 01 00:00:00 1970 +0000
1874 1874 summary: add a
1875 1875
1876 1876 diff --git a/a b/a
1877 1877 new file mode 100644
1878 1878 --- /dev/null
1879 1879 +++ b/a
1880 1880 @@ -0,0 +1,1 @@
1881 1881 +a
1882 1882
1883 1883
1884 1884 $ hg log -G --git --stat --follow b
1885 1885 o changeset: 1:216d4c92cf98
1886 1886 | user: test
1887 1887 | date: Thu Jan 01 00:00:00 1970 +0000
1888 1888 | summary: copy a b
1889 1889 |
1890 1890 | a | 0
1891 1891 | 1 files changed, 0 insertions(+), 0 deletions(-)
1892 1892 |
1893 1893 o changeset: 0:f8035bb17114
1894 1894 user: test
1895 1895 date: Thu Jan 01 00:00:00 1970 +0000
1896 1896 summary: add a
1897 1897
1898 1898 a | 1 +
1899 1899 1 files changed, 1 insertions(+), 0 deletions(-)
1900 1900
1901 1901
1902 1902 $ hg up -q 6
1903 1903 $ hg log -G --git --patch --follow-first e
1904 1904 @ changeset: 6:fc281d8ff18d
1905 1905 |\ tag: tip
1906 1906 | | parent: 5:99b31f1c2782
1907 1907 | | parent: 4:17d952250a9d
1908 1908 | | user: test
1909 1909 | | date: Thu Jan 01 00:00:00 1970 +0000
1910 1910 | | summary: merge 5 and 4
1911 1911 | |
1912 1912 | | diff --git a/e b/e
1913 1913 | | --- a/e
1914 1914 | | +++ b/e
1915 1915 | | @@ -1,1 +1,1 @@
1916 1916 | | -ee
1917 1917 | | +merge
1918 1918 | |
1919 1919 o | changeset: 5:99b31f1c2782
1920 1920 | | parent: 3:5918b8d165d1
1921 1921 | | user: test
1922 1922 | | date: Thu Jan 01 00:00:00 1970 +0000
1923 1923 | | summary: add another e
1924 1924 | |
1925 1925 | | diff --git a/e b/e
1926 1926 | | new file mode 100644
1927 1927 | | --- /dev/null
1928 1928 | | +++ b/e
1929 1929 | | @@ -0,0 +1,1 @@
1930 1930 | | +ee
1931 1931 | |
1932 1932
1933 1933 Test old-style --rev
1934 1934
1935 1935 $ hg tag 'foo-bar'
1936 1936 $ testlog -r 'foo-bar'
1937 1937 ['foo-bar']
1938 1938 []
1939 1939
1940 1940 Test --follow and forward --rev
1941 1941
1942 1942 $ hg up -q 6
1943 1943 $ echo g > g
1944 1944 $ hg ci -Am 'add g' g
1945 1945 created new head
1946 1946 $ hg up -q 2
1947 1947 $ hg log -G --template "{rev} {desc|firstline}\n"
1948 1948 o 8 add g
1949 1949 |
1950 1950 | o 7 Added tag foo-bar for changeset fc281d8ff18d
1951 1951 |/
1952 1952 o 6 merge 5 and 4
1953 1953 |\
1954 1954 | o 5 add another e
1955 1955 | |
1956 1956 o | 4 mv dir/b e
1957 1957 |/
1958 1958 o 3 mv a b; add d
1959 1959 |
1960 1960 @ 2 mv b dir/b
1961 1961 |
1962 1962 o 1 copy a b
1963 1963 |
1964 1964 o 0 add a
1965 1965
1966 1966 $ testlog --follow -r6 -r8 -r5 -r7 -r4
1967 1967 ['6', '8', '5', '7', '4']
1968 1968 (group
1969 1969 (func
1970 1970 ('symbol', 'descendants')
1971 1971 ('symbol', '6')))
1972 1972 --- log.nodes * (glob)
1973 1973 +++ glog.nodes * (glob)
1974 1974 @@ -1,3 +1,3 @@
1975 1975 -nodetag 6
1976 1976 nodetag 8
1977 1977 nodetag 7
1978 1978 +nodetag 6
1979 1979
1980 1980 Test --follow-first and forward --rev
1981 1981
1982 1982 $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
1983 1983 ['6', '8', '5', '7', '4']
1984 1984 (group
1985 1985 (func
1986 1986 ('symbol', '_firstdescendants')
1987 1987 ('symbol', '6')))
1988 1988 --- log.nodes * (glob)
1989 1989 +++ glog.nodes * (glob)
1990 1990 @@ -1,3 +1,3 @@
1991 1991 -nodetag 6
1992 1992 nodetag 8
1993 1993 nodetag 7
1994 1994 +nodetag 6
1995 1995
1996 1996 Test --follow and backward --rev
1997 1997
1998 1998 $ testlog --follow -r6 -r5 -r7 -r8 -r4
1999 1999 ['6', '5', '7', '8', '4']
2000 2000 (group
2001 2001 (func
2002 2002 ('symbol', 'ancestors')
2003 2003 ('symbol', '6')))
2004 2004
2005 2005 Test --follow-first and backward --rev
2006 2006
2007 2007 $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
2008 2008 ['6', '5', '7', '8', '4']
2009 2009 (group
2010 2010 (func
2011 2011 ('symbol', '_firstancestors')
2012 2012 ('symbol', '6')))
2013 2013
2014 2014 Test subdir
2015 2015
2016 2016 $ hg up -q 3
2017 2017 $ cd dir
2018 2018 $ testlog .
2019 2019 []
2020 2020 (group
2021 2021 (func
2022 2022 ('symbol', '_matchfiles')
2023 2023 (list
2024 2024 (list
2025 2025 ('string', 'r:')
2026 2026 ('string', 'd:relpath'))
2027 2027 ('string', 'p:.'))))
2028 2028 $ testlog ../b
2029 2029 []
2030 2030 (group
2031 2031 (group
2032 2032 (func
2033 2033 ('symbol', 'filelog')
2034 2034 ('string', '../b'))))
2035 2035 $ testlog -f ../b
2036 2036 []
2037 2037 (group
2038 2038 (group
2039 2039 (func
2040 2040 ('symbol', 'follow')
2041 2041 ('string', 'b'))))
2042 2042 $ cd ..
2043 2043
2044 2044 Test --hidden
2045 2045
2046 2046 $ cat > $HGTMP/testhidden.py << EOF
2047 2047 > def reposetup(ui, repo):
2048 2048 > for line in repo.opener('hidden'):
2049 2049 > ctx = repo[line.strip()]
2050 2050 > repo.hiddenrevs.add(ctx.rev())
2051 2051 > EOF
2052 2052 $ echo '[extensions]' >> .hg/hgrc
2053 2053 $ echo "hidden=$HGTMP/testhidden.py" >> .hg/hgrc
2054 2054 $ hg id --debug -i -r 0 > .hg/hidden
2055 2055 $ testlog
2056 2056 []
2057 2057 []
2058 2058 $ testlog --hidden
2059 2059 []
2060 2060 []
2061 2061
2062 2062 A template without trailing newline should do something sane
2063 2063
2064 2064 $ hg glog -r ::2 --template '{rev} {desc}'
2065 2065 o 2 mv b dir/b
2066 2066 |
2067 2067 o 1 copy a b
2068 2068 |
2069 2069
2070 2070 Extra newlines must be preserved
2071 2071
2072 2072 $ hg glog -r ::2 --template '\n{rev} {desc}\n\n'
2073 2073 o
2074 2074 | 2 mv b dir/b
2075 2075 |
2076 2076 o
2077 2077 | 1 copy a b
2078 2078 |
2079 2079
2080 2080 The almost-empty template should do something sane too ...
2081 2081
2082 2082 $ hg glog -r ::2 --template '\n'
2083 2083 o
2084 2084 |
2085 2085 o
2086 2086 |
2087 2087
2088 2088 $ cd ..
@@ -1,611 +1,611
1 1 $ hg init repo
2 2 $ cd repo
3 3
4 4 New file:
5 5
6 6 $ hg import -d "1000000 0" -mnew - <<EOF
7 7 > diff --git a/new b/new
8 8 > new file mode 100644
9 9 > index 0000000..7898192
10 10 > --- /dev/null
11 11 > +++ b/new
12 12 > @@ -0,0 +1 @@
13 13 > +a
14 14 > EOF
15 15 applying patch from stdin
16 16
17 17 $ hg tip -q
18 18 0:ae3ee40d2079
19 19
20 20 New empty file:
21 21
22 22 $ hg import -d "1000000 0" -mempty - <<EOF
23 23 > diff --git a/empty b/empty
24 24 > new file mode 100644
25 25 > EOF
26 26 applying patch from stdin
27 27
28 28 $ hg tip -q
29 29 1:ab199dc869b5
30 30
31 31 $ hg locate empty
32 32 empty
33 33
34 34 chmod +x:
35 35
36 36 $ hg import -d "1000000 0" -msetx - <<EOF
37 37 > diff --git a/new b/new
38 38 > old mode 100644
39 39 > new mode 100755
40 40 > EOF
41 41 applying patch from stdin
42 42
43 43 #if execbit
44 44 $ hg tip -q
45 45 2:3a34410f282e
46 46 $ test -x new
47 47 $ hg rollback -q
48 48 #else
49 49 $ hg tip -q
50 50 1:ab199dc869b5
51 51 #endif
52 52
53 53 Copy and removing x bit:
54 54
55 55 $ hg import -f -d "1000000 0" -mcopy - <<EOF
56 56 > diff --git a/new b/copy
57 57 > old mode 100755
58 58 > new mode 100644
59 59 > similarity index 100%
60 60 > copy from new
61 61 > copy to copy
62 62 > diff --git a/new b/copyx
63 63 > similarity index 100%
64 64 > copy from new
65 65 > copy to copyx
66 66 > EOF
67 67 applying patch from stdin
68 68
69 69 $ test -f copy
70 70 #if execbit
71 71 $ test ! -x copy
72 72 $ test -x copyx
73 73 $ hg tip -q
74 74 2:21dfaae65c71
75 75 #else
76 76 $ hg tip -q
77 77 2:0efdaa8e3bf3
78 78 #endif
79 79
80 80 $ hg up -qCr1
81 81 $ hg rollback -q
82 82
83 83 Copy (like above but independent of execbit):
84 84
85 85 $ hg import -d "1000000 0" -mcopy - <<EOF
86 86 > diff --git a/new b/copy
87 87 > similarity index 100%
88 88 > copy from new
89 89 > copy to copy
90 90 > diff --git a/new b/copyx
91 91 > similarity index 100%
92 92 > copy from new
93 93 > copy to copyx
94 94 > EOF
95 95 applying patch from stdin
96 96
97 97 $ hg tip -q
98 98 2:0efdaa8e3bf3
99 99 $ test -f copy
100 100
101 101 $ cat copy
102 102 a
103 103
104 104 $ hg cat copy
105 105 a
106 106
107 107 Rename:
108 108
109 109 $ hg import -d "1000000 0" -mrename - <<EOF
110 110 > diff --git a/copy b/rename
111 111 > similarity index 100%
112 112 > rename from copy
113 113 > rename to rename
114 114 > EOF
115 115 applying patch from stdin
116 116
117 117 $ hg tip -q
118 118 3:b1f57753fad2
119 119
120 120 $ hg locate
121 121 copyx
122 122 empty
123 123 new
124 124 rename
125 125
126 126 Delete:
127 127
128 128 $ hg import -d "1000000 0" -mdelete - <<EOF
129 129 > diff --git a/copyx b/copyx
130 130 > deleted file mode 100755
131 131 > index 7898192..0000000
132 132 > --- a/copyx
133 133 > +++ /dev/null
134 134 > @@ -1 +0,0 @@
135 135 > -a
136 136 > EOF
137 137 applying patch from stdin
138 138
139 139 $ hg tip -q
140 140 4:1bd1da94b9b2
141 141
142 142 $ hg locate
143 143 empty
144 144 new
145 145 rename
146 146
147 147 $ test -f copyx
148 148 [1]
149 149
150 150 Regular diff:
151 151
152 152 $ hg import -d "1000000 0" -mregular - <<EOF
153 153 > diff --git a/rename b/rename
154 154 > index 7898192..72e1fe3 100644
155 155 > --- a/rename
156 156 > +++ b/rename
157 157 > @@ -1 +1,5 @@
158 158 > a
159 159 > +a
160 160 > +a
161 161 > +a
162 162 > +a
163 163 > EOF
164 164 applying patch from stdin
165 165
166 166 $ hg tip -q
167 167 5:46fe99cb3035
168 168
169 169 Copy and modify:
170 170
171 171 $ hg import -d "1000000 0" -mcopymod - <<EOF
172 172 > diff --git a/rename b/copy2
173 173 > similarity index 80%
174 174 > copy from rename
175 175 > copy to copy2
176 176 > index 72e1fe3..b53c148 100644
177 177 > --- a/rename
178 178 > +++ b/copy2
179 179 > @@ -1,5 +1,5 @@
180 180 > a
181 181 > a
182 182 > -a
183 183 > +b
184 184 > a
185 185 > a
186 186 > EOF
187 187 applying patch from stdin
188 188
189 189 $ hg tip -q
190 190 6:ffeb3197c12d
191 191
192 192 $ hg cat copy2
193 193 a
194 194 a
195 195 b
196 196 a
197 197 a
198 198
199 199 Rename and modify:
200 200
201 201 $ hg import -d "1000000 0" -mrenamemod - <<EOF
202 202 > diff --git a/copy2 b/rename2
203 203 > similarity index 80%
204 204 > rename from copy2
205 205 > rename to rename2
206 206 > index b53c148..8f81e29 100644
207 207 > --- a/copy2
208 208 > +++ b/rename2
209 209 > @@ -1,5 +1,5 @@
210 210 > a
211 211 > a
212 212 > b
213 213 > -a
214 214 > +c
215 215 > a
216 216 > EOF
217 217 applying patch from stdin
218 218
219 219 $ hg tip -q
220 220 7:401aede9e6bb
221 221
222 222 $ hg locate copy2
223 223 [1]
224 224 $ hg cat rename2
225 225 a
226 226 a
227 227 b
228 228 c
229 229 a
230 230
231 231 One file renamed multiple times:
232 232
233 233 $ hg import -d "1000000 0" -mmultirenames - <<EOF
234 234 > diff --git a/rename2 b/rename3
235 235 > rename from rename2
236 236 > rename to rename3
237 237 > diff --git a/rename2 b/rename3-2
238 238 > rename from rename2
239 239 > rename to rename3-2
240 240 > EOF
241 241 applying patch from stdin
242 242
243 243 $ hg tip -q
244 244 8:2ef727e684e8
245 245
246 246 $ hg log -vr. --template '{rev} {files} / {file_copies}\n'
247 247 8 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2)
248 248
249 249 $ hg locate rename2 rename3 rename3-2
250 250 rename3
251 251 rename3-2
252 252
253 253 $ hg cat rename3
254 254 a
255 255 a
256 256 b
257 257 c
258 258 a
259 259
260 260 $ hg cat rename3-2
261 261 a
262 262 a
263 263 b
264 264 c
265 265 a
266 266
267 267 $ echo foo > foo
268 268 $ hg add foo
269 269 $ hg ci -m 'add foo'
270 270
271 271 Binary files and regular patch hunks:
272 272
273 273 $ hg import -d "1000000 0" -m binaryregular - <<EOF
274 274 > diff --git a/binary b/binary
275 275 > new file mode 100644
276 276 > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
277 277 > GIT binary patch
278 278 > literal 4
279 279 > Lc\${NkU|;|M00aO5
280 280 >
281 281 > diff --git a/foo b/foo2
282 282 > rename from foo
283 283 > rename to foo2
284 284 > EOF
285 285 applying patch from stdin
286 286
287 287 $ hg tip -q
288 288 10:27377172366e
289 289
290 290 $ cat foo2
291 291 foo
292 292
293 293 $ hg manifest --debug | grep binary
294 294 045c85ba38952325e126c70962cc0f9d9077bc67 644 binary
295 295
296 296 Multiple binary files:
297 297
298 298 $ hg import -d "1000000 0" -m multibinary - <<EOF
299 299 > diff --git a/mbinary1 b/mbinary1
300 300 > new file mode 100644
301 301 > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
302 302 > GIT binary patch
303 303 > literal 4
304 304 > Lc\${NkU|;|M00aO5
305 305 >
306 306 > diff --git a/mbinary2 b/mbinary2
307 307 > new file mode 100644
308 308 > index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490
309 309 > GIT binary patch
310 310 > literal 5
311 311 > Mc\${NkU|\`?^000jF3jhEB
312 312 >
313 313 > EOF
314 314 applying patch from stdin
315 315
316 316 $ hg tip -q
317 317 11:18b73a84b4ab
318 318
319 319 $ hg manifest --debug | grep mbinary
320 320 045c85ba38952325e126c70962cc0f9d9077bc67 644 mbinary1
321 321 a874b471193996e7cb034bb301cac7bdaf3e3f46 644 mbinary2
322 322
323 323 Filenames with spaces:
324 324
325 $ hg import -d "1000000 0" -m spaces - <<EOF
325 $ sed 's,EOL$,,g' <<EOF | hg import -d "1000000 0" -m spaces -
326 326 > diff --git a/foo bar b/foo bar
327 327 > new file mode 100644
328 328 > index 0000000..257cc56
329 329 > --- /dev/null
330 > +++ b/foo bar
330 > +++ b/foo bar EOL
331 331 > @@ -0,0 +1 @@
332 332 > +foo
333 333 > EOF
334 334 applying patch from stdin
335 335
336 336 $ hg tip -q
337 337 12:47500ce1614e
338 338
339 339 $ cat "foo bar"
340 340 foo
341 341
342 342 Copy then modify the original file:
343 343
344 344 $ hg import -d "1000000 0" -m copy-mod-orig - <<EOF
345 345 > diff --git a/foo2 b/foo2
346 346 > index 257cc56..fe08ec6 100644
347 347 > --- a/foo2
348 348 > +++ b/foo2
349 349 > @@ -1 +1,2 @@
350 350 > foo
351 351 > +new line
352 352 > diff --git a/foo2 b/foo3
353 353 > similarity index 100%
354 354 > copy from foo2
355 355 > copy to foo3
356 356 > EOF
357 357 applying patch from stdin
358 358
359 359 $ hg tip -q
360 360 13:6757efb07ea9
361 361
362 362 $ cat foo3
363 363 foo
364 364
365 365 Move text file and patch as binary
366 366
367 367 $ echo a > text2
368 368 $ hg ci -Am0
369 369 adding text2
370 370 $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF"
371 371 > diff --git a/text2 b/binary2
372 372 > rename from text2
373 373 > rename to binary2
374 374 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
375 375 > GIT binary patch
376 376 > literal 5
377 377 > Mc$`b*O5$Pw00T?_*Z=?k
378 378 >
379 379 > EOF
380 380 applying patch from stdin
381 381
382 382 $ cat binary2
383 383 a
384 384 b
385 385 \x00 (no-eol) (esc)
386 386
387 387 $ hg st --copies --change .
388 388 A binary2
389 389 text2
390 390 R text2
391 391
392 392 Invalid base85 content
393 393
394 394 $ hg rollback
395 395 repository tip rolled back to revision 14 (undo import)
396 396 working directory now based on revision 14
397 397 $ hg revert -aq
398 398 $ hg import -d "1000000 0" -m invalid-binary - <<"EOF"
399 399 > diff --git a/text2 b/binary2
400 400 > rename from text2
401 401 > rename to binary2
402 402 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
403 403 > GIT binary patch
404 404 > literal 5
405 405 > Mc$`b*O.$Pw00T?_*Z=?k
406 406 >
407 407 > EOF
408 408 applying patch from stdin
409 409 abort: could not decode "binary2" binary patch: bad base85 character at position 6
410 410 [255]
411 411
412 412 $ hg revert -aq
413 413 $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF"
414 414 > diff --git a/text2 b/binary2
415 415 > rename from text2
416 416 > rename to binary2
417 417 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
418 418 > GIT binary patch
419 419 > literal 6
420 420 > Mc$`b*O5$Pw00T?_*Z=?k
421 421 >
422 422 > EOF
423 423 applying patch from stdin
424 424 abort: "binary2" length is 5 bytes, should be 6
425 425 [255]
426 426
427 427 $ hg revert -aq
428 428 $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF"
429 429 > diff --git a/text2 b/binary2
430 430 > rename from text2
431 431 > rename to binary2
432 432 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
433 433 > GIT binary patch
434 434 > Mc$`b*O5$Pw00T?_*Z=?k
435 435 >
436 436 > EOF
437 437 applying patch from stdin
438 438 abort: could not extract "binary2" binary data
439 439 [255]
440 440
441 441 Simulate a copy/paste turning LF into CRLF (issue2870)
442 442
443 443 $ hg revert -aq
444 444 $ cat > binary.diff <<"EOF"
445 445 > diff --git a/text2 b/binary2
446 446 > rename from text2
447 447 > rename to binary2
448 448 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
449 449 > GIT binary patch
450 450 > literal 5
451 451 > Mc$`b*O5$Pw00T?_*Z=?k
452 452 >
453 453 > EOF
454 454 >>> fp = file('binary.diff', 'rb')
455 455 >>> data = fp.read()
456 456 >>> fp.close()
457 457 >>> file('binary.diff', 'wb').write(data.replace('\n', '\r\n'))
458 458 $ rm binary2
459 459 $ hg import --no-commit binary.diff
460 460 applying binary.diff
461 461
462 462 $ cd ..
463 463
464 464 Consecutive import with renames (issue2459)
465 465
466 466 $ hg init issue2459
467 467 $ cd issue2459
468 468 $ hg import --no-commit --force - <<EOF
469 469 > diff --git a/a b/a
470 470 > new file mode 100644
471 471 > EOF
472 472 applying patch from stdin
473 473 $ hg import --no-commit --force - <<EOF
474 474 > diff --git a/a b/b
475 475 > rename from a
476 476 > rename to b
477 477 > EOF
478 478 applying patch from stdin
479 479 a has not been committed yet, so no copy data will be stored for b.
480 480 $ hg debugstate
481 481 a 0 -1 unset b
482 482 $ hg ci -m done
483 483 $ cd ..
484 484
485 485 Renames and strip
486 486
487 487 $ hg init renameandstrip
488 488 $ cd renameandstrip
489 489 $ echo a > a
490 490 $ hg ci -Am adda
491 491 adding a
492 492 $ hg import --no-commit -p2 - <<EOF
493 493 > diff --git a/foo/a b/foo/b
494 494 > rename from foo/a
495 495 > rename to foo/b
496 496 > EOF
497 497 applying patch from stdin
498 498 $ hg st --copies
499 499 A b
500 500 a
501 501 R a
502 502
503 503 Renames, similarity and git diff
504 504
505 505 $ hg revert -aC
506 506 undeleting a
507 507 forgetting b
508 508 $ rm b
509 509 $ hg import --similarity 90 --no-commit - <<EOF
510 510 > diff --git a/a b/b
511 511 > rename from a
512 512 > rename to b
513 513 > EOF
514 514 applying patch from stdin
515 515 $ hg st --copies
516 516 A b
517 517 a
518 518 R a
519 519 $ cd ..
520 520
521 521 Pure copy with existing destination
522 522
523 523 $ hg init copytoexisting
524 524 $ cd copytoexisting
525 525 $ echo a > a
526 526 $ echo b > b
527 527 $ hg ci -Am add
528 528 adding a
529 529 adding b
530 530 $ hg import --no-commit - <<EOF
531 531 > diff --git a/a b/b
532 532 > copy from a
533 533 > copy to b
534 534 > EOF
535 535 applying patch from stdin
536 536 abort: cannot create b: destination already exists
537 537 [255]
538 538 $ cat b
539 539 b
540 540
541 541 Copy and changes with existing destination
542 542
543 543 $ hg import --no-commit - <<EOF
544 544 > diff --git a/a b/b
545 545 > copy from a
546 546 > copy to b
547 547 > --- a/a
548 548 > +++ b/b
549 549 > @@ -1,1 +1,2 @@
550 550 > a
551 551 > +b
552 552 > EOF
553 553 applying patch from stdin
554 554 cannot create b: destination already exists
555 555 1 out of 1 hunks FAILED -- saving rejects to file b.rej
556 556 abort: patch failed to apply
557 557 [255]
558 558 $ cat b
559 559 b
560 560
561 561 #if symlink
562 562
563 563 $ ln -s b linkb
564 564 $ hg add linkb
565 565 $ hg ci -m addlinkb
566 566 $ hg import --no-commit - <<EOF
567 567 > diff --git a/linkb b/linkb
568 568 > deleted file mode 120000
569 569 > --- a/linkb
570 570 > +++ /dev/null
571 571 > @@ -1,1 +0,0 @@
572 572 > -badhunk
573 573 > \ No newline at end of file
574 574 > EOF
575 575 applying patch from stdin
576 576 patching file linkb
577 577 Hunk #1 FAILED at 0
578 578 1 out of 1 hunks FAILED -- saving rejects to file linkb.rej
579 579 abort: patch failed to apply
580 580 [255]
581 581 $ hg st
582 582 ? b.rej
583 583 ? linkb.rej
584 584
585 585 #endif
586 586
587 587 Test corner case involving copies and multiple hunks (issue3384)
588 588
589 589 $ hg revert -qa
590 590 $ hg import --no-commit - <<EOF
591 591 > diff --git a/a b/c
592 592 > copy from a
593 593 > copy to c
594 594 > --- a/a
595 595 > +++ b/c
596 596 > @@ -1,1 +1,2 @@
597 597 > a
598 598 > +a
599 599 > @@ -2,1 +2,2 @@
600 600 > a
601 601 > +a
602 602 > diff --git a/a b/a
603 603 > --- a/a
604 604 > +++ b/a
605 605 > @@ -1,1 +1,2 @@
606 606 > a
607 607 > +b
608 608 > EOF
609 609 applying patch from stdin
610 610
611 611 $ cd ..
@@ -1,902 +1,902
1 1
2 2 $ echo "[extensions]" >> $HGRCPATH
3 3 $ echo "mq=" >> $HGRCPATH
4 4 $ echo "[diff]" >> $HGRCPATH
5 5 $ echo "nodates=true" >> $HGRCPATH
6 6 $ catpatch() {
7 7 > cat .hg/patches/$1.patch | sed -e "s/^diff \-r [0-9a-f]* /diff -r ... /" \
8 8 > -e "s/^\(# Parent \).*/\1/"
9 9 > }
10 10 $ catlog() {
11 11 > catpatch $1
12 12 > hg log --template "{rev}: {desc} - {author}\n"
13 13 > }
14 14 $ catlogd() {
15 15 > catpatch $1
16 16 > hg log --template "{rev}: {desc} - {author} - {date}\n"
17 17 > }
18 18 $ drop() {
19 19 > hg qpop
20 20 > hg qdel $1.patch
21 21 > }
22 22 $ runtest() {
23 23 > echo ==== init
24 24 > hg init a
25 25 > cd a
26 26 > hg qinit
27 27 >
28 28 >
29 29 > echo ==== qnew -d
30 30 > hg qnew -d '3 0' 1.patch
31 31 > catlogd 1
32 32 >
33 33 > echo ==== qref
34 34 > echo "1" >1
35 35 > hg add
36 36 > hg qref
37 37 > catlogd 1
38 38 >
39 39 > echo ==== qref -d
40 40 > hg qref -d '4 0'
41 41 > catlogd 1
42 42 >
43 43 >
44 44 > echo ==== qnew
45 45 > hg qnew 2.patch
46 46 > echo "2" >2
47 47 > hg add
48 48 > hg qref
49 49 > catlog 2
50 50 >
51 51 > echo ==== qref -d
52 52 > hg qref -d '5 0'
53 53 > catlog 2
54 54 >
55 55 > drop 2
56 56 >
57 57 >
58 58 > echo ==== qnew -d -m
59 59 > hg qnew -d '6 0' -m "Three" 3.patch
60 60 > catlogd 3
61 61 >
62 62 > echo ==== qref
63 63 > echo "3" >3
64 64 > hg add
65 65 > hg qref
66 66 > catlogd 3
67 67 >
68 68 > echo ==== qref -m
69 69 > hg qref -m "Drei"
70 70 > catlogd 3
71 71 >
72 72 > echo ==== qref -d
73 73 > hg qref -d '7 0'
74 74 > catlogd 3
75 75 >
76 76 > echo ==== qref -d -m
77 77 > hg qref -d '8 0' -m "Three (again)"
78 78 > catlogd 3
79 79 >
80 80 >
81 81 > echo ==== qnew -m
82 82 > hg qnew -m "Four" 4.patch
83 83 > echo "4" >4
84 84 > hg add
85 85 > hg qref
86 86 > catlog 4
87 87 >
88 88 > echo ==== qref -d
89 89 > hg qref -d '9 0'
90 90 > catlog 4
91 91 >
92 92 > drop 4
93 93 >
94 94 >
95 95 > echo ==== qnew with HG header
96 96 > hg qnew --config 'mq.plain=true' 5.patch
97 97 > hg qpop
98 98 > echo "# HG changeset patch" >>.hg/patches/5.patch
99 99 > echo "# Date 10 0" >>.hg/patches/5.patch
100 100 > hg qpush 2>&1 | grep 'Now at'
101 101 > catlogd 5
102 102 >
103 103 > echo ==== hg qref
104 104 > echo "5" >5
105 105 > hg add
106 106 > hg qref
107 107 > catlogd 5
108 108 >
109 109 > echo ==== hg qref -d
110 110 > hg qref -d '11 0'
111 111 > catlogd 5
112 112 >
113 113 >
114 114 > echo ==== qnew with plain header
115 115 > hg qnew --config 'mq.plain=true' -d '12 0' 6.patch
116 116 > hg qpop
117 117 > hg qpush 2>&1 | grep 'now at'
118 118 > catlog 6
119 119 >
120 120 > echo ==== hg qref
121 121 > echo "6" >6
122 122 > hg add
123 123 > hg qref
124 124 > catlogd 6
125 125 >
126 126 > echo ==== hg qref -d
127 127 > hg qref -d '13 0'
128 128 > catlogd 6
129 129 >
130 130 > drop 6
131 >
131 >
132 132 >
133 133 > echo ==== qnew -u
134 134 > hg qnew -u jane 6.patch
135 135 > echo "6" >6
136 136 > hg add
137 137 > hg qref
138 138 > catlog 6
139 139 >
140 140 > echo ==== qref -d
141 141 > hg qref -d '12 0'
142 142 > catlog 6
143 143 >
144 144 > drop 6
145 145 >
146 146 >
147 147 > echo ==== qnew -d
148 148 > hg qnew -d '13 0' 7.patch
149 149 > echo "7" >7
150 150 > hg add
151 151 > hg qref
152 152 > catlog 7
153 153 >
154 154 > echo ==== qref -u
155 155 > hg qref -u john
156 156 > catlogd 7
157 157 >
158 158 >
159 159 > echo ==== qnew
160 160 > hg qnew 8.patch
161 161 > echo "8" >8
162 162 > hg add
163 163 > hg qref
164 164 > catlog 8
165 165 >
166 166 > echo ==== qref -u -d
167 167 > hg qref -u john -d '14 0'
168 168 > catlog 8
169 169 >
170 170 > drop 8
171 171 >
172 172 >
173 173 > echo ==== qnew -m
174 174 > hg qnew -m "Nine" 9.patch
175 175 > echo "9" >9
176 176 > hg add
177 177 > hg qref
178 178 > catlog 9
179 179 >
180 180 > echo ==== qref -u -d
181 181 > hg qref -u john -d '15 0'
182 182 > catlog 9
183 183 >
184 184 > drop 9
185 185 >
186 186 >
187 187 > echo ==== "qpop -a / qpush -a"
188 188 > hg qpop -a
189 189 > hg qpush -a
190 190 > hg log --template "{rev}: {desc} - {author} - {date}\n"
191 191 > }
192 192
193 193 ======= plain headers
194 194
195 195 $ echo "[mq]" >> $HGRCPATH
196 196 $ echo "plain=true" >> $HGRCPATH
197 197 $ mkdir sandbox
198 198 $ (cd sandbox ; runtest)
199 199 ==== init
200 200 ==== qnew -d
201 201 Date: 3 0
202 202
203 203 0: [mq]: 1.patch - test - 3.00
204 204 ==== qref
205 205 adding 1
206 206 Date: 3 0
207 207
208 208 diff -r ... 1
209 209 --- /dev/null
210 210 +++ b/1
211 211 @@ -0,0 +1,1 @@
212 212 +1
213 213 0: [mq]: 1.patch - test - 3.00
214 214 ==== qref -d
215 215 Date: 4 0
216 216
217 217 diff -r ... 1
218 218 --- /dev/null
219 219 +++ b/1
220 220 @@ -0,0 +1,1 @@
221 221 +1
222 222 0: [mq]: 1.patch - test - 4.00
223 223 ==== qnew
224 224 adding 2
225 225 diff -r ... 2
226 226 --- /dev/null
227 227 +++ b/2
228 228 @@ -0,0 +1,1 @@
229 229 +2
230 230 1: [mq]: 2.patch - test
231 231 0: [mq]: 1.patch - test
232 232 ==== qref -d
233 233 Date: 5 0
234 234
235 235 diff -r ... 2
236 236 --- /dev/null
237 237 +++ b/2
238 238 @@ -0,0 +1,1 @@
239 239 +2
240 240 1: [mq]: 2.patch - test
241 241 0: [mq]: 1.patch - test
242 242 popping 2.patch
243 243 now at: 1.patch
244 244 ==== qnew -d -m
245 245 Date: 6 0
246 246
247 247 Three
248 248
249 249 1: Three - test - 6.00
250 250 0: [mq]: 1.patch - test - 4.00
251 251 ==== qref
252 252 adding 3
253 253 Date: 6 0
254 254
255 255 Three
256 256
257 257 diff -r ... 3
258 258 --- /dev/null
259 259 +++ b/3
260 260 @@ -0,0 +1,1 @@
261 261 +3
262 262 1: Three - test - 6.00
263 263 0: [mq]: 1.patch - test - 4.00
264 264 ==== qref -m
265 265 Date: 6 0
266 266
267 267 Drei
268 268
269 269 diff -r ... 3
270 270 --- /dev/null
271 271 +++ b/3
272 272 @@ -0,0 +1,1 @@
273 273 +3
274 274 1: Drei - test - 6.00
275 275 0: [mq]: 1.patch - test - 4.00
276 276 ==== qref -d
277 277 Date: 7 0
278 278
279 279 Drei
280 280
281 281 diff -r ... 3
282 282 --- /dev/null
283 283 +++ b/3
284 284 @@ -0,0 +1,1 @@
285 285 +3
286 286 1: Drei - test - 7.00
287 287 0: [mq]: 1.patch - test - 4.00
288 288 ==== qref -d -m
289 289 Date: 8 0
290 290
291 291 Three (again)
292 292
293 293 diff -r ... 3
294 294 --- /dev/null
295 295 +++ b/3
296 296 @@ -0,0 +1,1 @@
297 297 +3
298 298 1: Three (again) - test - 8.00
299 299 0: [mq]: 1.patch - test - 4.00
300 300 ==== qnew -m
301 301 adding 4
302 302 Four
303 303
304 304 diff -r ... 4
305 305 --- /dev/null
306 306 +++ b/4
307 307 @@ -0,0 +1,1 @@
308 308 +4
309 309 2: Four - test
310 310 1: Three (again) - test
311 311 0: [mq]: 1.patch - test
312 312 ==== qref -d
313 313 Date: 9 0
314 314 Four
315 315
316 316 diff -r ... 4
317 317 --- /dev/null
318 318 +++ b/4
319 319 @@ -0,0 +1,1 @@
320 320 +4
321 321 2: Four - test
322 322 1: Three (again) - test
323 323 0: [mq]: 1.patch - test
324 324 popping 4.patch
325 325 now at: 3.patch
326 326 ==== qnew with HG header
327 327 popping 5.patch
328 328 now at: 3.patch
329 329 # HG changeset patch
330 330 # Date 10 0
331 331 2: imported patch 5.patch - test - 10.00
332 332 1: Three (again) - test - 8.00
333 333 0: [mq]: 1.patch - test - 4.00
334 334 ==== hg qref
335 335 adding 5
336 336 # HG changeset patch
337 337 # Parent
338 338 # Date 10 0
339 339
340 340 diff -r ... 5
341 341 --- /dev/null
342 342 +++ b/5
343 343 @@ -0,0 +1,1 @@
344 344 +5
345 345 2: [mq]: 5.patch - test - 10.00
346 346 1: Three (again) - test - 8.00
347 347 0: [mq]: 1.patch - test - 4.00
348 348 ==== hg qref -d
349 349 # HG changeset patch
350 350 # Parent
351 351 # Date 11 0
352 352
353 353 diff -r ... 5
354 354 --- /dev/null
355 355 +++ b/5
356 356 @@ -0,0 +1,1 @@
357 357 +5
358 358 2: [mq]: 5.patch - test - 11.00
359 359 1: Three (again) - test - 8.00
360 360 0: [mq]: 1.patch - test - 4.00
361 361 ==== qnew with plain header
362 362 popping 6.patch
363 363 now at: 5.patch
364 364 now at: 6.patch
365 365 Date: 12 0
366 366
367 367 3: imported patch 6.patch - test
368 368 2: [mq]: 5.patch - test
369 369 1: Three (again) - test
370 370 0: [mq]: 1.patch - test
371 371 ==== hg qref
372 372 adding 6
373 373 Date: 12 0
374 374
375 375 diff -r ... 6
376 376 --- /dev/null
377 377 +++ b/6
378 378 @@ -0,0 +1,1 @@
379 379 +6
380 380 3: [mq]: 6.patch - test - 12.00
381 381 2: [mq]: 5.patch - test - 11.00
382 382 1: Three (again) - test - 8.00
383 383 0: [mq]: 1.patch - test - 4.00
384 384 ==== hg qref -d
385 385 Date: 13 0
386 386
387 387 diff -r ... 6
388 388 --- /dev/null
389 389 +++ b/6
390 390 @@ -0,0 +1,1 @@
391 391 +6
392 392 3: [mq]: 6.patch - test - 13.00
393 393 2: [mq]: 5.patch - test - 11.00
394 394 1: Three (again) - test - 8.00
395 395 0: [mq]: 1.patch - test - 4.00
396 396 popping 6.patch
397 397 now at: 5.patch
398 398 ==== qnew -u
399 399 adding 6
400 400 From: jane
401 401
402 402 diff -r ... 6
403 403 --- /dev/null
404 404 +++ b/6
405 405 @@ -0,0 +1,1 @@
406 406 +6
407 407 3: [mq]: 6.patch - jane
408 408 2: [mq]: 5.patch - test
409 409 1: Three (again) - test
410 410 0: [mq]: 1.patch - test
411 411 ==== qref -d
412 412 Date: 12 0
413 413 From: jane
414 414
415 415 diff -r ... 6
416 416 --- /dev/null
417 417 +++ b/6
418 418 @@ -0,0 +1,1 @@
419 419 +6
420 420 3: [mq]: 6.patch - jane
421 421 2: [mq]: 5.patch - test
422 422 1: Three (again) - test
423 423 0: [mq]: 1.patch - test
424 424 popping 6.patch
425 425 now at: 5.patch
426 426 ==== qnew -d
427 427 adding 7
428 428 Date: 13 0
429 429
430 430 diff -r ... 7
431 431 --- /dev/null
432 432 +++ b/7
433 433 @@ -0,0 +1,1 @@
434 434 +7
435 435 3: [mq]: 7.patch - test
436 436 2: [mq]: 5.patch - test
437 437 1: Three (again) - test
438 438 0: [mq]: 1.patch - test
439 439 ==== qref -u
440 440 From: john
441 441 Date: 13 0
442 442
443 443 diff -r ... 7
444 444 --- /dev/null
445 445 +++ b/7
446 446 @@ -0,0 +1,1 @@
447 447 +7
448 448 3: [mq]: 7.patch - john - 13.00
449 449 2: [mq]: 5.patch - test - 11.00
450 450 1: Three (again) - test - 8.00
451 451 0: [mq]: 1.patch - test - 4.00
452 452 ==== qnew
453 453 adding 8
454 454 diff -r ... 8
455 455 --- /dev/null
456 456 +++ b/8
457 457 @@ -0,0 +1,1 @@
458 458 +8
459 459 4: [mq]: 8.patch - test
460 460 3: [mq]: 7.patch - john
461 461 2: [mq]: 5.patch - test
462 462 1: Three (again) - test
463 463 0: [mq]: 1.patch - test
464 464 ==== qref -u -d
465 465 Date: 14 0
466 466 From: john
467 467
468 468 diff -r ... 8
469 469 --- /dev/null
470 470 +++ b/8
471 471 @@ -0,0 +1,1 @@
472 472 +8
473 473 4: [mq]: 8.patch - john
474 474 3: [mq]: 7.patch - john
475 475 2: [mq]: 5.patch - test
476 476 1: Three (again) - test
477 477 0: [mq]: 1.patch - test
478 478 popping 8.patch
479 479 now at: 7.patch
480 480 ==== qnew -m
481 481 adding 9
482 482 Nine
483 483
484 484 diff -r ... 9
485 485 --- /dev/null
486 486 +++ b/9
487 487 @@ -0,0 +1,1 @@
488 488 +9
489 489 4: Nine - test
490 490 3: [mq]: 7.patch - john
491 491 2: [mq]: 5.patch - test
492 492 1: Three (again) - test
493 493 0: [mq]: 1.patch - test
494 494 ==== qref -u -d
495 495 Date: 15 0
496 496 From: john
497 497 Nine
498 498
499 499 diff -r ... 9
500 500 --- /dev/null
501 501 +++ b/9
502 502 @@ -0,0 +1,1 @@
503 503 +9
504 504 4: Nine - john
505 505 3: [mq]: 7.patch - john
506 506 2: [mq]: 5.patch - test
507 507 1: Three (again) - test
508 508 0: [mq]: 1.patch - test
509 509 popping 9.patch
510 510 now at: 7.patch
511 511 ==== qpop -a / qpush -a
512 512 popping 7.patch
513 513 popping 5.patch
514 514 popping 3.patch
515 515 popping 1.patch
516 516 patch queue now empty
517 517 applying 1.patch
518 518 applying 3.patch
519 519 applying 5.patch
520 520 applying 7.patch
521 521 now at: 7.patch
522 522 3: imported patch 7.patch - john - 13.00
523 523 2: imported patch 5.patch - test - 11.00
524 524 1: Three (again) - test - 8.00
525 525 0: imported patch 1.patch - test - 4.00
526 526 $ rm -r sandbox
527 527
528 528 ======= hg headers
529 529
530 530 $ echo "plain=false" >> $HGRCPATH
531 531 $ mkdir sandbox
532 532 $ (cd sandbox ; runtest)
533 533 ==== init
534 534 ==== qnew -d
535 535 # HG changeset patch
536 536 # Parent
537 537 # Date 3 0
538 538
539 539 0: [mq]: 1.patch - test - 3.00
540 540 ==== qref
541 541 adding 1
542 542 # HG changeset patch
543 543 # Parent
544 544 # Date 3 0
545 545
546 546 diff -r ... 1
547 547 --- /dev/null
548 548 +++ b/1
549 549 @@ -0,0 +1,1 @@
550 550 +1
551 551 0: [mq]: 1.patch - test - 3.00
552 552 ==== qref -d
553 553 # HG changeset patch
554 554 # Parent
555 555 # Date 4 0
556 556
557 557 diff -r ... 1
558 558 --- /dev/null
559 559 +++ b/1
560 560 @@ -0,0 +1,1 @@
561 561 +1
562 562 0: [mq]: 1.patch - test - 4.00
563 563 ==== qnew
564 564 adding 2
565 565 # HG changeset patch
566 566 # Parent
567 567
568 568 diff -r ... 2
569 569 --- /dev/null
570 570 +++ b/2
571 571 @@ -0,0 +1,1 @@
572 572 +2
573 573 1: [mq]: 2.patch - test
574 574 0: [mq]: 1.patch - test
575 575 ==== qref -d
576 576 # HG changeset patch
577 577 # Date 5 0
578 578 # Parent
579 579
580 580 diff -r ... 2
581 581 --- /dev/null
582 582 +++ b/2
583 583 @@ -0,0 +1,1 @@
584 584 +2
585 585 1: [mq]: 2.patch - test
586 586 0: [mq]: 1.patch - test
587 587 popping 2.patch
588 588 now at: 1.patch
589 589 ==== qnew -d -m
590 590 # HG changeset patch
591 591 # Parent
592 592 # Date 6 0
593 593
594 594 Three
595 595
596 596 1: Three - test - 6.00
597 597 0: [mq]: 1.patch - test - 4.00
598 598 ==== qref
599 599 adding 3
600 600 # HG changeset patch
601 601 # Parent
602 602 # Date 6 0
603 603
604 604 Three
605 605
606 606 diff -r ... 3
607 607 --- /dev/null
608 608 +++ b/3
609 609 @@ -0,0 +1,1 @@
610 610 +3
611 611 1: Three - test - 6.00
612 612 0: [mq]: 1.patch - test - 4.00
613 613 ==== qref -m
614 614 # HG changeset patch
615 615 # Parent
616 616 # Date 6 0
617 617
618 618 Drei
619 619
620 620 diff -r ... 3
621 621 --- /dev/null
622 622 +++ b/3
623 623 @@ -0,0 +1,1 @@
624 624 +3
625 625 1: Drei - test - 6.00
626 626 0: [mq]: 1.patch - test - 4.00
627 627 ==== qref -d
628 628 # HG changeset patch
629 629 # Parent
630 630 # Date 7 0
631 631
632 632 Drei
633 633
634 634 diff -r ... 3
635 635 --- /dev/null
636 636 +++ b/3
637 637 @@ -0,0 +1,1 @@
638 638 +3
639 639 1: Drei - test - 7.00
640 640 0: [mq]: 1.patch - test - 4.00
641 641 ==== qref -d -m
642 642 # HG changeset patch
643 643 # Parent
644 644 # Date 8 0
645 645
646 646 Three (again)
647 647
648 648 diff -r ... 3
649 649 --- /dev/null
650 650 +++ b/3
651 651 @@ -0,0 +1,1 @@
652 652 +3
653 653 1: Three (again) - test - 8.00
654 654 0: [mq]: 1.patch - test - 4.00
655 655 ==== qnew -m
656 656 adding 4
657 657 # HG changeset patch
658 658 # Parent
659 659 Four
660 660
661 661 diff -r ... 4
662 662 --- /dev/null
663 663 +++ b/4
664 664 @@ -0,0 +1,1 @@
665 665 +4
666 666 2: Four - test
667 667 1: Three (again) - test
668 668 0: [mq]: 1.patch - test
669 669 ==== qref -d
670 670 # HG changeset patch
671 671 # Date 9 0
672 672 # Parent
673 673 Four
674 674
675 675 diff -r ... 4
676 676 --- /dev/null
677 677 +++ b/4
678 678 @@ -0,0 +1,1 @@
679 679 +4
680 680 2: Four - test
681 681 1: Three (again) - test
682 682 0: [mq]: 1.patch - test
683 683 popping 4.patch
684 684 now at: 3.patch
685 685 ==== qnew with HG header
686 686 popping 5.patch
687 687 now at: 3.patch
688 688 # HG changeset patch
689 689 # Date 10 0
690 690 2: imported patch 5.patch - test - 10.00
691 691 1: Three (again) - test - 8.00
692 692 0: [mq]: 1.patch - test - 4.00
693 693 ==== hg qref
694 694 adding 5
695 695 # HG changeset patch
696 696 # Parent
697 697 # Date 10 0
698 698
699 699 diff -r ... 5
700 700 --- /dev/null
701 701 +++ b/5
702 702 @@ -0,0 +1,1 @@
703 703 +5
704 704 2: [mq]: 5.patch - test - 10.00
705 705 1: Three (again) - test - 8.00
706 706 0: [mq]: 1.patch - test - 4.00
707 707 ==== hg qref -d
708 708 # HG changeset patch
709 709 # Parent
710 710 # Date 11 0
711 711
712 712 diff -r ... 5
713 713 --- /dev/null
714 714 +++ b/5
715 715 @@ -0,0 +1,1 @@
716 716 +5
717 717 2: [mq]: 5.patch - test - 11.00
718 718 1: Three (again) - test - 8.00
719 719 0: [mq]: 1.patch - test - 4.00
720 720 ==== qnew with plain header
721 721 popping 6.patch
722 722 now at: 5.patch
723 723 now at: 6.patch
724 724 Date: 12 0
725 725
726 726 3: imported patch 6.patch - test
727 727 2: [mq]: 5.patch - test
728 728 1: Three (again) - test
729 729 0: [mq]: 1.patch - test
730 730 ==== hg qref
731 731 adding 6
732 732 Date: 12 0
733 733
734 734 diff -r ... 6
735 735 --- /dev/null
736 736 +++ b/6
737 737 @@ -0,0 +1,1 @@
738 738 +6
739 739 3: [mq]: 6.patch - test - 12.00
740 740 2: [mq]: 5.patch - test - 11.00
741 741 1: Three (again) - test - 8.00
742 742 0: [mq]: 1.patch - test - 4.00
743 743 ==== hg qref -d
744 744 Date: 13 0
745 745
746 746 diff -r ... 6
747 747 --- /dev/null
748 748 +++ b/6
749 749 @@ -0,0 +1,1 @@
750 750 +6
751 751 3: [mq]: 6.patch - test - 13.00
752 752 2: [mq]: 5.patch - test - 11.00
753 753 1: Three (again) - test - 8.00
754 754 0: [mq]: 1.patch - test - 4.00
755 755 popping 6.patch
756 756 now at: 5.patch
757 757 ==== qnew -u
758 758 adding 6
759 759 # HG changeset patch
760 760 # Parent
761 761 # User jane
762 762
763 763 diff -r ... 6
764 764 --- /dev/null
765 765 +++ b/6
766 766 @@ -0,0 +1,1 @@
767 767 +6
768 768 3: [mq]: 6.patch - jane
769 769 2: [mq]: 5.patch - test
770 770 1: Three (again) - test
771 771 0: [mq]: 1.patch - test
772 772 ==== qref -d
773 773 # HG changeset patch
774 774 # Date 12 0
775 775 # Parent
776 776 # User jane
777 777
778 778 diff -r ... 6
779 779 --- /dev/null
780 780 +++ b/6
781 781 @@ -0,0 +1,1 @@
782 782 +6
783 783 3: [mq]: 6.patch - jane
784 784 2: [mq]: 5.patch - test
785 785 1: Three (again) - test
786 786 0: [mq]: 1.patch - test
787 787 popping 6.patch
788 788 now at: 5.patch
789 789 ==== qnew -d
790 790 adding 7
791 791 # HG changeset patch
792 792 # Parent
793 793 # Date 13 0
794 794
795 795 diff -r ... 7
796 796 --- /dev/null
797 797 +++ b/7
798 798 @@ -0,0 +1,1 @@
799 799 +7
800 800 3: [mq]: 7.patch - test
801 801 2: [mq]: 5.patch - test
802 802 1: Three (again) - test
803 803 0: [mq]: 1.patch - test
804 804 ==== qref -u
805 805 # HG changeset patch
806 806 # User john
807 807 # Parent
808 808 # Date 13 0
809 809
810 810 diff -r ... 7
811 811 --- /dev/null
812 812 +++ b/7
813 813 @@ -0,0 +1,1 @@
814 814 +7
815 815 3: [mq]: 7.patch - john - 13.00
816 816 2: [mq]: 5.patch - test - 11.00
817 817 1: Three (again) - test - 8.00
818 818 0: [mq]: 1.patch - test - 4.00
819 819 ==== qnew
820 820 adding 8
821 821 # HG changeset patch
822 822 # Parent
823 823
824 824 diff -r ... 8
825 825 --- /dev/null
826 826 +++ b/8
827 827 @@ -0,0 +1,1 @@
828 828 +8
829 829 4: [mq]: 8.patch - test
830 830 3: [mq]: 7.patch - john
831 831 2: [mq]: 5.patch - test
832 832 1: Three (again) - test
833 833 0: [mq]: 1.patch - test
834 834 ==== qref -u -d
835 835 # HG changeset patch
836 836 # Date 14 0
837 837 # User john
838 838 # Parent
839 839
840 840 diff -r ... 8
841 841 --- /dev/null
842 842 +++ b/8
843 843 @@ -0,0 +1,1 @@
844 844 +8
845 845 4: [mq]: 8.patch - john
846 846 3: [mq]: 7.patch - john
847 847 2: [mq]: 5.patch - test
848 848 1: Three (again) - test
849 849 0: [mq]: 1.patch - test
850 850 popping 8.patch
851 851 now at: 7.patch
852 852 ==== qnew -m
853 853 adding 9
854 854 # HG changeset patch
855 855 # Parent
856 856 Nine
857 857
858 858 diff -r ... 9
859 859 --- /dev/null
860 860 +++ b/9
861 861 @@ -0,0 +1,1 @@
862 862 +9
863 863 4: Nine - test
864 864 3: [mq]: 7.patch - john
865 865 2: [mq]: 5.patch - test
866 866 1: Three (again) - test
867 867 0: [mq]: 1.patch - test
868 868 ==== qref -u -d
869 869 # HG changeset patch
870 870 # Date 15 0
871 871 # User john
872 872 # Parent
873 873 Nine
874 874
875 875 diff -r ... 9
876 876 --- /dev/null
877 877 +++ b/9
878 878 @@ -0,0 +1,1 @@
879 879 +9
880 880 4: Nine - john
881 881 3: [mq]: 7.patch - john
882 882 2: [mq]: 5.patch - test
883 883 1: Three (again) - test
884 884 0: [mq]: 1.patch - test
885 885 popping 9.patch
886 886 now at: 7.patch
887 887 ==== qpop -a / qpush -a
888 888 popping 7.patch
889 889 popping 5.patch
890 890 popping 3.patch
891 891 popping 1.patch
892 892 patch queue now empty
893 893 applying 1.patch
894 894 applying 3.patch
895 895 applying 5.patch
896 896 applying 7.patch
897 897 now at: 7.patch
898 898 3: imported patch 7.patch - john - 13.00
899 899 2: imported patch 5.patch - test - 11.00
900 900 1: Three (again) - test - 8.00
901 901 0: imported patch 1.patch - test - 4.00
902 902 $ rm -r sandbox
@@ -1,280 +1,280
1 1 $ "$TESTDIR/hghave" serve || exit 80
2 2
3 3 $ cat > writelines.py <<EOF
4 4 > import sys
5 5 > path = sys.argv[1]
6 6 > args = sys.argv[2:]
7 7 > assert (len(args) % 2) == 0
8 8 >
9 9 > f = file(path, 'wb')
10 10 > for i in xrange(len(args)/2):
11 11 > count, s = args[2*i:2*i+2]
12 12 > count = int(count)
13 13 > s = s.decode('string_escape')
14 14 > f.write(s*count)
15 15 > f.close()
16 16 >
17 17 > EOF
18 18 $ echo "[extensions]" >> $HGRCPATH
19 19 $ echo "mq=" >> $HGRCPATH
20 20 $ echo "[diff]" >> $HGRCPATH
21 21 $ echo "git=1" >> $HGRCPATH
22 22 $ hg init repo
23 23 $ cd repo
24 24
25 25 qimport without file or revision
26 26
27 27 $ hg qimport
28 28 abort: no files or revisions specified
29 29 [255]
30 30
31 31 qimport non-existing-file
32 32
33 33 $ hg qimport non-existing-file
34 34 abort: unable to read file non-existing-file
35 35 [255]
36 36
37 37 qimport null revision
38 38
39 39 $ hg qimport -r null
40 40 abort: revision -1 is not mutable
41 41 (see "hg help phases" for details)
42 42 [255]
43 43 $ hg qseries
44 44
45 45 import email
46 46
47 47 $ hg qimport --push -n email - <<EOF
48 48 > From: Username in email <test@example.net>
49 49 > Subject: [PATCH] Message in email
50 50 > Date: Fri, 02 Jan 1970 00:00:00 +0000
51 51 >
52 52 > Text before patch.
53 53 >
54 54 > # HG changeset patch
55 55 > # User Username in patch <test@example.net>
56 56 > # Date 0 0
57 57 > # Node ID 1a706973a7d84cb549823634a821d9bdf21c6220
58 58 > # Parent 0000000000000000000000000000000000000000
59 59 > First line of commit message.
60 60 >
61 61 > More text in commit message.
62 62 > --- confuse the diff detection
63 63 >
64 64 > diff --git a/x b/x
65 65 > new file mode 100644
66 66 > --- /dev/null
67 67 > +++ b/x
68 68 > @@ -0,0 +1,1 @@
69 69 > +new file
70 70 > Text after patch.
71 71 >
72 72 > EOF
73 73 adding email to series file
74 74 applying email
75 75 now at: email
76 76
77 77 hg tip -v
78 78
79 79 $ hg tip -v
80 80 changeset: 0:1a706973a7d8
81 81 tag: email
82 82 tag: qbase
83 83 tag: qtip
84 84 tag: tip
85 85 user: Username in patch <test@example.net>
86 86 date: Thu Jan 01 00:00:00 1970 +0000
87 87 files: x
88 88 description:
89 89 First line of commit message.
90 90
91 91 More text in commit message.
92 92
93 93
94 94 $ hg qpop
95 95 popping email
96 96 patch queue now empty
97 97 $ hg qdelete email
98 98
99 99 import URL
100 100
101 101 $ echo foo >> foo
102 102 $ hg add foo
103 103 $ hg diff > url.diff
104 104 $ hg revert --no-backup foo
105 105 $ rm foo
106 106
107 107 Under unix: file:///foobar/blah
108 108 Under windows: file:///c:/foobar/blah
109 109
110 110 $ patchurl=`pwd | tr '\\\\' /`/url.diff
111 111 $ expr "$patchurl" : "\/" > /dev/null || patchurl="/$patchurl"
112 112 $ hg qimport file://"$patchurl"
113 113 adding url.diff to series file
114 114 $ rm url.diff
115 115 $ hg qun
116 116 url.diff
117 117
118 118 import patch that already exists
119 119
120 120 $ echo foo2 >> foo
121 121 $ hg add foo
122 122 $ hg diff > ../url.diff
123 123 $ hg revert --no-backup foo
124 124 $ rm foo
125 125 $ hg qimport ../url.diff
126 126 abort: patch "url.diff" already exists
127 127 [255]
128 128 $ hg qpush
129 129 applying url.diff
130 130 now at: url.diff
131 131 $ cat foo
132 132 foo
133 133 $ hg qpop
134 134 popping url.diff
135 135 patch queue now empty
136 136
137 137 qimport -f
138 138
139 139 $ hg qimport -f ../url.diff
140 140 adding url.diff to series file
141 141 $ hg qpush
142 142 applying url.diff
143 143 now at: url.diff
144 144 $ cat foo
145 145 foo2
146 146 $ hg qpop
147 147 popping url.diff
148 148 patch queue now empty
149 149
150 150 build diff with CRLF
151 151
152 152 $ python ../writelines.py b 5 'a\n' 5 'a\r\n'
153 153 $ hg ci -Am addb
154 154 adding b
155 155 $ python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n'
156 156 $ hg diff > b.diff
157 157 $ hg up -C
158 158 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
159 159
160 160 qimport CRLF diff
161 161
162 162 $ hg qimport b.diff
163 163 adding b.diff to series file
164 164 $ hg qpush
165 165 applying b.diff
166 166 now at: b.diff
167 167
168 168 try to import --push
169 169
170 170 $ cat > appendfoo.diff <<EOF
171 171 > append foo
172 >
172 >
173 173 > diff -r 07f494440405 -r 261500830e46 baz
174 174 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
175 175 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
176 176 > @@ -0,0 +1,1 @@
177 177 > +foo
178 178 > EOF
179 179
180 180 $ cat > appendbar.diff <<EOF
181 181 > append bar
182 >
182 >
183 183 > diff -r 07f494440405 -r 261500830e46 baz
184 184 > --- a/baz Thu Jan 01 00:00:00 1970 +0000
185 185 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
186 186 > @@ -1,1 +1,2 @@
187 187 > foo
188 188 > +bar
189 189 > EOF
190 190
191 191 $ hg qimport --push appendfoo.diff appendbar.diff
192 192 adding appendfoo.diff to series file
193 193 adding appendbar.diff to series file
194 194 applying appendfoo.diff
195 195 applying appendbar.diff
196 196 now at: appendbar.diff
197 197 $ hg qfin -a
198 198 patch b.diff finalized without changeset message
199 199 $ hg qimport -r 'p1(.)::' -P
200 200 $ hg qpop -a
201 201 popping 3.diff
202 202 popping 2.diff
203 203 patch queue now empty
204 204 $ hg qdel 3.diff
205 205 $ hg qdel -k 2.diff
206 206
207 207 qimport -e
208 208
209 209 $ hg qimport -e 2.diff
210 210 adding 2.diff to series file
211 211 $ hg qdel -k 2.diff
212 212
213 213 qimport -e --name newname oldexisitingpatch
214 214
215 215 $ hg qimport -e --name this-name-is-better 2.diff
216 216 renaming 2.diff to this-name-is-better
217 217 adding this-name-is-better to series file
218 218 $ hg qser
219 219 this-name-is-better
220 220 url.diff
221 221
222 222 qimport -e --name without --force
223 223
224 224 $ cp .hg/patches/this-name-is-better .hg/patches/3.diff
225 225 $ hg qimport -e --name this-name-is-better 3.diff
226 226 abort: patch "this-name-is-better" already exists
227 227 [255]
228 228 $ hg qser
229 229 this-name-is-better
230 230 url.diff
231 231
232 232 qimport -e --name with --force
233 233
234 234 $ hg qimport --force -e --name this-name-is-better 3.diff
235 235 renaming 3.diff to this-name-is-better
236 236 adding this-name-is-better to series file
237 237 $ hg qser
238 238 this-name-is-better
239 239 url.diff
240 240
241 241 qimport with bad name, should abort before reading file
242 242
243 243 $ hg qimport non-existant-file --name .hg
244 244 abort: patch name cannot begin with ".hg"
245 245 [255]
246 246
247 247 qimport http:// patch with leading slashes in url
248 248
249 249 set up hgweb
250 250
251 251 $ cd ..
252 252 $ hg init served
253 253 $ cd served
254 254 $ echo a > a
255 255 $ hg ci -Am patch
256 256 adding a
257 257 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
258 258 $ cat hg.pid >> $DAEMON_PIDS
259 259
260 260 $ cd ../repo
261 261 $ hg qimport http://localhost:$HGPORT/raw-rev/0///
262 262 adding 0 to series file
263 263
264 264 check qimport phase:
265 265
266 266 $ hg -q qpush
267 267 now at: 0
268 268 $ hg phase qparent
269 269 1: draft
270 270 $ hg qimport -r qparent
271 271 $ hg phase qbase
272 272 1: draft
273 273 $ hg qfinish qbase
274 274 $ echo '[mq]' >> $HGRCPATH
275 275 $ echo 'secret=true' >> $HGRCPATH
276 276 $ hg qimport -r qparent
277 277 $ hg phase qbase
278 278 1: secret
279 279
280 280 $ cd ..
@@ -1,156 +1,156
1 1 # Construct the following history tree:
2 2 #
3 3 # @ 5:e1bb631146ca b1
4 4 # |
5 5 # o 4:a4fdb3b883c4 0:b608b9236435 b1
6 6 # |
7 7 # | o 3:4b57d2520816 1:44592833ba9f
8 8 # | |
9 9 # | | o 2:063f31070f65
10 10 # | |/
11 11 # | o 1:44592833ba9f
12 12 # |/
13 13 # o 0:b608b9236435
14 14
15 15 $ hg init
16 16 $ echo foo > foo
17 17 $ echo zero > a
18 18 $ hg init sub
19 19 $ echo suba > sub/suba
20 20 $ hg --cwd sub ci -Am addsuba
21 21 adding suba
22 22 $ echo 'sub = sub' > .hgsub
23 23 $ hg ci -qAm0
24 24 $ echo one > a ; hg ci -m1
25 25 $ echo two > a ; hg ci -m2
26 26 $ hg up -q 1
27 27 $ echo three > a ; hg ci -qm3
28 28 $ hg up -q 0
29 29 $ hg branch -q b1
30 30 $ echo four > a ; hg ci -qm4
31 31 $ echo five > a ; hg ci -qm5
32 32
33 33 Initial repo state:
34 34
35 35 $ hg --config 'extensions.graphlog=' \
36 36 > glog --template '{rev}:{node|short} {parents} {branches}\n'
37 37 @ 5:ff252e8273df b1
38 38 |
39 39 o 4:d047485b3896 0:60829823a42a b1
40 40 |
41 41 | o 3:6efa171f091b 1:0786582aa4b1
42 42 | |
43 43 | | o 2:bd10386d478c
44 44 | |/
45 45 | o 1:0786582aa4b1
46 46 |/
47 47 o 0:60829823a42a
48 48
49 49
50 50 Test helper functions:
51 51
52 52 $ revtest () {
53 53 > msg=$1
54 54 > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub'
55 55 > startrev=$3
56 56 > targetrev=$4
57 57 > opt=$5
58 58 > hg up -qC $startrev
59 59 > test $dirtyflag = dirty && echo dirty > foo
60 60 > test $dirtyflag = dirtysub && echo dirty > sub/suba
61 61 > hg up $opt $targetrev
62 62 > hg parent --template 'parent={rev}\n'
63 63 > hg stat -S
64 > }
64 > }
65 65
66 66 $ norevtest () {
67 67 > msg=$1
68 68 > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub'
69 69 > startrev=$3
70 70 > opt=$4
71 71 > hg up -qC $startrev
72 72 > test $dirtyflag = dirty && echo dirty > foo
73 73 > test $dirtyflag = dirtysub && echo dirty > sub/suba
74 74 > hg up $opt
75 75 > hg parent --template 'parent={rev}\n'
76 76 > hg stat -S
77 > }
77 > }
78 78
79 79 Test cases are documented in a table in the update function of merge.py.
80 80 Cases are run as shown in that table, row by row.
81 81
82 82 $ norevtest 'none clean linear' clean 4
83 83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 84 parent=5
85 85
86 86 $ norevtest 'none clean same' clean 2
87 87 abort: crosses branches (merge branches or update --check to force update)
88 88 parent=2
89 89
90 90
91 91 $ revtest 'none clean linear' clean 1 2
92 92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 93 parent=2
94 94
95 95 $ revtest 'none clean same' clean 2 3
96 96 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 97 parent=3
98 98
99 99 $ revtest 'none clean cross' clean 3 4
100 100 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 101 parent=4
102 102
103 103
104 104 $ revtest 'none dirty linear' dirty 1 2
105 105 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 106 parent=2
107 107 M foo
108 108
109 109 $ revtest 'none dirtysub linear' dirtysub 1 2
110 110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 111 parent=2
112 112 M sub/suba
113 113
114 114 $ revtest 'none dirty same' dirty 2 3
115 115 abort: crosses branches (merge branches or use --clean to discard changes)
116 116 parent=2
117 117 M foo
118 118
119 119 $ revtest 'none dirtysub same' dirtysub 2 3
120 120 abort: crosses branches (merge branches or use --clean to discard changes)
121 121 parent=2
122 122 M sub/suba
123 123
124 124 $ revtest 'none dirty cross' dirty 3 4
125 125 abort: crosses branches (merge branches or use --clean to discard changes)
126 126 parent=3
127 127 M foo
128 128
129 129 $ revtest 'none dirtysub cross' dirtysub 3 4
130 130 abort: crosses branches (merge branches or use --clean to discard changes)
131 131 parent=3
132 132 M sub/suba
133 133
134 134 $ revtest '-C dirty linear' dirty 1 2 -C
135 135 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
136 136 parent=2
137 137
138 138 $ revtest '-c dirty linear' dirty 1 2 -c
139 139 abort: uncommitted local changes
140 140 parent=1
141 141 M foo
142 142
143 143 $ revtest '-c dirtysub linear' dirtysub 1 2 -c
144 144 abort: uncommitted local changes
145 145 parent=1
146 146 M sub/suba
147 147
148 148 $ norevtest '-c clean same' clean 2 -c
149 149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 150 parent=3
151 151
152 152 $ revtest '-cC dirty linear' dirty 1 2 -cC
153 153 abort: cannot specify both -c/--check and -C/--clean
154 154 parent=1
155 155 M foo
156 156
General Comments 0
You need to be logged in to leave comments. Login now