##// END OF EJS Templates
tests: make (glob) on windows accept \ instead of /...
Mads Kiilerich -
r15447:9910f60a default
parent child Browse files
Show More
@@ -1,1257 +1,1259 b''
1 1 #!/usr/bin/env python
2 2 #
3 3 # run-tests.py - Run a set of tests on Mercurial
4 4 #
5 5 # Copyright 2006 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 # Modifying this script is tricky because it has many modes:
11 11 # - serial (default) vs parallel (-jN, N > 1)
12 12 # - no coverage (default) vs coverage (-c, -C, -s)
13 13 # - temp install (default) vs specific hg script (--with-hg, --local)
14 14 # - tests are a mix of shell scripts and Python scripts
15 15 #
16 16 # If you change this script, it is recommended that you ensure you
17 17 # haven't broken it by running it in various modes with a representative
18 18 # sample of test scripts. For example:
19 19 #
20 20 # 1) serial, no coverage, temp install:
21 21 # ./run-tests.py test-s*
22 22 # 2) serial, no coverage, local hg:
23 23 # ./run-tests.py --local test-s*
24 24 # 3) serial, coverage, temp install:
25 25 # ./run-tests.py -c test-s*
26 26 # 4) serial, coverage, local hg:
27 27 # ./run-tests.py -c --local test-s* # unsupported
28 28 # 5) parallel, no coverage, temp install:
29 29 # ./run-tests.py -j2 test-s*
30 30 # 6) parallel, no coverage, local hg:
31 31 # ./run-tests.py -j2 --local test-s*
32 32 # 7) parallel, coverage, temp install:
33 33 # ./run-tests.py -j2 -c test-s* # currently broken
34 34 # 8) parallel, coverage, local install:
35 35 # ./run-tests.py -j2 -c --local test-s* # unsupported (and broken)
36 36 # 9) parallel, custom tmp dir:
37 37 # ./run-tests.py -j2 --tmpdir /tmp/myhgtests
38 38 #
39 39 # (You could use any subset of the tests: test-s* happens to match
40 40 # enough that it's worth doing parallel runs, few enough that it
41 41 # completes fairly quickly, includes both shell and Python scripts, and
42 42 # includes some scripts that run daemon processes.)
43 43
44 44 from distutils import version
45 45 import difflib
46 46 import errno
47 47 import optparse
48 48 import os
49 49 import shutil
50 50 import subprocess
51 51 import signal
52 52 import sys
53 53 import tempfile
54 54 import time
55 55 import re
56 56 import threading
57 57
58 58 processlock = threading.Lock()
59 59
60 60 closefds = os.name == 'posix'
61 61 def Popen4(cmd, wd, timeout):
62 62 processlock.acquire()
63 63 p = subprocess.Popen(cmd, shell=True, bufsize=-1, cwd=wd,
64 64 close_fds=closefds,
65 65 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
66 66 stderr=subprocess.STDOUT)
67 67 processlock.release()
68 68
69 69 p.fromchild = p.stdout
70 70 p.tochild = p.stdin
71 71 p.childerr = p.stderr
72 72
73 73 p.timeout = False
74 74 if timeout:
75 75 def t():
76 76 start = time.time()
77 77 while time.time() - start < timeout and p.returncode is None:
78 78 time.sleep(1)
79 79 p.timeout = True
80 80 if p.returncode is None:
81 81 terminate(p)
82 82 threading.Thread(target=t).start()
83 83
84 84 return p
85 85
86 86 # reserved exit code to skip test (used by hghave)
87 87 SKIPPED_STATUS = 80
88 88 SKIPPED_PREFIX = 'skipped: '
89 89 FAILED_PREFIX = 'hghave check failed: '
90 90 PYTHON = sys.executable
91 91 IMPL_PATH = 'PYTHONPATH'
92 92 if 'java' in sys.platform:
93 93 IMPL_PATH = 'JYTHONPATH'
94 94
95 95 requiredtools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
96 96
97 97 defaults = {
98 98 'jobs': ('HGTEST_JOBS', 1),
99 99 'timeout': ('HGTEST_TIMEOUT', 180),
100 100 'port': ('HGTEST_PORT', 20059),
101 101 'shell': ('HGTEST_SHELL', '/bin/sh'),
102 102 }
103 103
104 104 def parselistfiles(files, listtype, warn=True):
105 105 entries = dict()
106 106 for filename in files:
107 107 try:
108 108 path = os.path.expanduser(os.path.expandvars(filename))
109 109 f = open(path, "r")
110 110 except IOError, err:
111 111 if err.errno != errno.ENOENT:
112 112 raise
113 113 if warn:
114 114 print "warning: no such %s file: %s" % (listtype, filename)
115 115 continue
116 116
117 117 for line in f.readlines():
118 118 line = line.split('#', 1)[0].strip()
119 119 if line:
120 120 entries[line] = filename
121 121
122 122 f.close()
123 123 return entries
124 124
125 125 def parseargs():
126 126 parser = optparse.OptionParser("%prog [options] [tests]")
127 127
128 128 # keep these sorted
129 129 parser.add_option("--blacklist", action="append",
130 130 help="skip tests listed in the specified blacklist file")
131 131 parser.add_option("--whitelist", action="append",
132 132 help="always run tests listed in the specified whitelist file")
133 133 parser.add_option("-C", "--annotate", action="store_true",
134 134 help="output files annotated with coverage")
135 135 parser.add_option("--child", type="int",
136 136 help="run as child process, summary to given fd")
137 137 parser.add_option("-c", "--cover", action="store_true",
138 138 help="print a test coverage report")
139 139 parser.add_option("-d", "--debug", action="store_true",
140 140 help="debug mode: write output of test scripts to console"
141 141 " rather than capturing and diff'ing it (disables timeout)")
142 142 parser.add_option("-f", "--first", action="store_true",
143 143 help="exit on the first test failure")
144 144 parser.add_option("--inotify", action="store_true",
145 145 help="enable inotify extension when running tests")
146 146 parser.add_option("-i", "--interactive", action="store_true",
147 147 help="prompt to accept changed output")
148 148 parser.add_option("-j", "--jobs", type="int",
149 149 help="number of jobs to run in parallel"
150 150 " (default: $%s or %d)" % defaults['jobs'])
151 151 parser.add_option("--keep-tmpdir", action="store_true",
152 152 help="keep temporary directory after running tests")
153 153 parser.add_option("-k", "--keywords",
154 154 help="run tests matching keywords")
155 155 parser.add_option("-l", "--local", action="store_true",
156 156 help="shortcut for --with-hg=<testdir>/../hg")
157 157 parser.add_option("-n", "--nodiff", action="store_true",
158 158 help="skip showing test changes")
159 159 parser.add_option("-p", "--port", type="int",
160 160 help="port on which servers should listen"
161 161 " (default: $%s or %d)" % defaults['port'])
162 162 parser.add_option("--pure", action="store_true",
163 163 help="use pure Python code instead of C extensions")
164 164 parser.add_option("-R", "--restart", action="store_true",
165 165 help="restart at last error")
166 166 parser.add_option("-r", "--retest", action="store_true",
167 167 help="retest failed tests")
168 168 parser.add_option("-S", "--noskips", action="store_true",
169 169 help="don't report skip tests verbosely")
170 170 parser.add_option("--shell", type="string",
171 171 help="shell to use (default: $%s or %s)" % defaults['shell'])
172 172 parser.add_option("-t", "--timeout", type="int",
173 173 help="kill errant tests after TIMEOUT seconds"
174 174 " (default: $%s or %d)" % defaults['timeout'])
175 175 parser.add_option("--tmpdir", type="string",
176 176 help="run tests in the given temporary directory"
177 177 " (implies --keep-tmpdir)")
178 178 parser.add_option("-v", "--verbose", action="store_true",
179 179 help="output verbose messages")
180 180 parser.add_option("--view", type="string",
181 181 help="external diff viewer")
182 182 parser.add_option("--with-hg", type="string",
183 183 metavar="HG",
184 184 help="test using specified hg script rather than a "
185 185 "temporary installation")
186 186 parser.add_option("-3", "--py3k-warnings", action="store_true",
187 187 help="enable Py3k warnings on Python 2.6+")
188 188 parser.add_option('--extra-config-opt', action="append",
189 189 help='set the given config opt in the test hgrc')
190 190
191 191 for option, (envvar, default) in defaults.items():
192 192 defaults[option] = type(default)(os.environ.get(envvar, default))
193 193 parser.set_defaults(**defaults)
194 194 (options, args) = parser.parse_args()
195 195
196 196 # jython is always pure
197 197 if 'java' in sys.platform or '__pypy__' in sys.modules:
198 198 options.pure = True
199 199
200 200 if options.with_hg:
201 201 if not (os.path.isfile(options.with_hg) and
202 202 os.access(options.with_hg, os.X_OK)):
203 203 parser.error('--with-hg must specify an executable hg script')
204 204 if not os.path.basename(options.with_hg) == 'hg':
205 205 sys.stderr.write('warning: --with-hg should specify an hg script\n')
206 206 if options.local:
207 207 testdir = os.path.dirname(os.path.realpath(sys.argv[0]))
208 208 hgbin = os.path.join(os.path.dirname(testdir), 'hg')
209 209 if not os.access(hgbin, os.X_OK):
210 210 parser.error('--local specified, but %r not found or not executable'
211 211 % hgbin)
212 212 options.with_hg = hgbin
213 213
214 214 options.anycoverage = options.cover or options.annotate
215 215 if options.anycoverage:
216 216 try:
217 217 import coverage
218 218 covver = version.StrictVersion(coverage.__version__).version
219 219 if covver < (3, 3):
220 220 parser.error('coverage options require coverage 3.3 or later')
221 221 except ImportError:
222 222 parser.error('coverage options now require the coverage package')
223 223
224 224 if options.anycoverage and options.local:
225 225 # this needs some path mangling somewhere, I guess
226 226 parser.error("sorry, coverage options do not work when --local "
227 227 "is specified")
228 228
229 229 global vlog
230 230 if options.verbose:
231 231 if options.jobs > 1 or options.child is not None:
232 232 pid = "[%d]" % os.getpid()
233 233 else:
234 234 pid = None
235 235 def vlog(*msg):
236 236 iolock.acquire()
237 237 if pid:
238 238 print pid,
239 239 for m in msg:
240 240 print m,
241 241 print
242 242 sys.stdout.flush()
243 243 iolock.release()
244 244 else:
245 245 vlog = lambda *msg: None
246 246
247 247 if options.tmpdir:
248 248 options.tmpdir = os.path.expanduser(options.tmpdir)
249 249
250 250 if options.jobs < 1:
251 251 parser.error('--jobs must be positive')
252 252 if options.interactive and options.jobs > 1:
253 253 print '(--interactive overrides --jobs)'
254 254 options.jobs = 1
255 255 if options.interactive and options.debug:
256 256 parser.error("-i/--interactive and -d/--debug are incompatible")
257 257 if options.debug:
258 258 if options.timeout != defaults['timeout']:
259 259 sys.stderr.write(
260 260 'warning: --timeout option ignored with --debug\n')
261 261 options.timeout = 0
262 262 if options.py3k_warnings:
263 263 if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0):
264 264 parser.error('--py3k-warnings can only be used on Python 2.6+')
265 265 if options.blacklist:
266 266 options.blacklist = parselistfiles(options.blacklist, 'blacklist')
267 267 if options.whitelist:
268 268 options.whitelisted = parselistfiles(options.whitelist, 'whitelist',
269 269 warn=options.child is None)
270 270 else:
271 271 options.whitelisted = {}
272 272
273 273 return (options, args)
274 274
275 275 def rename(src, dst):
276 276 """Like os.rename(), trade atomicity and opened files friendliness
277 277 for existing destination support.
278 278 """
279 279 shutil.copy(src, dst)
280 280 os.remove(src)
281 281
282 282 def splitnewlines(text):
283 283 '''like str.splitlines, but only split on newlines.
284 284 keep line endings.'''
285 285 i = 0
286 286 lines = []
287 287 while True:
288 288 n = text.find('\n', i)
289 289 if n == -1:
290 290 last = text[i:]
291 291 if last:
292 292 lines.append(last)
293 293 return lines
294 294 lines.append(text[i:n + 1])
295 295 i = n + 1
296 296
297 297 def parsehghaveoutput(lines):
298 298 '''Parse hghave log lines.
299 299 Return tuple of lists (missing, failed):
300 300 * the missing/unknown features
301 301 * the features for which existence check failed'''
302 302 missing = []
303 303 failed = []
304 304 for line in lines:
305 305 if line.startswith(SKIPPED_PREFIX):
306 306 line = line.splitlines()[0]
307 307 missing.append(line[len(SKIPPED_PREFIX):])
308 308 elif line.startswith(FAILED_PREFIX):
309 309 line = line.splitlines()[0]
310 310 failed.append(line[len(FAILED_PREFIX):])
311 311
312 312 return missing, failed
313 313
314 314 def showdiff(expected, output, ref, err):
315 315 print
316 316 for line in difflib.unified_diff(expected, output, ref, err):
317 317 sys.stdout.write(line)
318 318
319 319 def findprogram(program):
320 320 """Search PATH for a executable program"""
321 321 for p in os.environ.get('PATH', os.defpath).split(os.pathsep):
322 322 name = os.path.join(p, program)
323 323 if os.name == 'nt' or os.access(name, os.X_OK):
324 324 return name
325 325 return None
326 326
327 327 def checktools():
328 328 # Before we go any further, check for pre-requisite tools
329 329 # stuff from coreutils (cat, rm, etc) are not tested
330 330 for p in requiredtools:
331 331 if os.name == 'nt':
332 332 p += '.exe'
333 333 found = findprogram(p)
334 334 if found:
335 335 vlog("# Found prerequisite", p, "at", found)
336 336 else:
337 337 print "WARNING: Did not find prerequisite tool: "+p
338 338
339 339 def terminate(proc):
340 340 """Terminate subprocess (with fallback for Python versions < 2.6)"""
341 341 vlog('# Terminating process %d' % proc.pid)
342 342 try:
343 343 getattr(proc, 'terminate', lambda : os.kill(proc.pid, signal.SIGTERM))()
344 344 except OSError:
345 345 pass
346 346
347 347 def killdaemons():
348 348 # Kill off any leftover daemon processes
349 349 try:
350 350 fp = open(DAEMON_PIDS)
351 351 for line in fp:
352 352 try:
353 353 pid = int(line)
354 354 except ValueError:
355 355 continue
356 356 try:
357 357 os.kill(pid, 0)
358 358 vlog('# Killing daemon process %d' % pid)
359 359 os.kill(pid, signal.SIGTERM)
360 360 time.sleep(0.25)
361 361 os.kill(pid, 0)
362 362 vlog('# Daemon process %d is stuck - really killing it' % pid)
363 363 os.kill(pid, signal.SIGKILL)
364 364 except OSError, err:
365 365 if err.errno != errno.ESRCH:
366 366 raise
367 367 fp.close()
368 368 os.unlink(DAEMON_PIDS)
369 369 except IOError:
370 370 pass
371 371
372 372 def cleanup(options):
373 373 if not options.keep_tmpdir:
374 374 vlog("# Cleaning up HGTMP", HGTMP)
375 375 shutil.rmtree(HGTMP, True)
376 376
377 377 def usecorrectpython():
378 378 # some tests run python interpreter. they must use same
379 379 # interpreter we use or bad things will happen.
380 380 exedir, exename = os.path.split(sys.executable)
381 381 if exename in ('python', 'python.exe'):
382 382 path = findprogram(exename)
383 383 if os.path.dirname(path) == exedir:
384 384 return
385 385 else:
386 386 exename = 'python'
387 387 vlog('# Making python executable in test path use correct Python')
388 388 mypython = os.path.join(BINDIR, exename)
389 389 try:
390 390 os.symlink(sys.executable, mypython)
391 391 except AttributeError:
392 392 # windows fallback
393 393 shutil.copyfile(sys.executable, mypython)
394 394 shutil.copymode(sys.executable, mypython)
395 395
396 396 def installhg(options):
397 397 vlog("# Performing temporary installation of HG")
398 398 installerrs = os.path.join("tests", "install.err")
399 399 pure = options.pure and "--pure" or ""
400 400
401 401 # Run installer in hg root
402 402 script = os.path.realpath(sys.argv[0])
403 403 hgroot = os.path.dirname(os.path.dirname(script))
404 404 os.chdir(hgroot)
405 405 nohome = '--home=""'
406 406 if os.name == 'nt':
407 407 # The --home="" trick works only on OS where os.sep == '/'
408 408 # because of a distutils convert_path() fast-path. Avoid it at
409 409 # least on Windows for now, deal with .pydistutils.cfg bugs
410 410 # when they happen.
411 411 nohome = ''
412 412 cmd = ('%s setup.py %s clean --all'
413 413 ' build --build-base="%s"'
414 414 ' install --force --prefix="%s" --install-lib="%s"'
415 415 ' --install-scripts="%s" %s >%s 2>&1'
416 416 % (sys.executable, pure, os.path.join(HGTMP, "build"),
417 417 INST, PYTHONDIR, BINDIR, nohome, installerrs))
418 418 vlog("# Running", cmd)
419 419 if os.system(cmd) == 0:
420 420 if not options.verbose:
421 421 os.remove(installerrs)
422 422 else:
423 423 f = open(installerrs)
424 424 for line in f:
425 425 print line,
426 426 f.close()
427 427 sys.exit(1)
428 428 os.chdir(TESTDIR)
429 429
430 430 usecorrectpython()
431 431
432 432 vlog("# Installing dummy diffstat")
433 433 f = open(os.path.join(BINDIR, 'diffstat'), 'w')
434 434 f.write('#!' + sys.executable + '\n'
435 435 'import sys\n'
436 436 'files = 0\n'
437 437 'for line in sys.stdin:\n'
438 438 ' if line.startswith("diff "):\n'
439 439 ' files += 1\n'
440 440 'sys.stdout.write("files patched: %d\\n" % files)\n')
441 441 f.close()
442 442 os.chmod(os.path.join(BINDIR, 'diffstat'), 0700)
443 443
444 444 if options.py3k_warnings and not options.anycoverage:
445 445 vlog("# Updating hg command to enable Py3k Warnings switch")
446 446 f = open(os.path.join(BINDIR, 'hg'), 'r')
447 447 lines = [line.rstrip() for line in f]
448 448 lines[0] += ' -3'
449 449 f.close()
450 450 f = open(os.path.join(BINDIR, 'hg'), 'w')
451 451 for line in lines:
452 452 f.write(line + '\n')
453 453 f.close()
454 454
455 455 hgbat = os.path.join(BINDIR, 'hg.bat')
456 456 if os.path.isfile(hgbat):
457 457 # hg.bat expects to be put in bin/scripts while run-tests.py
458 458 # installation layout put it in bin/ directly. Fix it
459 459 f = open(hgbat, 'rb')
460 460 data = f.read()
461 461 f.close()
462 462 if '"%~dp0..\python" "%~dp0hg" %*' in data:
463 463 data = data.replace('"%~dp0..\python" "%~dp0hg" %*',
464 464 '"%~dp0python" "%~dp0hg" %*')
465 465 f = open(hgbat, 'wb')
466 466 f.write(data)
467 467 f.close()
468 468 else:
469 469 print 'WARNING: cannot fix hg.bat reference to python.exe'
470 470
471 471 if options.anycoverage:
472 472 custom = os.path.join(TESTDIR, 'sitecustomize.py')
473 473 target = os.path.join(PYTHONDIR, 'sitecustomize.py')
474 474 vlog('# Installing coverage trigger to %s' % target)
475 475 shutil.copyfile(custom, target)
476 476 rc = os.path.join(TESTDIR, '.coveragerc')
477 477 vlog('# Installing coverage rc to %s' % rc)
478 478 os.environ['COVERAGE_PROCESS_START'] = rc
479 479 fn = os.path.join(INST, '..', '.coverage')
480 480 os.environ['COVERAGE_FILE'] = fn
481 481
482 482 def outputcoverage(options):
483 483
484 484 vlog('# Producing coverage report')
485 485 os.chdir(PYTHONDIR)
486 486
487 487 def covrun(*args):
488 488 cmd = 'coverage %s' % ' '.join(args)
489 489 vlog('# Running: %s' % cmd)
490 490 os.system(cmd)
491 491
492 492 if options.child:
493 493 return
494 494
495 495 covrun('-c')
496 496 omit = ','.join([BINDIR, TESTDIR])
497 497 covrun('-i', '-r', '"--omit=%s"' % omit) # report
498 498 if options.annotate:
499 499 adir = os.path.join(TESTDIR, 'annotated')
500 500 if not os.path.isdir(adir):
501 501 os.mkdir(adir)
502 502 covrun('-i', '-a', '"--directory=%s"' % adir, '"--omit=%s"' % omit)
503 503
504 504 def pytest(test, wd, options, replacements):
505 505 py3kswitch = options.py3k_warnings and ' -3' or ''
506 506 cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test)
507 507 vlog("# Running", cmd)
508 508 return run(cmd, wd, options, replacements)
509 509
510 510 def shtest(test, wd, options, replacements):
511 511 cmd = '"%s"' % test
512 512 vlog("# Running", cmd)
513 513 return run(cmd, wd, options, replacements)
514 514
515 515 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search
516 516 escapesub = re.compile(r'[\x00-\x08\x0b-\x1f\\\x7f-\xff]').sub
517 517 escapemap = dict((chr(i), r'\x%02x' % i) for i in range(256))
518 518 escapemap.update({'\\': '\\\\', '\r': r'\r'})
519 519 def escapef(m):
520 520 return escapemap[m.group(0)]
521 521 def stringescape(s):
522 522 return escapesub(escapef, s)
523 523
524 524 def rematch(el, l):
525 525 try:
526 526 # ensure that the regex matches to the end of the string
527 527 return re.match(el + r'\Z', l)
528 528 except re.error:
529 529 # el is an invalid regex
530 530 return False
531 531
532 532 def globmatch(el, l):
533 # The only supported special characters are * and ?. Escaping is
534 # supported.
533 # The only supported special characters are * and ? plus / which also
534 # matches \ on windows. Escaping of these caracters is supported.
535 535 i, n = 0, len(el)
536 536 res = ''
537 537 while i < n:
538 538 c = el[i]
539 539 i += 1
540 if c == '\\' and el[i] in '*?\\':
540 if c == '\\' and el[i] in '*?\\/':
541 541 res += el[i - 1:i + 1]
542 542 i += 1
543 543 elif c == '*':
544 544 res += '.*'
545 545 elif c == '?':
546 546 res += '.'
547 elif c == '/' and os.name == 'nt':
548 res += '[/\\\\]'
547 549 else:
548 550 res += re.escape(c)
549 551 return rematch(res, l)
550 552
551 553 def linematch(el, l):
552 554 if el == l: # perfect match (fast)
553 555 return True
554 556 if (el and
555 557 (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or
556 558 el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', l) or
557 559 el.endswith(" (esc)\n") and
558 560 el[:-7].decode('string-escape') + '\n' == l)):
559 561 return True
560 562 return False
561 563
562 564 def tsttest(test, wd, options, replacements):
563 565 # We generate a shell script which outputs unique markers to line
564 566 # up script results with our source. These markers include input
565 567 # line number and the last return code
566 568 salt = "SALT" + str(time.time())
567 569 def addsalt(line, inpython):
568 570 if inpython:
569 571 script.append('%s %d 0\n' % (salt, line))
570 572 else:
571 573 script.append('echo %s %s $?\n' % (salt, line))
572 574
573 575 # After we run the shell script, we re-unify the script output
574 576 # with non-active parts of the source, with synchronization by our
575 577 # SALT line number markers. The after table contains the
576 578 # non-active components, ordered by line number
577 579 after = {}
578 580 pos = prepos = -1
579 581
580 582 # Expected shellscript output
581 583 expected = {}
582 584
583 585 # We keep track of whether or not we're in a Python block so we
584 586 # can generate the surrounding doctest magic
585 587 inpython = False
586 588
587 589 f = open(test)
588 590 t = f.readlines()
589 591 f.close()
590 592
591 593 script = []
592 594 for n, l in enumerate(t):
593 595 if not l.endswith('\n'):
594 596 l += '\n'
595 597 if l.startswith(' >>> '): # python inlines
596 598 after.setdefault(pos, []).append(l)
597 599 prepos = pos
598 600 pos = n
599 601 if not inpython:
600 602 # we've just entered a Python block, add the header
601 603 inpython = True
602 604 addsalt(prepos, False) # make sure we report the exit code
603 605 script.append('%s -m heredoctest <<EOF\n' % PYTHON)
604 606 addsalt(n, True)
605 607 script.append(l[2:])
606 608 if l.startswith(' ... '): # python inlines
607 609 after.setdefault(prepos, []).append(l)
608 610 script.append(l[2:])
609 611 elif l.startswith(' $ '): # commands
610 612 if inpython:
611 613 script.append("EOF\n")
612 614 inpython = False
613 615 after.setdefault(pos, []).append(l)
614 616 prepos = pos
615 617 pos = n
616 618 addsalt(n, False)
617 619 script.append(l[4:])
618 620 elif l.startswith(' > '): # continuations
619 621 after.setdefault(prepos, []).append(l)
620 622 script.append(l[4:])
621 623 elif l.startswith(' '): # results
622 624 # queue up a list of expected results
623 625 expected.setdefault(pos, []).append(l[2:])
624 626 else:
625 627 if inpython:
626 628 script.append("EOF\n")
627 629 inpython = False
628 630 # non-command/result - queue up for merged output
629 631 after.setdefault(pos, []).append(l)
630 632
631 633 if inpython:
632 634 script.append("EOF\n")
633 635 addsalt(n + 1, False)
634 636
635 637 # Write out the script and execute it
636 638 fd, name = tempfile.mkstemp(suffix='hg-tst')
637 639 try:
638 640 for l in script:
639 641 os.write(fd, l)
640 642 os.close(fd)
641 643
642 644 cmd = '"%s" "%s"' % (options.shell, name)
643 645 vlog("# Running", cmd)
644 646 exitcode, output = run(cmd, wd, options, replacements)
645 647 # do not merge output if skipped, return hghave message instead
646 648 # similarly, with --debug, output is None
647 649 if exitcode == SKIPPED_STATUS or output is None:
648 650 return exitcode, output
649 651 finally:
650 652 os.remove(name)
651 653
652 654 # Merge the script output back into a unified test
653 655
654 656 pos = -1
655 657 postout = []
656 658 ret = 0
657 659 for n, l in enumerate(output):
658 660 lout, lcmd = l, None
659 661 if salt in l:
660 662 lout, lcmd = l.split(salt, 1)
661 663
662 664 if lout:
663 665 if lcmd:
664 666 # output block had no trailing newline, clean up
665 667 lout += ' (no-eol)\n'
666 668
667 669 # find the expected output at the current position
668 670 el = None
669 671 if pos in expected and expected[pos]:
670 672 el = expected[pos].pop(0)
671 673
672 674 if linematch(el, lout):
673 675 postout.append(" " + el)
674 676 else:
675 677 if needescape(lout):
676 678 lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
677 679 postout.append(" " + lout) # let diff deal with it
678 680
679 681 if lcmd:
680 682 # add on last return code
681 683 ret = int(lcmd.split()[1])
682 684 if ret != 0:
683 685 postout.append(" [%s]\n" % ret)
684 686 if pos in after:
685 687 # merge in non-active test bits
686 688 postout += after.pop(pos)
687 689 pos = int(lcmd.split()[0])
688 690
689 691 if pos in after:
690 692 postout += after.pop(pos)
691 693
692 694 return exitcode, postout
693 695
694 696 wifexited = getattr(os, "WIFEXITED", lambda x: False)
695 697 def run(cmd, wd, options, replacements):
696 698 """Run command in a sub-process, capturing the output (stdout and stderr).
697 699 Return a tuple (exitcode, output). output is None in debug mode."""
698 700 # TODO: Use subprocess.Popen if we're running on Python 2.4
699 701 if options.debug:
700 702 proc = subprocess.Popen(cmd, shell=True, cwd=wd)
701 703 ret = proc.wait()
702 704 return (ret, None)
703 705
704 706 proc = Popen4(cmd, wd, options.timeout)
705 707 def cleanup():
706 708 terminate(proc)
707 709 ret = proc.wait()
708 710 if ret == 0:
709 711 ret = signal.SIGTERM << 8
710 712 killdaemons()
711 713 return ret
712 714
713 715 output = ''
714 716 proc.tochild.close()
715 717
716 718 try:
717 719 output = proc.fromchild.read()
718 720 except KeyboardInterrupt:
719 721 vlog('# Handling keyboard interrupt')
720 722 cleanup()
721 723 raise
722 724
723 725 ret = proc.wait()
724 726 if wifexited(ret):
725 727 ret = os.WEXITSTATUS(ret)
726 728
727 729 if proc.timeout:
728 730 ret = 'timeout'
729 731
730 732 if ret:
731 733 killdaemons()
732 734
733 735 for s, r in replacements:
734 736 output = re.sub(s, r, output)
735 737 return ret, splitnewlines(output)
736 738
737 739 def runone(options, test):
738 740 '''tristate output:
739 741 None -> skipped
740 742 True -> passed
741 743 False -> failed'''
742 744
743 745 global results, resultslock, iolock
744 746
745 747 testpath = os.path.join(TESTDIR, test)
746 748
747 749 def result(l, e):
748 750 resultslock.acquire()
749 751 results[l].append(e)
750 752 resultslock.release()
751 753
752 754 def skip(msg):
753 755 if not options.verbose:
754 756 result('s', (test, msg))
755 757 else:
756 758 iolock.acquire()
757 759 print "\nSkipping %s: %s" % (testpath, msg)
758 760 iolock.release()
759 761 return None
760 762
761 763 def fail(msg, ret):
762 764 if not options.nodiff:
763 765 iolock.acquire()
764 766 print "\nERROR: %s %s" % (testpath, msg)
765 767 iolock.release()
766 768 if (not ret and options.interactive
767 769 and os.path.exists(testpath + ".err")):
768 770 iolock.acquire()
769 771 print "Accept this change? [n] ",
770 772 answer = sys.stdin.readline().strip()
771 773 iolock.release()
772 774 if answer.lower() in "y yes".split():
773 775 if test.endswith(".t"):
774 776 rename(testpath + ".err", testpath)
775 777 else:
776 778 rename(testpath + ".err", testpath + ".out")
777 779 result('p', test)
778 780 return
779 781 result('f', (test, msg))
780 782
781 783 def success():
782 784 result('p', test)
783 785
784 786 def ignore(msg):
785 787 result('i', (test, msg))
786 788
787 789 if (os.path.basename(test).startswith("test-") and '~' not in test and
788 790 ('.' not in test or test.endswith('.py') or
789 791 test.endswith('.bat') or test.endswith('.t'))):
790 792 if not os.path.exists(test):
791 793 skip("doesn't exist")
792 794 return None
793 795 else:
794 796 vlog('# Test file', test, 'not supported, ignoring')
795 797 return None # not a supported test, don't record
796 798
797 799 if not (options.whitelisted and test in options.whitelisted):
798 800 if options.blacklist and test in options.blacklist:
799 801 skip("blacklisted")
800 802 return None
801 803
802 804 if options.retest and not os.path.exists(test + ".err"):
803 805 ignore("not retesting")
804 806 return None
805 807
806 808 if options.keywords:
807 809 fp = open(test)
808 810 t = fp.read().lower() + test.lower()
809 811 fp.close()
810 812 for k in options.keywords.lower().split():
811 813 if k in t:
812 814 break
813 815 else:
814 816 ignore("doesn't match keyword")
815 817 return None
816 818
817 819 vlog("# Test", test)
818 820
819 821 # create a fresh hgrc
820 822 hgrc = open(HGRCPATH, 'w+')
821 823 hgrc.write('[ui]\n')
822 824 hgrc.write('slash = True\n')
823 825 hgrc.write('[defaults]\n')
824 826 hgrc.write('backout = -d "0 0"\n')
825 827 hgrc.write('commit = -d "0 0"\n')
826 828 hgrc.write('tag = -d "0 0"\n')
827 829 if options.inotify:
828 830 hgrc.write('[extensions]\n')
829 831 hgrc.write('inotify=\n')
830 832 hgrc.write('[inotify]\n')
831 833 hgrc.write('pidfile=%s\n' % DAEMON_PIDS)
832 834 hgrc.write('appendpid=True\n')
833 835 if options.extra_config_opt:
834 836 for opt in options.extra_config_opt:
835 837 section, key = opt.split('.', 1)
836 838 assert '=' in key, ('extra config opt %s must '
837 839 'have an = for assignment' % opt)
838 840 hgrc.write('[%s]\n%s\n' % (section, key))
839 841 hgrc.close()
840 842
841 843 ref = os.path.join(TESTDIR, test+".out")
842 844 err = os.path.join(TESTDIR, test+".err")
843 845 if os.path.exists(err):
844 846 os.remove(err) # Remove any previous output files
845 847 try:
846 848 tf = open(testpath)
847 849 firstline = tf.readline().rstrip()
848 850 tf.close()
849 851 except:
850 852 firstline = ''
851 853 lctest = test.lower()
852 854
853 855 if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
854 856 runner = pytest
855 857 elif lctest.endswith('.t'):
856 858 runner = tsttest
857 859 ref = testpath
858 860 else:
859 861 # do not try to run non-executable programs
860 862 if not os.access(testpath, os.X_OK):
861 863 return skip("not executable")
862 864 runner = shtest
863 865
864 866 # Make a tmp subdirectory to work in
865 867 testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
866 868 os.path.join(HGTMP, os.path.basename(test))
867 869
868 870 os.mkdir(testtmp)
869 871 ret, out = runner(testpath, testtmp, options, [
870 872 (re.escape(testtmp), '$TESTTMP'),
871 873 (r':%s\b' % options.port, ':$HGPORT'),
872 874 (r':%s\b' % (options.port + 1), ':$HGPORT1'),
873 875 (r':%s\b' % (options.port + 2), ':$HGPORT2'),
874 876 ])
875 877 vlog("# Ret was:", ret)
876 878
877 879 mark = '.'
878 880
879 881 skipped = (ret == SKIPPED_STATUS)
880 882
881 883 # If we're not in --debug mode and reference output file exists,
882 884 # check test output against it.
883 885 if options.debug:
884 886 refout = None # to match "out is None"
885 887 elif os.path.exists(ref):
886 888 f = open(ref, "r")
887 889 refout = list(splitnewlines(f.read()))
888 890 f.close()
889 891 else:
890 892 refout = []
891 893
892 894 if (ret != 0 or out != refout) and not skipped and not options.debug:
893 895 # Save errors to a file for diagnosis
894 896 f = open(err, "wb")
895 897 for line in out:
896 898 f.write(line)
897 899 f.close()
898 900
899 901 if skipped:
900 902 mark = 's'
901 903 if out is None: # debug mode: nothing to parse
902 904 missing = ['unknown']
903 905 failed = None
904 906 else:
905 907 missing, failed = parsehghaveoutput(out)
906 908 if not missing:
907 909 missing = ['irrelevant']
908 910 if failed:
909 911 fail("hghave failed checking for %s" % failed[-1], ret)
910 912 skipped = False
911 913 else:
912 914 skip(missing[-1])
913 915 elif ret == 'timeout':
914 916 mark = 't'
915 917 fail("timed out", ret)
916 918 elif out != refout:
917 919 mark = '!'
918 920 if not options.nodiff:
919 921 iolock.acquire()
920 922 if options.view:
921 923 os.system("%s %s %s" % (options.view, ref, err))
922 924 else:
923 925 showdiff(refout, out, ref, err)
924 926 iolock.release()
925 927 if ret:
926 928 fail("output changed and returned error code %d" % ret, ret)
927 929 else:
928 930 fail("output changed", ret)
929 931 ret = 1
930 932 elif ret:
931 933 mark = '!'
932 934 fail("returned error code %d" % ret, ret)
933 935 else:
934 936 success()
935 937
936 938 if not options.verbose:
937 939 iolock.acquire()
938 940 sys.stdout.write(mark)
939 941 sys.stdout.flush()
940 942 iolock.release()
941 943
942 944 killdaemons()
943 945
944 946 if not options.keep_tmpdir:
945 947 shutil.rmtree(testtmp, True)
946 948 if skipped:
947 949 return None
948 950 return ret == 0
949 951
950 952 _hgpath = None
951 953
952 954 def _gethgpath():
953 955 """Return the path to the mercurial package that is actually found by
954 956 the current Python interpreter."""
955 957 global _hgpath
956 958 if _hgpath is not None:
957 959 return _hgpath
958 960
959 961 cmd = '%s -c "import mercurial; print mercurial.__path__[0]"'
960 962 pipe = os.popen(cmd % PYTHON)
961 963 try:
962 964 _hgpath = pipe.read().strip()
963 965 finally:
964 966 pipe.close()
965 967 return _hgpath
966 968
967 969 def _checkhglib(verb):
968 970 """Ensure that the 'mercurial' package imported by python is
969 971 the one we expect it to be. If not, print a warning to stderr."""
970 972 expecthg = os.path.join(PYTHONDIR, 'mercurial')
971 973 actualhg = _gethgpath()
972 974 if os.path.abspath(actualhg) != os.path.abspath(expecthg):
973 975 sys.stderr.write('warning: %s with unexpected mercurial lib: %s\n'
974 976 ' (expected %s)\n'
975 977 % (verb, actualhg, expecthg))
976 978
977 979 def runchildren(options, tests):
978 980 if INST:
979 981 installhg(options)
980 982 _checkhglib("Testing")
981 983
982 984 optcopy = dict(options.__dict__)
983 985 optcopy['jobs'] = 1
984 986
985 987 # Because whitelist has to override keyword matches, we have to
986 988 # actually load the whitelist in the children as well, so we allow
987 989 # the list of whitelist files to pass through and be parsed in the
988 990 # children, but not the dict of whitelisted tests resulting from
989 991 # the parse, used here to override blacklisted tests.
990 992 whitelist = optcopy['whitelisted'] or []
991 993 del optcopy['whitelisted']
992 994
993 995 blacklist = optcopy['blacklist'] or []
994 996 del optcopy['blacklist']
995 997 blacklisted = []
996 998
997 999 if optcopy['with_hg'] is None:
998 1000 optcopy['with_hg'] = os.path.join(BINDIR, "hg")
999 1001 optcopy.pop('anycoverage', None)
1000 1002
1001 1003 opts = []
1002 1004 for opt, value in optcopy.iteritems():
1003 1005 name = '--' + opt.replace('_', '-')
1004 1006 if value is True:
1005 1007 opts.append(name)
1006 1008 elif isinstance(value, list):
1007 1009 for v in value:
1008 1010 opts.append(name + '=' + str(v))
1009 1011 elif value is not None:
1010 1012 opts.append(name + '=' + str(value))
1011 1013
1012 1014 tests.reverse()
1013 1015 jobs = [[] for j in xrange(options.jobs)]
1014 1016 while tests:
1015 1017 for job in jobs:
1016 1018 if not tests:
1017 1019 break
1018 1020 test = tests.pop()
1019 1021 if test not in whitelist and test in blacklist:
1020 1022 blacklisted.append(test)
1021 1023 else:
1022 1024 job.append(test)
1023 1025 fps = {}
1024 1026
1025 1027 for j, job in enumerate(jobs):
1026 1028 if not job:
1027 1029 continue
1028 1030 rfd, wfd = os.pipe()
1029 1031 childopts = ['--child=%d' % wfd, '--port=%d' % (options.port + j * 3)]
1030 1032 childtmp = os.path.join(HGTMP, 'child%d' % j)
1031 1033 childopts += ['--tmpdir', childtmp]
1032 1034 cmdline = [PYTHON, sys.argv[0]] + opts + childopts + job
1033 1035 vlog(' '.join(cmdline))
1034 1036 fps[os.spawnvp(os.P_NOWAIT, cmdline[0], cmdline)] = os.fdopen(rfd, 'r')
1035 1037 os.close(wfd)
1036 1038 signal.signal(signal.SIGINT, signal.SIG_IGN)
1037 1039 failures = 0
1038 1040 tested, skipped, failed = 0, 0, 0
1039 1041 skips = []
1040 1042 fails = []
1041 1043 while fps:
1042 1044 pid, status = os.wait()
1043 1045 fp = fps.pop(pid)
1044 1046 l = fp.read().splitlines()
1045 1047 try:
1046 1048 test, skip, fail = map(int, l[:3])
1047 1049 except ValueError:
1048 1050 test, skip, fail = 0, 0, 0
1049 1051 split = -fail or len(l)
1050 1052 for s in l[3:split]:
1051 1053 skips.append(s.split(" ", 1))
1052 1054 for s in l[split:]:
1053 1055 fails.append(s.split(" ", 1))
1054 1056 tested += test
1055 1057 skipped += skip
1056 1058 failed += fail
1057 1059 vlog('pid %d exited, status %d' % (pid, status))
1058 1060 failures |= status
1059 1061 print
1060 1062 skipped += len(blacklisted)
1061 1063 if not options.noskips:
1062 1064 for s in skips:
1063 1065 print "Skipped %s: %s" % (s[0], s[1])
1064 1066 for s in blacklisted:
1065 1067 print "Skipped %s: blacklisted" % s
1066 1068 for s in fails:
1067 1069 print "Failed %s: %s" % (s[0], s[1])
1068 1070
1069 1071 _checkhglib("Tested")
1070 1072 print "# Ran %d tests, %d skipped, %d failed." % (
1071 1073 tested, skipped, failed)
1072 1074
1073 1075 if options.anycoverage:
1074 1076 outputcoverage(options)
1075 1077 sys.exit(failures != 0)
1076 1078
1077 1079 results = dict(p=[], f=[], s=[], i=[])
1078 1080 resultslock = threading.Lock()
1079 1081 iolock = threading.Lock()
1080 1082
1081 1083 def runqueue(options, tests, results):
1082 1084 for test in tests:
1083 1085 ret = runone(options, test)
1084 1086 if options.first and ret is not None and not ret:
1085 1087 break
1086 1088
1087 1089 def runtests(options, tests):
1088 1090 global DAEMON_PIDS, HGRCPATH
1089 1091 DAEMON_PIDS = os.environ["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
1090 1092 HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
1091 1093
1092 1094 try:
1093 1095 if INST:
1094 1096 installhg(options)
1095 1097 _checkhglib("Testing")
1096 1098
1097 1099 if options.restart:
1098 1100 orig = list(tests)
1099 1101 while tests:
1100 1102 if os.path.exists(tests[0] + ".err"):
1101 1103 break
1102 1104 tests.pop(0)
1103 1105 if not tests:
1104 1106 print "running all tests"
1105 1107 tests = orig
1106 1108
1107 1109 runqueue(options, tests, results)
1108 1110
1109 1111 failed = len(results['f'])
1110 1112 tested = len(results['p']) + failed
1111 1113 skipped = len(results['s'])
1112 1114 ignored = len(results['i'])
1113 1115
1114 1116 if options.child:
1115 1117 fp = os.fdopen(options.child, 'w')
1116 1118 fp.write('%d\n%d\n%d\n' % (tested, skipped, failed))
1117 1119 for s in results['s']:
1118 1120 fp.write("%s %s\n" % s)
1119 1121 for s in results['f']:
1120 1122 fp.write("%s %s\n" % s)
1121 1123 fp.close()
1122 1124 else:
1123 1125 print
1124 1126 for s in results['s']:
1125 1127 print "Skipped %s: %s" % s
1126 1128 for s in results['f']:
1127 1129 print "Failed %s: %s" % s
1128 1130 _checkhglib("Tested")
1129 1131 print "# Ran %d tests, %d skipped, %d failed." % (
1130 1132 tested, skipped + ignored, failed)
1131 1133
1132 1134 if options.anycoverage:
1133 1135 outputcoverage(options)
1134 1136 except KeyboardInterrupt:
1135 1137 failed = True
1136 1138 print "\ninterrupted!"
1137 1139
1138 1140 if failed:
1139 1141 sys.exit(1)
1140 1142
1141 1143 def main():
1142 1144 (options, args) = parseargs()
1143 1145 if not options.child:
1144 1146 os.umask(022)
1145 1147
1146 1148 checktools()
1147 1149
1148 1150 if len(args) == 0:
1149 1151 args = os.listdir(".")
1150 1152 args.sort()
1151 1153
1152 1154 tests = args
1153 1155
1154 1156 # Reset some environment variables to well-known values so that
1155 1157 # the tests produce repeatable output.
1156 1158 os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C'
1157 1159 os.environ['TZ'] = 'GMT'
1158 1160 os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>"
1159 1161 os.environ['CDPATH'] = ''
1160 1162 os.environ['COLUMNS'] = '80'
1161 1163 os.environ['GREP_OPTIONS'] = ''
1162 1164 os.environ['http_proxy'] = ''
1163 1165 os.environ['no_proxy'] = ''
1164 1166 os.environ['NO_PROXY'] = ''
1165 1167
1166 1168 # unset env related to hooks
1167 1169 for k in os.environ.keys():
1168 1170 if k.startswith('HG_'):
1169 1171 # can't remove on solaris
1170 1172 os.environ[k] = ''
1171 1173 del os.environ[k]
1172 1174
1173 1175 global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE
1174 1176 TESTDIR = os.environ["TESTDIR"] = os.getcwd()
1175 1177 if options.tmpdir:
1176 1178 options.keep_tmpdir = True
1177 1179 tmpdir = options.tmpdir
1178 1180 if os.path.exists(tmpdir):
1179 1181 # Meaning of tmpdir has changed since 1.3: we used to create
1180 1182 # HGTMP inside tmpdir; now HGTMP is tmpdir. So fail if
1181 1183 # tmpdir already exists.
1182 1184 sys.exit("error: temp dir %r already exists" % tmpdir)
1183 1185
1184 1186 # Automatically removing tmpdir sounds convenient, but could
1185 1187 # really annoy anyone in the habit of using "--tmpdir=/tmp"
1186 1188 # or "--tmpdir=$HOME".
1187 1189 #vlog("# Removing temp dir", tmpdir)
1188 1190 #shutil.rmtree(tmpdir)
1189 1191 os.makedirs(tmpdir)
1190 1192 else:
1191 1193 tmpdir = tempfile.mkdtemp('', 'hgtests.')
1192 1194 HGTMP = os.environ['HGTMP'] = os.path.realpath(tmpdir)
1193 1195 DAEMON_PIDS = None
1194 1196 HGRCPATH = None
1195 1197
1196 1198 os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
1197 1199 os.environ["HGMERGE"] = "internal:merge"
1198 1200 os.environ["HGUSER"] = "test"
1199 1201 os.environ["HGENCODING"] = "ascii"
1200 1202 os.environ["HGENCODINGMODE"] = "strict"
1201 1203 os.environ["HGPORT"] = str(options.port)
1202 1204 os.environ["HGPORT1"] = str(options.port + 1)
1203 1205 os.environ["HGPORT2"] = str(options.port + 2)
1204 1206
1205 1207 if options.with_hg:
1206 1208 INST = None
1207 1209 BINDIR = os.path.dirname(os.path.realpath(options.with_hg))
1208 1210
1209 1211 # This looks redundant with how Python initializes sys.path from
1210 1212 # the location of the script being executed. Needed because the
1211 1213 # "hg" specified by --with-hg is not the only Python script
1212 1214 # executed in the test suite that needs to import 'mercurial'
1213 1215 # ... which means it's not really redundant at all.
1214 1216 PYTHONDIR = BINDIR
1215 1217 else:
1216 1218 INST = os.path.join(HGTMP, "install")
1217 1219 BINDIR = os.environ["BINDIR"] = os.path.join(INST, "bin")
1218 1220 PYTHONDIR = os.path.join(INST, "lib", "python")
1219 1221
1220 1222 os.environ["BINDIR"] = BINDIR
1221 1223 os.environ["PYTHON"] = PYTHON
1222 1224
1223 1225 if not options.child:
1224 1226 path = [BINDIR] + os.environ["PATH"].split(os.pathsep)
1225 1227 os.environ["PATH"] = os.pathsep.join(path)
1226 1228
1227 1229 # Include TESTDIR in PYTHONPATH so that out-of-tree extensions
1228 1230 # can run .../tests/run-tests.py test-foo where test-foo
1229 1231 # adds an extension to HGRC
1230 1232 pypath = [PYTHONDIR, TESTDIR]
1231 1233 # We have to augment PYTHONPATH, rather than simply replacing
1232 1234 # it, in case external libraries are only available via current
1233 1235 # PYTHONPATH. (In particular, the Subversion bindings on OS X
1234 1236 # are in /opt/subversion.)
1235 1237 oldpypath = os.environ.get(IMPL_PATH)
1236 1238 if oldpypath:
1237 1239 pypath.append(oldpypath)
1238 1240 os.environ[IMPL_PATH] = os.pathsep.join(pypath)
1239 1241
1240 1242 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
1241 1243
1242 1244 vlog("# Using TESTDIR", TESTDIR)
1243 1245 vlog("# Using HGTMP", HGTMP)
1244 1246 vlog("# Using PATH", os.environ["PATH"])
1245 1247 vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
1246 1248
1247 1249 try:
1248 1250 if len(tests) > 1 and options.jobs > 1:
1249 1251 runchildren(options, tests)
1250 1252 else:
1251 1253 runtests(options, tests)
1252 1254 finally:
1253 1255 time.sleep(1)
1254 1256 cleanup(options)
1255 1257
1256 1258 if __name__ == '__main__':
1257 1259 main()
@@ -1,100 +1,100 b''
1 1 $ hg init rep; cd rep
2 2
3 3 $ touch empty-file
4 4 $ python -c 'for x in range(10000): print x' > large-file
5 5
6 6 $ hg addremove
7 7 adding empty-file
8 8 adding large-file
9 9
10 10 $ hg commit -m A
11 11
12 12 $ rm large-file empty-file
13 13 $ python -c 'for x in range(10,10000): print x' > another-file
14 14
15 15 $ hg addremove -s50
16 16 adding another-file
17 17 removing empty-file
18 18 removing large-file
19 19 recording removal of large-file as rename to another-file (99% similar)
20 20
21 21 $ hg commit -m B
22 22
23 23 comparing two empty files caused ZeroDivisionError in the past
24 24
25 25 $ hg update -C 0
26 26 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
27 27 $ rm empty-file
28 28 $ touch another-empty-file
29 29 $ hg addremove -s50
30 30 adding another-empty-file
31 31 removing empty-file
32 32
33 33 $ cd ..
34 34
35 35 $ hg init rep2; cd rep2
36 36
37 37 $ python -c 'for x in range(10000): print x' > large-file
38 38 $ python -c 'for x in range(50): print x' > tiny-file
39 39
40 40 $ hg addremove
41 41 adding large-file
42 42 adding tiny-file
43 43
44 44 $ hg commit -m A
45 45
46 46 $ python -c 'for x in range(70): print x' > small-file
47 47 $ rm tiny-file
48 48 $ rm large-file
49 49
50 50 $ hg addremove -s50
51 51 removing large-file
52 52 adding small-file
53 53 removing tiny-file
54 54 recording removal of tiny-file as rename to small-file (82% similar)
55 55
56 56 $ hg commit -m B
57 57
58 58 should all fail
59 59
60 60 $ hg addremove -s foo
61 61 abort: similarity must be a number
62 62 [255]
63 63 $ hg addremove -s -1
64 64 abort: similarity must be between 0 and 100
65 65 [255]
66 66 $ hg addremove -s 1e6
67 67 abort: similarity must be between 0 and 100
68 68 [255]
69 69
70 70 $ cd ..
71 71
72 72 Issue1527: repeated addremove causes util.Abort
73 73
74 74 $ hg init rep3; cd rep3
75 75 $ mkdir d
76 76 $ echo a > d/a
77 77 $ hg add d/a
78 78 $ hg commit -m 1
79 79
80 80 $ mv d/a d/b
81 81 $ hg addremove -s80
82 82 removing d/a
83 83 adding d/b
84 recording removal of d/a as rename to d/b (100% similar)
84 recording removal of d/a as rename to d/b (100% similar) (glob)
85 85 $ hg debugstate
86 86 r 0 0 1970-01-01 00:00:00 d/a
87 87 a 0 -1 unset d/b
88 88 copy: d/a -> d/b
89 89 $ mv d/b c
90 90
91 91 no copies found here (since the target isn't in d
92 92
93 93 $ hg addremove -s80 d
94 removing d/b
94 removing d/b (glob)
95 95
96 96 copies here
97 97
98 98 $ hg addremove -s80
99 99 adding c
100 recording removal of d/a as rename to c (100% similar)
100 recording removal of d/a as rename to c (100% similar) (glob)
@@ -1,84 +1,84 b''
1 1 $ "$TESTDIR/hghave" symlink || exit 80
2 2
3 3 $ hg init
4 4
5 5 should fail
6 6
7 7 $ hg add .hg/00changelog.i
8 abort: path contains illegal component: .hg/00changelog.i
8 abort: path contains illegal component: .hg/00changelog.i (glob)
9 9 [255]
10 10
11 11 $ mkdir a
12 12 $ echo a > a/a
13 13 $ hg ci -Ama
14 14 adding a/a
15 15 $ ln -s a b
16 16 $ echo b > a/b
17 17
18 18 should fail
19 19
20 20 $ hg add b/b
21 abort: path 'b/b' traverses symbolic link 'b'
21 abort: path 'b/b' traverses symbolic link 'b' (glob)
22 22 [255]
23 23
24 24 should succeed
25 25
26 26 $ hg add b
27 27
28 28 should still fail - maybe
29 29
30 30 $ hg add b/b
31 abort: path 'b/b' traverses symbolic link 'b'
31 abort: path 'b/b' traverses symbolic link 'b' (glob)
32 32 [255]
33 33
34 34 unbundle tampered bundle
35 35
36 36 $ hg init target
37 37 $ cd target
38 38 $ hg unbundle $TESTDIR/bundles/tampered.hg
39 39 adding changesets
40 40 adding manifests
41 41 adding file changes
42 42 added 5 changesets with 6 changes to 6 files (+4 heads)
43 43 (run 'hg heads' to see heads, 'hg merge' to merge)
44 44
45 45 attack .hg/test
46 46
47 47 $ hg manifest -r0
48 48 .hg/test
49 49 $ hg update -Cr0
50 50 abort: path contains illegal component: .hg/test
51 51 [255]
52 52
53 53 attack foo/.hg/test
54 54
55 55 $ hg manifest -r1
56 56 foo/.hg/test
57 57 $ hg update -Cr1
58 58 abort: path 'foo/.hg/test' is inside nested repo 'foo'
59 59 [255]
60 60
61 61 attack back/test where back symlinks to ..
62 62
63 63 $ hg manifest -r2
64 64 back
65 65 back/test
66 66 $ hg update -Cr2
67 67 abort: path 'back/test' traverses symbolic link 'back'
68 68 [255]
69 69
70 70 attack ../test
71 71
72 72 $ hg manifest -r3
73 73 ../test
74 74 $ hg update -Cr3
75 75 abort: path contains illegal component: ../test
76 76 [255]
77 77
78 78 attack /tmp/test
79 79
80 80 $ hg manifest -r4
81 81 /tmp/test
82 82 $ hg update -Cr4
83 83 abort: No such file or directory: $TESTTMP/target//tmp/test
84 84 [255]
@@ -1,283 +1,283 b''
1 1 $ "$TESTDIR/hghave" symlink || exit 80
2 2
3 3 commit date test
4 4
5 5 $ hg init test
6 6 $ cd test
7 7 $ echo foo > foo
8 8 $ hg add foo
9 9 $ HGEDITOR=true hg commit -m ""
10 10 abort: empty commit message
11 11 [255]
12 12 $ hg commit -d '0 0' -m commit-1
13 13 $ echo foo >> foo
14 14 $ hg commit -d '1 4444444' -m commit-3
15 15 abort: impossible time zone offset: 4444444
16 16 [255]
17 17 $ hg commit -d '1 15.1' -m commit-4
18 18 abort: invalid date: '1\t15.1'
19 19 [255]
20 20 $ hg commit -d 'foo bar' -m commit-5
21 21 abort: invalid date: 'foo bar'
22 22 [255]
23 23 $ hg commit -d ' 1 4444' -m commit-6
24 24 $ hg commit -d '111111111111 0' -m commit-7
25 25 abort: date exceeds 32 bits: 111111111111
26 26 [255]
27 27 $ hg commit -d '-7654321 3600' -m commit-7
28 28 abort: negative date value: -7654321
29 29 [255]
30 30
31 31 commit added file that has been deleted
32 32
33 33 $ echo bar > bar
34 34 $ hg add bar
35 35 $ rm bar
36 36 $ hg commit -m commit-8
37 37 nothing changed (1 missing files, see 'hg status')
38 38 [1]
39 39 $ hg commit -m commit-8-2 bar
40 40 abort: bar: file not found!
41 41 [255]
42 42
43 43 $ hg -q revert -a --no-backup
44 44
45 45 $ mkdir dir
46 46 $ echo boo > dir/file
47 47 $ hg add
48 adding dir/file
48 adding dir/file (glob)
49 49 $ hg -v commit -m commit-9 dir
50 50 dir/file
51 51 committed changeset 2:d2a76177cb42
52 52
53 53 $ echo > dir.file
54 54 $ hg add
55 55 adding dir.file
56 56 $ hg commit -m commit-10 dir dir.file
57 57 abort: dir: no match under directory!
58 58 [255]
59 59
60 60 $ echo >> dir/file
61 61 $ mkdir bleh
62 62 $ mkdir dir2
63 63 $ cd bleh
64 64 $ hg commit -m commit-11 .
65 65 abort: bleh: no match under directory!
66 66 [255]
67 67 $ hg commit -m commit-12 ../dir ../dir2
68 68 abort: dir2: no match under directory!
69 69 [255]
70 70 $ hg -v commit -m commit-13 ../dir
71 71 dir/file
72 72 committed changeset 3:1cd62a2d8db5
73 73 $ cd ..
74 74
75 75 $ hg commit -m commit-14 does-not-exist
76 76 abort: does-not-exist: No such file or directory
77 77 [255]
78 78 $ ln -s foo baz
79 79 $ hg commit -m commit-15 baz
80 80 abort: baz: file not tracked!
81 81 [255]
82 82 $ touch quux
83 83 $ hg commit -m commit-16 quux
84 84 abort: quux: file not tracked!
85 85 [255]
86 86 $ echo >> dir/file
87 87 $ hg -v commit -m commit-17 dir/file
88 88 dir/file
89 89 committed changeset 4:49176991390e
90 90
91 91 An empty date was interpreted as epoch origin
92 92
93 93 $ echo foo >> foo
94 94 $ hg commit -d '' -m commit-no-date
95 95 $ hg tip --template '{date|isodate}\n' | grep '1970'
96 96 [1]
97 97
98 98 Make sure we do not obscure unknown requires file entries (issue2649)
99 99
100 100 $ echo foo >> foo
101 101 $ echo fake >> .hg/requires
102 102 $ hg commit -m bla
103 103 abort: unknown repository format: requires features 'fake' (upgrade Mercurial)!
104 104 [255]
105 105
106 106 $ cd ..
107 107
108 108
109 109 partial subdir commit test
110 110
111 111 $ hg init test2
112 112 $ cd test2
113 113 $ mkdir foo
114 114 $ echo foo > foo/foo
115 115 $ mkdir bar
116 116 $ echo bar > bar/bar
117 117 $ hg add
118 adding bar/bar
119 adding foo/foo
118 adding bar/bar (glob)
119 adding foo/foo (glob)
120 120 $ hg ci -m commit-subdir-1 foo
121 121 $ hg ci -m commit-subdir-2 bar
122 122
123 123 subdir log 1
124 124
125 125 $ hg log -v foo
126 126 changeset: 0:f97e73a25882
127 127 user: test
128 128 date: Thu Jan 01 00:00:00 1970 +0000
129 129 files: foo/foo
130 130 description:
131 131 commit-subdir-1
132 132
133 133
134 134
135 135 subdir log 2
136 136
137 137 $ hg log -v bar
138 138 changeset: 1:aa809156d50d
139 139 tag: tip
140 140 user: test
141 141 date: Thu Jan 01 00:00:00 1970 +0000
142 142 files: bar/bar
143 143 description:
144 144 commit-subdir-2
145 145
146 146
147 147
148 148 full log
149 149
150 150 $ hg log -v
151 151 changeset: 1:aa809156d50d
152 152 tag: tip
153 153 user: test
154 154 date: Thu Jan 01 00:00:00 1970 +0000
155 155 files: bar/bar
156 156 description:
157 157 commit-subdir-2
158 158
159 159
160 160 changeset: 0:f97e73a25882
161 161 user: test
162 162 date: Thu Jan 01 00:00:00 1970 +0000
163 163 files: foo/foo
164 164 description:
165 165 commit-subdir-1
166 166
167 167
168 168 $ cd ..
169 169
170 170
171 171 dot and subdir commit test
172 172
173 173 $ hg init test3
174 174 $ cd test3
175 175 $ mkdir foo
176 176 $ echo foo content > foo/plain-file
177 177 $ hg add foo/plain-file
178 178 $ hg ci -m commit-foo-subdir foo
179 179 $ echo modified foo content > foo/plain-file
180 180 $ hg ci -m commit-foo-dot .
181 181
182 182 full log
183 183
184 184 $ hg log -v
185 185 changeset: 1:95b38e3a5b2e
186 186 tag: tip
187 187 user: test
188 188 date: Thu Jan 01 00:00:00 1970 +0000
189 189 files: foo/plain-file
190 190 description:
191 191 commit-foo-dot
192 192
193 193
194 194 changeset: 0:65d4e9386227
195 195 user: test
196 196 date: Thu Jan 01 00:00:00 1970 +0000
197 197 files: foo/plain-file
198 198 description:
199 199 commit-foo-subdir
200 200
201 201
202 202
203 203 subdir log
204 204
205 205 $ cd foo
206 206 $ hg log .
207 207 changeset: 1:95b38e3a5b2e
208 208 tag: tip
209 209 user: test
210 210 date: Thu Jan 01 00:00:00 1970 +0000
211 211 summary: commit-foo-dot
212 212
213 213 changeset: 0:65d4e9386227
214 214 user: test
215 215 date: Thu Jan 01 00:00:00 1970 +0000
216 216 summary: commit-foo-subdir
217 217
218 218 $ cd ..
219 219 $ cd ..
220 220
221 221 Issue1049: Hg permits partial commit of merge without warning
222 222
223 223 $ cd ..
224 224 $ hg init issue1049
225 225 $ cd issue1049
226 226 $ echo a > a
227 227 $ hg ci -Ama
228 228 adding a
229 229 $ echo a >> a
230 230 $ hg ci -mb
231 231 $ hg up 0
232 232 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 233 $ echo b >> a
234 234 $ hg ci -mc
235 235 created new head
236 236 $ HGMERGE=true hg merge
237 237 merging a
238 238 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
239 239 (branch merge, don't forget to commit)
240 240
241 241 should fail because we are specifying a file name
242 242
243 243 $ hg ci -mmerge a
244 244 abort: cannot partially commit a merge (do not specify files or patterns)
245 245 [255]
246 246
247 247 should fail because we are specifying a pattern
248 248
249 249 $ hg ci -mmerge -I a
250 250 abort: cannot partially commit a merge (do not specify files or patterns)
251 251 [255]
252 252
253 253 should succeed
254 254
255 255 $ hg ci -mmerge
256 256 $ cd ..
257 257
258 258
259 259 test commit message content
260 260
261 261 $ hg init commitmsg
262 262 $ cd commitmsg
263 263 $ echo changed > changed
264 264 $ echo removed > removed
265 265 $ hg ci -qAm init
266 266
267 267 $ hg rm removed
268 268 $ echo changed >> changed
269 269 $ echo added > added
270 270 $ hg add added
271 271 $ HGEDITOR=cat hg ci -A
272 272
273 273
274 274 HG: Enter commit message. Lines beginning with 'HG:' are removed.
275 275 HG: Leave message empty to abort commit.
276 276 HG: --
277 277 HG: user: test
278 278 HG: branch 'default'
279 279 HG: added added
280 280 HG: changed changed
281 281 HG: removed removed
282 282 abort: empty commit message
283 283 [255]
@@ -1,302 +1,302 b''
1 1 Set vars:
2 2
3 3 $ CONTRIBDIR=$TESTDIR/../contrib
4 4
5 5 Prepare repo-a:
6 6
7 7 $ hg init repo-a
8 8 $ cd repo-a
9 9
10 10 $ echo this is file a > a
11 11 $ hg add a
12 12 $ hg commit -m first
13 13
14 14 $ echo adding to file a >> a
15 15 $ hg commit -m second
16 16
17 17 $ echo adding more to file a >> a
18 18 $ hg commit -m third
19 19
20 20 $ hg verify
21 21 checking changesets
22 22 checking manifests
23 23 crosschecking files in changesets and manifests
24 24 checking files
25 25 1 files, 3 changesets, 3 total revisions
26 26
27 27 Dumping revlog of file a to stdout:
28 28
29 29 $ python $CONTRIBDIR/dumprevlog .hg/store/data/a.i
30 30 file: .hg/store/data/a.i
31 31 node: 183d2312b35066fb6b3b449b84efc370d50993d0
32 32 linkrev: 0
33 33 parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
34 34 length: 15
35 35 -start-
36 36 this is file a
37 37
38 38 -end-
39 39 node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b
40 40 linkrev: 1
41 41 parents: 183d2312b35066fb6b3b449b84efc370d50993d0 0000000000000000000000000000000000000000
42 42 length: 32
43 43 -start-
44 44 this is file a
45 45 adding to file a
46 46
47 47 -end-
48 48 node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1
49 49 linkrev: 2
50 50 parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b 0000000000000000000000000000000000000000
51 51 length: 54
52 52 -start-
53 53 this is file a
54 54 adding to file a
55 55 adding more to file a
56 56
57 57 -end-
58 58
59 59 Dump all revlogs to file repo.dump:
60 60
61 61 $ find .hg/store -name "*.i" | sort | xargs python $CONTRIBDIR/dumprevlog > ../repo.dump
62 62 $ cd ..
63 63
64 64 Undumping into repo-b:
65 65
66 66 $ hg init repo-b
67 67 $ cd repo-b
68 68 $ python $CONTRIBDIR/undumprevlog < ../repo.dump
69 69 .hg/store/00changelog.i
70 70 .hg/store/00manifest.i
71 71 .hg/store/data/a.i
72 72 $ cd ..
73 73
74 74 Rebuild fncache with clone --pull:
75 75
76 76 $ hg clone --pull -U repo-b repo-c
77 77 requesting all changes
78 78 adding changesets
79 79 adding manifests
80 80 adding file changes
81 81 added 3 changesets with 3 changes to 1 files
82 82
83 83 Verify:
84 84
85 85 $ hg -R repo-c verify
86 86 checking changesets
87 87 checking manifests
88 88 crosschecking files in changesets and manifests
89 89 checking files
90 90 1 files, 3 changesets, 3 total revisions
91 91
92 92 Compare repos:
93 93
94 94 $ hg -R repo-c incoming repo-a
95 95 comparing with repo-a
96 96 searching for changes
97 97 no changes found
98 98 [1]
99 99
100 100 $ hg -R repo-a incoming repo-c
101 101 comparing with repo-c
102 102 searching for changes
103 103 no changes found
104 104 [1]
105 105
106 106
107 107 Test shrink-revlog:
108 108 $ cd repo-a
109 109 $ hg --config extensions.shrink=$CONTRIBDIR/shrink-revlog.py shrink
110 shrinking $TESTTMP/repo-a/.hg/store/00manifest.i
110 shrinking $TESTTMP/repo-a/.hg/store/00manifest.i (glob)
111 111 reading revs
112 112 sorting revs
113 113 writing revs
114 114 old file size: 324 bytes ( 0.0 MiB)
115 115 new file size: 324 bytes ( 0.0 MiB)
116 116 shrinkage: 0.0% (1.0x)
117 117 note: old revlog saved in:
118 $TESTTMP/repo-a/.hg/store/00manifest.i.old
119 $TESTTMP/repo-a/.hg/store/00manifest.d.old
118 $TESTTMP/repo-a/.hg/store/00manifest.i.old (glob)
119 $TESTTMP/repo-a/.hg/store/00manifest.d.old (glob)
120 120 (You can delete those files when you are satisfied that your
121 121 repository is still sane. Running 'hg verify' is strongly recommended.)
122 122 $ hg verify
123 123 checking changesets
124 124 checking manifests
125 125 crosschecking files in changesets and manifests
126 126 checking files
127 127 1 files, 3 changesets, 3 total revisions
128 128 $ cd ..
129 129
130 130 Test simplemerge command:
131 131
132 132 $ cp "$CONTRIBDIR/simplemerge" .
133 133 $ echo base > base
134 134 $ echo local > local
135 135 $ cat base >> local
136 136 $ cp local orig
137 137 $ cat base > other
138 138 $ echo other >> other
139 139
140 140 changing local directly
141 141
142 142 $ python simplemerge local base other && echo "merge succeeded"
143 143 merge succeeded
144 144 $ cat local
145 145 local
146 146 base
147 147 other
148 148 $ cp orig local
149 149
150 150 printing to stdout
151 151
152 152 $ python simplemerge -p local base other
153 153 local
154 154 base
155 155 other
156 156
157 157 local:
158 158
159 159 $ cat local
160 160 local
161 161 base
162 162
163 163 conflicts
164 164
165 165 $ cp base conflict-local
166 166 $ cp other conflict-other
167 167 $ echo not other >> conflict-local
168 168 $ echo end >> conflict-local
169 169 $ echo end >> conflict-other
170 170 $ python simplemerge -p conflict-local base conflict-other
171 171 base
172 172 <<<<<<< conflict-local
173 173 not other
174 174 =======
175 175 other
176 176 >>>>>>> conflict-other
177 177 end
178 178 warning: conflicts during merge.
179 179 [1]
180 180
181 181 --no-minimal
182 182
183 183 $ python simplemerge -p --no-minimal conflict-local base conflict-other
184 184 base
185 185 <<<<<<< conflict-local
186 186 not other
187 187 end
188 188 =======
189 189 other
190 190 end
191 191 >>>>>>> conflict-other
192 192 warning: conflicts during merge.
193 193 [1]
194 194
195 195 1 label
196 196
197 197 $ python simplemerge -p -L foo conflict-local base conflict-other
198 198 base
199 199 <<<<<<< foo
200 200 not other
201 201 =======
202 202 other
203 203 >>>>>>> conflict-other
204 204 end
205 205 warning: conflicts during merge.
206 206 [1]
207 207
208 208 2 labels
209 209
210 210 $ python simplemerge -p -L foo -L bar conflict-local base conflict-other
211 211 base
212 212 <<<<<<< foo
213 213 not other
214 214 =======
215 215 other
216 216 >>>>>>> bar
217 217 end
218 218 warning: conflicts during merge.
219 219 [1]
220 220
221 221 too many labels
222 222
223 223 $ python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other
224 224 abort: can only specify two labels.
225 225 [255]
226 226
227 227 binary file
228 228
229 229 $ python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
230 230 $ cat orig >> binary-local
231 231 $ python simplemerge -p binary-local base other
232 232 warning: binary-local looks like a binary file.
233 233 [1]
234 234
235 235 binary file --text
236 236
237 237 $ python simplemerge -a -p binary-local base other 2>&1
238 238 warning: binary-local looks like a binary file.
239 239 \x00local (esc)
240 240 base
241 241 other
242 242
243 243 help
244 244
245 245 $ python simplemerge --help
246 246 simplemerge [OPTS] LOCAL BASE OTHER
247 247
248 248 Simple three-way file merge utility with a minimal feature set.
249 249
250 250 Apply to LOCAL the changes necessary to go from BASE to OTHER.
251 251
252 252 By default, LOCAL is overwritten with the results of this operation.
253 253
254 254 options:
255 255 -L --label labels to use on conflict markers
256 256 -a --text treat all files as text
257 257 -p --print print results instead of overwriting LOCAL
258 258 --no-minimal do not try to minimize conflict regions
259 259 -h --help display help and exit
260 260 -q --quiet suppress output
261 261
262 262 wrong number of arguments
263 263
264 264 $ python simplemerge
265 265 simplemerge: wrong number of arguments
266 266 simplemerge [OPTS] LOCAL BASE OTHER
267 267
268 268 Simple three-way file merge utility with a minimal feature set.
269 269
270 270 Apply to LOCAL the changes necessary to go from BASE to OTHER.
271 271
272 272 By default, LOCAL is overwritten with the results of this operation.
273 273
274 274 options:
275 275 -L --label labels to use on conflict markers
276 276 -a --text treat all files as text
277 277 -p --print print results instead of overwriting LOCAL
278 278 --no-minimal do not try to minimize conflict regions
279 279 -h --help display help and exit
280 280 -q --quiet suppress output
281 281 [1]
282 282
283 283 bad option
284 284
285 285 $ python simplemerge --foo -p local base other
286 286 simplemerge: option --foo not recognized
287 287 simplemerge [OPTS] LOCAL BASE OTHER
288 288
289 289 Simple three-way file merge utility with a minimal feature set.
290 290
291 291 Apply to LOCAL the changes necessary to go from BASE to OTHER.
292 292
293 293 By default, LOCAL is overwritten with the results of this operation.
294 294
295 295 options:
296 296 -L --label labels to use on conflict markers
297 297 -a --text treat all files as text
298 298 -p --print print results instead of overwriting LOCAL
299 299 --no-minimal do not try to minimize conflict regions
300 300 -h --help display help and exit
301 301 -q --quiet suppress output
302 302 [1]
@@ -1,58 +1,58 b''
1 1
2 2 $ cat >> $HGRCPATH <<EOF
3 3 > [extensions]
4 4 > convert=
5 5 > EOF
6 6
7 7 Prepare orig repo
8 8
9 9 $ hg init orig
10 10 $ cd orig
11 11 $ echo foo > foo
12 12 $ HGUSER='user name' hg ci -qAm 'foo'
13 13 $ cd ..
14 14
15 15 Explicit --authors
16 16
17 17 $ cat > authormap.txt <<EOF
18 18 > user name = Long User Name
19 19 >
20 20 > # comment
21 21 > this line is ignored
22 22 > EOF
23 23 $ hg convert --authors authormap.txt orig new
24 24 initializing destination new repository
25 25 Ignoring bad line in author map file authormap.txt: this line is ignored
26 26 scanning source...
27 27 sorting...
28 28 converting...
29 29 0 foo
30 Writing author map file $TESTTMP/new/.hg/authormap
30 Writing author map file $TESTTMP/new/.hg/authormap (glob)
31 31 $ cat new/.hg/authormap
32 32 user name=Long User Name
33 33 $ hg -Rnew log
34 34 changeset: 0:d89716e88087
35 35 tag: tip
36 36 user: Long User Name
37 37 date: Thu Jan 01 00:00:00 1970 +0000
38 38 summary: foo
39 39
40 40 $ rm -rf new
41 41
42 42 Implicit .hg/authormap
43 43
44 44 $ hg init new
45 45 $ mv authormap.txt new/.hg/authormap
46 46 $ hg convert orig new
47 Ignoring bad line in author map file $TESTTMP/new/.hg/authormap: this line is ignored
47 Ignoring bad line in author map file $TESTTMP/new/.hg/authormap: this line is ignored (glob)
48 48 scanning source...
49 49 sorting...
50 50 converting...
51 51 0 foo
52 52 $ hg -Rnew log
53 53 changeset: 0:d89716e88087
54 54 tag: tip
55 55 user: Long User Name
56 56 date: Thu Jan 01 00:00:00 1970 +0000
57 57 summary: foo
58 58
@@ -1,38 +1,38 b''
1 1 $ hg init a
2 2
3 3 $ echo a > a/a
4 4 $ hg --cwd a ci -Ama
5 5 adding a
6 6
7 7 $ hg clone a c
8 8 updating to branch default
9 9 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 10
11 11 $ hg clone a b
12 12 updating to branch default
13 13 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
14 14
15 15 $ echo b >> b/a
16 16 $ hg --cwd b ci -mb
17 17
18 18 Push should push to 'default' when 'default-push' not set:
19 19
20 20 $ hg --cwd b push
21 pushing to $TESTTMP/a
21 pushing to $TESTTMP/a (glob)
22 22 searching for changes
23 23 adding changesets
24 24 adding manifests
25 25 adding file changes
26 26 added 1 changesets with 1 changes to 1 files
27 27
28 28 Push should push to 'default-push' when set:
29 29
30 30 $ echo 'default-push = ../c' >> b/.hg/hgrc
31 31 $ hg --cwd b push
32 pushing to $TESTTMP/c
32 pushing to $TESTTMP/c (glob)
33 33 searching for changes
34 34 adding changesets
35 35 adding manifests
36 36 adding file changes
37 37 added 1 changesets with 1 changes to 1 files
38 38
@@ -1,41 +1,41 b''
1 1 ------ Test dirstate._dirs refcounting
2 2
3 3 $ hg init t
4 4 $ cd t
5 5 $ mkdir -p a/b/c/d
6 6 $ touch a/b/c/d/x
7 7 $ touch a/b/c/d/y
8 8 $ touch a/b/c/d/z
9 9 $ hg ci -Am m
10 10 adding a/b/c/d/x
11 11 adding a/b/c/d/y
12 12 adding a/b/c/d/z
13 13 $ hg mv a z
14 moving a/b/c/d/x to z/b/c/d/x
15 moving a/b/c/d/y to z/b/c/d/y
16 moving a/b/c/d/z to z/b/c/d/z
14 moving a/b/c/d/x to z/b/c/d/x (glob)
15 moving a/b/c/d/y to z/b/c/d/y (glob)
16 moving a/b/c/d/z to z/b/c/d/z (glob)
17 17 $ cd ..
18 18
19 19 Issue1790: dirstate entry locked into unset if file mtime is set into
20 20 the future
21 21
22 22 Prepare test repo:
23 23
24 24 $ hg init u
25 25 $ cd u
26 26 $ echo a > a
27 27 $ hg add
28 28 adding a
29 29 $ hg ci -m1
30 30
31 31 Set mtime of a into the future:
32 32
33 33 $ touch -t 202101011200 a
34 34
35 35 Status must not set a's entry to unset (issue1790):
36 36
37 37 $ hg status
38 38 $ hg debugstate
39 39 n 644 2 2021-01-01 12:00:00 a
40 40 $ cd ..
41 41
@@ -1,479 +1,479 b''
1 1 Test basic extension support
2 2
3 3 $ "$TESTDIR/hghave" no-outer-repo || exit 80
4 4
5 5 $ cat > foobar.py <<EOF
6 6 > import os
7 7 > from mercurial import commands
8 8 >
9 9 > def uisetup(ui):
10 10 > ui.write("uisetup called\\n")
11 11 >
12 12 > def reposetup(ui, repo):
13 13 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
14 14 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
15 15 >
16 16 > def foo(ui, *args, **kwargs):
17 17 > ui.write("Foo\\n")
18 18 >
19 19 > def bar(ui, *args, **kwargs):
20 20 > ui.write("Bar\\n")
21 21 >
22 22 > cmdtable = {
23 23 > "foo": (foo, [], "hg foo"),
24 24 > "bar": (bar, [], "hg bar"),
25 25 > }
26 26 >
27 27 > commands.norepo += ' bar'
28 28 > EOF
29 29 $ abspath=`pwd`/foobar.py
30 30
31 31 $ mkdir barfoo
32 32 $ cp foobar.py barfoo/__init__.py
33 33 $ barfoopath=`pwd`/barfoo
34 34
35 35 $ hg init a
36 36 $ cd a
37 37 $ echo foo > file
38 38 $ hg add file
39 39 $ hg commit -m 'add file'
40 40
41 41 $ echo '[extensions]' >> $HGRCPATH
42 42 $ echo "foobar = $abspath" >> $HGRCPATH
43 43 $ hg foo
44 44 uisetup called
45 45 reposetup called for a
46 46 ui == repo.ui
47 47 Foo
48 48
49 49 $ cd ..
50 50 $ hg clone a b
51 51 uisetup called
52 52 reposetup called for a
53 53 ui == repo.ui
54 54 reposetup called for b
55 55 ui == repo.ui
56 56 updating to branch default
57 57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 58
59 59 $ hg bar
60 60 uisetup called
61 61 Bar
62 62 $ echo 'foobar = !' >> $HGRCPATH
63 63
64 64 module/__init__.py-style
65 65
66 66 $ echo "barfoo = $barfoopath" >> $HGRCPATH
67 67 $ cd a
68 68 $ hg foo
69 69 uisetup called
70 70 reposetup called for a
71 71 ui == repo.ui
72 72 Foo
73 73 $ echo 'barfoo = !' >> $HGRCPATH
74 74
75 75 Check that extensions are loaded in phases:
76 76
77 77 $ cat > foo.py <<EOF
78 78 > import os
79 79 > name = os.path.basename(__file__).rsplit('.', 1)[0]
80 80 > print "1) %s imported" % name
81 81 > def uisetup(ui):
82 82 > print "2) %s uisetup" % name
83 83 > def extsetup():
84 84 > print "3) %s extsetup" % name
85 85 > def reposetup(ui, repo):
86 86 > print "4) %s reposetup" % name
87 87 > EOF
88 88
89 89 $ cp foo.py bar.py
90 90 $ echo 'foo = foo.py' >> $HGRCPATH
91 91 $ echo 'bar = bar.py' >> $HGRCPATH
92 92
93 93 Command with no output, we just want to see the extensions loaded:
94 94
95 95 $ hg paths
96 96 1) foo imported
97 97 1) bar imported
98 98 2) foo uisetup
99 99 2) bar uisetup
100 100 3) foo extsetup
101 101 3) bar extsetup
102 102 4) foo reposetup
103 103 4) bar reposetup
104 104
105 105 Check hgweb's load order:
106 106
107 107 $ cat > hgweb.cgi <<EOF
108 108 > #!/usr/bin/env python
109 109 > from mercurial import demandimport; demandimport.enable()
110 110 > from mercurial.hgweb import hgweb
111 111 > from mercurial.hgweb import wsgicgi
112 112 >
113 113 > application = hgweb('.', 'test repo')
114 114 > wsgicgi.launch(application)
115 115 > EOF
116 116
117 117 $ SCRIPT_NAME='/' SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
118 118 > | grep '^[0-9]) ' # ignores HTML output
119 119 1) foo imported
120 120 1) bar imported
121 121 2) foo uisetup
122 122 2) bar uisetup
123 123 3) foo extsetup
124 124 3) bar extsetup
125 125 4) foo reposetup
126 126 4) bar reposetup
127 127 4) foo reposetup
128 128 4) bar reposetup
129 129
130 130 $ echo 'foo = !' >> $HGRCPATH
131 131 $ echo 'bar = !' >> $HGRCPATH
132 132
133 133 $ cd ..
134 134
135 135 $ cat > empty.py <<EOF
136 136 > '''empty cmdtable
137 137 > '''
138 138 > cmdtable = {}
139 139 > EOF
140 140 $ emptypath=`pwd`/empty.py
141 141 $ echo "empty = $emptypath" >> $HGRCPATH
142 142 $ hg help empty
143 143 empty extension - empty cmdtable
144 144
145 145 no commands defined
146 146
147 147 $ echo 'empty = !' >> $HGRCPATH
148 148
149 149 $ cat > debugextension.py <<EOF
150 150 > '''only debugcommands
151 151 > '''
152 152 > def debugfoobar(ui, repo, *args, **opts):
153 153 > "yet another debug command"
154 154 > pass
155 155 >
156 156 > def foo(ui, repo, *args, **opts):
157 157 > """yet another foo command
158 158 >
159 159 > This command has been DEPRECATED since forever.
160 160 > """
161 161 > pass
162 162 >
163 163 > cmdtable = {
164 164 > "debugfoobar": (debugfoobar, (), "hg debugfoobar"),
165 165 > "foo": (foo, (), "hg foo")
166 166 > }
167 167 > EOF
168 168 $ debugpath=`pwd`/debugextension.py
169 169 $ echo "debugextension = $debugpath" >> $HGRCPATH
170 170
171 171 $ hg help debugextension
172 172 debugextension extension - only debugcommands
173 173
174 174 no commands defined
175 175
176 176 $ hg --verbose help debugextension
177 177 debugextension extension - only debugcommands
178 178
179 179 list of commands:
180 180
181 181 foo:
182 182 yet another foo command
183 183
184 184 global options:
185 185
186 186 -R --repository REPO repository root directory or name of overlay bundle
187 187 file
188 188 --cwd DIR change working directory
189 189 -y --noninteractive do not prompt, automatically pick the first choice for
190 190 all prompts
191 191 -q --quiet suppress output
192 192 -v --verbose enable additional output
193 193 --config CONFIG [+] set/override config option (use 'section.name=value')
194 194 --debug enable debugging output
195 195 --debugger start debugger
196 196 --encoding ENCODE set the charset encoding (default: ascii)
197 197 --encodingmode MODE set the charset encoding mode (default: strict)
198 198 --traceback always print a traceback on exception
199 199 --time time how long the command takes
200 200 --profile print command execution profile
201 201 --version output version information and exit
202 202 -h --help display help and exit
203 203
204 204 [+] marked option can be specified multiple times
205 205
206 206 $ hg --debug help debugextension
207 207 debugextension extension - only debugcommands
208 208
209 209 list of commands:
210 210
211 211 debugfoobar:
212 212 yet another debug command
213 213 foo:
214 214 yet another foo command
215 215
216 216 global options:
217 217
218 218 -R --repository REPO repository root directory or name of overlay bundle
219 219 file
220 220 --cwd DIR change working directory
221 221 -y --noninteractive do not prompt, automatically pick the first choice for
222 222 all prompts
223 223 -q --quiet suppress output
224 224 -v --verbose enable additional output
225 225 --config CONFIG [+] set/override config option (use 'section.name=value')
226 226 --debug enable debugging output
227 227 --debugger start debugger
228 228 --encoding ENCODE set the charset encoding (default: ascii)
229 229 --encodingmode MODE set the charset encoding mode (default: strict)
230 230 --traceback always print a traceback on exception
231 231 --time time how long the command takes
232 232 --profile print command execution profile
233 233 --version output version information and exit
234 234 -h --help display help and exit
235 235
236 236 [+] marked option can be specified multiple times
237 237 $ echo 'debugextension = !' >> $HGRCPATH
238 238
239 239 Extension module help vs command help:
240 240
241 241 $ echo 'extdiff =' >> $HGRCPATH
242 242 $ hg help extdiff
243 243 hg extdiff [OPT]... [FILE]...
244 244
245 245 use external program to diff repository (or selected files)
246 246
247 247 Show differences between revisions for the specified files, using an
248 248 external program. The default program used is diff, with default options
249 249 "-Npru".
250 250
251 251 To select a different program, use the -p/--program option. The program
252 252 will be passed the names of two directories to compare. To pass additional
253 253 options to the program, use -o/--option. These will be passed before the
254 254 names of the directories to compare.
255 255
256 256 When two revision arguments are given, then changes are shown between
257 257 those revisions. If only one revision is specified then that revision is
258 258 compared to the working directory, and, when no revisions are specified,
259 259 the working directory files are compared to its parent.
260 260
261 261 use "hg help -e extdiff" to show help for the extdiff extension
262 262
263 263 options:
264 264
265 265 -p --program CMD comparison program to run
266 266 -o --option OPT [+] pass option to comparison program
267 267 -r --rev REV [+] revision
268 268 -c --change REV change made by revision
269 269 -I --include PATTERN [+] include names matching the given patterns
270 270 -X --exclude PATTERN [+] exclude names matching the given patterns
271 271
272 272 [+] marked option can be specified multiple times
273 273
274 274 use "hg -v help extdiff" to show more info
275 275
276 276 $ hg help --extension extdiff
277 277 extdiff extension - command to allow external programs to compare revisions
278 278
279 279 The extdiff Mercurial extension allows you to use external programs to compare
280 280 revisions, or revision with working directory. The external diff programs are
281 281 called with a configurable set of options and two non-option arguments: paths
282 282 to directories containing snapshots of files to compare.
283 283
284 284 The extdiff extension also allows you to configure new diff commands, so you
285 285 do not need to type "hg extdiff -p kdiff3" always.
286 286
287 287 [extdiff]
288 288 # add new command that runs GNU diff(1) in 'context diff' mode
289 289 cdiff = gdiff -Nprc5
290 290 ## or the old way:
291 291 #cmd.cdiff = gdiff
292 292 #opts.cdiff = -Nprc5
293 293
294 294 # add new command called vdiff, runs kdiff3
295 295 vdiff = kdiff3
296 296
297 297 # add new command called meld, runs meld (no need to name twice)
298 298 meld =
299 299
300 300 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
301 301 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
302 302 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
303 303 # your .vimrc
304 304 vimdiff = gvim -f '+next' '+execute "DirDiff" argv(0) argv(1)'
305 305
306 306 Tool arguments can include variables that are expanded at runtime:
307 307
308 308 $parent1, $plabel1 - filename, descriptive label of first parent
309 309 $child, $clabel - filename, descriptive label of child revision
310 310 $parent2, $plabel2 - filename, descriptive label of second parent
311 311 $root - repository root
312 312 $parent is an alias for $parent1.
313 313
314 314 The extdiff extension will look in your [diff-tools] and [merge-tools]
315 315 sections for diff tool arguments, when none are specified in [extdiff].
316 316
317 317 [extdiff]
318 318 kdiff3 =
319 319
320 320 [diff-tools]
321 321 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
322 322
323 323 You can use -I/-X and list of file or directory names like normal "hg diff"
324 324 command. The extdiff extension makes snapshots of only needed files, so
325 325 running the external diff program will actually be pretty fast (at least
326 326 faster than having to compare the entire tree).
327 327
328 328 list of commands:
329 329
330 330 extdiff use external program to diff repository (or selected files)
331 331
332 332 use "hg -v help extdiff" to show builtin aliases and global options
333 333
334 334 $ echo 'extdiff = !' >> $HGRCPATH
335 335
336 336 Test help topic with same name as extension
337 337
338 338 $ cat > multirevs.py <<EOF
339 339 > from mercurial import commands
340 340 > """multirevs extension
341 341 > Big multi-line module docstring."""
342 342 > def multirevs(ui, repo, arg, *args, **opts):
343 343 > """multirevs command"""
344 344 > pass
345 345 > cmdtable = {
346 346 > "multirevs": (multirevs, [], 'ARG')
347 347 > }
348 348 > commands.norepo += ' multirevs'
349 349 > EOF
350 350 $ echo "multirevs = multirevs.py" >> $HGRCPATH
351 351
352 352 $ hg help multirevs
353 353 Specifying Multiple Revisions
354 354
355 355 When Mercurial accepts more than one revision, they may be specified
356 356 individually, or provided as a topologically continuous range, separated
357 357 by the ":" character.
358 358
359 359 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
360 360 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
361 361 specified, it defaults to revision number 0. If END is not specified, it
362 362 defaults to the tip. The range ":" thus means "all revisions".
363 363
364 364 If BEGIN is greater than END, revisions are treated in reverse order.
365 365
366 366 A range acts as a closed interval. This means that a range of 3:5 gives 3,
367 367 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
368 368
369 369 use "hg help -c multirevs" to see help for the multirevs command
370 370
371 371 $ hg help -c multirevs
372 372 hg multirevs ARG
373 373
374 374 multirevs command
375 375
376 376 use "hg -v help multirevs" to show more info
377 377
378 378 $ hg multirevs
379 379 hg multirevs: invalid arguments
380 380 hg multirevs ARG
381 381
382 382 multirevs command
383 383
384 384 use "hg help multirevs" to show the full help text
385 385 [255]
386 386
387 387 $ echo "multirevs = !" >> $HGRCPATH
388 388
389 389 Issue811: Problem loading extensions twice (by site and by user)
390 390
391 391 $ debugpath=`pwd`/debugissue811.py
392 392 $ cat > debugissue811.py <<EOF
393 393 > '''show all loaded extensions
394 394 > '''
395 395 > from mercurial import extensions, commands
396 396 >
397 397 > def debugextensions(ui):
398 398 > "yet another debug command"
399 399 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
400 400 >
401 401 > cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")}
402 402 > commands.norepo += " debugextensions"
403 403 > EOF
404 404 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
405 405 $ echo "mq=" >> $HGRCPATH
406 406 $ echo "hgext.mq=" >> $HGRCPATH
407 407 $ echo "hgext/mq=" >> $HGRCPATH
408 408
409 409 Show extensions:
410 410
411 411 $ hg debugextensions
412 412 debugissue811
413 413 mq
414 414
415 415 Disabled extension commands:
416 416
417 417 $ HGRCPATH=
418 418 $ export HGRCPATH
419 419 $ hg help email
420 420 'email' is provided by the following extension:
421 421
422 422 patchbomb command to send changesets as (a series of) patch emails
423 423
424 424 use "hg help extensions" for information on enabling extensions
425 425 $ hg qdel
426 426 hg: unknown command 'qdel'
427 427 'qdelete' is provided by the following extension:
428 428
429 429 mq manage a stack of patches
430 430
431 431 use "hg help extensions" for information on enabling extensions
432 432 [255]
433 433 $ hg churn
434 434 hg: unknown command 'churn'
435 435 'churn' is provided by the following extension:
436 436
437 437 churn command to display statistics about repository history
438 438
439 439 use "hg help extensions" for information on enabling extensions
440 440 [255]
441 441
442 442 Disabled extensions:
443 443
444 444 $ hg help churn
445 445 churn extension - command to display statistics about repository history
446 446
447 447 use "hg help extensions" for information on enabling extensions
448 448 $ hg help patchbomb
449 449 patchbomb extension - command to send changesets as (a series of) patch emails
450 450
451 451 use "hg help extensions" for information on enabling extensions
452 452
453 453 Broken disabled extension and command:
454 454
455 455 $ mkdir hgext
456 456 $ echo > hgext/__init__.py
457 457 $ cat > hgext/broken.py <<EOF
458 458 > "broken extension'
459 459 > EOF
460 460 $ cat > path.py <<EOF
461 461 > import os, sys
462 462 > sys.path.insert(0, os.environ['HGEXTPATH'])
463 463 > EOF
464 464 $ HGEXTPATH=`pwd`
465 465 $ export HGEXTPATH
466 466
467 467 $ hg --config extensions.path=./path.py help broken
468 468 broken extension - (no help text available)
469 469
470 470 use "hg help extensions" for information on enabling extensions
471 471
472 472 $ cat > hgext/forest.py <<EOF
473 473 > cmdtable = None
474 474 > EOF
475 475 $ hg --config extensions.path=./path.py help foo > /dev/null
476 warning: error finding commands in $TESTTMP/hgext/forest.py
476 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
477 477 hg: unknown command 'foo'
478 warning: error finding commands in $TESTTMP/hgext/forest.py
478 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
479 479 [255]
@@ -1,111 +1,111 b''
1 1 Init repo1:
2 2
3 3 $ hg init repo1
4 4 $ cd repo1
5 5 $ echo "some text" > a
6 6 $ hg add
7 7 adding a
8 8 $ hg ci -m first
9 9 $ cat .hg/store/fncache | sort
10 10 data/a.i
11 11
12 12 Testing a.i/b:
13 13
14 14 $ mkdir a.i
15 15 $ echo "some other text" > a.i/b
16 16 $ hg add
17 adding a.i/b
17 adding a.i/b (glob)
18 18 $ hg ci -m second
19 19 $ cat .hg/store/fncache | sort
20 20 data/a.i
21 21 data/a.i.hg/b.i
22 22
23 23 Testing a.i.hg/c:
24 24
25 25 $ mkdir a.i.hg
26 26 $ echo "yet another text" > a.i.hg/c
27 27 $ hg add
28 adding a.i.hg/c
28 adding a.i.hg/c (glob)
29 29 $ hg ci -m third
30 30 $ cat .hg/store/fncache | sort
31 31 data/a.i
32 32 data/a.i.hg.hg/c.i
33 33 data/a.i.hg/b.i
34 34
35 35 Testing verify:
36 36
37 37 $ hg verify
38 38 checking changesets
39 39 checking manifests
40 40 crosschecking files in changesets and manifests
41 41 checking files
42 42 3 files, 3 changesets, 3 total revisions
43 43
44 44 $ rm .hg/store/fncache
45 45
46 46 $ hg verify
47 47 checking changesets
48 48 checking manifests
49 49 crosschecking files in changesets and manifests
50 50 checking files
51 51 data/a.i@0: missing revlog!
52 52 data/a.i.hg/c.i@2: missing revlog!
53 53 data/a.i/b.i@1: missing revlog!
54 54 3 files, 3 changesets, 3 total revisions
55 55 3 integrity errors encountered!
56 56 (first damaged changeset appears to be 0)
57 57 [1]
58 58 $ cd ..
59 59
60 60 Non store repo:
61 61
62 62 $ hg --config format.usestore=False init foo
63 63 $ cd foo
64 64 $ mkdir tst.d
65 65 $ echo foo > tst.d/foo
66 66 $ hg ci -Amfoo
67 67 adding tst.d/foo
68 68 $ find .hg | sort
69 69 .hg
70 70 .hg/00changelog.i
71 71 .hg/00manifest.i
72 72 .hg/data
73 73 .hg/data/tst.d.hg
74 74 .hg/data/tst.d.hg/foo.i
75 75 .hg/dirstate
76 76 .hg/last-message.txt
77 77 .hg/requires
78 78 .hg/undo
79 79 .hg/undo.bookmarks
80 80 .hg/undo.branch
81 81 .hg/undo.desc
82 82 .hg/undo.dirstate
83 83 $ cd ..
84 84
85 85 Non fncache repo:
86 86
87 87 $ hg --config format.usefncache=False init bar
88 88 $ cd bar
89 89 $ mkdir tst.d
90 90 $ echo foo > tst.d/Foo
91 91 $ hg ci -Amfoo
92 92 adding tst.d/Foo
93 93 $ find .hg | sort
94 94 .hg
95 95 .hg/00changelog.i
96 96 .hg/dirstate
97 97 .hg/last-message.txt
98 98 .hg/requires
99 99 .hg/store
100 100 .hg/store/00changelog.i
101 101 .hg/store/00manifest.i
102 102 .hg/store/data
103 103 .hg/store/data/tst.d.hg
104 104 .hg/store/data/tst.d.hg/_foo.i
105 105 .hg/store/undo
106 106 .hg/undo.bookmarks
107 107 .hg/undo.branch
108 108 .hg/undo.desc
109 109 .hg/undo.dirstate
110 110 $ cd ..
111 111
@@ -1,124 +1,124 b''
1 1 $ hg init
2 2
3 3 Issue562: .hgignore requires newline at end:
4 4
5 5 $ touch foo
6 6 $ touch bar
7 7 $ touch baz
8 8 $ cat > makeignore.py <<EOF
9 9 > f = open(".hgignore", "w")
10 10 > f.write("ignore\n")
11 11 > f.write("foo\n")
12 12 > # No EOL here
13 13 > f.write("bar")
14 14 > f.close()
15 15 > EOF
16 16
17 17 $ python makeignore.py
18 18
19 19 Should display baz only:
20 20
21 21 $ hg status
22 22 ? baz
23 23
24 24 $ rm foo bar baz .hgignore makeignore.py
25 25
26 26 $ touch a.o
27 27 $ touch a.c
28 28 $ touch syntax
29 29 $ mkdir dir
30 30 $ touch dir/a.o
31 31 $ touch dir/b.o
32 32 $ touch dir/c.o
33 33
34 34 $ hg add dir/a.o
35 35 $ hg commit -m 0
36 36 $ hg add dir/b.o
37 37
38 38 $ hg status
39 39 A dir/b.o
40 40 ? a.c
41 41 ? a.o
42 42 ? dir/c.o
43 43 ? syntax
44 44
45 45 $ echo "*.o" > .hgignore
46 46 $ hg status
47 abort: $TESTTMP/.hgignore: invalid pattern (relre): *.o
47 abort: $TESTTMP/.hgignore: invalid pattern (relre): *.o (glob)
48 48 [255]
49 49
50 50 $ echo ".*\.o" > .hgignore
51 51 $ hg status
52 52 A dir/b.o
53 53 ? .hgignore
54 54 ? a.c
55 55 ? syntax
56 56
57 57 Check it does not ignore the current directory '.':
58 58
59 59 $ echo "^\." > .hgignore
60 60 $ hg status
61 61 A dir/b.o
62 62 ? a.c
63 63 ? a.o
64 64 ? dir/c.o
65 65 ? syntax
66 66
67 67 $ echo "glob:**.o" > .hgignore
68 68 $ hg status
69 69 A dir/b.o
70 70 ? .hgignore
71 71 ? a.c
72 72 ? syntax
73 73
74 74 $ echo "glob:*.o" > .hgignore
75 75 $ hg status
76 76 A dir/b.o
77 77 ? .hgignore
78 78 ? a.c
79 79 ? syntax
80 80
81 81 $ echo "syntax: glob" > .hgignore
82 82 $ echo "re:.*\.o" >> .hgignore
83 83 $ hg status
84 84 A dir/b.o
85 85 ? .hgignore
86 86 ? a.c
87 87 ? syntax
88 88
89 89 $ echo "syntax: invalid" > .hgignore
90 90 $ hg status
91 $TESTTMP/.hgignore: ignoring invalid syntax 'invalid'
91 $TESTTMP/.hgignore: ignoring invalid syntax 'invalid' (glob)
92 92 A dir/b.o
93 93 ? .hgignore
94 94 ? a.c
95 95 ? a.o
96 96 ? dir/c.o
97 97 ? syntax
98 98
99 99 $ echo "syntax: glob" > .hgignore
100 100 $ echo "*.o" >> .hgignore
101 101 $ hg status
102 102 A dir/b.o
103 103 ? .hgignore
104 104 ? a.c
105 105 ? syntax
106 106
107 107 $ echo "relglob:syntax*" > .hgignore
108 108 $ hg status
109 109 A dir/b.o
110 110 ? .hgignore
111 111 ? a.c
112 112 ? a.o
113 113 ? dir/c.o
114 114
115 115 $ echo "relglob:*" > .hgignore
116 116 $ hg status
117 117 A dir/b.o
118 118
119 119 $ cd dir
120 120 $ hg status .
121 121 A b.o
122 122
123 123 $ hg debugignore
124 124 (?:(?:|.*/)[^/]*(?:/|$))
@@ -1,195 +1,195 b''
1 1 Use hgrc within $TESTTMP
2 2
3 3 $ HGRCPATH=`pwd`/hgrc
4 4 $ export HGRCPATH
5 5
6 6 Use an alternate var for scribbling on hgrc to keep check-code from
7 7 complaining about the important settings we may be overwriting:
8 8
9 9 $ HGRC=`pwd`/hgrc
10 10 $ export HGRC
11 11
12 12 Basic syntax error
13 13
14 14 $ echo "invalid" > $HGRC
15 15 $ hg version
16 16 hg: parse error at $TESTTMP/hgrc:1: invalid
17 17 [255]
18 18 $ echo "" > $HGRC
19 19
20 20 Issue1199: Can't use '%' in hgrc (eg url encoded username)
21 21
22 22 $ hg init "foo%bar"
23 23 $ hg clone "foo%bar" foobar
24 24 updating to branch default
25 25 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
26 26 $ cd foobar
27 27 $ cat .hg/hgrc
28 28 [paths]
29 default = $TESTTMP/foo%bar
29 default = $TESTTMP/foo%bar (glob)
30 30 $ hg paths
31 default = $TESTTMP/foo%bar
31 default = $TESTTMP/foo%bar (glob)
32 32 $ hg showconfig
33 bundle.mainreporoot=$TESTTMP/foobar
34 paths.default=$TESTTMP/foo%bar
33 bundle.mainreporoot=$TESTTMP/foobar (glob)
34 paths.default=$TESTTMP/foo%bar (glob)
35 35 $ cd ..
36 36
37 37 issue1829: wrong indentation
38 38
39 39 $ echo '[foo]' > $HGRC
40 40 $ echo ' x = y' >> $HGRC
41 41 $ hg version
42 42 hg: parse error at $TESTTMP/hgrc:2: x = y
43 43 [255]
44 44
45 45 $ python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \
46 46 > > $HGRC
47 47 $ hg showconfig foo
48 48 foo.bar=a\nb\nc\nde\nfg
49 49 foo.baz=bif cb
50 50
51 51 $ FAKEPATH=/path/to/nowhere
52 52 $ export FAKEPATH
53 53 $ echo '%include $FAKEPATH/no-such-file' > $HGRC
54 54 $ hg version
55 55 Mercurial Distributed SCM (version *) (glob)
56 56 (see http://mercurial.selenic.com for more information)
57 57
58 58 Copyright (C) 2005-2011 Matt Mackall and others
59 59 This is free software; see the source for copying conditions. There is NO
60 60 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
61 61 $ unset FAKEPATH
62 62
63 63 make sure global options given on the cmdline take precedence
64 64
65 65 $ hg showconfig --config ui.verbose=True --quiet
66 66 ui.verbose=False
67 67 ui.debug=False
68 68 ui.quiet=True
69 69
70 70 $ touch foobar/untracked
71 71 $ cat >> foobar/.hg/hgrc <<EOF
72 72 > [ui]
73 73 > verbose=True
74 74 > EOF
75 75 $ hg -R foobar st -q
76 76
77 77 username expansion
78 78
79 79 $ olduser=$HGUSER
80 80 $ unset HGUSER
81 81
82 82 $ FAKEUSER='John Doe'
83 83 $ export FAKEUSER
84 84 $ echo '[ui]' > $HGRC
85 85 $ echo 'username = $FAKEUSER' >> $HGRC
86 86
87 87 $ hg init usertest
88 88 $ cd usertest
89 89 $ touch bar
90 90 $ hg commit --addremove --quiet -m "added bar"
91 91 $ hg log --template "{author}\n"
92 92 John Doe
93 93 $ cd ..
94 94
95 95 $ hg showconfig
96 96 ui.username=$FAKEUSER
97 97
98 98 $ unset FAKEUSER
99 99 $ HGUSER=$olduser
100 100 $ export HGUSER
101 101
102 102 showconfig with multiple arguments
103 103
104 104 $ echo "[alias]" > $HGRC
105 105 $ echo "log = log -g" >> $HGRC
106 106 $ echo "[defaults]" >> $HGRC
107 107 $ echo "identify = -n" >> $HGRC
108 108 $ hg showconfig alias defaults
109 109 alias.log=log -g
110 110 defaults.identify=-n
111 111 $ hg showconfig alias defaults.identify
112 112 abort: only one config item permitted
113 113 [255]
114 114 $ hg showconfig alias.log defaults.identify
115 115 abort: only one config item permitted
116 116 [255]
117 117
118 118 HGPLAIN
119 119
120 120 $ cd ..
121 121 $ p=`pwd`
122 122 $ echo "[ui]" > $HGRC
123 123 $ echo "debug=true" >> $HGRC
124 124 $ echo "fallbackencoding=ASCII" >> $HGRC
125 125 $ echo "quiet=true" >> $HGRC
126 126 $ echo "slash=true" >> $HGRC
127 127 $ echo "traceback=true" >> $HGRC
128 128 $ echo "verbose=true" >> $HGRC
129 129 $ echo "style=~/.hgstyle" >> $HGRC
130 130 $ echo "logtemplate={node}" >> $HGRC
131 131 $ echo "[defaults]" >> $HGRC
132 132 $ echo "identify=-n" >> $HGRC
133 133 $ echo "[alias]" >> $HGRC
134 134 $ echo "log=log -g" >> $HGRC
135 135
136 136 customized hgrc
137 137
138 138 $ hg showconfig
139 139 read config from: $TESTTMP/hgrc
140 140 $TESTTMP/hgrc:13: alias.log=log -g
141 141 $TESTTMP/hgrc:11: defaults.identify=-n
142 142 $TESTTMP/hgrc:2: ui.debug=true
143 143 $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII
144 144 $TESTTMP/hgrc:4: ui.quiet=true
145 145 $TESTTMP/hgrc:5: ui.slash=true
146 146 $TESTTMP/hgrc:6: ui.traceback=true
147 147 $TESTTMP/hgrc:7: ui.verbose=true
148 148 $TESTTMP/hgrc:8: ui.style=~/.hgstyle
149 149 $TESTTMP/hgrc:9: ui.logtemplate={node}
150 150
151 151 plain hgrc
152 152
153 153 $ HGPLAIN=; export HGPLAIN
154 154 $ hg showconfig --config ui.traceback=True --debug
155 155 read config from: $TESTTMP/hgrc
156 156 none: ui.traceback=True
157 157 none: ui.verbose=False
158 158 none: ui.debug=True
159 159 none: ui.quiet=False
160 160
161 161 plain mode with exceptions
162 162
163 163 $ cat > plain.py <<EOF
164 164 > def uisetup(ui):
165 165 > ui.write('plain: %r\n' % ui.plain())
166 166 > EOF
167 167 $ echo "[extensions]" >> $HGRC
168 168 $ echo "plain=./plain.py" >> $HGRC
169 169 $ HGPLAINEXCEPT=; export HGPLAINEXCEPT
170 170 $ hg showconfig --config ui.traceback=True --debug
171 171 plain: True
172 172 read config from: $TESTTMP/hgrc
173 173 $TESTTMP/hgrc:15: extensions.plain=./plain.py
174 174 none: ui.traceback=True
175 175 none: ui.verbose=False
176 176 none: ui.debug=True
177 177 none: ui.quiet=False
178 178 $ unset HGPLAIN
179 179 $ hg showconfig --config ui.traceback=True --debug
180 180 plain: True
181 181 read config from: $TESTTMP/hgrc
182 182 $TESTTMP/hgrc:15: extensions.plain=./plain.py
183 183 none: ui.traceback=True
184 184 none: ui.verbose=False
185 185 none: ui.debug=True
186 186 none: ui.quiet=False
187 187 $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
188 188 $ hg showconfig --config ui.traceback=True --debug
189 189 plain: True
190 190 read config from: $TESTTMP/hgrc
191 191 $TESTTMP/hgrc:15: extensions.plain=./plain.py
192 192 none: ui.traceback=True
193 193 none: ui.verbose=False
194 194 none: ui.debug=True
195 195 none: ui.quiet=False
@@ -1,20 +1,20 b''
1 1 hg debuginstall
2 2 $ hg debuginstall
3 3 Checking encoding (ascii)...
4 Checking installed modules (*/mercurial)... (glob)
5 Checking templates (*/mercurial/templates)... (glob)
4 Checking installed modules (*mercurial)... (glob)
5 Checking templates (*mercurial?templates)... (glob)
6 6 Checking commit editor...
7 7 Checking username...
8 8 No problems detected
9 9
10 10 hg debuginstall with no username
11 11 $ HGUSER= hg debuginstall
12 12 Checking encoding (ascii)...
13 Checking installed modules (*/mercurial)... (glob)
14 Checking templates (*/mercurial/templates)... (glob)
13 Checking installed modules (*mercurial)... (glob)
14 Checking templates (*mercurial?templates)... (glob)
15 15 Checking commit editor...
16 16 Checking username...
17 17 no username supplied (see "hg help config")
18 18 (specify a username in your configuration file)
19 19 1 problems detected, please check your install!
20 20 [1]
@@ -1,25 +1,25 b''
1 1 http://mercurial.selenic.com/bts/issue1089
2 2
3 3 $ hg init
4 4 $ mkdir a
5 5 $ echo a > a/b
6 6 $ hg ci -Am m
7 7 adding a/b
8 8
9 9 $ hg rm a
10 removing a/b
10 removing a/b (glob)
11 11 $ hg ci -m m a
12 12
13 13 $ mkdir a b
14 14 $ echo a > a/b
15 15 $ hg ci -Am m
16 16 adding a/b
17 17
18 18 $ hg rm a
19 removing a/b
19 removing a/b (glob)
20 20 $ cd b
21 21
22 22 Relative delete:
23 23
24 24 $ hg ci -m m ../a
25 25
@@ -1,41 +1,41 b''
1 1 http://mercurial.selenic.com/bts/issue1502
2 2
3 3 Initialize repository
4 4
5 5 $ hg init foo
6 6 $ touch foo/a && hg -R foo commit -A -m "added a"
7 7 adding a
8 8
9 9 $ hg clone foo foo1
10 10 updating to branch default
11 11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 12
13 13 $ echo "bar" > foo1/a && hg -R foo1 commit -m "edit a in foo1"
14 14 $ echo "hi" > foo/a && hg -R foo commit -m "edited a foo"
15 15 $ hg -R foo1 pull -u
16 pulling from $TESTTMP/foo
16 pulling from $TESTTMP/foo (glob)
17 17 searching for changes
18 18 adding changesets
19 19 adding manifests
20 20 adding file changes
21 21 added 1 changesets with 1 changes to 1 files (+1 heads)
22 22 not updating: crosses branches (merge branches or update --check to force update)
23 23
24 24 $ hg -R foo1 book branchy
25 25 $ hg -R foo1 book
26 26 * branchy 1:e3e522925eff
27 27
28 28 Pull. Bookmark should not jump to new head.
29 29
30 30 $ echo "there" >> foo/a && hg -R foo commit -m "edited a again"
31 31 $ hg -R foo1 pull
32 pulling from $TESTTMP/foo
32 pulling from $TESTTMP/foo (glob)
33 33 searching for changes
34 34 adding changesets
35 35 adding manifests
36 36 adding file changes
37 37 added 1 changesets with 1 changes to 1 files
38 38 (run 'hg update' to get a working copy)
39 39
40 40 $ hg -R foo1 book
41 41 * branchy 1:e3e522925eff
@@ -1,34 +1,34 b''
1 1 http://mercurial.selenic.com/bts/issue612
2 2
3 3 $ hg init
4 4 $ mkdir src
5 5 $ echo a > src/a.c
6 6 $ hg ci -Ama
7 7 adding src/a.c
8 8
9 9 $ hg mv src source
10 moving src/a.c to source/a.c
10 moving src/a.c to source/a.c (glob)
11 11
12 12 $ hg ci -Ammove
13 13
14 14 $ hg co -C 0
15 15 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
16 16
17 17 $ echo new > src/a.c
18 18 $ echo compiled > src/a.o
19 19 $ hg ci -mupdate
20 20 created new head
21 21
22 22 $ hg status
23 23 ? src/a.o
24 24
25 25 $ hg merge
26 26 merging src/a.c and source/a.c to source/a.c
27 27 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
28 28 (branch merge, don't forget to commit)
29 29
30 30 $ hg status
31 31 M source/a.c
32 32 R src/a.c
33 33 ? source/a.o
34 34
@@ -1,145 +1,145 b''
1 1 http://mercurial.selenic.com/bts/issue660 and:
2 2 http://mercurial.selenic.com/bts/issue322
3 3
4 4 $ hg init
5 5 $ echo a > a
6 6 $ mkdir b
7 7 $ echo b > b/b
8 8 $ hg commit -A -m "a is file, b is dir"
9 9 adding a
10 10 adding b/b
11 11
12 12 File replaced with directory:
13 13
14 14 $ rm a
15 15 $ mkdir a
16 16 $ echo a > a/a
17 17
18 18 Should fail - would corrupt dirstate:
19 19
20 20 $ hg add a/a
21 21 abort: file 'a' in dirstate clashes with 'a/a'
22 22 [255]
23 23
24 24 Removing shadow:
25 25
26 26 $ hg rm --after a
27 27
28 28 Should succeed - shadow removed:
29 29
30 30 $ hg add a/a
31 31
32 32 Directory replaced with file:
33 33
34 34 $ rm -r b
35 35 $ echo b > b
36 36
37 37 Should fail - would corrupt dirstate:
38 38
39 39 $ hg add b
40 40 abort: directory 'b' already in dirstate
41 41 [255]
42 42
43 43 Removing shadow:
44 44
45 45 $ hg rm --after b/b
46 46
47 47 Should succeed - shadow removed:
48 48
49 49 $ hg add b
50 50
51 51 Look what we got:
52 52
53 53 $ hg st
54 54 A a/a
55 55 A b
56 56 R a
57 57 R b/b
58 58
59 59 Revert reintroducing shadow - should fail:
60 60
61 61 $ rm -r a b
62 62 $ hg revert b/b
63 63 abort: file 'b' in dirstate clashes with 'b/b'
64 64 [255]
65 65
66 66 Revert all - should succeed:
67 67
68 68 $ hg revert --all
69 69 undeleting a
70 forgetting a/a
70 forgetting a/a (glob)
71 71 forgetting b
72 undeleting b/b
72 undeleting b/b (glob)
73 73
74 74 $ hg st
75 75
76 76 addremove:
77 77
78 78 $ rm -r a b
79 79 $ mkdir a
80 80 $ echo a > a/a
81 81 $ echo b > b
82 82
83 83 $ hg addremove -s 0
84 84 removing a
85 85 adding a/a
86 86 adding b
87 87 removing b/b
88 88
89 89 $ hg st
90 90 A a/a
91 91 A b
92 92 R a
93 93 R b/b
94 94
95 95 commit:
96 96
97 97 $ hg ci -A -m "a is dir, b is file"
98 98 $ hg st --all
99 99 C a/a
100 100 C b
101 101
102 102 Long directory replaced with file:
103 103
104 104 $ mkdir d
105 105 $ mkdir d/d
106 106 $ echo d > d/d/d
107 107 $ hg commit -A -m "d is long directory"
108 108 adding d/d/d
109 109
110 110 $ rm -r d
111 111 $ echo d > d
112 112
113 113 Should fail - would corrupt dirstate:
114 114
115 115 $ hg add d
116 116 abort: directory 'd' already in dirstate
117 117 [255]
118 118
119 119 Removing shadow:
120 120
121 121 $ hg rm --after d/d/d
122 122
123 123 Should succeed - shadow removed:
124 124
125 125 $ hg add d
126 126 $ hg ci -md
127 127
128 128 Update should work at least with clean working directory:
129 129
130 130 $ rm -r a b d
131 131 $ hg up -r 0
132 132 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
133 133
134 134 $ hg st --all
135 135 C a
136 136 C b/b
137 137
138 138 $ rm -r a b
139 139 $ hg up -r 1
140 140 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 141
142 142 $ hg st --all
143 143 C a/a
144 144 C b
145 145
@@ -1,1085 +1,1085 b''
1 1 $ "$TESTDIR/hghave" symlink unix-permissions serve || exit 80
2 2
3 3 $ cat <<EOF >> $HGRCPATH
4 4 > [extensions]
5 5 > keyword =
6 6 > mq =
7 7 > notify =
8 8 > record =
9 9 > transplant =
10 10 > [ui]
11 11 > interactive = true
12 12 > EOF
13 13
14 14 Run kwdemo before [keyword] files are set up
15 15 as it would succeed without uisetup otherwise
16 16
17 17 $ hg --quiet kwdemo
18 18 [extensions]
19 19 keyword =
20 20 [keyword]
21 21 demo.txt =
22 22 [keywordset]
23 23 svn = False
24 24 [keywordmaps]
25 25 Author = {author|user}
26 26 Date = {date|utcdate}
27 27 Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
28 28 Id = {file|basename},v {node|short} {date|utcdate} {author|user}
29 29 RCSFile = {file|basename},v
30 30 RCSfile = {file|basename},v
31 31 Revision = {node|short}
32 32 Source = {root}/{file},v
33 33 $Author: test $
34 34 $Date: ????/??/?? ??:??:?? $ (glob)
35 35 $Header: */demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
36 36 $Id: demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
37 37 $RCSFile: demo.txt,v $
38 38 $RCSfile: demo.txt,v $
39 39 $Revision: ???????????? $ (glob)
40 40 $Source: */demo.txt,v $ (glob)
41 41
42 42 $ hg --quiet kwdemo "Branch = {branches}"
43 43 [extensions]
44 44 keyword =
45 45 [keyword]
46 46 demo.txt =
47 47 [keywordset]
48 48 svn = False
49 49 [keywordmaps]
50 50 Branch = {branches}
51 51 $Branch: demobranch $
52 52
53 53 $ cat <<EOF >> $HGRCPATH
54 54 > [keyword]
55 55 > ** =
56 56 > b = ignore
57 57 > i = ignore
58 58 > [hooks]
59 59 > EOF
60 60 $ cp $HGRCPATH $HGRCPATH.nohooks
61 61 > cat <<EOF >> $HGRCPATH
62 62 > commit=
63 63 > commit.test=cp a hooktest
64 64 > EOF
65 65
66 66 $ hg init Test-bndl
67 67 $ cd Test-bndl
68 68
69 69 kwshrink should exit silently in empty/invalid repo
70 70
71 71 $ hg kwshrink
72 72
73 73 Symlinks cannot be created on Windows.
74 74 A bundle to test this was made with:
75 75 hg init t
76 76 cd t
77 77 echo a > a
78 78 ln -s a sym
79 79 hg add sym
80 80 hg ci -m addsym -u mercurial
81 81 hg bundle --base null ../test-keyword.hg
82 82
83 83 $ hg pull -u "$TESTDIR"/bundles/test-keyword.hg
84 84 pulling from *test-keyword.hg (glob)
85 85 requesting all changes
86 86 adding changesets
87 87 adding manifests
88 88 adding file changes
89 89 added 1 changesets with 1 changes to 1 files
90 90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 91
92 92 $ echo 'expand $Id$' > a
93 93 $ echo 'do not process $Id:' >> a
94 94 $ echo 'xxx $' >> a
95 95 $ echo 'ignore $Id$' > b
96 96
97 97 Output files as they were created
98 98
99 99 $ cat a b
100 100 expand $Id$
101 101 do not process $Id:
102 102 xxx $
103 103 ignore $Id$
104 104
105 105 no kwfiles
106 106
107 107 $ hg kwfiles
108 108
109 109 untracked candidates
110 110
111 111 $ hg -v kwfiles --unknown
112 112 k a
113 113
114 114 Add files and check status
115 115
116 116 $ hg addremove
117 117 adding a
118 118 adding b
119 119 $ hg status
120 120 A a
121 121 A b
122 122
123 123
124 124 Default keyword expansion including commit hook
125 125 Interrupted commit should not change state or run commit hook
126 126
127 127 $ hg --debug commit
128 128 abort: empty commit message
129 129 [255]
130 130 $ hg status
131 131 A a
132 132 A b
133 133
134 134 Commit with several checks
135 135
136 136 $ hg --debug commit -mabsym -u 'User Name <user@example.com>'
137 137 a
138 138 b
139 139 overwriting a expanding keywords
140 140 running hook commit.test: cp a hooktest
141 141 committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
142 142 $ hg status
143 143 ? hooktest
144 144 $ hg debugrebuildstate
145 145 $ hg --quiet identify
146 146 ef63ca68695b
147 147
148 148 cat files in working directory with keywords expanded
149 149
150 150 $ cat a b
151 151 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
152 152 do not process $Id:
153 153 xxx $
154 154 ignore $Id$
155 155
156 156 hg cat files and symlink, no expansion
157 157
158 158 $ hg cat sym a b && echo
159 159 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
160 160 do not process $Id:
161 161 xxx $
162 162 ignore $Id$
163 163 a
164 164
165 165 Test hook execution
166 166
167 167 $ diff a hooktest
168 168
169 169 $ cp $HGRCPATH.nohooks $HGRCPATH
170 170 $ rm hooktest
171 171
172 172 bundle
173 173
174 174 $ hg bundle --base null ../kw.hg
175 175 2 changesets found
176 176 $ cd ..
177 177 $ hg init Test
178 178 $ cd Test
179 179
180 180 Notify on pull to check whether keywords stay as is in email
181 181 ie. if patch.diff wrapper acts as it should
182 182
183 183 $ cat <<EOF >> $HGRCPATH
184 184 > [hooks]
185 185 > incoming.notify = python:hgext.notify.hook
186 186 > [notify]
187 187 > sources = pull
188 188 > diffstat = False
189 189 > maxsubject = 15
190 190 > [reposubs]
191 191 > * = Test
192 192 > EOF
193 193
194 194 Pull from bundle and trigger notify
195 195
196 196 $ hg pull -u ../kw.hg
197 197 pulling from ../kw.hg
198 198 requesting all changes
199 199 adding changesets
200 200 adding manifests
201 201 adding file changes
202 202 added 2 changesets with 3 changes to 3 files
203 203 Content-Type: text/plain; charset="us-ascii"
204 204 MIME-Version: 1.0
205 205 Content-Transfer-Encoding: 7bit
206 206 Date: * (glob)
207 207 Subject: changeset in...
208 208 From: mercurial
209 209 X-Hg-Notification: changeset a2392c293916
210 210 Message-Id: <hg.a2392c293916*> (glob)
211 211 To: Test
212 212
213 changeset a2392c293916 in $TESTTMP/Test
213 changeset a2392c293916 in $TESTTMP/Test (glob)
214 214 details: $TESTTMP/Test?cmd=changeset;node=a2392c293916
215 215 description:
216 216 addsym
217 217
218 218 diffs (6 lines):
219 219
220 220 diff -r 000000000000 -r a2392c293916 sym
221 221 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
222 222 +++ b/sym Sat Feb 09 20:25:47 2008 +0100
223 223 @@ -0,0 +1,1 @@
224 224 +a
225 225 \ No newline at end of file
226 226 Content-Type: text/plain; charset="us-ascii"
227 227 MIME-Version: 1.0
228 228 Content-Transfer-Encoding: 7bit
229 229 Date:* (glob)
230 230 Subject: changeset in...
231 231 From: User Name <user@example.com>
232 232 X-Hg-Notification: changeset ef63ca68695b
233 233 Message-Id: <hg.ef63ca68695b*> (glob)
234 234 To: Test
235 235
236 changeset ef63ca68695b in $TESTTMP/Test
236 changeset ef63ca68695b in $TESTTMP/Test (glob)
237 237 details: $TESTTMP/Test?cmd=changeset;node=ef63ca68695b
238 238 description:
239 239 absym
240 240
241 241 diffs (12 lines):
242 242
243 243 diff -r a2392c293916 -r ef63ca68695b a
244 244 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
245 245 +++ b/a Thu Jan 01 00:00:00 1970 +0000
246 246 @@ -0,0 +1,3 @@
247 247 +expand $Id$
248 248 +do not process $Id:
249 249 +xxx $
250 250 diff -r a2392c293916 -r ef63ca68695b b
251 251 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
252 252 +++ b/b Thu Jan 01 00:00:00 1970 +0000
253 253 @@ -0,0 +1,1 @@
254 254 +ignore $Id$
255 255 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
256 256
257 257 $ cp $HGRCPATH.nohooks $HGRCPATH
258 258
259 259 Touch files and check with status
260 260
261 261 $ touch a b
262 262 $ hg status
263 263
264 264 Update and expand
265 265
266 266 $ rm sym a b
267 267 $ hg update -C
268 268 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 269 $ cat a b
270 270 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
271 271 do not process $Id:
272 272 xxx $
273 273 ignore $Id$
274 274
275 275 Check whether expansion is filewise and file mode is preserved
276 276
277 277 $ echo '$Id$' > c
278 278 $ echo 'tests for different changenodes' >> c
279 279 $ chmod 600 c
280 280 $ ls -l c | cut -b 1-10
281 281 -rw-------
282 282
283 283 commit file c
284 284
285 285 $ hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
286 286 adding c
287 287 $ ls -l c | cut -b 1-10
288 288 -rw-------
289 289
290 290 force expansion
291 291
292 292 $ hg -v kwexpand
293 293 overwriting a expanding keywords
294 294 overwriting c expanding keywords
295 295
296 296 compare changenodes in a and c
297 297
298 298 $ cat a c
299 299 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
300 300 do not process $Id:
301 301 xxx $
302 302 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
303 303 tests for different changenodes
304 304
305 305 record
306 306
307 307 $ echo '$Id$' > r
308 308 $ hg add r
309 309
310 310 record chunk
311 311
312 312 $ python -c \
313 313 > 'l=open("a").readlines();l.insert(1,"foo\n");l.append("bar\n");open("a","w").writelines(l);'
314 314 $ hg record -d '1 10' -m rectest a<<EOF
315 315 > y
316 316 > y
317 317 > n
318 318 > EOF
319 319 diff --git a/a b/a
320 320 2 hunks, 2 lines changed
321 321 examine changes to 'a'? [Ynsfdaq?]
322 322 @@ -1,3 +1,4 @@
323 323 expand $Id$
324 324 +foo
325 325 do not process $Id:
326 326 xxx $
327 327 record change 1/2 to 'a'? [Ynsfdaq?]
328 328 @@ -2,2 +3,3 @@
329 329 do not process $Id:
330 330 xxx $
331 331 +bar
332 332 record change 2/2 to 'a'? [Ynsfdaq?]
333 333
334 334 $ hg identify
335 335 d17e03c92c97+ tip
336 336 $ hg status
337 337 M a
338 338 A r
339 339
340 340 Cat modified file a
341 341
342 342 $ cat a
343 343 expand $Id: a,v d17e03c92c97 1970/01/01 00:00:01 test $
344 344 foo
345 345 do not process $Id:
346 346 xxx $
347 347 bar
348 348
349 349 Diff remaining chunk
350 350
351 351 $ hg diff a
352 352 diff -r d17e03c92c97 a
353 353 --- a/a Wed Dec 31 23:59:51 1969 -0000
354 354 +++ b/a * (glob)
355 355 @@ -2,3 +2,4 @@
356 356 foo
357 357 do not process $Id:
358 358 xxx $
359 359 +bar
360 360
361 361 $ hg rollback
362 362 repository tip rolled back to revision 2 (undo commit)
363 363 working directory now based on revision 2
364 364
365 365 Record all chunks in file a
366 366
367 367 $ echo foo > msg
368 368
369 369 - do not use "hg record -m" here!
370 370
371 371 $ hg record -l msg -d '1 11' a<<EOF
372 372 > y
373 373 > y
374 374 > y
375 375 > EOF
376 376 diff --git a/a b/a
377 377 2 hunks, 2 lines changed
378 378 examine changes to 'a'? [Ynsfdaq?]
379 379 @@ -1,3 +1,4 @@
380 380 expand $Id$
381 381 +foo
382 382 do not process $Id:
383 383 xxx $
384 384 record change 1/2 to 'a'? [Ynsfdaq?]
385 385 @@ -2,2 +3,3 @@
386 386 do not process $Id:
387 387 xxx $
388 388 +bar
389 389 record change 2/2 to 'a'? [Ynsfdaq?]
390 390
391 391 File a should be clean
392 392
393 393 $ hg status -A a
394 394 C a
395 395
396 396 rollback and revert expansion
397 397
398 398 $ cat a
399 399 expand $Id: a,v 59f969a3b52c 1970/01/01 00:00:01 test $
400 400 foo
401 401 do not process $Id:
402 402 xxx $
403 403 bar
404 404 $ hg --verbose rollback
405 405 repository tip rolled back to revision 2 (undo commit)
406 406 working directory now based on revision 2
407 407 overwriting a expanding keywords
408 408 $ hg status a
409 409 M a
410 410 $ cat a
411 411 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
412 412 foo
413 413 do not process $Id:
414 414 xxx $
415 415 bar
416 416 $ echo '$Id$' > y
417 417 $ echo '$Id$' > z
418 418 $ hg add y
419 419 $ hg commit -Am "rollback only" z
420 420 $ cat z
421 421 $Id: z,v 45a5d3adce53 1970/01/01 00:00:00 test $
422 422 $ hg --verbose rollback
423 423 repository tip rolled back to revision 2 (undo commit)
424 424 working directory now based on revision 2
425 425 overwriting z shrinking keywords
426 426
427 427 Only z should be overwritten
428 428
429 429 $ hg status a y z
430 430 M a
431 431 A y
432 432 A z
433 433 $ cat z
434 434 $Id$
435 435 $ hg forget y z
436 436 $ rm y z
437 437
438 438 record added file alone
439 439
440 440 $ hg -v record -l msg -d '1 12' r<<EOF
441 441 > y
442 442 > EOF
443 443 diff --git a/r b/r
444 444 new file mode 100644
445 445 examine changes to 'r'? [Ynsfdaq?]
446 446 r
447 447 committed changeset 3:899491280810
448 448 overwriting r expanding keywords
449 449 - status call required for dirstate.normallookup() check
450 450 $ hg status r
451 451 $ hg --verbose rollback
452 452 repository tip rolled back to revision 2 (undo commit)
453 453 working directory now based on revision 2
454 454 overwriting r shrinking keywords
455 455 $ hg forget r
456 456 $ rm msg r
457 457 $ hg update -C
458 458 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 459
460 460 record added keyword ignored file
461 461
462 462 $ echo '$Id$' > i
463 463 $ hg add i
464 464 $ hg --verbose record -d '1 13' -m recignored<<EOF
465 465 > y
466 466 > EOF
467 467 diff --git a/i b/i
468 468 new file mode 100644
469 469 examine changes to 'i'? [Ynsfdaq?]
470 470 i
471 471 committed changeset 3:5f40fe93bbdc
472 472 $ cat i
473 473 $Id$
474 474 $ hg -q rollback
475 475 $ hg forget i
476 476 $ rm i
477 477
478 478 Test patch queue repo
479 479
480 480 $ hg init --mq
481 481 $ hg qimport -r tip -n mqtest.diff
482 482 $ hg commit --mq -m mqtest
483 483
484 484 Keywords should not be expanded in patch
485 485
486 486 $ cat .hg/patches/mqtest.diff
487 487 # HG changeset patch
488 488 # User User Name <user@example.com>
489 489 # Date 1 0
490 490 # Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
491 491 # Parent ef63ca68695bc9495032c6fda1350c71e6d256e9
492 492 cndiff
493 493
494 494 diff -r ef63ca68695b -r 40a904bbbe4c c
495 495 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
496 496 +++ b/c Thu Jan 01 00:00:01 1970 +0000
497 497 @@ -0,0 +1,2 @@
498 498 +$Id$
499 499 +tests for different changenodes
500 500
501 501 $ hg qpop
502 502 popping mqtest.diff
503 503 patch queue now empty
504 504
505 505 qgoto, implying qpush, should expand
506 506
507 507 $ hg qgoto mqtest.diff
508 508 applying mqtest.diff
509 509 now at: mqtest.diff
510 510 $ cat c
511 511 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
512 512 tests for different changenodes
513 513 $ hg cat c
514 514 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
515 515 tests for different changenodes
516 516
517 517 Keywords should not be expanded in filelog
518 518
519 519 $ hg --config 'extensions.keyword=!' cat c
520 520 $Id$
521 521 tests for different changenodes
522 522
523 523 qpop and move on
524 524
525 525 $ hg qpop
526 526 popping mqtest.diff
527 527 patch queue now empty
528 528
529 529 Copy and show added kwfiles
530 530
531 531 $ hg cp a c
532 532 $ hg kwfiles
533 533 a
534 534 c
535 535
536 536 Commit and show expansion in original and copy
537 537
538 538 $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
539 539 c
540 540 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
541 541 overwriting c expanding keywords
542 542 committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
543 543 $ cat a c
544 544 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
545 545 do not process $Id:
546 546 xxx $
547 547 expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
548 548 do not process $Id:
549 549 xxx $
550 550
551 551 Touch copied c and check its status
552 552
553 553 $ touch c
554 554 $ hg status
555 555
556 556 Copy kwfile to keyword ignored file unexpanding keywords
557 557
558 558 $ hg --verbose copy a i
559 559 copying a to i
560 560 overwriting i shrinking keywords
561 561 $ head -n 1 i
562 562 expand $Id$
563 563 $ hg forget i
564 564 $ rm i
565 565
566 566 Copy ignored file to ignored file: no overwriting
567 567
568 568 $ hg --verbose copy b i
569 569 copying b to i
570 570 $ hg forget i
571 571 $ rm i
572 572
573 573 cp symlink file; hg cp -A symlink file (part1)
574 574 - copied symlink points to kwfile: overwrite
575 575
576 576 $ cp sym i
577 577 $ ls -l i
578 578 -rw-r--r--* (glob)
579 579 $ head -1 i
580 580 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
581 581 $ hg copy --after --verbose sym i
582 582 copying sym to i
583 583 overwriting i shrinking keywords
584 584 $ head -1 i
585 585 expand $Id$
586 586 $ hg forget i
587 587 $ rm i
588 588
589 589 Test different options of hg kwfiles
590 590
591 591 $ hg kwfiles
592 592 a
593 593 c
594 594 $ hg -v kwfiles --ignore
595 595 I b
596 596 I sym
597 597 $ hg kwfiles --all
598 598 K a
599 599 K c
600 600 I b
601 601 I sym
602 602
603 603 Diff specific revision
604 604
605 605 $ hg diff --rev 1
606 606 diff -r ef63ca68695b c
607 607 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
608 608 +++ b/c * (glob)
609 609 @@ -0,0 +1,3 @@
610 610 +expand $Id$
611 611 +do not process $Id:
612 612 +xxx $
613 613
614 614 Status after rollback:
615 615
616 616 $ hg rollback
617 617 repository tip rolled back to revision 1 (undo commit)
618 618 working directory now based on revision 1
619 619 $ hg status
620 620 A c
621 621 $ hg update --clean
622 622 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
623 623
624 624 cp symlink file; hg cp -A symlink file (part2)
625 625 - copied symlink points to kw ignored file: do not overwrite
626 626
627 627 $ cat a > i
628 628 $ ln -s i symignored
629 629 $ hg commit -Am 'fake expansion in ignored and symlink' i symignored
630 630 $ cp symignored x
631 631 $ hg copy --after --verbose symignored x
632 632 copying symignored to x
633 633 $ head -n 1 x
634 634 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
635 635 $ hg forget x
636 636 $ rm x
637 637
638 638 $ hg rollback
639 639 repository tip rolled back to revision 1 (undo commit)
640 640 working directory now based on revision 1
641 641 $ hg update --clean
642 642 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
643 643 $ rm i symignored
644 644
645 645 Custom keywordmaps as argument to kwdemo
646 646
647 647 $ hg --quiet kwdemo "Xinfo = {author}: {desc}"
648 648 [extensions]
649 649 keyword =
650 650 [keyword]
651 651 ** =
652 652 b = ignore
653 653 demo.txt =
654 654 i = ignore
655 655 [keywordset]
656 656 svn = False
657 657 [keywordmaps]
658 658 Xinfo = {author}: {desc}
659 659 $Xinfo: test: hg keyword configuration and expansion example $
660 660
661 661 Configure custom keywordmaps
662 662
663 663 $ cat <<EOF >>$HGRCPATH
664 664 > [keywordmaps]
665 665 > Id = {file} {node|short} {date|rfc822date} {author|user}
666 666 > Xinfo = {author}: {desc}
667 667 > EOF
668 668
669 669 Cat and hg cat files before custom expansion
670 670
671 671 $ cat a b
672 672 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
673 673 do not process $Id:
674 674 xxx $
675 675 ignore $Id$
676 676 $ hg cat sym a b && echo
677 677 expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
678 678 do not process $Id:
679 679 xxx $
680 680 ignore $Id$
681 681 a
682 682
683 683 Write custom keyword and prepare multiline commit message
684 684
685 685 $ echo '$Xinfo$' >> a
686 686 $ cat <<EOF >> log
687 687 > firstline
688 688 > secondline
689 689 > EOF
690 690
691 691 Interrupted commit should not change state
692 692
693 693 $ hg commit
694 694 abort: empty commit message
695 695 [255]
696 696 $ hg status
697 697 M a
698 698 ? c
699 699 ? log
700 700
701 701 Commit with multiline message and custom expansion
702 702
703 703 $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
704 704 a
705 705 overwriting a expanding keywords
706 706 committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
707 707 $ rm log
708 708
709 709 Stat, verify and show custom expansion (firstline)
710 710
711 711 $ hg status
712 712 ? c
713 713 $ hg verify
714 714 checking changesets
715 715 checking manifests
716 716 crosschecking files in changesets and manifests
717 717 checking files
718 718 3 files, 3 changesets, 4 total revisions
719 719 $ cat a b
720 720 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
721 721 do not process $Id:
722 722 xxx $
723 723 $Xinfo: User Name <user@example.com>: firstline $
724 724 ignore $Id$
725 725 $ hg cat sym a b && echo
726 726 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
727 727 do not process $Id:
728 728 xxx $
729 729 $Xinfo: User Name <user@example.com>: firstline $
730 730 ignore $Id$
731 731 a
732 732
733 733 annotate
734 734
735 735 $ hg annotate a
736 736 1: expand $Id$
737 737 1: do not process $Id:
738 738 1: xxx $
739 739 2: $Xinfo$
740 740
741 741 remove with status checks
742 742
743 743 $ hg debugrebuildstate
744 744 $ hg remove a
745 745 $ hg --debug commit -m rma
746 746 committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
747 747 $ hg status
748 748 ? c
749 749
750 750 Rollback, revert, and check expansion
751 751
752 752 $ hg rollback
753 753 repository tip rolled back to revision 2 (undo commit)
754 754 working directory now based on revision 2
755 755 $ hg status
756 756 R a
757 757 ? c
758 758 $ hg revert --no-backup --rev tip a
759 759 $ cat a
760 760 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
761 761 do not process $Id:
762 762 xxx $
763 763 $Xinfo: User Name <user@example.com>: firstline $
764 764
765 765 Clone to test global and local configurations
766 766
767 767 $ cd ..
768 768
769 769 Expansion in destinaton with global configuration
770 770
771 771 $ hg --quiet clone Test globalconf
772 772 $ cat globalconf/a
773 773 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
774 774 do not process $Id:
775 775 xxx $
776 776 $Xinfo: User Name <user@example.com>: firstline $
777 777
778 778 No expansion in destination with local configuration in origin only
779 779
780 780 $ hg --quiet --config 'keyword.**=ignore' clone Test localconf
781 781 $ cat localconf/a
782 782 expand $Id$
783 783 do not process $Id:
784 784 xxx $
785 785 $Xinfo$
786 786
787 787 Clone to test incoming
788 788
789 789 $ hg clone -r1 Test Test-a
790 790 adding changesets
791 791 adding manifests
792 792 adding file changes
793 793 added 2 changesets with 3 changes to 3 files
794 794 updating to branch default
795 795 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
796 796 $ cd Test-a
797 797 $ cat <<EOF >> .hg/hgrc
798 798 > [paths]
799 799 > default = ../Test
800 800 > EOF
801 801 $ hg incoming
802 comparing with $TESTTMP/Test
802 comparing with $TESTTMP/Test (glob)
803 803 searching for changes
804 804 changeset: 2:bb948857c743
805 805 tag: tip
806 806 user: User Name <user@example.com>
807 807 date: Thu Jan 01 00:00:02 1970 +0000
808 808 summary: firstline
809 809
810 810 Imported patch should not be rejected
811 811
812 812 $ python -c \
813 813 > 'import re; s=re.sub("(Id.*)","\\1 rejecttest",open("a").read()); open("a","wb").write(s);'
814 814 $ hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
815 815 a
816 816 overwriting a expanding keywords
817 817 committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
818 818 $ hg export -o ../rejecttest.diff tip
819 819 $ cd ../Test
820 820 $ hg import ../rejecttest.diff
821 821 applying ../rejecttest.diff
822 822 $ cat a b
823 823 expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
824 824 do not process $Id: rejecttest
825 825 xxx $
826 826 $Xinfo: User Name <user@example.com>: rejects? $
827 827 ignore $Id$
828 828
829 829 $ hg rollback
830 830 repository tip rolled back to revision 2 (undo import)
831 831 working directory now based on revision 2
832 832 $ hg update --clean
833 833 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
834 834
835 835 kwexpand/kwshrink on selected files
836 836
837 837 $ mkdir x
838 838 $ hg copy a x/a
839 839 $ hg --verbose kwshrink a
840 840 overwriting a shrinking keywords
841 841 - sleep required for dirstate.normal() check
842 842 $ sleep 1
843 843 $ hg status a
844 844 $ hg --verbose kwexpand a
845 845 overwriting a expanding keywords
846 846 $ hg status a
847 847
848 848 kwexpand x/a should abort
849 849
850 850 $ hg --verbose kwexpand x/a
851 851 abort: outstanding uncommitted changes
852 852 [255]
853 853 $ cd x
854 854 $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
855 855 x/a
856 856 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
857 857 overwriting x/a expanding keywords
858 858 committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
859 859 $ cat a
860 860 expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
861 861 do not process $Id:
862 862 xxx $
863 863 $Xinfo: User Name <user@example.com>: xa $
864 864
865 865 kwshrink a inside directory x
866 866
867 867 $ hg --verbose kwshrink a
868 868 overwriting x/a shrinking keywords
869 869 $ cat a
870 870 expand $Id$
871 871 do not process $Id:
872 872 xxx $
873 873 $Xinfo$
874 874 $ cd ..
875 875
876 876 kwexpand nonexistent
877 877
878 878 $ hg kwexpand nonexistent
879 879 nonexistent:* (glob)
880 880
881 881
882 882 hg serve
883 883 - expand with hgweb file
884 884 - no expansion with hgweb annotate/changeset/filediff
885 885 - check errors
886 886
887 887 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
888 888 $ cat hg.pid >> $DAEMON_PIDS
889 889 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/file/tip/a/?style=raw'
890 890 200 Script output follows
891 891
892 892 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
893 893 do not process $Id:
894 894 xxx $
895 895 $Xinfo: User Name <user@example.com>: firstline $
896 896 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/annotate/tip/a/?style=raw'
897 897 200 Script output follows
898 898
899 899
900 900 user@1: expand $Id$
901 901 user@1: do not process $Id:
902 902 user@1: xxx $
903 903 user@2: $Xinfo$
904 904
905 905
906 906
907 907
908 908 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/rev/tip/?style=raw'
909 909 200 Script output follows
910 910
911 911
912 912 # HG changeset patch
913 913 # User User Name <user@example.com>
914 914 # Date 3 0
915 915 # Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
916 916 # Parent bb948857c743469b22bbf51f7ec8112279ca5d83
917 917 xa
918 918
919 919 diff -r bb948857c743 -r b4560182a3f9 x/a
920 920 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
921 921 +++ b/x/a Thu Jan 01 00:00:03 1970 +0000
922 922 @@ -0,0 +1,4 @@
923 923 +expand $Id$
924 924 +do not process $Id:
925 925 +xxx $
926 926 +$Xinfo$
927 927
928 928 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/diff/bb948857c743/a?style=raw'
929 929 200 Script output follows
930 930
931 931
932 932 diff -r ef63ca68695b -r bb948857c743 a
933 933 --- a/a Thu Jan 01 00:00:00 1970 +0000
934 934 +++ b/a Thu Jan 01 00:00:02 1970 +0000
935 935 @@ -1,3 +1,4 @@
936 936 expand $Id$
937 937 do not process $Id:
938 938 xxx $
939 939 +$Xinfo$
940 940
941 941
942 942
943 943
944 944 $ cat errors.log
945 945
946 946 Prepare merge and resolve tests
947 947
948 948 $ echo '$Id$' > m
949 949 $ hg add m
950 950 $ hg commit -m 4kw
951 951 $ echo foo >> m
952 952 $ hg commit -m 5foo
953 953
954 954 simplemerge
955 955
956 956 $ hg update 4
957 957 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
958 958 $ echo foo >> m
959 959 $ hg commit -m 6foo
960 960 created new head
961 961 $ hg merge
962 962 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
963 963 (branch merge, don't forget to commit)
964 964 $ hg commit -m simplemerge
965 965 $ cat m
966 966 $Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
967 967 foo
968 968
969 969 conflict: keyword should stay outside conflict zone
970 970
971 971 $ hg update 4
972 972 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
973 973 $ echo bar >> m
974 974 $ hg commit -m 8bar
975 975 created new head
976 976 $ hg merge
977 977 merging m
978 978 warning: conflicts during merge.
979 979 merging m failed!
980 980 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
981 981 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
982 982 [1]
983 983 $ cat m
984 984 $Id$
985 985 <<<<<<< local
986 986 bar
987 987 =======
988 988 foo
989 989 >>>>>>> other
990 990
991 991 resolve to local
992 992
993 993 $ HGMERGE=internal:local hg resolve -a
994 994 $ hg commit -m localresolve
995 995 $ cat m
996 996 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
997 997 bar
998 998
999 999 Test restricted mode with transplant -b
1000 1000
1001 1001 $ hg update 6
1002 1002 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1003 1003 $ hg branch foo
1004 1004 marked working directory as branch foo
1005 1005 $ mv a a.bak
1006 1006 $ echo foobranch > a
1007 1007 $ cat a.bak >> a
1008 1008 $ rm a.bak
1009 1009 $ hg commit -m 9foobranch
1010 1010 $ hg update default
1011 1011 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1012 1012 $ hg -y transplant -b foo tip
1013 1013 applying 4aa30d025d50
1014 1014 4aa30d025d50 transplanted to e00abbf63521
1015 1015
1016 1016 Expansion in changeset but not in file
1017 1017
1018 1018 $ hg tip -p
1019 1019 changeset: 11:e00abbf63521
1020 1020 tag: tip
1021 1021 parent: 9:800511b3a22d
1022 1022 user: test
1023 1023 date: Thu Jan 01 00:00:00 1970 +0000
1024 1024 summary: 9foobranch
1025 1025
1026 1026 diff -r 800511b3a22d -r e00abbf63521 a
1027 1027 --- a/a Thu Jan 01 00:00:00 1970 +0000
1028 1028 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1029 1029 @@ -1,3 +1,4 @@
1030 1030 +foobranch
1031 1031 expand $Id$
1032 1032 do not process $Id:
1033 1033 xxx $
1034 1034
1035 1035 $ head -n 2 a
1036 1036 foobranch
1037 1037 expand $Id: a e00abbf63521 Thu, 01 Jan 1970 00:00:00 +0000 test $
1038 1038
1039 1039 Turn off expansion
1040 1040
1041 1041 $ hg -q rollback
1042 1042 $ hg -q update -C
1043 1043
1044 1044 kwshrink with unknown file u
1045 1045
1046 1046 $ cp a u
1047 1047 $ hg --verbose kwshrink
1048 1048 overwriting a shrinking keywords
1049 1049 overwriting m shrinking keywords
1050 1050 overwriting x/a shrinking keywords
1051 1051
1052 1052 Keywords shrunk in working directory, but not yet disabled
1053 1053 - cat shows unexpanded keywords
1054 1054 - hg cat shows expanded keywords
1055 1055
1056 1056 $ cat a b
1057 1057 expand $Id$
1058 1058 do not process $Id:
1059 1059 xxx $
1060 1060 $Xinfo$
1061 1061 ignore $Id$
1062 1062 $ hg cat sym a b && echo
1063 1063 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
1064 1064 do not process $Id:
1065 1065 xxx $
1066 1066 $Xinfo: User Name <user@example.com>: firstline $
1067 1067 ignore $Id$
1068 1068 a
1069 1069
1070 1070 Now disable keyword expansion
1071 1071
1072 1072 $ rm "$HGRCPATH"
1073 1073 $ cat a b
1074 1074 expand $Id$
1075 1075 do not process $Id:
1076 1076 xxx $
1077 1077 $Xinfo$
1078 1078 ignore $Id$
1079 1079 $ hg cat sym a b && echo
1080 1080 expand $Id$
1081 1081 do not process $Id:
1082 1082 xxx $
1083 1083 $Xinfo$
1084 1084 ignore $Id$
1085 1085 a
@@ -1,844 +1,844 b''
1 1 $ "$TESTDIR/hghave" symlink unix-permissions serve || exit 80
2 2
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [extensions]
5 5 > largefiles=
6 6 > purge=
7 7 > rebase=
8 8 > transplant=
9 9 > [largefiles]
10 10 > minsize=2
11 11 > patterns=glob:**.dat
12 12 > EOF
13 13
14 14 Create the repo with a couple of revisions of both large and normal
15 15 files, testing that status correctly shows largefiles.
16 16
17 17 $ hg init a
18 18 $ cd a
19 19 $ mkdir sub
20 20 $ echo normal1 > normal1
21 21 $ echo normal2 > sub/normal2
22 22 $ echo large1 > large1
23 23 $ echo large2 > sub/large2
24 24 $ hg add normal1 sub/normal2
25 25 $ hg add --large large1 sub/large2
26 26 $ hg commit -m "add files"
27 27 $ echo normal11 > normal1
28 28 $ echo normal22 > sub/normal2
29 29 $ echo large11 > large1
30 30 $ echo large22 > sub/large2
31 31 $ hg st
32 32 M large1
33 33 M normal1
34 34 M sub/large2
35 35 M sub/normal2
36 36 $ hg commit -m "edit files"
37 37
38 38 Commit preserved largefile contents.
39 39
40 40 $ cat normal1
41 41 normal11
42 42 $ cat large1
43 43 large11
44 44 $ cat sub/normal2
45 45 normal22
46 46 $ cat sub/large2
47 47 large22
48 48
49 49 Remove both largefiles and normal files.
50 50
51 51 $ hg remove normal1 large1
52 52 $ hg commit -m "remove files"
53 53 $ ls
54 54 sub
55 55
56 56 Copy both largefiles and normal files.
57 57
58 58 $ hg cp sub/normal2 normal1
59 59 $ hg cp sub/large2 large1
60 60 $ hg commit -m "copy files"
61 61 $ cat normal1
62 62 normal22
63 63 $ cat large1
64 64 large22
65 65
66 66 Test moving largefiles and verify that normal files are also unaffected.
67 67
68 68 $ hg mv normal1 normal3
69 69 $ hg mv large1 large3
70 70 $ hg mv sub/normal2 sub/normal4
71 71 $ hg mv sub/large2 sub/large4
72 72 $ hg commit -m "move files"
73 73 $ cat normal3
74 74 normal22
75 75 $ cat large3
76 76 large22
77 77 $ cat sub/normal4
78 78 normal22
79 79 $ cat sub/large4
80 80 large22
81 81
82 82 Test archiving the various revisions. These hit corner cases known with
83 83 archiving.
84 84
85 85 $ hg archive -r 0 ../archive0
86 86 $ hg archive -r 1 ../archive1
87 87 $ hg archive -r 2 ../archive2
88 88 $ hg archive -r 3 ../archive3
89 89 $ hg archive -r 4 ../archive4
90 90 $ cd ../archive0
91 91 $ cat normal1
92 92 normal1
93 93 $ cat large1
94 94 large1
95 95 $ cat sub/normal2
96 96 normal2
97 97 $ cat sub/large2
98 98 large2
99 99 $ cd ../archive1
100 100 $ cat normal1
101 101 normal11
102 102 $ cat large1
103 103 large11
104 104 $ cat sub/normal2
105 105 normal22
106 106 $ cat sub/large2
107 107 large22
108 108 $ cd ../archive2
109 109 $ ls
110 110 sub
111 111 $ cat sub/normal2
112 112 normal22
113 113 $ cat sub/large2
114 114 large22
115 115 $ cd ../archive3
116 116 $ cat normal1
117 117 normal22
118 118 $ cat large1
119 119 large22
120 120 $ cat sub/normal2
121 121 normal22
122 122 $ cat sub/large2
123 123 large22
124 124 $ cd ../archive4
125 125 $ cat normal3
126 126 normal22
127 127 $ cat large3
128 128 large22
129 129 $ cat sub/normal4
130 130 normal22
131 131 $ cat sub/large4
132 132 large22
133 133
134 134 Commit corner case: specify files to commit.
135 135
136 136 $ cd ../a
137 137 $ echo normal3 > normal3
138 138 $ echo large3 > large3
139 139 $ echo normal4 > sub/normal4
140 140 $ echo large4 > sub/large4
141 141 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
142 142 $ cat normal3
143 143 normal3
144 144 $ cat large3
145 145 large3
146 146 $ cat sub/normal4
147 147 normal4
148 148 $ cat sub/large4
149 149 large4
150 150
151 151 One more commit corner case: commit from a subdirectory.
152 152
153 153 $ cd ../a
154 154 $ echo normal33 > normal3
155 155 $ echo large33 > large3
156 156 $ echo normal44 > sub/normal4
157 157 $ echo large44 > sub/large4
158 158 $ cd sub
159 159 $ hg commit -m "edit files yet again"
160 160 $ cat ../normal3
161 161 normal33
162 162 $ cat ../large3
163 163 large33
164 164 $ cat normal4
165 165 normal44
166 166 $ cat large4
167 167 large44
168 168
169 169 Committing standins is not allowed.
170 170
171 171 $ cd ..
172 172 $ echo large3 > large3
173 173 $ hg commit .hglf/large3 -m "try to commit standin"
174 174 abort: file ".hglf/large3" is a largefile standin
175 175 (commit the largefile itself instead)
176 176 [255]
177 177
178 178 Corner cases for adding largefiles.
179 179
180 180 $ echo large5 > large5
181 181 $ hg add --large large5
182 182 $ hg add --large large5
183 183 large5 already a largefile
184 184 $ mkdir sub2
185 185 $ echo large6 > sub2/large6
186 186 $ echo large7 > sub2/large7
187 187 $ hg add --large sub2
188 adding sub2/large6 as a largefile
189 adding sub2/large7 as a largefile
188 adding sub2/large6 as a largefile (glob)
189 adding sub2/large7 as a largefile (glob)
190 190 $ hg st
191 191 M large3
192 192 A large5
193 193 A sub2/large6
194 194 A sub2/large7
195 195
196 196 Config settings (pattern **.dat, minsize 2 MB) are respected.
197 197
198 198 $ echo testdata > test.dat
199 199 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
200 200 $ hg add
201 201 adding reallylarge as a largefile
202 202 adding test.dat as a largefile
203 203
204 204 Test that minsize and --lfsize handle float values;
205 205 also tests that --lfsize overrides largefiles.minsize.
206 206 (0.250 MB = 256 kB = 262144 B)
207 207
208 208 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
209 209 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
210 210 $ hg --config largefiles.minsize=.25 add
211 211 adding ratherlarge as a largefile
212 212 adding medium
213 213 $ hg forget medium
214 214 $ hg --config largefiles.minsize=.25 add --lfsize=.125
215 215 adding medium as a largefile
216 216 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
217 217 $ hg --config largefiles.minsize=.25 add --lfsize=.125
218 218 adding notlarge
219 219 $ hg forget notlarge
220 220
221 221 Test forget on largefiles.
222 222
223 223 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
224 224 $ hg st
225 225 A sub2/large6
226 226 A sub2/large7
227 227 R large3
228 228 ? large5
229 229 ? medium
230 230 ? notlarge
231 231 ? ratherlarge
232 232 ? reallylarge
233 233 ? test.dat
234 234 $ hg commit -m "add/edit more largefiles"
235 235 $ hg st
236 236 ? large3
237 237 ? large5
238 238 ? medium
239 239 ? notlarge
240 240 ? ratherlarge
241 241 ? reallylarge
242 242 ? test.dat
243 243
244 244 Purge with largefiles: verify that largefiles are still in the working
245 245 dir after a purge.
246 246
247 247 $ hg purge --all
248 248 $ cat sub/large4
249 249 large44
250 250 $ cat sub2/large6
251 251 large6
252 252 $ cat sub2/large7
253 253 large7
254 254
255 255 Clone a largefiles repo.
256 256
257 257 $ cd ..
258 258 $ hg clone a b
259 259 updating to branch default
260 260 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 261 getting changed largefiles
262 262 3 largefiles updated, 0 removed
263 263 $ cd b
264 264 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
265 265 7:daea875e9014 add/edit more largefiles
266 266 6:4355d653f84f edit files yet again
267 267 5:9d5af5072dbd edit files again
268 268 4:74c02385b94c move files
269 269 3:9e8fbc4bce62 copy files
270 270 2:51a0ae4d5864 remove files
271 271 1:ce8896473775 edit files
272 272 0:30d30fe6a5be add files
273 273 $ cat normal3
274 274 normal33
275 275 $ cat sub/normal4
276 276 normal44
277 277 $ cat sub/large4
278 278 large44
279 279 $ cat sub2/large6
280 280 large6
281 281 $ cat sub2/large7
282 282 large7
283 283 $ cd ..
284 284 $ hg clone a -r 3 c
285 285 adding changesets
286 286 adding manifests
287 287 adding file changes
288 288 added 4 changesets with 10 changes to 4 files
289 289 updating to branch default
290 290 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
291 291 getting changed largefiles
292 292 2 largefiles updated, 0 removed
293 293 $ cd c
294 294 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
295 295 3:9e8fbc4bce62 copy files
296 296 2:51a0ae4d5864 remove files
297 297 1:ce8896473775 edit files
298 298 0:30d30fe6a5be add files
299 299 $ cat normal1
300 300 normal22
301 301 $ cat large1
302 302 large22
303 303 $ cat sub/normal2
304 304 normal22
305 305 $ cat sub/large2
306 306 large22
307 307
308 308 Old revisions of a clone have correct largefiles content (this also
309 309 tests update).
310 310
311 311 $ hg update -r 1
312 312 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
313 313 getting changed largefiles
314 314 1 largefiles updated, 0 removed
315 315 $ cat large1
316 316 large11
317 317 $ cat sub/large2
318 318 large22
319 319
320 320 Rebasing between two repositories does not revert largefiles to old
321 321 revisions (this was a very bad bug that took a lot of work to fix).
322 322
323 323 $ cd ..
324 324 $ hg clone a d
325 325 updating to branch default
326 326 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
327 327 getting changed largefiles
328 328 3 largefiles updated, 0 removed
329 329 $ cd b
330 330 $ echo large4-modified > sub/large4
331 331 $ echo normal3-modified > normal3
332 332 $ hg commit -m "modify normal file and largefile in repo b"
333 333 $ cd ../d
334 334 $ echo large6-modified > sub2/large6
335 335 $ echo normal4-modified > sub/normal4
336 336 $ hg commit -m "modify normal file largefile in repo d"
337 337 $ cd ..
338 338 $ hg clone d e
339 339 updating to branch default
340 340 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
341 341 getting changed largefiles
342 342 3 largefiles updated, 0 removed
343 343 $ cd d
344 344 $ hg pull --rebase ../b
345 345 pulling from ../b
346 346 searching for changes
347 347 adding changesets
348 348 adding manifests
349 349 adding file changes
350 350 added 1 changesets with 2 changes to 2 files (+1 heads)
351 351 getting changed largefiles
352 352 1 largefiles updated, 0 removed
353 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg
353 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
354 354 nothing to rebase
355 355 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
356 356 9:598410d3eb9a modify normal file largefile in repo d
357 357 8:a381d2c8c80e modify normal file and largefile in repo b
358 358 7:daea875e9014 add/edit more largefiles
359 359 6:4355d653f84f edit files yet again
360 360 5:9d5af5072dbd edit files again
361 361 4:74c02385b94c move files
362 362 3:9e8fbc4bce62 copy files
363 363 2:51a0ae4d5864 remove files
364 364 1:ce8896473775 edit files
365 365 0:30d30fe6a5be add files
366 366 $ cat normal3
367 367 normal3-modified
368 368 $ cat sub/normal4
369 369 normal4-modified
370 370 $ cat sub/large4
371 371 large4-modified
372 372 $ cat sub2/large6
373 373 large6-modified
374 374 $ cat sub2/large7
375 375 large7
376 376 $ cd ../e
377 377 $ hg pull ../b
378 378 pulling from ../b
379 379 searching for changes
380 380 adding changesets
381 381 adding manifests
382 382 adding file changes
383 383 added 1 changesets with 2 changes to 2 files (+1 heads)
384 384 (run 'hg heads' to see heads, 'hg merge' to merge)
385 385 $ hg rebase
386 386 getting changed largefiles
387 387 1 largefiles updated, 0 removed
388 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg
388 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
389 389 $ hg log
390 390 changeset: 9:598410d3eb9a
391 391 tag: tip
392 392 user: test
393 393 date: Thu Jan 01 00:00:00 1970 +0000
394 394 summary: modify normal file largefile in repo d
395 395
396 396 changeset: 8:a381d2c8c80e
397 397 user: test
398 398 date: Thu Jan 01 00:00:00 1970 +0000
399 399 summary: modify normal file and largefile in repo b
400 400
401 401 changeset: 7:daea875e9014
402 402 user: test
403 403 date: Thu Jan 01 00:00:00 1970 +0000
404 404 summary: add/edit more largefiles
405 405
406 406 changeset: 6:4355d653f84f
407 407 user: test
408 408 date: Thu Jan 01 00:00:00 1970 +0000
409 409 summary: edit files yet again
410 410
411 411 changeset: 5:9d5af5072dbd
412 412 user: test
413 413 date: Thu Jan 01 00:00:00 1970 +0000
414 414 summary: edit files again
415 415
416 416 changeset: 4:74c02385b94c
417 417 user: test
418 418 date: Thu Jan 01 00:00:00 1970 +0000
419 419 summary: move files
420 420
421 421 changeset: 3:9e8fbc4bce62
422 422 user: test
423 423 date: Thu Jan 01 00:00:00 1970 +0000
424 424 summary: copy files
425 425
426 426 changeset: 2:51a0ae4d5864
427 427 user: test
428 428 date: Thu Jan 01 00:00:00 1970 +0000
429 429 summary: remove files
430 430
431 431 changeset: 1:ce8896473775
432 432 user: test
433 433 date: Thu Jan 01 00:00:00 1970 +0000
434 434 summary: edit files
435 435
436 436 changeset: 0:30d30fe6a5be
437 437 user: test
438 438 date: Thu Jan 01 00:00:00 1970 +0000
439 439 summary: add files
440 440
441 441 $ cat normal3
442 442 normal3-modified
443 443 $ cat sub/normal4
444 444 normal4-modified
445 445 $ cat sub/large4
446 446 large4-modified
447 447 $ cat sub2/large6
448 448 large6-modified
449 449 $ cat sub2/large7
450 450 large7
451 451
452 452 Rollback on largefiles.
453 453
454 454 $ echo large4-modified-again > sub/large4
455 455 $ hg commit -m "Modify large4 again"
456 456 $ hg rollback
457 457 repository tip rolled back to revision 9 (undo commit)
458 458 working directory now based on revision 9
459 459 $ hg st
460 460 M sub/large4
461 461 $ hg log
462 462 changeset: 9:598410d3eb9a
463 463 tag: tip
464 464 user: test
465 465 date: Thu Jan 01 00:00:00 1970 +0000
466 466 summary: modify normal file largefile in repo d
467 467
468 468 changeset: 8:a381d2c8c80e
469 469 user: test
470 470 date: Thu Jan 01 00:00:00 1970 +0000
471 471 summary: modify normal file and largefile in repo b
472 472
473 473 changeset: 7:daea875e9014
474 474 user: test
475 475 date: Thu Jan 01 00:00:00 1970 +0000
476 476 summary: add/edit more largefiles
477 477
478 478 changeset: 6:4355d653f84f
479 479 user: test
480 480 date: Thu Jan 01 00:00:00 1970 +0000
481 481 summary: edit files yet again
482 482
483 483 changeset: 5:9d5af5072dbd
484 484 user: test
485 485 date: Thu Jan 01 00:00:00 1970 +0000
486 486 summary: edit files again
487 487
488 488 changeset: 4:74c02385b94c
489 489 user: test
490 490 date: Thu Jan 01 00:00:00 1970 +0000
491 491 summary: move files
492 492
493 493 changeset: 3:9e8fbc4bce62
494 494 user: test
495 495 date: Thu Jan 01 00:00:00 1970 +0000
496 496 summary: copy files
497 497
498 498 changeset: 2:51a0ae4d5864
499 499 user: test
500 500 date: Thu Jan 01 00:00:00 1970 +0000
501 501 summary: remove files
502 502
503 503 changeset: 1:ce8896473775
504 504 user: test
505 505 date: Thu Jan 01 00:00:00 1970 +0000
506 506 summary: edit files
507 507
508 508 changeset: 0:30d30fe6a5be
509 509 user: test
510 510 date: Thu Jan 01 00:00:00 1970 +0000
511 511 summary: add files
512 512
513 513 $ cat sub/large4
514 514 large4-modified-again
515 515
516 516 "update --check" refuses to update with uncommitted changes.
517 517 $ hg update --check 8
518 518 abort: uncommitted local changes
519 519 [255]
520 520
521 521 "update --clean" leaves correct largefiles in working copy.
522 522
523 523 $ hg update --clean
524 524 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
525 525 getting changed largefiles
526 526 1 largefiles updated, 0 removed
527 527 $ cat normal3
528 528 normal3-modified
529 529 $ cat sub/normal4
530 530 normal4-modified
531 531 $ cat sub/large4
532 532 large4-modified
533 533 $ cat sub2/large6
534 534 large6-modified
535 535 $ cat sub2/large7
536 536 large7
537 537
538 538 Now "update check" is happy.
539 539 $ hg update --check 8
540 540 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
541 541 getting changed largefiles
542 542 1 largefiles updated, 0 removed
543 543 $ hg update --check
544 544 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
545 545 getting changed largefiles
546 546 1 largefiles updated, 0 removed
547 547
548 548 "revert" works on largefiles (and normal files too).
549 549 $ echo hack3 >> normal3
550 550 $ echo hack4 >> sub/normal4
551 551 $ echo hack4 >> sub/large4
552 552 $ hg rm sub2/large6
553 553 $ echo new >> sub2/large8
554 554 $ hg add --large sub2/large8
555 555 # XXX we don't really want to report that we're reverting the standin;
556 556 # that's just an implementation detail. But I don't see an obvious fix. ;-(
557 557 $ hg revert sub
558 reverting .hglf/sub/large4
559 reverting sub/normal4
558 reverting .hglf/sub/large4 (glob)
559 reverting sub/normal4 (glob)
560 560 $ hg status
561 561 M normal3
562 562 A sub2/large8
563 563 R sub2/large6
564 564 ? sub/large4.orig
565 565 ? sub/normal4.orig
566 566 $ cat sub/normal4
567 567 normal4-modified
568 568 $ cat sub/large4
569 569 large4-modified
570 570 $ hg revert -a --no-backup
571 undeleting .hglf/sub2/large6
572 forgetting .hglf/sub2/large8
571 undeleting .hglf/sub2/large6 (glob)
572 forgetting .hglf/sub2/large8 (glob)
573 573 reverting normal3
574 574 $ hg status
575 575 ? sub/large4.orig
576 576 ? sub/normal4.orig
577 577 ? sub2/large8
578 578 $ cat normal3
579 579 normal3-modified
580 580 $ cat sub2/large6
581 581 large6-modified
582 582 $ rm sub/*.orig sub2/large8
583 583
584 584 revert some files to an older revision
585 585 $ hg revert --no-backup -r 8 sub2
586 reverting .hglf/sub2/large6
586 reverting .hglf/sub2/large6 (glob)
587 587 $ cat sub2/large6
588 588 large6
589 589 $ hg revert --no-backup sub2
590 reverting .hglf/sub2/large6
590 reverting .hglf/sub2/large6 (glob)
591 591 $ hg status
592 592
593 593 "verify --large" actually verifies largefiles
594 594
595 595 $ hg verify --large
596 596 checking changesets
597 597 checking manifests
598 598 crosschecking files in changesets and manifests
599 599 checking files
600 600 10 files, 10 changesets, 28 total revisions
601 601 searching 1 changesets for largefiles
602 602 verified existence of 3 revisions of 3 largefiles
603 603
604 604 Merging does not revert to old versions of largefiles (this has also
605 605 been very problematic).
606 606
607 607 $ cd ..
608 608 $ hg clone -r 7 e f
609 609 adding changesets
610 610 adding manifests
611 611 adding file changes
612 612 added 8 changesets with 24 changes to 10 files
613 613 updating to branch default
614 614 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
615 615 getting changed largefiles
616 616 3 largefiles updated, 0 removed
617 617 $ cd f
618 618 $ echo "large4-merge-test" > sub/large4
619 619 $ hg commit -m "Modify large4 to test merge"
620 620 $ hg pull ../e
621 621 pulling from ../e
622 622 searching for changes
623 623 adding changesets
624 624 adding manifests
625 625 adding file changes
626 626 added 2 changesets with 4 changes to 4 files (+1 heads)
627 627 (run 'hg heads' to see heads, 'hg merge' to merge)
628 628 $ hg merge
629 629 merging sub/large4
630 630 largefile sub/large4 has a merge conflict
631 631 keep (l)ocal or take (o)ther? l
632 632 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
633 633 (branch merge, don't forget to commit)
634 634 getting changed largefiles
635 635 1 largefiles updated, 0 removed
636 636 $ hg commit -m "Merge repos e and f"
637 637 $ cat normal3
638 638 normal3-modified
639 639 $ cat sub/normal4
640 640 normal4-modified
641 641 $ cat sub/large4
642 642 large4-merge-test
643 643 $ cat sub2/large6
644 644 large6-modified
645 645 $ cat sub2/large7
646 646 large7
647 647
648 648 Test that a normal file and a largefile with the same name and path cannot
649 649 coexist.
650 650
651 651 $ rm sub2/large7
652 652 $ echo "largeasnormal" > sub2/large7
653 653 $ hg add sub2/large7
654 654 sub2/large7 already a largefile
655 655
656 656 Test that transplanting a largefile change works correctly.
657 657
658 658 $ cd ..
659 659 $ hg clone -r 8 d g
660 660 adding changesets
661 661 adding manifests
662 662 adding file changes
663 663 added 9 changesets with 26 changes to 10 files
664 664 updating to branch default
665 665 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
666 666 getting changed largefiles
667 667 3 largefiles updated, 0 removed
668 668 $ cd g
669 669 $ hg transplant -s ../d 598410d3eb9a
670 670 searching for changes
671 671 searching for changes
672 672 adding changesets
673 673 adding manifests
674 674 adding file changes
675 675 added 1 changesets with 2 changes to 2 files
676 676 getting changed largefiles
677 677 1 largefiles updated, 0 removed
678 678 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
679 679 9:598410d3eb9a modify normal file largefile in repo d
680 680 8:a381d2c8c80e modify normal file and largefile in repo b
681 681 7:daea875e9014 add/edit more largefiles
682 682 6:4355d653f84f edit files yet again
683 683 5:9d5af5072dbd edit files again
684 684 4:74c02385b94c move files
685 685 3:9e8fbc4bce62 copy files
686 686 2:51a0ae4d5864 remove files
687 687 1:ce8896473775 edit files
688 688 0:30d30fe6a5be add files
689 689 $ cat normal3
690 690 normal3-modified
691 691 $ cat sub/normal4
692 692 normal4-modified
693 693 $ cat sub/large4
694 694 large4-modified
695 695 $ cat sub2/large6
696 696 large6-modified
697 697 $ cat sub2/large7
698 698 large7
699 699 $ cd ..
700 700
701 701 vanilla clients not locked out from largefiles servers on vanilla repos
702 702 $ mkdir r1
703 703 $ cd r1
704 704 $ hg init
705 705 $ echo c1 > f1
706 706 $ hg add f1
707 707 $ hg com -m "m1"
708 708 $ cd ..
709 709 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
710 710 $ cat hg.pid >> $DAEMON_PIDS
711 711 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
712 712 requesting all changes
713 713 adding changesets
714 714 adding manifests
715 715 adding file changes
716 716 added 1 changesets with 1 changes to 1 files
717 717 updating to branch default
718 718 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
719 719
720 720 largefiles clients still work with vanilla servers
721 721 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
722 722 $ cat hg.pid >> $DAEMON_PIDS
723 723 $ hg clone http://localhost:$HGPORT1 r3
724 724 requesting all changes
725 725 adding changesets
726 726 adding manifests
727 727 adding file changes
728 728 added 1 changesets with 1 changes to 1 files
729 729 updating to branch default
730 730 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
731 731
732 732 vanilla clients locked out from largefiles http repos
733 733 $ mkdir r4
734 734 $ cd r4
735 735 $ hg init
736 736 $ echo c1 > f1
737 737 $ hg add --large f1
738 738 $ hg com -m "m1"
739 739 $ cd ..
740 740 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
741 741 $ cat hg.pid >> $DAEMON_PIDS
742 742 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
743 743 abort: remote error:
744 744
745 745 This repository uses the largefiles extension.
746 746
747 747 Please enable it in your Mercurial config file.
748 748 [255]
749 749
750 750 used all HGPORTs, kill all daemons
751 751 $ "$TESTDIR/killdaemons.py"
752 752
753 753 vanilla clients locked out from largefiles ssh repos
754 754 $ hg --config extensions.largefiles=! clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/r4 r5
755 755 abort: remote error:
756 756
757 757 This repository uses the largefiles extension.
758 758
759 759 Please enable it in your Mercurial config file.
760 760 [255]
761 761
762 762 largefiles clients refuse to push largefiles repos to vanilla servers
763 763 $ mkdir r6
764 764 $ cd r6
765 765 $ hg init
766 766 $ echo c1 > f1
767 767 $ hg add f1
768 768 $ hg com -m "m1"
769 769 $ cat >> .hg/hgrc <<!
770 770 > [web]
771 771 > push_ssl = false
772 772 > allow_push = *
773 773 > !
774 774 $ cd ..
775 775 $ hg clone r6 r7
776 776 updating to branch default
777 777 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
778 778 $ cd r7
779 779 $ echo c2 > f2
780 780 $ hg add --large f2
781 781 $ hg com -m "m2"
782 782 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
783 783 $ cat ../hg.pid >> $DAEMON_PIDS
784 784 $ hg push http://localhost:$HGPORT
785 785 pushing to http://localhost:$HGPORT/
786 786 searching for changes
787 787 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
788 788 [255]
789 789 $ cd ..
790 790
791 791 $ cd ..
792 792
793 793 Clone a local repository owned by another user
794 794 We have to simulate that here by setting $HOME and removing write permissions
795 795 $ ORIGHOME="$HOME"
796 796 $ mkdir alice
797 797 $ HOME="`pwd`/alice"
798 798 $ cd alice
799 799 $ hg init pubrepo
800 800 $ cd pubrepo
801 801 $ dd if=/dev/urandom bs=1k count=11k > a-large-file 2> /dev/null
802 802 $ hg add --large a-large-file
803 803 $ hg commit -m "Add a large file"
804 804 $ cd ..
805 805 $ chmod -R a-w pubrepo
806 806 $ cd ..
807 807 $ mkdir bob
808 808 $ HOME="`pwd`/bob"
809 809 $ cd bob
810 810 $ hg clone --pull ../alice/pubrepo pubrepo
811 811 requesting all changes
812 812 adding changesets
813 813 adding manifests
814 814 adding file changes
815 815 added 1 changesets with 1 changes to 1 files
816 816 updating to branch default
817 817 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
818 818 getting changed largefiles
819 819 1 largefiles updated, 0 removed
820 820 $ cd ..
821 821 $ HOME="$ORIGHOME"
822 822
823 823 Symlink to a large largefile should behave the same as a symlink to a normal file
824 824 $ hg init largesymlink
825 825 $ cd largesymlink
826 826 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
827 827 $ hg add --large largefile
828 828 $ hg commit -m "commit a large file"
829 829 $ ln -s largefile largelink
830 830 $ hg add largelink
831 831 $ hg commit -m "commit a large symlink"
832 832 $ rm -f largelink
833 833 $ hg up >/dev/null
834 834 $ test -f largelink
835 835 [1]
836 836 $ test -L largelink
837 837 [1]
838 838 $ rm -f largelink # make next part of the test independent of the previous
839 839 $ hg up -C >/dev/null
840 840 $ test -f largelink
841 841 $ test -L largelink
842 842 $ cd ..
843 843
844 844
@@ -1,232 +1,232 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > largefiles =
4 4 > share =
5 5 > graphlog =
6 6 > [largefiles]
7 7 > minsize = 0.5
8 8 > patterns = **.dat
9 9 > EOF
10 10
11 11 "lfconvert" works
12 12 $ hg init bigfile-repo
13 13 $ cd bigfile-repo
14 14 $ cat >> .hg/hgrc <<EOF
15 15 > [extensions]
16 16 > largefiles = !
17 17 > EOF
18 18 $ mkdir sub
19 19 $ dd if=/dev/zero bs=1k count=256 > large 2> /dev/null
20 20 $ echo normal > normal1
21 21 $ echo alsonormal > sub/normal2
22 22 $ dd if=/dev/zero bs=1k count=10 > sub/maybelarge.dat 2> /dev/null
23 23 $ hg addremove
24 24 adding large
25 25 adding normal1
26 26 adding sub/maybelarge.dat
27 27 adding sub/normal2
28 28 $ hg commit -m"add large, normal1" large normal1
29 29 $ hg commit -m"add sub/*" sub
30 30 $ [ -d .hg/largefiles ] && echo fail || echo pass
31 31 pass
32 32 $ cd ..
33 33 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
34 34 initializing destination largefiles-repo
35 35
36 36 "lfconvert" converts content correctly
37 37 $ cd largefiles-repo
38 38 $ hg up
39 39 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 40 getting changed largefiles
41 41 2 largefiles updated, 0 removed
42 42 $ hg locate
43 43 .hglf/large
44 44 .hglf/sub/maybelarge.dat
45 45 normal1
46 46 sub/normal2
47 47 $ cat normal1
48 48 normal
49 49 $ cat sub/normal2
50 50 alsonormal
51 51 $ "$TESTDIR/md5sum.py" large sub/maybelarge.dat
52 52 ec87a838931d4d5d2e94a04644788a55 large
53 53 1276481102f218c981e0324180bafd9f sub/maybelarge.dat
54 54
55 55 "lfconvert" adds 'largefiles' to .hg/requires.
56 56 $ cat .hg/requires
57 57 largefiles
58 58 revlogv1
59 59 fncache
60 60 store
61 61 dotencode
62 62
63 63 "lfconvert" includes a newline at the end of the standin files.
64 64 $ cat .hglf/large .hglf/sub/maybelarge.dat
65 65 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
66 66 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
67 67 $ cd ..
68 68
69 69 add some changesets to rename/remove/merge
70 70 $ cd bigfile-repo
71 71 $ hg mv -q sub stuff
72 72 $ hg commit -m"rename sub/ to stuff/"
73 73 $ hg update -q 1
74 74 $ echo blah >> normal3
75 75 $ echo blah >> sub/normal2
76 76 $ echo blah >> sub/maybelarge.dat
77 77 $ "$TESTDIR/md5sum.py" sub/maybelarge.dat
78 78 1dd0b99ff80e19cff409702a1d3f5e15 sub/maybelarge.dat
79 79 $ hg commit -A -m"add normal3, modify sub/*"
80 80 adding normal3
81 81 created new head
82 82 $ hg rm large normal3
83 83 $ hg commit -q -m"remove large, normal3"
84 84 $ hg merge
85 85 merging sub/maybelarge.dat and stuff/maybelarge.dat to stuff/maybelarge.dat
86 warning: $TESTTMP/bigfile-repo/stuff/maybelarge.dat looks like a binary file.
86 warning: $TESTTMP/bigfile-repo/stuff/maybelarge.dat looks like a binary file. (glob)
87 87 merging stuff/maybelarge.dat failed!
88 88 merging sub/normal2 and stuff/normal2 to stuff/normal2
89 89 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
90 90 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
91 91 [1]
92 92 $ hg cat -r . sub/maybelarge.dat > stuff/maybelarge.dat
93 93 $ hg resolve -m stuff/maybelarge.dat
94 94 $ hg commit -m"merge"
95 95 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
96 96 @ 5:4884f215abda merge
97 97 |\
98 98 | o 4:7285f817b77e remove large, normal3
99 99 | |
100 100 | o 3:67e3892e3534 add normal3, modify sub/*
101 101 | |
102 102 o | 2:c96c8beb5d56 rename sub/ to stuff/
103 103 |/
104 104 o 1:020c65d24e11 add sub/*
105 105 |
106 106 o 0:117b8328f97a add large, normal1
107 107
108 108 $ cd ..
109 109
110 110 lfconvert with rename, merge, and remove
111 111 $ rm -rf largefiles-repo
112 112 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
113 113 initializing destination largefiles-repo
114 114 $ cd largefiles-repo
115 115 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
116 116 o 5:8e05f5f2b77e merge
117 117 |\
118 118 | o 4:a5a02de7a8e4 remove large, normal3
119 119 | |
120 120 | o 3:55759520c76f add normal3, modify sub/*
121 121 | |
122 122 o | 2:261ad3f3f037 rename sub/ to stuff/
123 123 |/
124 124 o 1:334e5237836d add sub/*
125 125 |
126 126 o 0:d4892ec57ce2 add large, normal1
127 127
128 128 $ hg locate -r 2
129 129 .hglf/large
130 130 .hglf/stuff/maybelarge.dat
131 131 normal1
132 132 stuff/normal2
133 133 $ hg locate -r 3
134 134 .hglf/large
135 135 .hglf/sub/maybelarge.dat
136 136 normal1
137 137 normal3
138 138 sub/normal2
139 139 $ hg locate -r 4
140 140 .hglf/sub/maybelarge.dat
141 141 normal1
142 142 sub/normal2
143 143 $ hg locate -r 5
144 144 .hglf/stuff/maybelarge.dat
145 145 normal1
146 146 stuff/normal2
147 147 $ hg update
148 148 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 149 getting changed largefiles
150 150 1 largefiles updated, 0 removed
151 151 $ cat stuff/normal2
152 152 alsonormal
153 153 blah
154 154 $ "$TESTDIR/md5sum.py" stuff/maybelarge.dat
155 155 1dd0b99ff80e19cff409702a1d3f5e15 stuff/maybelarge.dat
156 156 $ cat .hglf/stuff/maybelarge.dat
157 157 76236b6a2c6102826c61af4297dd738fb3b1de38
158 158 $ cd ..
159 159
160 160 "lfconvert" error cases
161 161 $ hg lfconvert http://localhost/foo foo
162 162 abort: http://localhost/foo is not a local Mercurial repo
163 163 [255]
164 164 $ hg lfconvert foo ssh://localhost/foo
165 165 abort: ssh://localhost/foo is not a local Mercurial repo
166 166 [255]
167 167 $ hg lfconvert nosuchrepo foo
168 168 abort: repository nosuchrepo not found!
169 169 [255]
170 170 $ hg share -q -U bigfile-repo shared
171 171 $ printf 'bogus' > shared/.hg/sharedpath
172 172 $ hg lfconvert shared foo
173 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus!
173 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus! (glob)
174 174 [255]
175 175 $ hg lfconvert bigfile-repo largefiles-repo
176 176 initializing destination largefiles-repo
177 177 abort: repository largefiles-repo already exists!
178 178 [255]
179 179
180 180 add another largefile to the new largefiles repo
181 181 $ cd largefiles-repo
182 182 $ dd if=/dev/zero bs=1k count=1k > anotherlarge 2> /dev/null
183 183 $ hg add --lfsize=1 anotherlarge
184 184 $ hg commit -m "add anotherlarge (should be a largefile)"
185 185 $ cat .hglf/anotherlarge
186 186 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
187 187 $ cd ..
188 188
189 189 round-trip: converting back to a normal (non-largefiles) repo with
190 190 "lfconvert --to-normal" should give the same as ../bigfile-repo
191 191 $ cd largefiles-repo
192 192 $ hg lfconvert --to-normal . ../normal-repo
193 193 initializing destination ../normal-repo
194 194 $ cd ../normal-repo
195 195 $ cat >> .hg/hgrc <<EOF
196 196 > [extensions]
197 197 > largefiles = !
198 198 > EOF
199 199
200 200 # Hmmm: the changeset ID for rev 5 is different from the original
201 201 # normal repo (../bigfile-repo), because the changelog filelist
202 202 # differs between the two incarnations of rev 5: this repo includes
203 203 # 'large' in the list, but ../bigfile-repo does not. Since rev 5
204 204 # removes 'large' relative to the first parent in both repos, it seems
205 205 # to me that lfconvert is doing a *better* job than
206 206 # "hg remove" + "hg merge" + "hg commit".
207 207 # $ hg -R ../bigfile-repo debugdata -c 5
208 208 # $ hg debugdata -c 5
209 209 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
210 210 o 6:1635824e6f59 add anotherlarge (should be a largefile)
211 211 |
212 212 o 5:7215f8deeaaf merge
213 213 |\
214 214 | o 4:7285f817b77e remove large, normal3
215 215 | |
216 216 | o 3:67e3892e3534 add normal3, modify sub/*
217 217 | |
218 218 o | 2:c96c8beb5d56 rename sub/ to stuff/
219 219 |/
220 220 o 1:020c65d24e11 add sub/*
221 221 |
222 222 o 0:117b8328f97a add large, normal1
223 223
224 224 $ hg update
225 225 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
226 226 $ hg locate
227 227 anotherlarge
228 228 normal1
229 229 stuff/maybelarge.dat
230 230 stuff/normal2
231 231 $ [ -d .hg/largefiles ] && echo fail || echo pass
232 232 pass
@@ -1,120 +1,120 b''
1 1 $ hg init t
2 2 $ cd t
3 3 $ echo 0 > a
4 4 $ echo 0 > b
5 5 $ echo 0 > t.h
6 6 $ mkdir t
7 7 $ echo 0 > t/x
8 8 $ echo 0 > t/b
9 9 $ echo 0 > t/e.h
10 10 $ mkdir dir.h
11 11 $ echo 0 > dir.h/foo
12 12
13 13 $ hg ci -A -m m
14 14 adding a
15 15 adding b
16 16 adding dir.h/foo
17 17 adding t.h
18 18 adding t/b
19 19 adding t/e.h
20 20 adding t/x
21 21
22 22 $ touch nottracked
23 23
24 24 $ hg locate a
25 25 a
26 26
27 27 $ hg locate NONEXISTENT
28 28 [1]
29 29
30 30 $ hg locate
31 31 a
32 32 b
33 33 dir.h/foo
34 34 t.h
35 35 t/b
36 36 t/e.h
37 37 t/x
38 38
39 39 $ hg rm a
40 40 $ hg ci -m m
41 41
42 42 $ hg locate a
43 43 [1]
44 44 $ hg locate NONEXISTENT
45 45 [1]
46 46 $ hg locate relpath:NONEXISTENT
47 47 [1]
48 48 $ hg locate
49 49 b
50 50 dir.h/foo
51 51 t.h
52 52 t/b
53 53 t/e.h
54 54 t/x
55 55 $ hg locate -r 0 a
56 56 a
57 57 $ hg locate -r 0 NONEXISTENT
58 58 [1]
59 59 $ hg locate -r 0 relpath:NONEXISTENT
60 60 [1]
61 61 $ hg locate -r 0
62 62 a
63 63 b
64 64 dir.h/foo
65 65 t.h
66 66 t/b
67 67 t/e.h
68 68 t/x
69 69
70 70 -I/-X with relative path should work:
71 71
72 72 $ cd t
73 73 $ hg locate
74 74 b
75 75 dir.h/foo
76 76 t.h
77 77 t/b
78 78 t/e.h
79 79 t/x
80 80 $ hg locate -I ../t
81 81 t/b
82 82 t/e.h
83 83 t/x
84 84
85 85 Issue294: hg remove --after dir fails when dir.* also exists
86 86
87 87 $ cd ..
88 88 $ rm -r t
89 89
90 90 $ hg locate 't/**'
91 t/b
92 t/e.h
93 t/x
91 t/b (glob)
92 t/e.h (glob)
93 t/x (glob)
94 94
95 95 $ mkdir otherdir
96 96 $ cd otherdir
97 97
98 98 $ hg locate b
99 ../b
100 ../t/b
99 ../b (glob)
100 ../t/b (glob)
101 101 $ hg locate '*.h'
102 ../t.h
103 ../t/e.h
102 ../t.h (glob)
103 ../t/e.h (glob)
104 104 $ hg locate path:t/x
105 ../t/x
105 ../t/x (glob)
106 106 $ hg locate 're:.*\.h$'
107 ../t.h
108 ../t/e.h
107 ../t.h (glob)
108 ../t/e.h (glob)
109 109 $ hg locate -r 0 b
110 ../b
111 ../t/b
110 ../b (glob)
111 ../t/b (glob)
112 112 $ hg locate -r 0 '*.h'
113 ../t.h
114 ../t/e.h
113 ../t.h (glob)
114 ../t/e.h (glob)
115 115 $ hg locate -r 0 path:t/x
116 ../t/x
116 ../t/x (glob)
117 117 $ hg locate -r 0 're:.*\.h$'
118 ../t.h
119 ../t/e.h
118 ../t.h (glob)
119 ../t/e.h (glob)
120 120
@@ -1,177 +1,177 b''
1 1 Setup extension:
2 2
3 3 $ echo "[extensions]" >> $HGRCPATH
4 4 $ echo "mq =" >> $HGRCPATH
5 5 $ echo "[mq]" >> $HGRCPATH
6 6 $ echo "git = keep" >> $HGRCPATH
7 7
8 8 Test merge with mq changeset as the second parent:
9 9
10 10 $ hg init m
11 11 $ cd m
12 12 $ touch a b c
13 13 $ hg add a
14 14 $ hg commit -m a
15 15 $ hg add b
16 16 $ hg qnew -d "0 0" b
17 17 $ hg update 0
18 18 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
19 19 $ hg add c
20 20 $ hg commit -m c
21 21 created new head
22 22 $ hg merge
23 23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 24 (branch merge, don't forget to commit)
25 25 $ hg commit -m merge
26 26 abort: cannot commit over an applied mq patch
27 27 [255]
28 28 $ cd ..
29 29
30 30 Issue529: mq aborts when merging patch deleting files
31 31
32 32 $ checkundo()
33 33 > {
34 34 > if [ -f .hg/store/undo ]; then
35 35 > echo ".hg/store/undo still exists"
36 36 > fi
37 37 > }
38 38
39 39 Commit two dummy files in "init" changeset:
40 40
41 41 $ hg init t
42 42 $ cd t
43 43 $ echo a > a
44 44 $ echo b > b
45 45 $ hg ci -Am init
46 46 adding a
47 47 adding b
48 48 $ hg tag -l init
49 49
50 50 Create a patch removing a:
51 51
52 52 $ hg qnew rm_a
53 53 $ hg rm a
54 54 $ hg qrefresh -m "rm a"
55 55
56 56 Save the patch queue so we can merge it later:
57 57
58 58 $ hg qsave -c -e
59 copy $TESTTMP/t/.hg/patches to $TESTTMP/t/.hg/patches.1
59 copy $TESTTMP/t/.hg/patches to $TESTTMP/t/.hg/patches.1 (glob)
60 60 $ checkundo
61 61
62 62 Update b and commit in an "update" changeset:
63 63
64 64 $ hg up -C init
65 65 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 66 $ echo b >> b
67 67 $ hg st
68 68 M b
69 69 $ hg ci -m update
70 70 created new head
71 71
72 72 # Here, qpush used to abort with :
73 73 # The system cannot find the file specified => a
74 74 $ hg manifest
75 75 a
76 76 b
77 77
78 78 $ hg qpush -a -m
79 merging with queue at: $TESTTMP/t/.hg/patches.1
79 merging with queue at: $TESTTMP/t/.hg/patches.1 (glob)
80 80 applying rm_a
81 81 now at: rm_a
82 82
83 83 $ checkundo
84 84 $ hg manifest
85 85 b
86 86
87 87 Ensure status is correct after merge:
88 88
89 89 $ hg qpop -a
90 90 popping rm_a
91 91 popping .hg.patches.merge.marker
92 92 patch queue now empty
93 93
94 94 $ cd ..
95 95
96 96 Classic MQ merge sequence *with an explicit named queue*:
97 97
98 98 $ hg init t2
99 99 $ cd t2
100 100 $ echo '[diff]' > .hg/hgrc
101 101 $ echo 'nodates = 1' >> .hg/hgrc
102 102 $ echo a > a
103 103 $ hg ci -Am init
104 104 adding a
105 105 $ echo b > a
106 106 $ hg ci -m changea
107 107 $ hg up -C 0
108 108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 109 $ hg cp a aa
110 110 $ echo c >> a
111 111 $ hg qnew --git -f -e patcha
112 112 $ echo d >> a
113 113 $ hg qnew -d '0 0' -f -e patcha2
114 114
115 115 Create the reference queue:
116 116
117 117 $ hg qsave -c -e -n refqueue
118 copy $TESTTMP/t2/.hg/patches to $TESTTMP/t2/.hg/refqueue
118 copy $TESTTMP/t2/.hg/patches to $TESTTMP/t2/.hg/refqueue (glob)
119 119 $ hg up -C 1
120 120 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
121 121
122 122 Merge:
123 123
124 124 $ HGMERGE=internal:other hg qpush -a -m -n refqueue
125 merging with queue at: $TESTTMP/t2/.hg/refqueue
125 merging with queue at: $TESTTMP/t2/.hg/refqueue (glob)
126 126 applying patcha
127 127 patching file a
128 128 Hunk #1 FAILED at 0
129 129 1 out of 1 hunks FAILED -- saving rejects to file a.rej
130 130 patch failed, unable to continue (try -v)
131 131 patch failed, rejects left in working dir
132 132 patch didn't work out, merging patcha
133 133 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
134 134 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
135 135 (branch merge, don't forget to commit)
136 136 applying patcha2
137 137 now at: patcha2
138 138
139 139 Check patcha is still a git patch:
140 140
141 141 $ cat .hg/patches/patcha
142 142 # HG changeset patch
143 143 # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
144 144
145 145 diff --git a/a b/a
146 146 --- a/a
147 147 +++ b/a
148 148 @@ -1,1 +1,2 @@
149 149 -b
150 150 +a
151 151 +c
152 152 diff --git a/a b/aa
153 153 copy from a
154 154 copy to aa
155 155 --- a/a
156 156 +++ b/aa
157 157 @@ -1,1 +1,1 @@
158 158 -b
159 159 +a
160 160
161 161 Check patcha2 is still a regular patch:
162 162
163 163 $ cat .hg/patches/patcha2
164 164 # HG changeset patch
165 165 # Parent ???????????????????????????????????????? (glob)
166 166 # Date 0 0
167 167
168 168 diff -r ???????????? -r ???????????? a (glob)
169 169 --- a/a
170 170 +++ b/a
171 171 @@ -1,2 +1,3 @@
172 172 a
173 173 c
174 174 +d
175 175
176 176 $ cd ..
177 177
@@ -1,175 +1,175 b''
1 1 $ echo '[extensions]' >> $HGRCPATH
2 2 $ echo 'mq =' >> $HGRCPATH
3 3
4 4 $ hg init repo
5 5 $ cd repo
6 6
7 7 $ echo foo > foo
8 8 $ hg ci -qAm 'add a file'
9 9
10 10 $ hg qinit
11 11
12 12 $ hg qnew foo
13 13 $ echo foo >> foo
14 14 $ hg qrefresh -m 'append foo'
15 15
16 16 $ hg qnew bar
17 17 $ echo bar >> foo
18 18 $ hg qrefresh -m 'append bar'
19 19
20 20
21 21 try to commit on top of a patch
22 22
23 23 $ echo quux >> foo
24 24 $ hg ci -m 'append quux'
25 25 abort: cannot commit over an applied mq patch
26 26 [255]
27 27
28 28
29 29 cheat a bit...
30 30
31 31 $ mv .hg/patches .hg/patches2
32 32 $ hg ci -m 'append quux'
33 33 $ mv .hg/patches2 .hg/patches
34 34
35 35
36 36 qpop/qrefresh on the wrong revision
37 37
38 38 $ hg qpop
39 39 abort: popping would remove a revision not managed by this patch queue
40 40 [255]
41 41 $ hg qpop -n patches
42 using patch queue: $TESTTMP/repo/.hg/patches
42 using patch queue: $TESTTMP/repo/.hg/patches (glob)
43 43 abort: popping would remove a revision not managed by this patch queue
44 44 [255]
45 45 $ hg qrefresh
46 46 abort: working directory revision is not qtip
47 47 [255]
48 48
49 49 $ hg up -C qtip
50 50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 51 $ hg qpop
52 52 abort: popping would remove a revision not managed by this patch queue
53 53 [255]
54 54 $ hg qrefresh
55 55 abort: cannot refresh a revision with children
56 56 [255]
57 57 $ hg tip --template '{rev} {desc}\n'
58 58 3 append quux
59 59
60 60
61 61 qpush warning branchheads
62 62
63 63 $ cd ..
64 64 $ hg init branchy
65 65 $ cd branchy
66 66 $ echo q > q
67 67 $ hg add q
68 68 $ hg qnew -f qp
69 69 $ hg qpop
70 70 popping qp
71 71 patch queue now empty
72 72 $ echo a > a
73 73 $ hg ci -Ama
74 74 adding a
75 75 $ hg up null
76 76 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
77 77 $ hg branch b
78 78 marked working directory as branch b
79 79 $ echo c > c
80 80 $ hg ci -Amc
81 81 adding c
82 82 $ hg merge default
83 83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 84 (branch merge, don't forget to commit)
85 85 $ hg ci -mmerge
86 86 $ hg up default
87 87 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
88 88 $ hg log
89 89 changeset: 2:65309210bf4e
90 90 branch: b
91 91 tag: tip
92 92 parent: 1:707adb4c8ae1
93 93 parent: 0:cb9a9f314b8b
94 94 user: test
95 95 date: Thu Jan 01 00:00:00 1970 +0000
96 96 summary: merge
97 97
98 98 changeset: 1:707adb4c8ae1
99 99 branch: b
100 100 parent: -1:000000000000
101 101 user: test
102 102 date: Thu Jan 01 00:00:00 1970 +0000
103 103 summary: c
104 104
105 105 changeset: 0:cb9a9f314b8b
106 106 user: test
107 107 date: Thu Jan 01 00:00:00 1970 +0000
108 108 summary: a
109 109
110 110 $ hg qpush
111 111 applying qp
112 112 now at: qp
113 113
114 114 Testing applied patches, push and --force
115 115
116 116 $ cd ..
117 117 $ hg init forcepush
118 118 $ cd forcepush
119 119 $ echo a > a
120 120 $ hg ci -Am adda
121 121 adding a
122 122 $ echo a >> a
123 123 $ hg ci -m changea
124 124 $ hg up 0
125 125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 126 $ hg branch branch
127 127 marked working directory as branch branch
128 128 $ echo b > b
129 129 $ hg ci -Am addb
130 130 adding b
131 131 $ hg up 0
132 132 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
133 133 $ hg --cwd .. clone -r 0 forcepush forcepush2
134 134 adding changesets
135 135 adding manifests
136 136 adding file changes
137 137 added 1 changesets with 1 changes to 1 files
138 138 updating to branch default
139 139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 140 $ echo a >> a
141 141 $ hg qnew patch
142 142
143 143 Pushing applied patch with --rev without --force
144 144
145 145 $ hg push -r default ../forcepush2
146 146 pushing to ../forcepush2
147 147 abort: source has mq patches applied
148 148 [255]
149 149
150 150 Pushing applied patch with branchhash, without --force
151 151
152 152 $ hg push ../forcepush2#default
153 153 pushing to ../forcepush2
154 154 abort: source has mq patches applied
155 155 [255]
156 156
157 157 Pushing revs excluding applied patch
158 158
159 159 $ hg push --new-branch -r branch -r 2 ../forcepush2
160 160 pushing to ../forcepush2
161 161 searching for changes
162 162 adding changesets
163 163 adding manifests
164 164 adding file changes
165 165 added 1 changesets with 1 changes to 1 files
166 166
167 167 Pushing applied patch with --force
168 168
169 169 $ hg push --force -r default ../forcepush2
170 170 pushing to ../forcepush2
171 171 searching for changes
172 172 adding changesets
173 173 adding manifests
174 174 adding file changes
175 175 added 1 changesets with 1 changes to 1 files (+1 heads)
@@ -1,1396 +1,1396 b''
1 1 $ "$TESTDIR/hghave" execbit || exit 80
2 2
3 3 $ checkundo()
4 4 > {
5 5 > if [ -f .hg/store/undo ]; then
6 6 > echo ".hg/store/undo still exists after $1"
7 7 > fi
8 8 > }
9 9
10 10 $ echo "[extensions]" >> $HGRCPATH
11 11 $ echo "mq=" >> $HGRCPATH
12 12
13 13 $ echo "[mq]" >> $HGRCPATH
14 14 $ echo "plain=true" >> $HGRCPATH
15 15
16 16
17 17 help
18 18
19 19 $ hg help mq
20 20 mq extension - manage a stack of patches
21 21
22 22 This extension lets you work with a stack of patches in a Mercurial
23 23 repository. It manages two stacks of patches - all known patches, and applied
24 24 patches (subset of known patches).
25 25
26 26 Known patches are represented as patch files in the .hg/patches directory.
27 27 Applied patches are both patch files and changesets.
28 28
29 29 Common tasks (use "hg help command" for more details):
30 30
31 31 create new patch qnew
32 32 import existing patch qimport
33 33
34 34 print patch series qseries
35 35 print applied patches qapplied
36 36
37 37 add known patch to applied stack qpush
38 38 remove patch from applied stack qpop
39 39 refresh contents of top applied patch qrefresh
40 40
41 41 By default, mq will automatically use git patches when required to avoid
42 42 losing file mode changes, copy records, binary files or empty files creations
43 43 or deletions. This behaviour can be configured with:
44 44
45 45 [mq]
46 46 git = auto/keep/yes/no
47 47
48 48 If set to 'keep', mq will obey the [diff] section configuration while
49 49 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
50 50 will override the [diff] section and always generate git or regular patches,
51 51 possibly losing data in the second case.
52 52
53 53 You will by default be managing a patch queue named "patches". You can create
54 54 other, independent patch queues with the "hg qqueue" command.
55 55
56 56 list of commands:
57 57
58 58 qapplied print the patches already applied
59 59 qclone clone main and patch repository at same time
60 60 qdelete remove patches from queue
61 61 qdiff diff of the current patch and subsequent modifications
62 62 qfinish move applied patches into repository history
63 63 qfold fold the named patches into the current patch
64 64 qgoto push or pop patches until named patch is at top of stack
65 65 qguard set or print guards for a patch
66 66 qheader print the header of the topmost or specified patch
67 67 qimport import a patch
68 68 qnew create a new patch
69 69 qnext print the name of the next patch
70 70 qpop pop the current patch off the stack
71 71 qprev print the name of the previous patch
72 72 qpush push the next patch onto the stack
73 73 qqueue manage multiple patch queues
74 74 qrefresh update the current patch
75 75 qrename rename a patch
76 76 qselect set or print guarded patches to push
77 77 qseries print the entire series file
78 78 qtop print the name of the current patch
79 79 qunapplied print the patches not yet applied
80 80 strip strip changesets and all their descendants from the repository
81 81
82 82 use "hg -v help mq" to show builtin aliases and global options
83 83
84 84 $ hg init a
85 85 $ cd a
86 86 $ echo a > a
87 87 $ hg ci -Ama
88 88 adding a
89 89
90 90 $ hg clone . ../k
91 91 updating to branch default
92 92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 93
94 94 $ mkdir b
95 95 $ echo z > b/z
96 96 $ hg ci -Ama
97 97 adding b/z
98 98
99 99
100 100 qinit
101 101
102 102 $ hg qinit
103 103
104 104 $ cd ..
105 105 $ hg init b
106 106
107 107
108 108 -R qinit
109 109
110 110 $ hg -R b qinit
111 111
112 112 $ hg init c
113 113
114 114
115 115 qinit -c
116 116
117 117 $ hg --cwd c qinit -c
118 118 $ hg -R c/.hg/patches st
119 119 A .hgignore
120 120 A series
121 121
122 122
123 123 qinit; qinit -c
124 124
125 125 $ hg init d
126 126 $ cd d
127 127 $ hg qinit
128 128 $ hg qinit -c
129 129
130 130 qinit -c should create both files if they don't exist
131 131
132 132 $ cat .hg/patches/.hgignore
133 133 ^\.hg
134 134 ^\.mq
135 135 syntax: glob
136 136 status
137 137 guards
138 138 $ cat .hg/patches/series
139 139 $ hg qinit -c
140 abort: repository $TESTTMP/d/.hg/patches already exists!
140 abort: repository $TESTTMP/d/.hg/patches already exists! (glob)
141 141 [255]
142 142 $ cd ..
143 143
144 144 $ echo '% qinit; <stuff>; qinit -c'
145 145 % qinit; <stuff>; qinit -c
146 146 $ hg init e
147 147 $ cd e
148 148 $ hg qnew A
149 149 $ checkundo qnew
150 150 $ echo foo > foo
151 151 $ hg add foo
152 152 $ hg qrefresh
153 153 $ hg qnew B
154 154 $ echo >> foo
155 155 $ hg qrefresh
156 156 $ echo status >> .hg/patches/.hgignore
157 157 $ echo bleh >> .hg/patches/.hgignore
158 158 $ hg qinit -c
159 adding .hg/patches/A
160 adding .hg/patches/B
159 adding .hg/patches/A (glob)
160 adding .hg/patches/B (glob)
161 161 $ hg -R .hg/patches status
162 162 A .hgignore
163 163 A A
164 164 A B
165 165 A series
166 166
167 167 qinit -c shouldn't touch these files if they already exist
168 168
169 169 $ cat .hg/patches/.hgignore
170 170 status
171 171 bleh
172 172 $ cat .hg/patches/series
173 173 A
174 174 B
175 175
176 176 add an untracked file
177 177
178 178 $ echo >> .hg/patches/flaf
179 179
180 180 status --mq with color (issue2096)
181 181
182 182 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
183 183 \x1b[0;32;1mA .hgignore\x1b[0m (esc)
184 184 \x1b[0;32;1mA A\x1b[0m (esc)
185 185 \x1b[0;32;1mA B\x1b[0m (esc)
186 186 \x1b[0;32;1mA series\x1b[0m (esc)
187 187 \x1b[0;35;1;4m? flaf\x1b[0m (esc)
188 188
189 189 try the --mq option on a command provided by an extension
190 190
191 191 $ hg purge --mq --verbose --config extensions.purge=
192 192 Removing file flaf
193 193
194 194 $ cd ..
195 195
196 196 init --mq without repo
197 197
198 198 $ mkdir f
199 199 $ cd f
200 200 $ hg init --mq
201 201 abort: there is no Mercurial repository here (.hg not found)
202 202 [255]
203 203 $ cd ..
204 204
205 205 init --mq with repo path
206 206
207 207 $ hg init g
208 208 $ hg init --mq g
209 209 $ test -d g/.hg/patches/.hg
210 210
211 211 init --mq with nonexistent directory
212 212
213 213 $ hg init --mq nonexistentdir
214 214 abort: repository nonexistentdir not found!
215 215 [255]
216 216
217 217
218 218 init --mq with bundle (non "local")
219 219
220 220 $ hg -R a bundle --all a.bundle >/dev/null
221 221 $ hg init --mq a.bundle
222 222 abort: only a local queue repository may be initialized
223 223 [255]
224 224
225 225 $ cd a
226 226
227 227 $ hg qnew -m 'foo bar' test.patch
228 228
229 229 $ echo '# comment' > .hg/patches/series.tmp
230 230 $ echo >> .hg/patches/series.tmp # empty line
231 231 $ cat .hg/patches/series >> .hg/patches/series.tmp
232 232 $ mv .hg/patches/series.tmp .hg/patches/series
233 233
234 234
235 235 qrefresh
236 236
237 237 $ echo a >> a
238 238 $ hg qrefresh
239 239 $ cat .hg/patches/test.patch
240 240 foo bar
241 241
242 242 diff -r [a-f0-9]* a (re)
243 243 --- a/a\t(?P<date>.*) (re)
244 244 \+\+\+ b/a\t(?P<date2>.*) (re)
245 245 @@ -1,1 +1,2 @@
246 246 a
247 247 +a
248 248
249 249 empty qrefresh
250 250
251 251 $ hg qrefresh -X a
252 252
253 253 revision:
254 254
255 255 $ hg diff -r -2 -r -1
256 256
257 257 patch:
258 258
259 259 $ cat .hg/patches/test.patch
260 260 foo bar
261 261
262 262
263 263 working dir diff:
264 264
265 265 $ hg diff --nodates -q
266 266 --- a/a
267 267 +++ b/a
268 268 @@ -1,1 +1,2 @@
269 269 a
270 270 +a
271 271
272 272 restore things
273 273
274 274 $ hg qrefresh
275 275 $ checkundo qrefresh
276 276
277 277
278 278 qpop
279 279
280 280 $ hg qpop
281 281 popping test.patch
282 282 patch queue now empty
283 283 $ checkundo qpop
284 284
285 285
286 286 qpush with dump of tag cache
287 287 Dump the tag cache to ensure that it has exactly one head after qpush.
288 288
289 289 $ rm -f .hg/cache/tags
290 290 $ hg tags > /dev/null
291 291
292 292 .hg/cache/tags (pre qpush):
293 293
294 294 $ cat .hg/cache/tags
295 295 1 [\da-f]{40} (re)
296 296
297 297 $ hg qpush
298 298 applying test.patch
299 299 now at: test.patch
300 300 $ hg tags > /dev/null
301 301
302 302 .hg/cache/tags (post qpush):
303 303
304 304 $ cat .hg/cache/tags
305 305 2 [\da-f]{40} (re)
306 306
307 307 $ checkundo qpush
308 308 $ cd ..
309 309
310 310
311 311 pop/push outside repo
312 312 $ hg -R a qpop
313 313 popping test.patch
314 314 patch queue now empty
315 315 $ hg -R a qpush
316 316 applying test.patch
317 317 now at: test.patch
318 318
319 319 $ cd a
320 320 $ hg qnew test2.patch
321 321
322 322 qrefresh in subdir
323 323
324 324 $ cd b
325 325 $ echo a > a
326 326 $ hg add a
327 327 $ hg qrefresh
328 328
329 329 pop/push -a in subdir
330 330
331 331 $ hg qpop -a
332 332 popping test2.patch
333 333 popping test.patch
334 334 patch queue now empty
335 335 $ hg --traceback qpush -a
336 336 applying test.patch
337 337 applying test2.patch
338 338 now at: test2.patch
339 339
340 340
341 341 setting columns & formatted tests truncating (issue1912)
342 342
343 343 $ COLUMNS=4 hg qseries --config ui.formatted=true
344 344 test.patch
345 345 test2.patch
346 346 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs
347 347 0 A test.patch: f...
348 348 1 A test2.patch:
349 349 $ hg qpop
350 350 popping test2.patch
351 351 now at: test.patch
352 352 $ hg qseries -vs
353 353 0 A test.patch: foo bar
354 354 1 U test2.patch:
355 355 $ hg sum | grep mq
356 356 mq: 1 applied, 1 unapplied
357 357 $ hg qpush
358 358 applying test2.patch
359 359 now at: test2.patch
360 360 $ hg sum | grep mq
361 361 mq: 2 applied
362 362 $ hg qapplied
363 363 test.patch
364 364 test2.patch
365 365 $ hg qtop
366 366 test2.patch
367 367
368 368
369 369 prev
370 370
371 371 $ hg qapp -1
372 372 test.patch
373 373
374 374 next
375 375
376 376 $ hg qunapp -1
377 377 all patches applied
378 378 [1]
379 379
380 380 $ hg qpop
381 381 popping test2.patch
382 382 now at: test.patch
383 383
384 384 commit should fail
385 385
386 386 $ hg commit
387 387 abort: cannot commit over an applied mq patch
388 388 [255]
389 389
390 390 push should fail
391 391
392 392 $ hg push ../../k
393 393 pushing to ../../k
394 394 abort: source has mq patches applied
395 395 [255]
396 396
397 397
398 398 import should fail
399 399
400 400 $ hg st .
401 401 $ echo foo >> ../a
402 402 $ hg diff > ../../import.diff
403 403 $ hg revert --no-backup ../a
404 404 $ hg import ../../import.diff
405 405 abort: cannot import over an applied patch
406 406 [255]
407 407 $ hg st
408 408
409 409 import --no-commit should succeed
410 410
411 411 $ hg import --no-commit ../../import.diff
412 412 applying ../../import.diff
413 413 $ hg st
414 414 M a
415 415 $ hg revert --no-backup ../a
416 416
417 417
418 418 qunapplied
419 419
420 420 $ hg qunapplied
421 421 test2.patch
422 422
423 423
424 424 qpush/qpop with index
425 425
426 426 $ hg qnew test1b.patch
427 427 $ echo 1b > 1b
428 428 $ hg add 1b
429 429 $ hg qrefresh
430 430 $ hg qpush 2
431 431 applying test2.patch
432 432 now at: test2.patch
433 433 $ hg qpop 0
434 434 popping test2.patch
435 435 popping test1b.patch
436 436 now at: test.patch
437 437 $ hg qpush test.patch+1
438 438 applying test1b.patch
439 439 now at: test1b.patch
440 440 $ hg qpush test.patch+2
441 441 applying test2.patch
442 442 now at: test2.patch
443 443 $ hg qpop test2.patch-1
444 444 popping test2.patch
445 445 now at: test1b.patch
446 446 $ hg qpop test2.patch-2
447 447 popping test1b.patch
448 448 now at: test.patch
449 449 $ hg qpush test1b.patch+1
450 450 applying test1b.patch
451 451 applying test2.patch
452 452 now at: test2.patch
453 453
454 454
455 455 qpush --move
456 456
457 457 $ hg qpop -a
458 458 popping test2.patch
459 459 popping test1b.patch
460 460 popping test.patch
461 461 patch queue now empty
462 462 $ hg qguard test1b.patch -- -negguard
463 463 $ hg qguard test2.patch -- +posguard
464 464 $ hg qpush --move test2.patch # can't move guarded patch
465 465 cannot push 'test2.patch' - guarded by '+posguard'
466 466 [1]
467 467 $ hg qselect posguard
468 468 number of unguarded, unapplied patches has changed from 2 to 3
469 469 $ hg qpush --move test2.patch # move to front
470 470 applying test2.patch
471 471 now at: test2.patch
472 472 $ hg qpush --move test1b.patch # negative guard unselected
473 473 applying test1b.patch
474 474 now at: test1b.patch
475 475 $ hg qpush --move test.patch # noop move
476 476 applying test.patch
477 477 now at: test.patch
478 478 $ hg qseries -v
479 479 0 A test2.patch
480 480 1 A test1b.patch
481 481 2 A test.patch
482 482 $ hg qpop -a
483 483 popping test.patch
484 484 popping test1b.patch
485 485 popping test2.patch
486 486 patch queue now empty
487 487
488 488 cleaning up
489 489
490 490 $ hg qselect --none
491 491 guards deactivated
492 492 number of unguarded, unapplied patches has changed from 3 to 2
493 493 $ hg qguard --none test1b.patch
494 494 $ hg qguard --none test2.patch
495 495 $ hg qpush --move test.patch
496 496 applying test.patch
497 497 now at: test.patch
498 498 $ hg qpush --move test1b.patch
499 499 applying test1b.patch
500 500 now at: test1b.patch
501 501 $ hg qpush --move bogus # nonexistent patch
502 502 abort: patch bogus not in series
503 503 [255]
504 504 $ hg qpush --move # no patch
505 505 abort: please specify the patch to move
506 506 [255]
507 507 $ hg qpush --move test.patch # already applied
508 508 abort: cannot push to a previous patch: test.patch
509 509 [255]
510 510 $ hg qpush
511 511 applying test2.patch
512 512 now at: test2.patch
513 513
514 514
515 515 series after move
516 516
517 517 $ cat `hg root`/.hg/patches/series
518 518 test.patch
519 519 test1b.patch
520 520 test2.patch
521 521 # comment
522 522
523 523
524 524
525 525 pop, qapplied, qunapplied
526 526
527 527 $ hg qseries -v
528 528 0 A test.patch
529 529 1 A test1b.patch
530 530 2 A test2.patch
531 531
532 532 qapplied -1 test.patch
533 533
534 534 $ hg qapplied -1 test.patch
535 535 only one patch applied
536 536 [1]
537 537
538 538 qapplied -1 test1b.patch
539 539
540 540 $ hg qapplied -1 test1b.patch
541 541 test.patch
542 542
543 543 qapplied -1 test2.patch
544 544
545 545 $ hg qapplied -1 test2.patch
546 546 test1b.patch
547 547
548 548 qapplied -1
549 549
550 550 $ hg qapplied -1
551 551 test1b.patch
552 552
553 553 qapplied
554 554
555 555 $ hg qapplied
556 556 test.patch
557 557 test1b.patch
558 558 test2.patch
559 559
560 560 qapplied test1b.patch
561 561
562 562 $ hg qapplied test1b.patch
563 563 test.patch
564 564 test1b.patch
565 565
566 566 qunapplied -1
567 567
568 568 $ hg qunapplied -1
569 569 all patches applied
570 570 [1]
571 571
572 572 qunapplied
573 573
574 574 $ hg qunapplied
575 575
576 576 popping
577 577
578 578 $ hg qpop
579 579 popping test2.patch
580 580 now at: test1b.patch
581 581
582 582 qunapplied -1
583 583
584 584 $ hg qunapplied -1
585 585 test2.patch
586 586
587 587 qunapplied
588 588
589 589 $ hg qunapplied
590 590 test2.patch
591 591
592 592 qunapplied test2.patch
593 593
594 594 $ hg qunapplied test2.patch
595 595
596 596 qunapplied -1 test2.patch
597 597
598 598 $ hg qunapplied -1 test2.patch
599 599 all patches applied
600 600 [1]
601 601
602 602 popping -a
603 603
604 604 $ hg qpop -a
605 605 popping test1b.patch
606 606 popping test.patch
607 607 patch queue now empty
608 608
609 609 qapplied
610 610
611 611 $ hg qapplied
612 612
613 613 qapplied -1
614 614
615 615 $ hg qapplied -1
616 616 no patches applied
617 617 [1]
618 618 $ hg qpush
619 619 applying test.patch
620 620 now at: test.patch
621 621
622 622
623 623 push should succeed
624 624
625 625 $ hg qpop -a
626 626 popping test.patch
627 627 patch queue now empty
628 628 $ hg push ../../k
629 629 pushing to ../../k
630 630 searching for changes
631 631 adding changesets
632 632 adding manifests
633 633 adding file changes
634 634 added 1 changesets with 1 changes to 1 files
635 635
636 636
637 637 we want to start with some patches applied
638 638
639 639 $ hg qpush -a
640 640 applying test.patch
641 641 applying test1b.patch
642 642 applying test2.patch
643 643 now at: test2.patch
644 644
645 645 % pops all patches and succeeds
646 646
647 647 $ hg qpop -a
648 648 popping test2.patch
649 649 popping test1b.patch
650 650 popping test.patch
651 651 patch queue now empty
652 652
653 653 % does nothing and succeeds
654 654
655 655 $ hg qpop -a
656 656 no patches applied
657 657
658 658 % fails - nothing else to pop
659 659
660 660 $ hg qpop
661 661 no patches applied
662 662 [1]
663 663
664 664 % pushes a patch and succeeds
665 665
666 666 $ hg qpush
667 667 applying test.patch
668 668 now at: test.patch
669 669
670 670 % pops a patch and succeeds
671 671
672 672 $ hg qpop
673 673 popping test.patch
674 674 patch queue now empty
675 675
676 676 % pushes up to test1b.patch and succeeds
677 677
678 678 $ hg qpush test1b.patch
679 679 applying test.patch
680 680 applying test1b.patch
681 681 now at: test1b.patch
682 682
683 683 % does nothing and succeeds
684 684
685 685 $ hg qpush test1b.patch
686 686 qpush: test1b.patch is already at the top
687 687
688 688 % does nothing and succeeds
689 689
690 690 $ hg qpop test1b.patch
691 691 qpop: test1b.patch is already at the top
692 692
693 693 % fails - can't push to this patch
694 694
695 695 $ hg qpush test.patch
696 696 abort: cannot push to a previous patch: test.patch
697 697 [255]
698 698
699 699 % fails - can't pop to this patch
700 700
701 701 $ hg qpop test2.patch
702 702 abort: patch test2.patch is not applied
703 703 [255]
704 704
705 705 % pops up to test.patch and succeeds
706 706
707 707 $ hg qpop test.patch
708 708 popping test1b.patch
709 709 now at: test.patch
710 710
711 711 % pushes all patches and succeeds
712 712
713 713 $ hg qpush -a
714 714 applying test1b.patch
715 715 applying test2.patch
716 716 now at: test2.patch
717 717
718 718 % does nothing and succeeds
719 719
720 720 $ hg qpush -a
721 721 all patches are currently applied
722 722
723 723 % fails - nothing else to push
724 724
725 725 $ hg qpush
726 726 patch series already fully applied
727 727 [1]
728 728
729 729 % does nothing and succeeds
730 730
731 731 $ hg qpush test2.patch
732 732 qpush: test2.patch is already at the top
733 733
734 734 strip
735 735
736 736 $ cd ../../b
737 737 $ echo x>x
738 738 $ hg ci -Ama
739 739 adding x
740 740 $ hg strip tip
741 741 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
742 742 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
743 743 $ hg unbundle .hg/strip-backup/*
744 744 adding changesets
745 745 adding manifests
746 746 adding file changes
747 747 added 1 changesets with 1 changes to 1 files
748 748 (run 'hg update' to get a working copy)
749 749
750 750
751 751 strip with local changes, should complain
752 752
753 753 $ hg up
754 754 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
755 755 $ echo y>y
756 756 $ hg add y
757 757 $ hg strip tip
758 758 abort: local changes found
759 759 [255]
760 760
761 761 --force strip with local changes
762 762
763 763 $ hg strip -f tip
764 764 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
765 765 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
766 766
767 767
768 768 cd b; hg qrefresh
769 769
770 770 $ hg init refresh
771 771 $ cd refresh
772 772 $ echo a > a
773 773 $ hg ci -Ama
774 774 adding a
775 775 $ hg qnew -mfoo foo
776 776 $ echo a >> a
777 777 $ hg qrefresh
778 778 $ mkdir b
779 779 $ cd b
780 780 $ echo f > f
781 781 $ hg add f
782 782 $ hg qrefresh
783 783 $ cat ../.hg/patches/foo
784 784 foo
785 785
786 786 diff -r cb9a9f314b8b a
787 787 --- a/a\t(?P<date>.*) (re)
788 788 \+\+\+ b/a\t(?P<date>.*) (re)
789 789 @@ -1,1 +1,2 @@
790 790 a
791 791 +a
792 792 diff -r cb9a9f314b8b b/f
793 793 --- /dev/null\t(?P<date>.*) (re)
794 794 \+\+\+ b/b/f\t(?P<date>.*) (re)
795 795 @@ -0,0 +1,1 @@
796 796 +f
797 797
798 798 hg qrefresh .
799 799
800 800 $ hg qrefresh .
801 801 $ cat ../.hg/patches/foo
802 802 foo
803 803
804 804 diff -r cb9a9f314b8b b/f
805 805 --- /dev/null\t(?P<date>.*) (re)
806 806 \+\+\+ b/b/f\t(?P<date>.*) (re)
807 807 @@ -0,0 +1,1 @@
808 808 +f
809 809 $ hg status
810 810 M a
811 811
812 812
813 813 qpush failure
814 814
815 815 $ cd ..
816 816 $ hg qrefresh
817 817 $ hg qnew -mbar bar
818 818 $ echo foo > foo
819 819 $ echo bar > bar
820 820 $ hg add foo bar
821 821 $ hg qrefresh
822 822 $ hg qpop -a
823 823 popping bar
824 824 popping foo
825 825 patch queue now empty
826 826 $ echo bar > foo
827 827 $ hg qpush -a
828 828 applying foo
829 829 applying bar
830 830 file foo already exists
831 831 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
832 832 patch failed, unable to continue (try -v)
833 833 patch failed, rejects left in working dir
834 834 errors during apply, please fix and refresh bar
835 835 [2]
836 836 $ hg st
837 837 ? foo
838 838 ? foo.rej
839 839
840 840
841 841 mq tags
842 842
843 843 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
844 844 0 qparent
845 845 1 foo qbase
846 846 2 bar qtip tip
847 847
848 848 mq revset
849 849
850 850 $ hg log -r 'mq()' --template '{rev}\n'
851 851 1
852 852 2
853 853 $ hg help revsets | grep -i mq
854 854 "mq()"
855 855 Changesets managed by MQ.
856 856
857 857 bad node in status
858 858
859 859 $ hg qpop
860 860 popping bar
861 861 now at: foo
862 862 $ hg strip -qn tip
863 863 $ hg tip
864 864 changeset: 0:cb9a9f314b8b
865 865 tag: tip
866 866 user: test
867 867 date: Thu Jan 01 00:00:00 1970 +0000
868 868 summary: a
869 869
870 870 $ hg branches
871 871 default 0:cb9a9f314b8b
872 872 $ hg qpop
873 873 no patches applied
874 874 [1]
875 875
876 876 $ cat >>$HGRCPATH <<EOF
877 877 > [diff]
878 878 > git = True
879 879 > EOF
880 880 $ cd ..
881 881 $ hg init git
882 882 $ cd git
883 883 $ hg qinit
884 884
885 885 $ hg qnew -m'new file' new
886 886 $ echo foo > new
887 887 $ chmod +x new
888 888 $ hg add new
889 889 $ hg qrefresh
890 890 $ cat .hg/patches/new
891 891 new file
892 892
893 893 diff --git a/new b/new
894 894 new file mode 100755
895 895 --- /dev/null
896 896 +++ b/new
897 897 @@ -0,0 +1,1 @@
898 898 +foo
899 899
900 900 $ hg qnew -m'copy file' copy
901 901 $ hg cp new copy
902 902 $ hg qrefresh
903 903 $ cat .hg/patches/copy
904 904 copy file
905 905
906 906 diff --git a/new b/copy
907 907 copy from new
908 908 copy to copy
909 909
910 910 $ hg qpop
911 911 popping copy
912 912 now at: new
913 913 $ hg qpush
914 914 applying copy
915 915 now at: copy
916 916 $ hg qdiff
917 917 diff --git a/new b/copy
918 918 copy from new
919 919 copy to copy
920 920 $ cat >>$HGRCPATH <<EOF
921 921 > [diff]
922 922 > git = False
923 923 > EOF
924 924 $ hg qdiff --git
925 925 diff --git a/new b/copy
926 926 copy from new
927 927 copy to copy
928 928 $ cd ..
929 929
930 930 empty lines in status
931 931
932 932 $ hg init emptystatus
933 933 $ cd emptystatus
934 934 $ hg qinit
935 935 $ printf '\n\n' > .hg/patches/status
936 936 $ hg qser
937 937 $ cd ..
938 938
939 939 bad line in status (without ":")
940 940
941 941 $ hg init badstatus
942 942 $ cd badstatus
943 943 $ hg qinit
944 944 $ printf 'babar has no colon in this line\n' > .hg/patches/status
945 945 $ hg qser
946 946 malformated mq status line: ['babar has no colon in this line']
947 947 $ cd ..
948 948
949 949
950 950 test file addition in slow path
951 951
952 952 $ hg init slow
953 953 $ cd slow
954 954 $ hg qinit
955 955 $ echo foo > foo
956 956 $ hg add foo
957 957 $ hg ci -m 'add foo'
958 958 $ hg qnew bar
959 959 $ echo bar > bar
960 960 $ hg add bar
961 961 $ hg mv foo baz
962 962 $ hg qrefresh --git
963 963 $ hg up -C 0
964 964 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
965 965 $ echo >> foo
966 966 $ hg ci -m 'change foo'
967 967 created new head
968 968 $ hg up -C 1
969 969 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
970 970 $ hg qrefresh --git
971 971 $ cat .hg/patches/bar
972 972 diff --git a/bar b/bar
973 973 new file mode 100644
974 974 --- /dev/null
975 975 +++ b/bar
976 976 @@ -0,0 +1,1 @@
977 977 +bar
978 978 diff --git a/foo b/baz
979 979 rename from foo
980 980 rename to baz
981 981 $ hg log -v --template '{rev} {file_copies}\n' -r .
982 982 2 baz (foo)
983 983 $ hg qrefresh --git
984 984 $ cat .hg/patches/bar
985 985 diff --git a/bar b/bar
986 986 new file mode 100644
987 987 --- /dev/null
988 988 +++ b/bar
989 989 @@ -0,0 +1,1 @@
990 990 +bar
991 991 diff --git a/foo b/baz
992 992 rename from foo
993 993 rename to baz
994 994 $ hg log -v --template '{rev} {file_copies}\n' -r .
995 995 2 baz (foo)
996 996 $ hg qrefresh
997 997 $ grep 'diff --git' .hg/patches/bar
998 998 diff --git a/bar b/bar
999 999 diff --git a/foo b/baz
1000 1000
1001 1001
1002 1002 test file move chains in the slow path
1003 1003
1004 1004 $ hg up -C 1
1005 1005 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1006 1006 $ echo >> foo
1007 1007 $ hg ci -m 'change foo again'
1008 1008 $ hg up -C 2
1009 1009 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1010 1010 $ hg mv bar quux
1011 1011 $ hg mv baz bleh
1012 1012 $ hg qrefresh --git
1013 1013 $ cat .hg/patches/bar
1014 1014 diff --git a/foo b/bleh
1015 1015 rename from foo
1016 1016 rename to bleh
1017 1017 diff --git a/quux b/quux
1018 1018 new file mode 100644
1019 1019 --- /dev/null
1020 1020 +++ b/quux
1021 1021 @@ -0,0 +1,1 @@
1022 1022 +bar
1023 1023 $ hg log -v --template '{rev} {file_copies}\n' -r .
1024 1024 3 bleh (foo)
1025 1025 $ hg mv quux fred
1026 1026 $ hg mv bleh barney
1027 1027 $ hg qrefresh --git
1028 1028 $ cat .hg/patches/bar
1029 1029 diff --git a/foo b/barney
1030 1030 rename from foo
1031 1031 rename to barney
1032 1032 diff --git a/fred b/fred
1033 1033 new file mode 100644
1034 1034 --- /dev/null
1035 1035 +++ b/fred
1036 1036 @@ -0,0 +1,1 @@
1037 1037 +bar
1038 1038 $ hg log -v --template '{rev} {file_copies}\n' -r .
1039 1039 3 barney (foo)
1040 1040
1041 1041
1042 1042 refresh omitting an added file
1043 1043
1044 1044 $ hg qnew baz
1045 1045 $ echo newfile > newfile
1046 1046 $ hg add newfile
1047 1047 $ hg qrefresh
1048 1048 $ hg st -A newfile
1049 1049 C newfile
1050 1050 $ hg qrefresh -X newfile
1051 1051 $ hg st -A newfile
1052 1052 A newfile
1053 1053 $ hg revert newfile
1054 1054 $ rm newfile
1055 1055 $ hg qpop
1056 1056 popping baz
1057 1057 now at: bar
1058 1058 $ hg qdel baz
1059 1059
1060 1060
1061 1061 create a git patch
1062 1062
1063 1063 $ echo a > alexander
1064 1064 $ hg add alexander
1065 1065 $ hg qnew -f --git addalexander
1066 1066 $ grep diff .hg/patches/addalexander
1067 1067 diff --git a/alexander b/alexander
1068 1068
1069 1069
1070 1070 create a git binary patch
1071 1071
1072 1072 $ cat > writebin.py <<EOF
1073 1073 > import sys
1074 1074 > path = sys.argv[1]
1075 1075 > open(path, 'wb').write('BIN\x00ARY')
1076 1076 > EOF
1077 1077 $ python writebin.py bucephalus
1078 1078
1079 1079 $ python "$TESTDIR/md5sum.py" bucephalus
1080 1080 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1081 1081 $ hg add bucephalus
1082 1082 $ hg qnew -f --git addbucephalus
1083 1083 $ grep diff .hg/patches/addbucephalus
1084 1084 diff --git a/bucephalus b/bucephalus
1085 1085
1086 1086
1087 1087 check binary patches can be popped and pushed
1088 1088
1089 1089 $ hg qpop
1090 1090 popping addbucephalus
1091 1091 now at: addalexander
1092 1092 $ test -f bucephalus && echo % bucephalus should not be there
1093 1093 [1]
1094 1094 $ hg qpush
1095 1095 applying addbucephalus
1096 1096 now at: addbucephalus
1097 1097 $ test -f bucephalus
1098 1098 $ python "$TESTDIR/md5sum.py" bucephalus
1099 1099 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1100 1100
1101 1101
1102 1102
1103 1103 strip again
1104 1104
1105 1105 $ cd ..
1106 1106 $ hg init strip
1107 1107 $ cd strip
1108 1108 $ touch foo
1109 1109 $ hg add foo
1110 1110 $ hg ci -m 'add foo'
1111 1111 $ echo >> foo
1112 1112 $ hg ci -m 'change foo 1'
1113 1113 $ hg up -C 0
1114 1114 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1115 1115 $ echo 1 >> foo
1116 1116 $ hg ci -m 'change foo 2'
1117 1117 created new head
1118 1118 $ HGMERGE=true hg merge
1119 1119 merging foo
1120 1120 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1121 1121 (branch merge, don't forget to commit)
1122 1122 $ hg ci -m merge
1123 1123 $ hg log
1124 1124 changeset: 3:99615015637b
1125 1125 tag: tip
1126 1126 parent: 2:20cbbe65cff7
1127 1127 parent: 1:d2871fc282d4
1128 1128 user: test
1129 1129 date: Thu Jan 01 00:00:00 1970 +0000
1130 1130 summary: merge
1131 1131
1132 1132 changeset: 2:20cbbe65cff7
1133 1133 parent: 0:53245c60e682
1134 1134 user: test
1135 1135 date: Thu Jan 01 00:00:00 1970 +0000
1136 1136 summary: change foo 2
1137 1137
1138 1138 changeset: 1:d2871fc282d4
1139 1139 user: test
1140 1140 date: Thu Jan 01 00:00:00 1970 +0000
1141 1141 summary: change foo 1
1142 1142
1143 1143 changeset: 0:53245c60e682
1144 1144 user: test
1145 1145 date: Thu Jan 01 00:00:00 1970 +0000
1146 1146 summary: add foo
1147 1147
1148 1148 $ hg strip 1
1149 1149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1150 1150 saved backup bundle to $TESTTMP/b/strip/.hg/strip-backup/*-backup.hg (glob)
1151 1151 $ checkundo strip
1152 1152 $ hg log
1153 1153 changeset: 1:20cbbe65cff7
1154 1154 tag: tip
1155 1155 user: test
1156 1156 date: Thu Jan 01 00:00:00 1970 +0000
1157 1157 summary: change foo 2
1158 1158
1159 1159 changeset: 0:53245c60e682
1160 1160 user: test
1161 1161 date: Thu Jan 01 00:00:00 1970 +0000
1162 1162 summary: add foo
1163 1163
1164 1164 $ cd ..
1165 1165
1166 1166
1167 1167 qclone
1168 1168
1169 1169 $ qlog()
1170 1170 > {
1171 1171 > echo 'main repo:'
1172 1172 > hg log --template ' rev {rev}: {desc}\n'
1173 1173 > echo 'patch repo:'
1174 1174 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1175 1175 > }
1176 1176 $ hg init qclonesource
1177 1177 $ cd qclonesource
1178 1178 $ echo foo > foo
1179 1179 $ hg add foo
1180 1180 $ hg ci -m 'add foo'
1181 1181 $ hg qinit
1182 1182 $ hg qnew patch1
1183 1183 $ echo bar >> foo
1184 1184 $ hg qrefresh -m 'change foo'
1185 1185 $ cd ..
1186 1186
1187 1187
1188 1188 repo with unversioned patch dir
1189 1189
1190 1190 $ hg qclone qclonesource failure
1191 1191 abort: versioned patch repository not found (see init --mq)
1192 1192 [255]
1193 1193
1194 1194 $ cd qclonesource
1195 1195 $ hg qinit -c
1196 adding .hg/patches/patch1
1196 adding .hg/patches/patch1 (glob)
1197 1197 $ hg qci -m checkpoint
1198 1198 $ qlog
1199 1199 main repo:
1200 1200 rev 1: change foo
1201 1201 rev 0: add foo
1202 1202 patch repo:
1203 1203 rev 0: checkpoint
1204 1204 $ cd ..
1205 1205
1206 1206
1207 1207 repo with patches applied
1208 1208
1209 1209 $ hg qclone qclonesource qclonedest
1210 1210 updating to branch default
1211 1211 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1212 1212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1213 1213 $ cd qclonedest
1214 1214 $ qlog
1215 1215 main repo:
1216 1216 rev 0: add foo
1217 1217 patch repo:
1218 1218 rev 0: checkpoint
1219 1219 $ cd ..
1220 1220
1221 1221
1222 1222 repo with patches unapplied
1223 1223
1224 1224 $ cd qclonesource
1225 1225 $ hg qpop -a
1226 1226 popping patch1
1227 1227 patch queue now empty
1228 1228 $ qlog
1229 1229 main repo:
1230 1230 rev 0: add foo
1231 1231 patch repo:
1232 1232 rev 0: checkpoint
1233 1233 $ cd ..
1234 1234 $ hg qclone qclonesource qclonedest2
1235 1235 updating to branch default
1236 1236 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1237 1237 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1238 1238 $ cd qclonedest2
1239 1239 $ qlog
1240 1240 main repo:
1241 1241 rev 0: add foo
1242 1242 patch repo:
1243 1243 rev 0: checkpoint
1244 1244 $ cd ..
1245 1245
1246 1246
1247 1247 Issue1033: test applying on an empty file
1248 1248
1249 1249 $ hg init empty
1250 1250 $ cd empty
1251 1251 $ touch a
1252 1252 $ hg ci -Am addempty
1253 1253 adding a
1254 1254 $ echo a > a
1255 1255 $ hg qnew -f -e changea
1256 1256 $ hg qpop
1257 1257 popping changea
1258 1258 patch queue now empty
1259 1259 $ hg qpush
1260 1260 applying changea
1261 1261 now at: changea
1262 1262 $ cd ..
1263 1263
1264 1264 test qpush with --force, issue1087
1265 1265
1266 1266 $ hg init forcepush
1267 1267 $ cd forcepush
1268 1268 $ echo hello > hello.txt
1269 1269 $ echo bye > bye.txt
1270 1270 $ hg ci -Ama
1271 1271 adding bye.txt
1272 1272 adding hello.txt
1273 1273 $ hg qnew -d '0 0' empty
1274 1274 $ hg qpop
1275 1275 popping empty
1276 1276 patch queue now empty
1277 1277 $ echo world >> hello.txt
1278 1278
1279 1279
1280 1280 qpush should fail, local changes
1281 1281
1282 1282 $ hg qpush
1283 1283 abort: local changes found
1284 1284 [255]
1285 1285
1286 1286
1287 1287 apply force, should not discard changes with empty patch
1288 1288
1289 1289 $ hg qpush -f
1290 1290 applying empty
1291 1291 patch empty is empty
1292 1292 now at: empty
1293 1293 $ hg diff --config diff.nodates=True
1294 1294 diff -r d58265112590 hello.txt
1295 1295 --- a/hello.txt
1296 1296 +++ b/hello.txt
1297 1297 @@ -1,1 +1,2 @@
1298 1298 hello
1299 1299 +world
1300 1300 $ hg qdiff --config diff.nodates=True
1301 1301 diff -r 9ecee4f634e3 hello.txt
1302 1302 --- a/hello.txt
1303 1303 +++ b/hello.txt
1304 1304 @@ -1,1 +1,2 @@
1305 1305 hello
1306 1306 +world
1307 1307 $ hg log -l1 -p
1308 1308 changeset: 1:d58265112590
1309 1309 tag: empty
1310 1310 tag: qbase
1311 1311 tag: qtip
1312 1312 tag: tip
1313 1313 user: test
1314 1314 date: Thu Jan 01 00:00:00 1970 +0000
1315 1315 summary: imported patch empty
1316 1316
1317 1317
1318 1318 $ hg qref -d '0 0'
1319 1319 $ hg qpop
1320 1320 popping empty
1321 1321 patch queue now empty
1322 1322 $ echo universe >> hello.txt
1323 1323 $ echo universe >> bye.txt
1324 1324
1325 1325
1326 1326 qpush should fail, local changes
1327 1327
1328 1328 $ hg qpush
1329 1329 abort: local changes found
1330 1330 [255]
1331 1331
1332 1332
1333 1333 apply force, should discard changes in hello, but not bye
1334 1334
1335 1335 $ hg qpush -f
1336 1336 applying empty
1337 1337 now at: empty
1338 1338 $ hg st
1339 1339 M bye.txt
1340 1340 $ hg diff --config diff.nodates=True
1341 1341 diff -r ba252371dbc1 bye.txt
1342 1342 --- a/bye.txt
1343 1343 +++ b/bye.txt
1344 1344 @@ -1,1 +1,2 @@
1345 1345 bye
1346 1346 +universe
1347 1347 $ hg qdiff --config diff.nodates=True
1348 1348 diff -r 9ecee4f634e3 bye.txt
1349 1349 --- a/bye.txt
1350 1350 +++ b/bye.txt
1351 1351 @@ -1,1 +1,2 @@
1352 1352 bye
1353 1353 +universe
1354 1354 diff -r 9ecee4f634e3 hello.txt
1355 1355 --- a/hello.txt
1356 1356 +++ b/hello.txt
1357 1357 @@ -1,1 +1,3 @@
1358 1358 hello
1359 1359 +world
1360 1360 +universe
1361 1361
1362 1362
1363 1363 test popping revisions not in working dir ancestry
1364 1364
1365 1365 $ hg qseries -v
1366 1366 0 A empty
1367 1367 $ hg up qparent
1368 1368 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1369 1369 $ hg qpop
1370 1370 popping empty
1371 1371 patch queue now empty
1372 1372
1373 1373 $ cd ..
1374 1374 $ hg init deletion-order
1375 1375 $ cd deletion-order
1376 1376
1377 1377 $ touch a
1378 1378 $ hg ci -Aqm0
1379 1379
1380 1380 $ hg qnew rename-dir
1381 1381 $ hg rm a
1382 1382 $ hg qrefresh
1383 1383
1384 1384 $ mkdir a b
1385 1385 $ touch a/a b/b
1386 1386 $ hg add -q a b
1387 1387 $ hg qrefresh
1388 1388
1389 1389
1390 1390 test popping must remove files added in subdirectories first
1391 1391
1392 1392 $ hg qpop
1393 1393 popping rename-dir
1394 1394 patch queue now empty
1395 1395 $ cd ..
1396 1396
@@ -1,1344 +1,1344 b''
1 1
2 2 $ add()
3 3 > {
4 4 > echo $2 >> $1
5 5 > }
6 6 $ hg init t
7 7 $ cd t
8 8
9 9 set up a boring main branch
10 10
11 11 $ add a a
12 12 $ hg add a
13 13 $ mkdir x
14 14 $ add x/x x
15 15 $ hg add x/x
16 16 $ hg ci -m0
17 17 $ add a m1
18 18 $ hg ci -m1
19 19 $ add a m2
20 20 $ add x/y y1
21 21 $ hg add x/y
22 22 $ hg ci -m2
23 23 $ cd ..
24 24 $ show()
25 25 > {
26 26 > echo "- $2: $1"
27 27 > hg st -C $1
28 28 > echo
29 29 > hg diff --git $1
30 30 > echo
31 31 > }
32 32 $ count=0
33 33
34 34 make a new branch and get diff/status output
35 35 $1 - first commit
36 36 $2 - second commit
37 37 $3 - working dir action
38 38 $4 - test description
39 39
40 40 $ tb()
41 41 > {
42 42 > hg clone t t2 ; cd t2
43 43 > hg co -q -C 0
44 44 >
45 45 > add a $count
46 46 > count=`expr $count + 1`
47 47 > hg ci -m "t0"
48 48 > $1
49 49 > hg ci -m "t1"
50 50 > $2
51 51 > hg ci -m "t2"
52 52 > $3
53 53 >
54 54 > echo "** $4 **"
55 55 > echo "** $1 / $2 / $3"
56 56 > show "" "working to parent"
57 57 > show "--rev 0" "working to root"
58 58 > show "--rev 2" "working to branch"
59 59 > show "--rev 0 --rev ." "root to parent"
60 60 > show "--rev . --rev 0" "parent to root"
61 61 > show "--rev 2 --rev ." "branch to parent"
62 62 > show "--rev . --rev 2" "parent to branch"
63 63 > echo
64 64 > cd ..
65 65 > rm -rf t2
66 66 > }
67 67 $ tb "add a a1" "add a a2" "hg mv a b" "rename in working dir"
68 68 updating to branch default
69 69 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 70 created new head
71 71 ** rename in working dir **
72 72 ** add a a1 / add a a2 / hg mv a b
73 73 - working to parent:
74 74 A b
75 75 a
76 76 R a
77 77
78 78 diff --git a/a b/b
79 79 rename from a
80 80 rename to b
81 81
82 82 - working to root: --rev 0
83 83 A b
84 84 a
85 85 R a
86 86
87 87 diff --git a/a b/b
88 88 rename from a
89 89 rename to b
90 90 --- a/a
91 91 +++ b/b
92 92 @@ -1,1 +1,4 @@
93 93 a
94 94 +0
95 95 +a1
96 96 +a2
97 97
98 98 - working to branch: --rev 2
99 99 A b
100 100 a
101 101 R a
102 102 R x/y
103 103
104 104 diff --git a/a b/b
105 105 rename from a
106 106 rename to b
107 107 --- a/a
108 108 +++ b/b
109 109 @@ -1,3 +1,4 @@
110 110 a
111 111 -m1
112 112 -m2
113 113 +0
114 114 +a1
115 115 +a2
116 116 diff --git a/x/y b/x/y
117 117 deleted file mode 100644
118 118 --- a/x/y
119 119 +++ /dev/null
120 120 @@ -1,1 +0,0 @@
121 121 -y1
122 122
123 123 - root to parent: --rev 0 --rev .
124 124 M a
125 125
126 126 diff --git a/a b/a
127 127 --- a/a
128 128 +++ b/a
129 129 @@ -1,1 +1,4 @@
130 130 a
131 131 +0
132 132 +a1
133 133 +a2
134 134
135 135 - parent to root: --rev . --rev 0
136 136 M a
137 137
138 138 diff --git a/a b/a
139 139 --- a/a
140 140 +++ b/a
141 141 @@ -1,4 +1,1 @@
142 142 a
143 143 -0
144 144 -a1
145 145 -a2
146 146
147 147 - branch to parent: --rev 2 --rev .
148 148 M a
149 149 R x/y
150 150
151 151 diff --git a/a b/a
152 152 --- a/a
153 153 +++ b/a
154 154 @@ -1,3 +1,4 @@
155 155 a
156 156 -m1
157 157 -m2
158 158 +0
159 159 +a1
160 160 +a2
161 161 diff --git a/x/y b/x/y
162 162 deleted file mode 100644
163 163 --- a/x/y
164 164 +++ /dev/null
165 165 @@ -1,1 +0,0 @@
166 166 -y1
167 167
168 168 - parent to branch: --rev . --rev 2
169 169 M a
170 170 A x/y
171 171
172 172 diff --git a/a b/a
173 173 --- a/a
174 174 +++ b/a
175 175 @@ -1,4 +1,3 @@
176 176 a
177 177 -0
178 178 -a1
179 179 -a2
180 180 +m1
181 181 +m2
182 182 diff --git a/x/y b/x/y
183 183 new file mode 100644
184 184 --- /dev/null
185 185 +++ b/x/y
186 186 @@ -0,0 +1,1 @@
187 187 +y1
188 188
189 189
190 190 $ tb "add a a1" "add a a2" "hg cp a b" "copy in working dir"
191 191 updating to branch default
192 192 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 193 created new head
194 194 ** copy in working dir **
195 195 ** add a a1 / add a a2 / hg cp a b
196 196 - working to parent:
197 197 A b
198 198 a
199 199
200 200 diff --git a/a b/b
201 201 copy from a
202 202 copy to b
203 203
204 204 - working to root: --rev 0
205 205 M a
206 206 A b
207 207 a
208 208
209 209 diff --git a/a b/a
210 210 --- a/a
211 211 +++ b/a
212 212 @@ -1,1 +1,4 @@
213 213 a
214 214 +1
215 215 +a1
216 216 +a2
217 217 diff --git a/a b/b
218 218 copy from a
219 219 copy to b
220 220 --- a/a
221 221 +++ b/b
222 222 @@ -1,1 +1,4 @@
223 223 a
224 224 +1
225 225 +a1
226 226 +a2
227 227
228 228 - working to branch: --rev 2
229 229 M a
230 230 A b
231 231 a
232 232 R x/y
233 233
234 234 diff --git a/a b/a
235 235 --- a/a
236 236 +++ b/a
237 237 @@ -1,3 +1,4 @@
238 238 a
239 239 -m1
240 240 -m2
241 241 +1
242 242 +a1
243 243 +a2
244 244 diff --git a/a b/b
245 245 copy from a
246 246 copy to b
247 247 --- a/a
248 248 +++ b/b
249 249 @@ -1,3 +1,4 @@
250 250 a
251 251 -m1
252 252 -m2
253 253 +1
254 254 +a1
255 255 +a2
256 256 diff --git a/x/y b/x/y
257 257 deleted file mode 100644
258 258 --- a/x/y
259 259 +++ /dev/null
260 260 @@ -1,1 +0,0 @@
261 261 -y1
262 262
263 263 - root to parent: --rev 0 --rev .
264 264 M a
265 265
266 266 diff --git a/a b/a
267 267 --- a/a
268 268 +++ b/a
269 269 @@ -1,1 +1,4 @@
270 270 a
271 271 +1
272 272 +a1
273 273 +a2
274 274
275 275 - parent to root: --rev . --rev 0
276 276 M a
277 277
278 278 diff --git a/a b/a
279 279 --- a/a
280 280 +++ b/a
281 281 @@ -1,4 +1,1 @@
282 282 a
283 283 -1
284 284 -a1
285 285 -a2
286 286
287 287 - branch to parent: --rev 2 --rev .
288 288 M a
289 289 R x/y
290 290
291 291 diff --git a/a b/a
292 292 --- a/a
293 293 +++ b/a
294 294 @@ -1,3 +1,4 @@
295 295 a
296 296 -m1
297 297 -m2
298 298 +1
299 299 +a1
300 300 +a2
301 301 diff --git a/x/y b/x/y
302 302 deleted file mode 100644
303 303 --- a/x/y
304 304 +++ /dev/null
305 305 @@ -1,1 +0,0 @@
306 306 -y1
307 307
308 308 - parent to branch: --rev . --rev 2
309 309 M a
310 310 A x/y
311 311
312 312 diff --git a/a b/a
313 313 --- a/a
314 314 +++ b/a
315 315 @@ -1,4 +1,3 @@
316 316 a
317 317 -1
318 318 -a1
319 319 -a2
320 320 +m1
321 321 +m2
322 322 diff --git a/x/y b/x/y
323 323 new file mode 100644
324 324 --- /dev/null
325 325 +++ b/x/y
326 326 @@ -0,0 +1,1 @@
327 327 +y1
328 328
329 329
330 330 $ tb "hg mv a b" "add b b1" "add b w" "single rename"
331 331 updating to branch default
332 332 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
333 333 created new head
334 334 ** single rename **
335 335 ** hg mv a b / add b b1 / add b w
336 336 - working to parent:
337 337 M b
338 338
339 339 diff --git a/b b/b
340 340 --- a/b
341 341 +++ b/b
342 342 @@ -1,3 +1,4 @@
343 343 a
344 344 2
345 345 b1
346 346 +w
347 347
348 348 - working to root: --rev 0
349 349 A b
350 350 a
351 351 R a
352 352
353 353 diff --git a/a b/b
354 354 rename from a
355 355 rename to b
356 356 --- a/a
357 357 +++ b/b
358 358 @@ -1,1 +1,4 @@
359 359 a
360 360 +2
361 361 +b1
362 362 +w
363 363
364 364 - working to branch: --rev 2
365 365 A b
366 366 a
367 367 R a
368 368 R x/y
369 369
370 370 diff --git a/a b/b
371 371 rename from a
372 372 rename to b
373 373 --- a/a
374 374 +++ b/b
375 375 @@ -1,3 +1,4 @@
376 376 a
377 377 -m1
378 378 -m2
379 379 +2
380 380 +b1
381 381 +w
382 382 diff --git a/x/y b/x/y
383 383 deleted file mode 100644
384 384 --- a/x/y
385 385 +++ /dev/null
386 386 @@ -1,1 +0,0 @@
387 387 -y1
388 388
389 389 - root to parent: --rev 0 --rev .
390 390 A b
391 391 a
392 392 R a
393 393
394 394 diff --git a/a b/b
395 395 rename from a
396 396 rename to b
397 397 --- a/a
398 398 +++ b/b
399 399 @@ -1,1 +1,3 @@
400 400 a
401 401 +2
402 402 +b1
403 403
404 404 - parent to root: --rev . --rev 0
405 405 A a
406 406 b
407 407 R b
408 408
409 409 diff --git a/b b/a
410 410 rename from b
411 411 rename to a
412 412 --- a/b
413 413 +++ b/a
414 414 @@ -1,3 +1,1 @@
415 415 a
416 416 -2
417 417 -b1
418 418
419 419 - branch to parent: --rev 2 --rev .
420 420 A b
421 421 a
422 422 R a
423 423 R x/y
424 424
425 425 diff --git a/a b/b
426 426 rename from a
427 427 rename to b
428 428 --- a/a
429 429 +++ b/b
430 430 @@ -1,3 +1,3 @@
431 431 a
432 432 -m1
433 433 -m2
434 434 +2
435 435 +b1
436 436 diff --git a/x/y b/x/y
437 437 deleted file mode 100644
438 438 --- a/x/y
439 439 +++ /dev/null
440 440 @@ -1,1 +0,0 @@
441 441 -y1
442 442
443 443 - parent to branch: --rev . --rev 2
444 444 A a
445 445 b
446 446 A x/y
447 447 R b
448 448
449 449 diff --git a/b b/a
450 450 rename from b
451 451 rename to a
452 452 --- a/b
453 453 +++ b/a
454 454 @@ -1,3 +1,3 @@
455 455 a
456 456 -2
457 457 -b1
458 458 +m1
459 459 +m2
460 460 diff --git a/x/y b/x/y
461 461 new file mode 100644
462 462 --- /dev/null
463 463 +++ b/x/y
464 464 @@ -0,0 +1,1 @@
465 465 +y1
466 466
467 467
468 468 $ tb "hg cp a b" "add b b1" "add a w" "single copy"
469 469 updating to branch default
470 470 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
471 471 created new head
472 472 ** single copy **
473 473 ** hg cp a b / add b b1 / add a w
474 474 - working to parent:
475 475 M a
476 476
477 477 diff --git a/a b/a
478 478 --- a/a
479 479 +++ b/a
480 480 @@ -1,2 +1,3 @@
481 481 a
482 482 3
483 483 +w
484 484
485 485 - working to root: --rev 0
486 486 M a
487 487 A b
488 488 a
489 489
490 490 diff --git a/a b/a
491 491 --- a/a
492 492 +++ b/a
493 493 @@ -1,1 +1,3 @@
494 494 a
495 495 +3
496 496 +w
497 497 diff --git a/a b/b
498 498 copy from a
499 499 copy to b
500 500 --- a/a
501 501 +++ b/b
502 502 @@ -1,1 +1,3 @@
503 503 a
504 504 +3
505 505 +b1
506 506
507 507 - working to branch: --rev 2
508 508 M a
509 509 A b
510 510 a
511 511 R x/y
512 512
513 513 diff --git a/a b/a
514 514 --- a/a
515 515 +++ b/a
516 516 @@ -1,3 +1,3 @@
517 517 a
518 518 -m1
519 519 -m2
520 520 +3
521 521 +w
522 522 diff --git a/a b/b
523 523 copy from a
524 524 copy to b
525 525 --- a/a
526 526 +++ b/b
527 527 @@ -1,3 +1,3 @@
528 528 a
529 529 -m1
530 530 -m2
531 531 +3
532 532 +b1
533 533 diff --git a/x/y b/x/y
534 534 deleted file mode 100644
535 535 --- a/x/y
536 536 +++ /dev/null
537 537 @@ -1,1 +0,0 @@
538 538 -y1
539 539
540 540 - root to parent: --rev 0 --rev .
541 541 M a
542 542 A b
543 543 a
544 544
545 545 diff --git a/a b/a
546 546 --- a/a
547 547 +++ b/a
548 548 @@ -1,1 +1,2 @@
549 549 a
550 550 +3
551 551 diff --git a/a b/b
552 552 copy from a
553 553 copy to b
554 554 --- a/a
555 555 +++ b/b
556 556 @@ -1,1 +1,3 @@
557 557 a
558 558 +3
559 559 +b1
560 560
561 561 - parent to root: --rev . --rev 0
562 562 M a
563 563 R b
564 564
565 565 diff --git a/a b/a
566 566 --- a/a
567 567 +++ b/a
568 568 @@ -1,2 +1,1 @@
569 569 a
570 570 -3
571 571 diff --git a/b b/b
572 572 deleted file mode 100644
573 573 --- a/b
574 574 +++ /dev/null
575 575 @@ -1,3 +0,0 @@
576 576 -a
577 577 -3
578 578 -b1
579 579
580 580 - branch to parent: --rev 2 --rev .
581 581 M a
582 582 A b
583 583 a
584 584 R x/y
585 585
586 586 diff --git a/a b/a
587 587 --- a/a
588 588 +++ b/a
589 589 @@ -1,3 +1,2 @@
590 590 a
591 591 -m1
592 592 -m2
593 593 +3
594 594 diff --git a/a b/b
595 595 copy from a
596 596 copy to b
597 597 --- a/a
598 598 +++ b/b
599 599 @@ -1,3 +1,3 @@
600 600 a
601 601 -m1
602 602 -m2
603 603 +3
604 604 +b1
605 605 diff --git a/x/y b/x/y
606 606 deleted file mode 100644
607 607 --- a/x/y
608 608 +++ /dev/null
609 609 @@ -1,1 +0,0 @@
610 610 -y1
611 611
612 612 - parent to branch: --rev . --rev 2
613 613 M a
614 614 A x/y
615 615 R b
616 616
617 617 diff --git a/a b/a
618 618 --- a/a
619 619 +++ b/a
620 620 @@ -1,2 +1,3 @@
621 621 a
622 622 -3
623 623 +m1
624 624 +m2
625 625 diff --git a/b b/b
626 626 deleted file mode 100644
627 627 --- a/b
628 628 +++ /dev/null
629 629 @@ -1,3 +0,0 @@
630 630 -a
631 631 -3
632 632 -b1
633 633 diff --git a/x/y b/x/y
634 634 new file mode 100644
635 635 --- /dev/null
636 636 +++ b/x/y
637 637 @@ -0,0 +1,1 @@
638 638 +y1
639 639
640 640
641 641 $ tb "hg mv a b" "hg mv b c" "hg mv c d" "rename chain"
642 642 updating to branch default
643 643 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
644 644 created new head
645 645 ** rename chain **
646 646 ** hg mv a b / hg mv b c / hg mv c d
647 647 - working to parent:
648 648 A d
649 649 c
650 650 R c
651 651
652 652 diff --git a/c b/d
653 653 rename from c
654 654 rename to d
655 655
656 656 - working to root: --rev 0
657 657 A d
658 658 a
659 659 R a
660 660
661 661 diff --git a/a b/d
662 662 rename from a
663 663 rename to d
664 664 --- a/a
665 665 +++ b/d
666 666 @@ -1,1 +1,2 @@
667 667 a
668 668 +4
669 669
670 670 - working to branch: --rev 2
671 671 A d
672 672 a
673 673 R a
674 674 R x/y
675 675
676 676 diff --git a/a b/d
677 677 rename from a
678 678 rename to d
679 679 --- a/a
680 680 +++ b/d
681 681 @@ -1,3 +1,2 @@
682 682 a
683 683 -m1
684 684 -m2
685 685 +4
686 686 diff --git a/x/y b/x/y
687 687 deleted file mode 100644
688 688 --- a/x/y
689 689 +++ /dev/null
690 690 @@ -1,1 +0,0 @@
691 691 -y1
692 692
693 693 - root to parent: --rev 0 --rev .
694 694 A c
695 695 a
696 696 R a
697 697
698 698 diff --git a/a b/c
699 699 rename from a
700 700 rename to c
701 701 --- a/a
702 702 +++ b/c
703 703 @@ -1,1 +1,2 @@
704 704 a
705 705 +4
706 706
707 707 - parent to root: --rev . --rev 0
708 708 A a
709 709 c
710 710 R c
711 711
712 712 diff --git a/c b/a
713 713 rename from c
714 714 rename to a
715 715 --- a/c
716 716 +++ b/a
717 717 @@ -1,2 +1,1 @@
718 718 a
719 719 -4
720 720
721 721 - branch to parent: --rev 2 --rev .
722 722 A c
723 723 a
724 724 R a
725 725 R x/y
726 726
727 727 diff --git a/a b/c
728 728 rename from a
729 729 rename to c
730 730 --- a/a
731 731 +++ b/c
732 732 @@ -1,3 +1,2 @@
733 733 a
734 734 -m1
735 735 -m2
736 736 +4
737 737 diff --git a/x/y b/x/y
738 738 deleted file mode 100644
739 739 --- a/x/y
740 740 +++ /dev/null
741 741 @@ -1,1 +0,0 @@
742 742 -y1
743 743
744 744 - parent to branch: --rev . --rev 2
745 745 A a
746 746 c
747 747 A x/y
748 748 R c
749 749
750 750 diff --git a/c b/a
751 751 rename from c
752 752 rename to a
753 753 --- a/c
754 754 +++ b/a
755 755 @@ -1,2 +1,3 @@
756 756 a
757 757 -4
758 758 +m1
759 759 +m2
760 760 diff --git a/x/y b/x/y
761 761 new file mode 100644
762 762 --- /dev/null
763 763 +++ b/x/y
764 764 @@ -0,0 +1,1 @@
765 765 +y1
766 766
767 767
768 768 $ tb "hg cp a b" "hg cp b c" "hg cp c d" "copy chain"
769 769 updating to branch default
770 770 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
771 771 created new head
772 772 ** copy chain **
773 773 ** hg cp a b / hg cp b c / hg cp c d
774 774 - working to parent:
775 775 A d
776 776 c
777 777
778 778 diff --git a/c b/d
779 779 copy from c
780 780 copy to d
781 781
782 782 - working to root: --rev 0
783 783 M a
784 784 A b
785 785 a
786 786 A c
787 787 a
788 788 A d
789 789 a
790 790
791 791 diff --git a/a b/a
792 792 --- a/a
793 793 +++ b/a
794 794 @@ -1,1 +1,2 @@
795 795 a
796 796 +5
797 797 diff --git a/a b/b
798 798 copy from a
799 799 copy to b
800 800 --- a/a
801 801 +++ b/b
802 802 @@ -1,1 +1,2 @@
803 803 a
804 804 +5
805 805 diff --git a/a b/c
806 806 copy from a
807 807 copy to c
808 808 --- a/a
809 809 +++ b/c
810 810 @@ -1,1 +1,2 @@
811 811 a
812 812 +5
813 813 diff --git a/a b/d
814 814 copy from a
815 815 copy to d
816 816 --- a/a
817 817 +++ b/d
818 818 @@ -1,1 +1,2 @@
819 819 a
820 820 +5
821 821
822 822 - working to branch: --rev 2
823 823 M a
824 824 A b
825 825 a
826 826 A c
827 827 a
828 828 A d
829 829 a
830 830 R x/y
831 831
832 832 diff --git a/a b/a
833 833 --- a/a
834 834 +++ b/a
835 835 @@ -1,3 +1,2 @@
836 836 a
837 837 -m1
838 838 -m2
839 839 +5
840 840 diff --git a/a b/b
841 841 copy from a
842 842 copy to b
843 843 --- a/a
844 844 +++ b/b
845 845 @@ -1,3 +1,2 @@
846 846 a
847 847 -m1
848 848 -m2
849 849 +5
850 850 diff --git a/a b/c
851 851 copy from a
852 852 copy to c
853 853 --- a/a
854 854 +++ b/c
855 855 @@ -1,3 +1,2 @@
856 856 a
857 857 -m1
858 858 -m2
859 859 +5
860 860 diff --git a/a b/d
861 861 copy from a
862 862 copy to d
863 863 --- a/a
864 864 +++ b/d
865 865 @@ -1,3 +1,2 @@
866 866 a
867 867 -m1
868 868 -m2
869 869 +5
870 870 diff --git a/x/y b/x/y
871 871 deleted file mode 100644
872 872 --- a/x/y
873 873 +++ /dev/null
874 874 @@ -1,1 +0,0 @@
875 875 -y1
876 876
877 877 - root to parent: --rev 0 --rev .
878 878 M a
879 879 A b
880 880 a
881 881 A c
882 882 a
883 883
884 884 diff --git a/a b/a
885 885 --- a/a
886 886 +++ b/a
887 887 @@ -1,1 +1,2 @@
888 888 a
889 889 +5
890 890 diff --git a/a b/b
891 891 copy from a
892 892 copy to b
893 893 --- a/a
894 894 +++ b/b
895 895 @@ -1,1 +1,2 @@
896 896 a
897 897 +5
898 898 diff --git a/a b/c
899 899 copy from a
900 900 copy to c
901 901 --- a/a
902 902 +++ b/c
903 903 @@ -1,1 +1,2 @@
904 904 a
905 905 +5
906 906
907 907 - parent to root: --rev . --rev 0
908 908 M a
909 909 R b
910 910 R c
911 911
912 912 diff --git a/a b/a
913 913 --- a/a
914 914 +++ b/a
915 915 @@ -1,2 +1,1 @@
916 916 a
917 917 -5
918 918 diff --git a/b b/b
919 919 deleted file mode 100644
920 920 --- a/b
921 921 +++ /dev/null
922 922 @@ -1,2 +0,0 @@
923 923 -a
924 924 -5
925 925 diff --git a/c b/c
926 926 deleted file mode 100644
927 927 --- a/c
928 928 +++ /dev/null
929 929 @@ -1,2 +0,0 @@
930 930 -a
931 931 -5
932 932
933 933 - branch to parent: --rev 2 --rev .
934 934 M a
935 935 A b
936 936 a
937 937 A c
938 938 a
939 939 R x/y
940 940
941 941 diff --git a/a b/a
942 942 --- a/a
943 943 +++ b/a
944 944 @@ -1,3 +1,2 @@
945 945 a
946 946 -m1
947 947 -m2
948 948 +5
949 949 diff --git a/a b/b
950 950 copy from a
951 951 copy to b
952 952 --- a/a
953 953 +++ b/b
954 954 @@ -1,3 +1,2 @@
955 955 a
956 956 -m1
957 957 -m2
958 958 +5
959 959 diff --git a/a b/c
960 960 copy from a
961 961 copy to c
962 962 --- a/a
963 963 +++ b/c
964 964 @@ -1,3 +1,2 @@
965 965 a
966 966 -m1
967 967 -m2
968 968 +5
969 969 diff --git a/x/y b/x/y
970 970 deleted file mode 100644
971 971 --- a/x/y
972 972 +++ /dev/null
973 973 @@ -1,1 +0,0 @@
974 974 -y1
975 975
976 976 - parent to branch: --rev . --rev 2
977 977 M a
978 978 A x/y
979 979 R b
980 980 R c
981 981
982 982 diff --git a/a b/a
983 983 --- a/a
984 984 +++ b/a
985 985 @@ -1,2 +1,3 @@
986 986 a
987 987 -5
988 988 +m1
989 989 +m2
990 990 diff --git a/b b/b
991 991 deleted file mode 100644
992 992 --- a/b
993 993 +++ /dev/null
994 994 @@ -1,2 +0,0 @@
995 995 -a
996 996 -5
997 997 diff --git a/c b/c
998 998 deleted file mode 100644
999 999 --- a/c
1000 1000 +++ /dev/null
1001 1001 @@ -1,2 +0,0 @@
1002 1002 -a
1003 1003 -5
1004 1004 diff --git a/x/y b/x/y
1005 1005 new file mode 100644
1006 1006 --- /dev/null
1007 1007 +++ b/x/y
1008 1008 @@ -0,0 +1,1 @@
1009 1009 +y1
1010 1010
1011 1011
1012 1012 $ tb "add a a1" "hg mv a b" "hg mv b a" "circular rename"
1013 1013 updating to branch default
1014 1014 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1015 1015 created new head
1016 1016 ** circular rename **
1017 1017 ** add a a1 / hg mv a b / hg mv b a
1018 1018 - working to parent:
1019 1019 A a
1020 1020 b
1021 1021 R b
1022 1022
1023 1023 diff --git a/b b/a
1024 1024 rename from b
1025 1025 rename to a
1026 1026
1027 1027 - working to root: --rev 0
1028 1028 M a
1029 1029
1030 1030 diff --git a/a b/a
1031 1031 --- a/a
1032 1032 +++ b/a
1033 1033 @@ -1,1 +1,3 @@
1034 1034 a
1035 1035 +6
1036 1036 +a1
1037 1037
1038 1038 - working to branch: --rev 2
1039 1039 M a
1040 1040 R x/y
1041 1041
1042 1042 diff --git a/a b/a
1043 1043 --- a/a
1044 1044 +++ b/a
1045 1045 @@ -1,3 +1,3 @@
1046 1046 a
1047 1047 -m1
1048 1048 -m2
1049 1049 +6
1050 1050 +a1
1051 1051 diff --git a/x/y b/x/y
1052 1052 deleted file mode 100644
1053 1053 --- a/x/y
1054 1054 +++ /dev/null
1055 1055 @@ -1,1 +0,0 @@
1056 1056 -y1
1057 1057
1058 1058 - root to parent: --rev 0 --rev .
1059 1059 A b
1060 1060 a
1061 1061 R a
1062 1062
1063 1063 diff --git a/a b/b
1064 1064 rename from a
1065 1065 rename to b
1066 1066 --- a/a
1067 1067 +++ b/b
1068 1068 @@ -1,1 +1,3 @@
1069 1069 a
1070 1070 +6
1071 1071 +a1
1072 1072
1073 1073 - parent to root: --rev . --rev 0
1074 1074 A a
1075 1075 b
1076 1076 R b
1077 1077
1078 1078 diff --git a/b b/a
1079 1079 rename from b
1080 1080 rename to a
1081 1081 --- a/b
1082 1082 +++ b/a
1083 1083 @@ -1,3 +1,1 @@
1084 1084 a
1085 1085 -6
1086 1086 -a1
1087 1087
1088 1088 - branch to parent: --rev 2 --rev .
1089 1089 A b
1090 1090 a
1091 1091 R a
1092 1092 R x/y
1093 1093
1094 1094 diff --git a/a b/b
1095 1095 rename from a
1096 1096 rename to b
1097 1097 --- a/a
1098 1098 +++ b/b
1099 1099 @@ -1,3 +1,3 @@
1100 1100 a
1101 1101 -m1
1102 1102 -m2
1103 1103 +6
1104 1104 +a1
1105 1105 diff --git a/x/y b/x/y
1106 1106 deleted file mode 100644
1107 1107 --- a/x/y
1108 1108 +++ /dev/null
1109 1109 @@ -1,1 +0,0 @@
1110 1110 -y1
1111 1111
1112 1112 - parent to branch: --rev . --rev 2
1113 1113 A a
1114 1114 b
1115 1115 A x/y
1116 1116 R b
1117 1117
1118 1118 diff --git a/b b/a
1119 1119 rename from b
1120 1120 rename to a
1121 1121 --- a/b
1122 1122 +++ b/a
1123 1123 @@ -1,3 +1,3 @@
1124 1124 a
1125 1125 -6
1126 1126 -a1
1127 1127 +m1
1128 1128 +m2
1129 1129 diff --git a/x/y b/x/y
1130 1130 new file mode 100644
1131 1131 --- /dev/null
1132 1132 +++ b/x/y
1133 1133 @@ -0,0 +1,1 @@
1134 1134 +y1
1135 1135
1136 1136
1137 1137 $ tb "hg mv x y" "add y/x x1" "add y/x x2" "directory move"
1138 1138 updating to branch default
1139 1139 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1140 1140 created new head
1141 moving x/x to y/x
1141 moving x/x to y/x (glob)
1142 1142 ** directory move **
1143 1143 ** hg mv x y / add y/x x1 / add y/x x2
1144 1144 - working to parent:
1145 1145 M y/x
1146 1146
1147 1147 diff --git a/y/x b/y/x
1148 1148 --- a/y/x
1149 1149 +++ b/y/x
1150 1150 @@ -1,2 +1,3 @@
1151 1151 x
1152 1152 x1
1153 1153 +x2
1154 1154
1155 1155 - working to root: --rev 0
1156 1156 M a
1157 1157 A y/x
1158 1158 x/x
1159 1159 R x/x
1160 1160
1161 1161 diff --git a/a b/a
1162 1162 --- a/a
1163 1163 +++ b/a
1164 1164 @@ -1,1 +1,2 @@
1165 1165 a
1166 1166 +7
1167 1167 diff --git a/x/x b/y/x
1168 1168 rename from x/x
1169 1169 rename to y/x
1170 1170 --- a/x/x
1171 1171 +++ b/y/x
1172 1172 @@ -1,1 +1,3 @@
1173 1173 x
1174 1174 +x1
1175 1175 +x2
1176 1176
1177 1177 - working to branch: --rev 2
1178 1178 M a
1179 1179 A y/x
1180 1180 x/x
1181 1181 R x/x
1182 1182 R x/y
1183 1183
1184 1184 diff --git a/a b/a
1185 1185 --- a/a
1186 1186 +++ b/a
1187 1187 @@ -1,3 +1,2 @@
1188 1188 a
1189 1189 -m1
1190 1190 -m2
1191 1191 +7
1192 1192 diff --git a/x/y b/x/y
1193 1193 deleted file mode 100644
1194 1194 --- a/x/y
1195 1195 +++ /dev/null
1196 1196 @@ -1,1 +0,0 @@
1197 1197 -y1
1198 1198 diff --git a/x/x b/y/x
1199 1199 rename from x/x
1200 1200 rename to y/x
1201 1201 --- a/x/x
1202 1202 +++ b/y/x
1203 1203 @@ -1,1 +1,3 @@
1204 1204 x
1205 1205 +x1
1206 1206 +x2
1207 1207
1208 1208 - root to parent: --rev 0 --rev .
1209 1209 M a
1210 1210 A y/x
1211 1211 x/x
1212 1212 R x/x
1213 1213
1214 1214 diff --git a/a b/a
1215 1215 --- a/a
1216 1216 +++ b/a
1217 1217 @@ -1,1 +1,2 @@
1218 1218 a
1219 1219 +7
1220 1220 diff --git a/x/x b/y/x
1221 1221 rename from x/x
1222 1222 rename to y/x
1223 1223 --- a/x/x
1224 1224 +++ b/y/x
1225 1225 @@ -1,1 +1,2 @@
1226 1226 x
1227 1227 +x1
1228 1228
1229 1229 - parent to root: --rev . --rev 0
1230 1230 M a
1231 1231 A x/x
1232 1232 y/x
1233 1233 R y/x
1234 1234
1235 1235 diff --git a/a b/a
1236 1236 --- a/a
1237 1237 +++ b/a
1238 1238 @@ -1,2 +1,1 @@
1239 1239 a
1240 1240 -7
1241 1241 diff --git a/y/x b/x/x
1242 1242 rename from y/x
1243 1243 rename to x/x
1244 1244 --- a/y/x
1245 1245 +++ b/x/x
1246 1246 @@ -1,2 +1,1 @@
1247 1247 x
1248 1248 -x1
1249 1249
1250 1250 - branch to parent: --rev 2 --rev .
1251 1251 M a
1252 1252 A y/x
1253 1253 x/x
1254 1254 R x/x
1255 1255 R x/y
1256 1256
1257 1257 diff --git a/a b/a
1258 1258 --- a/a
1259 1259 +++ b/a
1260 1260 @@ -1,3 +1,2 @@
1261 1261 a
1262 1262 -m1
1263 1263 -m2
1264 1264 +7
1265 1265 diff --git a/x/y b/x/y
1266 1266 deleted file mode 100644
1267 1267 --- a/x/y
1268 1268 +++ /dev/null
1269 1269 @@ -1,1 +0,0 @@
1270 1270 -y1
1271 1271 diff --git a/x/x b/y/x
1272 1272 rename from x/x
1273 1273 rename to y/x
1274 1274 --- a/x/x
1275 1275 +++ b/y/x
1276 1276 @@ -1,1 +1,2 @@
1277 1277 x
1278 1278 +x1
1279 1279
1280 1280 - parent to branch: --rev . --rev 2
1281 1281 M a
1282 1282 A x/x
1283 1283 y/x
1284 1284 A x/y
1285 1285 R y/x
1286 1286
1287 1287 diff --git a/a b/a
1288 1288 --- a/a
1289 1289 +++ b/a
1290 1290 @@ -1,2 +1,3 @@
1291 1291 a
1292 1292 -7
1293 1293 +m1
1294 1294 +m2
1295 1295 diff --git a/y/x b/x/x
1296 1296 rename from y/x
1297 1297 rename to x/x
1298 1298 --- a/y/x
1299 1299 +++ b/x/x
1300 1300 @@ -1,2 +1,1 @@
1301 1301 x
1302 1302 -x1
1303 1303 diff --git a/x/y b/x/y
1304 1304 new file mode 100644
1305 1305 --- /dev/null
1306 1306 +++ b/x/y
1307 1307 @@ -0,0 +1,1 @@
1308 1308 +y1
1309 1309
1310 1310
1311 1311
1312 1312 Cannot implement unrelated branch with tb
1313 1313 testing copies with unrelated branch
1314 1314
1315 1315 $ hg init unrelated
1316 1316 $ cd unrelated
1317 1317 $ add a a
1318 1318 $ hg ci -Am adda
1319 1319 adding a
1320 1320 $ hg mv a b
1321 1321 $ hg ci -m movea
1322 1322 $ hg up -C null
1323 1323 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1324 1324 $ add a a
1325 1325 $ hg ci -Am addunrelateda
1326 1326 adding a
1327 1327 created new head
1328 1328
1329 1329 unrelated branch diff
1330 1330
1331 1331 $ hg diff --git -r 2 -r 1
1332 1332 diff --git a/a b/a
1333 1333 deleted file mode 100644
1334 1334 --- a/a
1335 1335 +++ /dev/null
1336 1336 @@ -1,1 +0,0 @@
1337 1337 -a
1338 1338 diff --git a/b b/b
1339 1339 new file mode 100644
1340 1340 --- /dev/null
1341 1341 +++ b/b
1342 1342 @@ -0,0 +1,1 @@
1343 1343 +a
1344 1344 $ cd ..
@@ -1,40 +1,40 b''
1 1 $ hg init a
2 2 $ cd a
3 3 $ hg init b
4 4 $ echo x > b/x
5 5
6 6 Should print nothing:
7 7
8 8 $ hg add b
9 9 $ hg st
10 10
11 11 Should fail:
12 12
13 13 $ hg st b/x
14 abort: path 'b/x' is inside nested repo 'b'
14 abort: path 'b/x' is inside nested repo 'b' (glob)
15 15 [255]
16 16 $ hg add b/x
17 abort: path 'b/x' is inside nested repo 'b'
17 abort: path 'b/x' is inside nested repo 'b' (glob)
18 18 [255]
19 19
20 20 Should fail:
21 21
22 22 $ hg add b b/x
23 abort: path 'b/x' is inside nested repo 'b'
23 abort: path 'b/x' is inside nested repo 'b' (glob)
24 24 [255]
25 25 $ hg st
26 26
27 27 Should arguably print nothing:
28 28
29 29 $ hg st b
30 30
31 31 $ echo a > a
32 32 $ hg ci -Ama a
33 33
34 34 Should fail:
35 35
36 36 $ hg mv a b
37 abort: path 'b/a' is inside nested repo 'b'
37 abort: path 'b/a' is inside nested repo 'b' (glob)
38 38 [255]
39 39 $ hg st
40 40
@@ -1,126 +1,126 b''
1 1
2 2 $ cat <<EOF >> $HGRCPATH
3 3 > [extensions]
4 4 > notify=
5 5 >
6 6 > [hooks]
7 7 > changegroup.notify = python:hgext.notify.hook
8 8 >
9 9 > [notify]
10 10 > sources = push
11 11 > diffstat = False
12 12 > maxsubject = 10
13 13 >
14 14 > [usersubs]
15 15 > foo@bar = *
16 16 >
17 17 > [reposubs]
18 18 > * = baz
19 19 > EOF
20 20 $ hg init a
21 21
22 22 clone
23 23
24 24 $ hg --traceback clone a b
25 25 updating to branch default
26 26 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 27 $ echo a > b/a
28 28
29 29 commit
30 30
31 31 $ hg --traceback --cwd b commit -Ama
32 32 adding a
33 33 $ echo a >> b/a
34 34
35 35 commit
36 36
37 37 $ hg --traceback --cwd b commit -Amb
38 38
39 39 push
40 40
41 41 $ hg --traceback --cwd b push ../a 2>&1 |
42 42 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
43 43 pushing to ../a
44 44 searching for changes
45 45 adding changesets
46 46 adding manifests
47 47 adding file changes
48 48 added 2 changesets with 2 changes to 1 files
49 49 Content-Type: text/plain; charset="us-ascii"
50 50 MIME-Version: 1.0
51 51 Content-Transfer-Encoding: 7bit
52 52 Date: * (glob)
53 53 Subject: * (glob)
54 54 From: test
55 55 X-Hg-Notification: changeset cb9a9f314b8b
56 56 Message-Id: <*> (glob)
57 57 To: baz, foo@bar
58 58
59 changeset cb9a9f314b8b in $TESTTMP/a
59 changeset cb9a9f314b8b in $TESTTMP/a (glob)
60 60 details: $TESTTMP/a?cmd=changeset;node=cb9a9f314b8b
61 61 summary: a
62 62
63 changeset ba677d0156c1 in $TESTTMP/a
63 changeset ba677d0156c1 in $TESTTMP/a (glob)
64 64 details: $TESTTMP/a?cmd=changeset;node=ba677d0156c1
65 65 summary: b
66 66
67 67 diffs (6 lines):
68 68
69 69 diff -r 000000000000 -r ba677d0156c1 a
70 70 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
71 71 +++ b/a Thu Jan 01 00:00:00 1970 +0000
72 72 @@ -0,0 +1,2 @@
73 73 +a
74 74 +a
75 75 $ hg --cwd a rollback
76 76 repository tip rolled back to revision -1 (undo push)
77 77
78 78 unbundle with unrelated source
79 79
80 80 $ hg --cwd b bundle ../test.hg ../a
81 81 searching for changes
82 82 2 changesets found
83 83 $ hg --cwd a unbundle ../test.hg
84 84 adding changesets
85 85 adding manifests
86 86 adding file changes
87 87 added 2 changesets with 2 changes to 1 files
88 88 (run 'hg update' to get a working copy)
89 89 $ hg --cwd a rollback
90 90 repository tip rolled back to revision -1 (undo unbundle)
91 91
92 92 unbundle with correct source
93 93
94 94 $ hg --config notify.sources=unbundle --cwd a unbundle ../test.hg 2>&1 |
95 95 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
96 96 adding changesets
97 97 adding manifests
98 98 adding file changes
99 99 added 2 changesets with 2 changes to 1 files
100 100 Content-Type: text/plain; charset="us-ascii"
101 101 MIME-Version: 1.0
102 102 Content-Transfer-Encoding: 7bit
103 103 Date: * (glob)
104 104 Subject: * (glob)
105 105 From: test
106 106 X-Hg-Notification: changeset cb9a9f314b8b
107 107 Message-Id: <*> (glob)
108 108 To: baz, foo@bar
109 109
110 changeset cb9a9f314b8b in $TESTTMP/a
110 changeset cb9a9f314b8b in $TESTTMP/a (glob)
111 111 details: $TESTTMP/a?cmd=changeset;node=cb9a9f314b8b
112 112 summary: a
113 113
114 changeset ba677d0156c1 in $TESTTMP/a
114 changeset ba677d0156c1 in $TESTTMP/a (glob)
115 115 details: $TESTTMP/a?cmd=changeset;node=ba677d0156c1
116 116 summary: b
117 117
118 118 diffs (6 lines):
119 119
120 120 diff -r 000000000000 -r ba677d0156c1 a
121 121 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
122 122 +++ b/a Thu Jan 01 00:00:00 1970 +0000
123 123 @@ -0,0 +1,2 @@
124 124 +a
125 125 +a
126 126 (run 'hg update' to get a working copy)
@@ -1,397 +1,397 b''
1 1
2 2 $ cat <<EOF >> $HGRCPATH
3 3 > [extensions]
4 4 > notify=
5 5 >
6 6 > [hooks]
7 7 > incoming.notify = python:hgext.notify.hook
8 8 >
9 9 > [notify]
10 10 > sources = pull
11 11 > diffstat = False
12 12 >
13 13 > [usersubs]
14 14 > foo@bar = *
15 15 >
16 16 > [reposubs]
17 17 > * = baz
18 18 > EOF
19 19 $ hg help notify
20 20 notify extension - hooks for sending email push notifications
21 21
22 22 This extension let you run hooks sending email notifications when changesets
23 23 are being pushed, from the sending or receiving side.
24 24
25 25 First, enable the extension as explained in "hg help extensions", and register
26 26 the hook you want to run. "incoming" and "outgoing" hooks are run by the
27 27 changesets receiver while the "outgoing" one is for the sender:
28 28
29 29 [hooks]
30 30 # one email for each incoming changeset
31 31 incoming.notify = python:hgext.notify.hook
32 32 # one email for all incoming changesets
33 33 changegroup.notify = python:hgext.notify.hook
34 34
35 35 # one email for all outgoing changesets
36 36 outgoing.notify = python:hgext.notify.hook
37 37
38 38 Now the hooks are running, subscribers must be assigned to repositories. Use
39 39 the "[usersubs]" section to map repositories to a given email or the
40 40 "[reposubs]" section to map emails to a single repository:
41 41
42 42 [usersubs]
43 43 # key is subscriber email, value is a comma-separated list of glob
44 44 # patterns
45 45 user@host = pattern
46 46
47 47 [reposubs]
48 48 # key is glob pattern, value is a comma-separated list of subscriber
49 49 # emails
50 50 pattern = user@host
51 51
52 52 Glob patterns are matched against absolute path to repository root. The
53 53 subscriptions can be defined in their own file and referenced with:
54 54
55 55 [notify]
56 56 config = /path/to/subscriptionsfile
57 57
58 58 Alternatively, they can be added to Mercurial configuration files by setting
59 59 the previous entry to an empty value.
60 60
61 61 At this point, notifications should be generated but will not be sent until
62 62 you set the "notify.test" entry to "False".
63 63
64 64 Notifications content can be tweaked with the following configuration entries:
65 65
66 66 notify.test
67 67 If "True", print messages to stdout instead of sending them. Default: True.
68 68
69 69 notify.sources
70 70 Space separated list of change sources. Notifications are sent only if it
71 71 includes the incoming or outgoing changes source. Incoming sources can be
72 72 "serve" for changes coming from http or ssh, "pull" for pulled changes,
73 73 "unbundle" for changes added by "hg unbundle" or "push" for changes being
74 74 pushed locally. Outgoing sources are the same except for "unbundle" which is
75 75 replaced by "bundle". Default: serve.
76 76
77 77 notify.strip
78 78 Number of leading slashes to strip from url paths. By default, notifications
79 79 references repositories with their absolute path. "notify.strip" let you
80 80 turn them into relative paths. For example, "notify.strip=3" will change
81 81 "/long/path/repository" into "repository". Default: 0.
82 82
83 83 notify.domain
84 84 If subscribers emails or the from email have no domain set, complete them
85 85 with this value.
86 86
87 87 notify.style
88 88 Style file to use when formatting emails.
89 89
90 90 notify.template
91 91 Template to use when formatting emails.
92 92
93 93 notify.incoming
94 94 Template to use when run as incoming hook, override "notify.template".
95 95
96 96 notify.outgoing
97 97 Template to use when run as outgoing hook, override "notify.template".
98 98
99 99 notify.changegroup
100 100 Template to use when running as changegroup hook, override
101 101 "notify.template".
102 102
103 103 notify.maxdiff
104 104 Maximum number of diff lines to include in notification email. Set to 0 to
105 105 disable the diff, -1 to include all of it. Default: 300.
106 106
107 107 notify.maxsubject
108 108 Maximum number of characters in emails subject line. Default: 67.
109 109
110 110 notify.diffstat
111 111 Set to True to include a diffstat before diff content. Default: True.
112 112
113 113 notify.merge
114 114 If True, send notifications for merge changesets. Default: True.
115 115
116 116 If set, the following entries will also be used to customize the
117 117 notifications:
118 118
119 119 email.from
120 120 Email "From" address to use if none can be found in generated email content.
121 121
122 122 web.baseurl
123 123 Root repository browsing URL to combine with repository paths when making
124 124 references. See also "notify.strip".
125 125
126 126 no commands defined
127 127 $ hg init a
128 128 $ echo a > a/a
129 129
130 130 commit
131 131
132 132 $ hg --cwd a commit -Ama -d '0 0'
133 133 adding a
134 134
135 135
136 136 clone
137 137
138 138 $ hg --traceback clone a b
139 139 updating to branch default
140 140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 141 $ echo a >> a/a
142 142
143 143 commit
144 144
145 145 $ hg --traceback --cwd a commit -Amb -d '1 0'
146 146
147 147 on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line
148 148
149 149 $ cat <<EOF >> $HGRCPATH
150 150 > [notify]
151 151 > maxsubject = 200
152 152 > EOF
153 153
154 154 the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
155 155 of the very long subject line
156 156 pull (minimal config)
157 157
158 158 $ hg --traceback --cwd b pull ../a | \
159 159 > python -c 'import sys,re; print re.sub("\n[\t ]", " ", sys.stdin.read()),'
160 160 pulling from ../a
161 161 searching for changes
162 162 adding changesets
163 163 adding manifests
164 164 adding file changes
165 165 added 1 changesets with 1 changes to 1 files
166 166 Content-Type: text/plain; charset="us-ascii"
167 167 MIME-Version: 1.0
168 168 Content-Transfer-Encoding: 7bit
169 169 Date: * (glob)
170 170 Subject: changeset in $TESTTMP/b: b
171 171 From: test
172 172 X-Hg-Notification: changeset 0647d048b600
173 173 Message-Id: <*> (glob)
174 174 To: baz, foo@bar
175 175
176 changeset 0647d048b600 in $TESTTMP/b
176 changeset 0647d048b600 in $TESTTMP/b (glob)
177 177 details: $TESTTMP/b?cmd=changeset;node=0647d048b600
178 178 description: b
179 179
180 180 diffs (6 lines):
181 181
182 182 diff -r cb9a9f314b8b -r 0647d048b600 a
183 183 --- a/a Thu Jan 01 00:00:00 1970 +0000
184 184 +++ b/a Thu Jan 01 00:00:01 1970 +0000
185 185 @@ -1,1 +1,2 @@ a
186 186 +a
187 187 (run 'hg update' to get a working copy)
188 188 $ cat <<EOF >> $HGRCPATH
189 189 > [notify]
190 190 > config = `pwd`/.notify.conf
191 191 > domain = test.com
192 192 > strip = 42
193 193 > template = Subject: {desc|firstline|strip}\nFrom: {author}\nX-Test: foo\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip}
194 194 >
195 195 > [web]
196 196 > baseurl = http://test/
197 197 > EOF
198 198
199 199 fail for config file is missing
200 200
201 201 $ hg --cwd b rollback
202 202 repository tip rolled back to revision 0 (undo pull)
203 203 $ hg --cwd b pull ../a 2>&1 | grep 'error.*\.notify\.conf' > /dev/null && echo pull failed
204 204 pull failed
205 205 $ touch ".notify.conf"
206 206
207 207 pull
208 208
209 209 $ hg --cwd b rollback
210 210 repository tip rolled back to revision 0 (undo pull)
211 211 $ hg --traceback --cwd b pull ../a | \
212 212 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
213 213 pulling from ../a
214 214 searching for changes
215 215 adding changesets
216 216 adding manifests
217 217 adding file changes
218 218 added 1 changesets with 1 changes to 1 files
219 219 Content-Type: text/plain; charset="us-ascii"
220 220 MIME-Version: 1.0
221 221 Content-Transfer-Encoding: 7bit
222 222 X-Test: foo
223 223 Date: * (glob)
224 224 Subject: b
225 225 From: test@test.com
226 226 X-Hg-Notification: changeset 0647d048b600
227 227 Message-Id: <*> (glob)
228 228 To: baz@test.com, foo@bar
229 229
230 230 changeset 0647d048b600 in b
231 231 description: b
232 232 diffs (6 lines):
233 233
234 234 diff -r cb9a9f314b8b -r 0647d048b600 a
235 235 --- a/a Thu Jan 01 00:00:00 1970 +0000
236 236 +++ b/a Thu Jan 01 00:00:01 1970 +0000
237 237 @@ -1,1 +1,2 @@
238 238 a
239 239 +a
240 240 (run 'hg update' to get a working copy)
241 241
242 242 $ cat << EOF >> $HGRCPATH
243 243 > [hooks]
244 244 > incoming.notify = python:hgext.notify.hook
245 245 >
246 246 > [notify]
247 247 > sources = pull
248 248 > diffstat = True
249 249 > EOF
250 250
251 251 pull
252 252
253 253 $ hg --cwd b rollback
254 254 repository tip rolled back to revision 0 (undo pull)
255 255 $ hg --traceback --cwd b pull ../a | \
256 256 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
257 257 pulling from ../a
258 258 searching for changes
259 259 adding changesets
260 260 adding manifests
261 261 adding file changes
262 262 added 1 changesets with 1 changes to 1 files
263 263 Content-Type: text/plain; charset="us-ascii"
264 264 MIME-Version: 1.0
265 265 Content-Transfer-Encoding: 7bit
266 266 X-Test: foo
267 267 Date: * (glob)
268 268 Subject: b
269 269 From: test@test.com
270 270 X-Hg-Notification: changeset 0647d048b600
271 271 Message-Id: <*> (glob)
272 272 To: baz@test.com, foo@bar
273 273
274 274 changeset 0647d048b600 in b
275 275 description: b
276 276 diffstat:
277 277
278 278 a | 1 +
279 279 1 files changed, 1 insertions(+), 0 deletions(-)
280 280
281 281 diffs (6 lines):
282 282
283 283 diff -r cb9a9f314b8b -r 0647d048b600 a
284 284 --- a/a Thu Jan 01 00:00:00 1970 +0000
285 285 +++ b/a Thu Jan 01 00:00:01 1970 +0000
286 286 @@ -1,1 +1,2 @@
287 287 a
288 288 +a
289 289 (run 'hg update' to get a working copy)
290 290
291 291 test merge
292 292
293 293 $ cd a
294 294 $ hg up -C 0
295 295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 296 $ echo a >> a
297 297 $ hg ci -Am adda2 -d '2 0'
298 298 created new head
299 299 $ hg merge
300 300 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
301 301 (branch merge, don't forget to commit)
302 302 $ hg ci -m merge -d '3 0'
303 303 $ cd ..
304 304 $ hg --traceback --cwd b pull ../a | \
305 305 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
306 306 pulling from ../a
307 307 searching for changes
308 308 adding changesets
309 309 adding manifests
310 310 adding file changes
311 311 added 2 changesets with 0 changes to 0 files
312 312 Content-Type: text/plain; charset="us-ascii"
313 313 MIME-Version: 1.0
314 314 Content-Transfer-Encoding: 7bit
315 315 X-Test: foo
316 316 Date: * (glob)
317 317 Subject: adda2
318 318 From: test@test.com
319 319 X-Hg-Notification: changeset 0a184ce6067f
320 320 Message-Id: <*> (glob)
321 321 To: baz@test.com, foo@bar
322 322
323 323 changeset 0a184ce6067f in b
324 324 description: adda2
325 325 diffstat:
326 326
327 327 a | 1 +
328 328 1 files changed, 1 insertions(+), 0 deletions(-)
329 329
330 330 diffs (6 lines):
331 331
332 332 diff -r cb9a9f314b8b -r 0a184ce6067f a
333 333 --- a/a Thu Jan 01 00:00:00 1970 +0000
334 334 +++ b/a Thu Jan 01 00:00:02 1970 +0000
335 335 @@ -1,1 +1,2 @@
336 336 a
337 337 +a
338 338 Content-Type: text/plain; charset="us-ascii"
339 339 MIME-Version: 1.0
340 340 Content-Transfer-Encoding: 7bit
341 341 X-Test: foo
342 342 Date: * (glob)
343 343 Subject: merge
344 344 From: test@test.com
345 345 X-Hg-Notification: changeset 6a0cf76b2701
346 346 Message-Id: <*> (glob)
347 347 To: baz@test.com, foo@bar
348 348
349 349 changeset 6a0cf76b2701 in b
350 350 description: merge
351 351 (run 'hg update' to get a working copy)
352 352
353 353 truncate multi-byte subject
354 354
355 355 $ cat <<EOF >> $HGRCPATH
356 356 > [notify]
357 357 > maxsubject = 4
358 358 > EOF
359 359 $ echo a >> a/a
360 360 $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \
361 361 > -m `python -c 'print "\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4"'`
362 362 $ hg --traceback --cwd b --encoding utf-8 pull ../a | \
363 363 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
364 364 pulling from ../a
365 365 searching for changes
366 366 adding changesets
367 367 adding manifests
368 368 adding file changes
369 369 added 1 changesets with 1 changes to 1 files
370 370 Content-Type: text/plain; charset="us-ascii"
371 371 MIME-Version: 1.0
372 372 Content-Transfer-Encoding: 8bit
373 373 X-Test: foo
374 374 Date: * (glob)
375 375 Subject: \xc3\xa0... (esc)
376 376 From: test@test.com
377 377 X-Hg-Notification: changeset 7ea05ad269dc
378 378 Message-Id: <*> (glob)
379 379 To: baz@test.com, foo@bar
380 380
381 381 changeset 7ea05ad269dc in b
382 382 description: \xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4 (esc)
383 383 diffstat:
384 384
385 385 a | 1 +
386 386 1 files changed, 1 insertions(+), 0 deletions(-)
387 387
388 388 diffs (7 lines):
389 389
390 390 diff -r 6a0cf76b2701 -r 7ea05ad269dc a
391 391 --- a/a Thu Jan 01 00:00:03 1970 +0000
392 392 +++ b/a Thu Jan 01 00:00:00 1970 +0000
393 393 @@ -1,2 +1,3 @@
394 394 a
395 395 a
396 396 +a
397 397 (run 'hg update' to get a working copy)
@@ -1,58 +1,58 b''
1 1 $ hg init a
2 2 $ hg clone a b
3 3 updating to branch default
4 4 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
5 5 $ cd a
6 6 $ echo '[paths]' >> .hg/hgrc
7 7 $ echo 'dupe = ../b' >> .hg/hgrc
8 8 $ echo 'expand = $SOMETHING/bar' >> .hg/hgrc
9 9 $ hg in dupe
10 comparing with $TESTTMP/b
10 comparing with $TESTTMP/b (glob)
11 11 no changes found
12 12 [1]
13 13 $ cd ..
14 14 $ hg -R a in dupe
15 comparing with $TESTTMP/b
15 comparing with $TESTTMP/b (glob)
16 16 no changes found
17 17 [1]
18 18 $ cd a
19 19 $ hg paths
20 dupe = $TESTTMP/b
21 expand = $TESTTMP/a/$SOMETHING/bar
20 dupe = $TESTTMP/b (glob)
21 expand = $TESTTMP/a/$SOMETHING/bar (glob)
22 22 $ SOMETHING=foo hg paths
23 dupe = $TESTTMP/b
24 expand = $TESTTMP/a/foo/bar
23 dupe = $TESTTMP/b (glob)
24 expand = $TESTTMP/a/foo/bar (glob)
25 25 $ SOMETHING=/foo hg paths
26 dupe = $TESTTMP/b
26 dupe = $TESTTMP/b (glob)
27 27 expand = /foo/bar
28 28 $ hg paths -q
29 29 dupe
30 30 expand
31 31 $ hg paths dupe
32 $TESTTMP/b
32 $TESTTMP/b (glob)
33 33 $ hg paths -q dupe
34 34 $ hg paths unknown
35 35 not found!
36 36 [1]
37 37 $ hg paths -q unknown
38 38 [1]
39 39 $ cd ..
40 40
41 41 'file:' disables [paths] entries for clone destination
42 42
43 43 $ cat >> $HGRCPATH <<EOF
44 44 > [paths]
45 45 > gpath1 = http://hg.example.com
46 46 > EOF
47 47
48 48 $ hg clone a gpath1
49 49 abort: cannot create new http repository
50 50 [255]
51 51
52 52 $ hg clone a file:gpath1
53 53 updating to branch default
54 54 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 55 $ cd gpath1
56 56 $ hg -q id
57 57 000000000000
58 58
@@ -1,103 +1,103 b''
1 1 $ hg init repo
2 2 $ cd repo
3 3 $ echo foo > foo
4 4 $ hg ci -qAm 'add foo'
5 5 $ echo >> foo
6 6 $ hg ci -m 'change foo'
7 7 $ hg up -qC 0
8 8 $ echo bar > bar
9 9 $ hg ci -qAm 'add bar'
10 10
11 11 $ hg log
12 12 changeset: 2:effea6de0384
13 13 tag: tip
14 14 parent: 0:bbd179dfa0a7
15 15 user: test
16 16 date: Thu Jan 01 00:00:00 1970 +0000
17 17 summary: add bar
18 18
19 19 changeset: 1:ed1b79f46b9a
20 20 user: test
21 21 date: Thu Jan 01 00:00:00 1970 +0000
22 22 summary: change foo
23 23
24 24 changeset: 0:bbd179dfa0a7
25 25 user: test
26 26 date: Thu Jan 01 00:00:00 1970 +0000
27 27 summary: add foo
28 28
29 29 $ cd ..
30 30
31 31 don't show "(+1 heads)" message when pulling closed head
32 32
33 33 $ hg clone -q repo repo2
34 34 $ hg clone -q repo2 repo3
35 35 $ cd repo2
36 36 $ hg up -q 0
37 37 $ echo hello >> foo
38 38 $ hg ci -mx1
39 39 created new head
40 40 $ hg ci -mx2 --close-branch
41 41 $ cd ../repo3
42 42 $ hg heads -q --closed
43 43 2:effea6de0384
44 44 1:ed1b79f46b9a
45 45 $ hg pull
46 pulling from $TESTTMP/repo2
46 pulling from $TESTTMP/repo2 (glob)
47 47 searching for changes
48 48 adding changesets
49 49 adding manifests
50 50 adding file changes
51 51 added 2 changesets with 1 changes to 1 files
52 52 (run 'hg update' to get a working copy)
53 53 $ hg heads -q --closed
54 54 4:00cfe9073916
55 55 2:effea6de0384
56 56 1:ed1b79f46b9a
57 57
58 58 $ cd ..
59 59
60 60 $ hg init copy
61 61 $ cd copy
62 62
63 63 Pull a missing revision:
64 64
65 65 $ hg pull -qr missing ../repo
66 66 abort: unknown revision 'missing'!
67 67 [255]
68 68
69 69 Pull multiple revisions with update:
70 70
71 71 $ hg pull -qu -r 0 -r 1 ../repo
72 72 $ hg -q parents
73 73 0:bbd179dfa0a7
74 74 $ hg rollback
75 75 repository tip rolled back to revision -1 (undo pull)
76 76 working directory now based on revision -1
77 77
78 78 $ hg pull -qr 0 ../repo
79 79 $ hg log
80 80 changeset: 0:bbd179dfa0a7
81 81 tag: tip
82 82 user: test
83 83 date: Thu Jan 01 00:00:00 1970 +0000
84 84 summary: add foo
85 85
86 86 $ hg pull -qr 1 ../repo
87 87 $ hg log
88 88 changeset: 1:ed1b79f46b9a
89 89 tag: tip
90 90 user: test
91 91 date: Thu Jan 01 00:00:00 1970 +0000
92 92 summary: change foo
93 93
94 94 changeset: 0:bbd179dfa0a7
95 95 user: test
96 96 date: Thu Jan 01 00:00:00 1970 +0000
97 97 summary: add foo
98 98
99 99
100 100 This used to abort: received changelog group is empty:
101 101
102 102 $ hg pull -qr 1 ../repo
103 103
@@ -1,52 +1,52 b''
1 1 $ hg init test
2 2 $ cd test
3 3
4 4 $ cat > .hg/hgrc <<EOF
5 5 > [server]
6 6 > validate=1
7 7 > EOF
8 8
9 9 $ echo alpha > alpha
10 10 $ echo beta > beta
11 11 $ hg addr
12 12 adding alpha
13 13 adding beta
14 14 $ hg ci -m 1
15 15
16 16 $ cd ..
17 17 $ hg clone test test-clone
18 18 updating to branch default
19 19 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 20
21 21 $ cd test-clone
22 22 $ cp .hg/store/data/beta.i tmp
23 23 $ echo blah >> beta
24 24 $ hg ci -m '2 (corrupt)'
25 25 $ mv tmp .hg/store/data/beta.i
26 26
27 27 Expected to fail:
28 28
29 29 $ hg verify
30 30 checking changesets
31 31 checking manifests
32 32 crosschecking files in changesets and manifests
33 33 checking files
34 34 beta@1: dddc47b3ba30 in manifests not found
35 35 2 files, 2 changesets, 2 total revisions
36 36 1 integrity errors encountered!
37 37 (first damaged changeset appears to be 1)
38 38 [1]
39 39
40 40 Expected to fail:
41 41
42 42 $ hg push
43 pushing to $TESTTMP/test
43 pushing to $TESTTMP/test (glob)
44 44 searching for changes
45 45 adding changesets
46 46 adding manifests
47 47 adding file changes
48 48 transaction abort!
49 49 rollback completed
50 50 abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify
51 51 [255]
52 52
@@ -1,305 +1,305 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > graphlog=
4 4 > rebase=
5 5 >
6 6 > [alias]
7 7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 8 > EOF
9 9
10 10
11 11 $ hg init a
12 12 $ cd a
13 13 $ hg unbundle $TESTDIR/bundles/rebase.hg
14 14 adding changesets
15 15 adding manifests
16 16 adding file changes
17 17 added 8 changesets with 7 changes to 7 files (+2 heads)
18 18 (run 'hg heads' to see heads, 'hg merge' to merge)
19 19 $ hg up tip
20 20 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
21 21
22 22 $ cd ..
23 23
24 24
25 25 Rebasing D onto H detaching from C:
26 26
27 27 $ hg clone -q -u . a a1
28 28 $ cd a1
29 29
30 30 $ hg tglog
31 31 @ 7: 'H'
32 32 |
33 33 | o 6: 'G'
34 34 |/|
35 35 o | 5: 'F'
36 36 | |
37 37 | o 4: 'E'
38 38 |/
39 39 | o 3: 'D'
40 40 | |
41 41 | o 2: 'C'
42 42 | |
43 43 | o 1: 'B'
44 44 |/
45 45 o 0: 'A'
46 46
47 47 $ hg rebase --detach -s 3 -d 7
48 48 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
49 49
50 50 $ hg tglog
51 51 @ 7: 'D'
52 52 |
53 53 o 6: 'H'
54 54 |
55 55 | o 5: 'G'
56 56 |/|
57 57 o | 4: 'F'
58 58 | |
59 59 | o 3: 'E'
60 60 |/
61 61 | o 2: 'C'
62 62 | |
63 63 | o 1: 'B'
64 64 |/
65 65 o 0: 'A'
66 66
67 67 $ hg manifest
68 68 A
69 69 D
70 70 F
71 71 H
72 72
73 73 $ cd ..
74 74
75 75
76 76 Rebasing C onto H detaching from B:
77 77
78 78 $ hg clone -q -u . a a2
79 79 $ cd a2
80 80
81 81 $ hg tglog
82 82 @ 7: 'H'
83 83 |
84 84 | o 6: 'G'
85 85 |/|
86 86 o | 5: 'F'
87 87 | |
88 88 | o 4: 'E'
89 89 |/
90 90 | o 3: 'D'
91 91 | |
92 92 | o 2: 'C'
93 93 | |
94 94 | o 1: 'B'
95 95 |/
96 96 o 0: 'A'
97 97
98 98 $ hg rebase --detach -s 2 -d 7
99 99 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/*-backup.hg (glob)
100 100
101 101 $ hg tglog
102 102 @ 7: 'D'
103 103 |
104 104 o 6: 'C'
105 105 |
106 106 o 5: 'H'
107 107 |
108 108 | o 4: 'G'
109 109 |/|
110 110 o | 3: 'F'
111 111 | |
112 112 | o 2: 'E'
113 113 |/
114 114 | o 1: 'B'
115 115 |/
116 116 o 0: 'A'
117 117
118 118 $ hg manifest
119 119 A
120 120 C
121 121 D
122 122 F
123 123 H
124 124
125 125 $ cd ..
126 126
127 127
128 128 Rebasing B onto H using detach (same as not using it):
129 129
130 130 $ hg clone -q -u . a a3
131 131 $ cd a3
132 132
133 133 $ hg tglog
134 134 @ 7: 'H'
135 135 |
136 136 | o 6: 'G'
137 137 |/|
138 138 o | 5: 'F'
139 139 | |
140 140 | o 4: 'E'
141 141 |/
142 142 | o 3: 'D'
143 143 | |
144 144 | o 2: 'C'
145 145 | |
146 146 | o 1: 'B'
147 147 |/
148 148 o 0: 'A'
149 149
150 150 $ hg rebase --detach -s 1 -d 7
151 151 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob)
152 152
153 153 $ hg tglog
154 154 @ 7: 'D'
155 155 |
156 156 o 6: 'C'
157 157 |
158 158 o 5: 'B'
159 159 |
160 160 o 4: 'H'
161 161 |
162 162 | o 3: 'G'
163 163 |/|
164 164 o | 2: 'F'
165 165 | |
166 166 | o 1: 'E'
167 167 |/
168 168 o 0: 'A'
169 169
170 170 $ hg manifest
171 171 A
172 172 B
173 173 C
174 174 D
175 175 F
176 176 H
177 177
178 178 $ cd ..
179 179
180 180
181 181 Rebasing C onto H detaching from B and collapsing:
182 182
183 183 $ hg clone -q -u . a a4
184 184 $ cd a4
185 185
186 186 $ hg tglog
187 187 @ 7: 'H'
188 188 |
189 189 | o 6: 'G'
190 190 |/|
191 191 o | 5: 'F'
192 192 | |
193 193 | o 4: 'E'
194 194 |/
195 195 | o 3: 'D'
196 196 | |
197 197 | o 2: 'C'
198 198 | |
199 199 | o 1: 'B'
200 200 |/
201 201 o 0: 'A'
202 202
203 203 $ hg rebase --detach --collapse -s 2 -d 7
204 204 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/*-backup.hg (glob)
205 205
206 206 $ hg tglog
207 207 @ 6: 'Collapsed revision
208 208 | * C
209 209 | * D'
210 210 o 5: 'H'
211 211 |
212 212 | o 4: 'G'
213 213 |/|
214 214 o | 3: 'F'
215 215 | |
216 216 | o 2: 'E'
217 217 |/
218 218 | o 1: 'B'
219 219 |/
220 220 o 0: 'A'
221 221
222 222 $ hg manifest
223 223 A
224 224 C
225 225 D
226 226 F
227 227 H
228 228
229 229 $ cd ..
230 230
231 231 Rebasing across null as ancestor
232 232 $ hg clone -q -U a a5
233 233
234 234 $ cd a5
235 235
236 236 $ echo x > x
237 237
238 238 $ hg add x
239 239
240 240 $ hg ci -m "extra branch"
241 241 created new head
242 242
243 243 $ hg tglog
244 244 @ 8: 'extra branch'
245 245
246 246 o 7: 'H'
247 247 |
248 248 | o 6: 'G'
249 249 |/|
250 250 o | 5: 'F'
251 251 | |
252 252 | o 4: 'E'
253 253 |/
254 254 | o 3: 'D'
255 255 | |
256 256 | o 2: 'C'
257 257 | |
258 258 | o 1: 'B'
259 259 |/
260 260 o 0: 'A'
261 261
262 262 $ hg rebase --detach -s 1 -d tip
263 263 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/*-backup.hg (glob)
264 264
265 265 $ hg tglog
266 266 @ 8: 'D'
267 267 |
268 268 o 7: 'C'
269 269 |
270 270 o 6: 'B'
271 271 |
272 272 o 5: 'extra branch'
273 273
274 274 o 4: 'H'
275 275 |
276 276 | o 3: 'G'
277 277 |/|
278 278 o | 2: 'F'
279 279 | |
280 280 | o 1: 'E'
281 281 |/
282 282 o 0: 'A'
283 283
284 284
285 285 $ hg rebase -d 5 -s 7
286 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/13547172c9c0-backup.hg
286 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/13547172c9c0-backup.hg (glob)
287 287 $ hg tglog
288 288 @ 8: 'D'
289 289 |
290 290 o 7: 'C'
291 291 |
292 292 | o 6: 'B'
293 293 |/
294 294 o 5: 'extra branch'
295 295
296 296 o 4: 'H'
297 297 |
298 298 | o 3: 'G'
299 299 |/|
300 300 o | 2: 'F'
301 301 | |
302 302 | o 1: 'E'
303 303 |/
304 304 o 0: 'A'
305 305
@@ -1,113 +1,113 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > graphlog=
4 4 > rebase=
5 5 >
6 6 > [alias]
7 7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 8 > EOF
9 9
10 10
11 11 $ hg init a
12 12 $ cd a
13 13
14 14 $ echo C1 > C1
15 15 $ hg ci -Am C1
16 16 adding C1
17 17
18 18 $ echo C2 > C2
19 19 $ hg ci -Am C2
20 20 adding C2
21 21
22 22 $ cd ..
23 23
24 24 $ hg clone a b
25 25 updating to branch default
26 26 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 27
28 28 $ hg clone a c
29 29 updating to branch default
30 30 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 31
32 32 $ cd b
33 33
34 34 $ echo L1 > L1
35 35 $ hg ci -Am L1
36 36 adding L1
37 37
38 38
39 39 $ cd ../a
40 40
41 41 $ echo R1 > R1
42 42 $ hg ci -Am R1
43 43 adding R1
44 44
45 45
46 46 $ cd ../b
47 47
48 48 Now b has one revision to be pulled from a:
49 49
50 50 $ hg pull --rebase
51 pulling from $TESTTMP/a
51 pulling from $TESTTMP/a (glob)
52 52 searching for changes
53 53 adding changesets
54 54 adding manifests
55 55 adding file changes
56 56 added 1 changesets with 1 changes to 1 files (+1 heads)
57 57 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
58 58
59 59 $ hg tglog
60 60 @ 3: 'L1'
61 61 |
62 62 o 2: 'R1'
63 63 |
64 64 o 1: 'C2'
65 65 |
66 66 o 0: 'C1'
67 67
68 68 Re-run:
69 69
70 70 $ hg pull --rebase
71 pulling from $TESTTMP/a
71 pulling from $TESTTMP/a (glob)
72 72 searching for changes
73 73 no changes found
74 74
75 75
76 76 Invoke pull --rebase and nothing to rebase:
77 77
78 78 $ cd ../c
79 79
80 80 $ hg pull --rebase
81 pulling from $TESTTMP/a
81 pulling from $TESTTMP/a (glob)
82 82 searching for changes
83 83 adding changesets
84 84 adding manifests
85 85 adding file changes
86 86 added 1 changesets with 1 changes to 1 files
87 87 nothing to rebase
88 88 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 89
90 90 $ hg tglog -l 1
91 91 @ 2: 'R1'
92 92 |
93 93
94 94 pull --rebase --update should ignore --update:
95 95
96 96 $ hg pull --rebase --update
97 pulling from $TESTTMP/a
97 pulling from $TESTTMP/a (glob)
98 98 searching for changes
99 99 no changes found
100 100
101 101 pull --rebase doesn't update if nothing has been pulled:
102 102
103 103 $ hg up -q 1
104 104
105 105 $ hg pull --rebase
106 pulling from $TESTTMP/a
106 pulling from $TESTTMP/a (glob)
107 107 searching for changes
108 108 no changes found
109 109
110 110 $ hg tglog -l 1
111 111 o 2: 'R1'
112 112 |
113 113
@@ -1,508 +1,508 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > graphlog=
4 4 > rebase=
5 5 >
6 6 > [alias]
7 7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 8 > EOF
9 9
10 10
11 11 $ hg init a
12 12 $ cd a
13 13 $ hg unbundle $TESTDIR/bundles/rebase.hg
14 14 adding changesets
15 15 adding manifests
16 16 adding file changes
17 17 added 8 changesets with 7 changes to 7 files (+2 heads)
18 18 (run 'hg heads' to see heads, 'hg merge' to merge)
19 19 $ hg up tip
20 20 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
21 21 $ cd ..
22 22
23 23
24 24 Rebasing
25 25 D onto H - simple rebase:
26 26
27 27 $ hg clone -q -u . a a1
28 28 $ cd a1
29 29
30 30 $ hg tglog
31 31 @ 7: 'H'
32 32 |
33 33 | o 6: 'G'
34 34 |/|
35 35 o | 5: 'F'
36 36 | |
37 37 | o 4: 'E'
38 38 |/
39 39 | o 3: 'D'
40 40 | |
41 41 | o 2: 'C'
42 42 | |
43 43 | o 1: 'B'
44 44 |/
45 45 o 0: 'A'
46 46
47 47
48 48 $ hg rebase -s 3 -d 7
49 49 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
50 50
51 51 $ hg tglog
52 52 @ 7: 'D'
53 53 |\
54 54 | o 6: 'H'
55 55 | |
56 56 | | o 5: 'G'
57 57 | |/|
58 58 | o | 4: 'F'
59 59 | | |
60 60 | | o 3: 'E'
61 61 | |/
62 62 o | 2: 'C'
63 63 | |
64 64 o | 1: 'B'
65 65 |/
66 66 o 0: 'A'
67 67
68 68 $ cd ..
69 69
70 70
71 71 D onto F - intermediate point:
72 72
73 73 $ hg clone -q -u . a a2
74 74 $ cd a2
75 75
76 76 $ hg rebase -s 3 -d 5
77 77 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/*-backup.hg (glob)
78 78
79 79 $ hg tglog
80 80 @ 7: 'D'
81 81 |\
82 82 | | o 6: 'H'
83 83 | |/
84 84 | | o 5: 'G'
85 85 | |/|
86 86 | o | 4: 'F'
87 87 | | |
88 88 | | o 3: 'E'
89 89 | |/
90 90 o | 2: 'C'
91 91 | |
92 92 o | 1: 'B'
93 93 |/
94 94 o 0: 'A'
95 95
96 96 $ cd ..
97 97
98 98
99 99 E onto H - skip of G:
100 100
101 101 $ hg clone -q -u . a a3
102 102 $ cd a3
103 103
104 104 $ hg rebase -s 4 -d 7
105 105 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob)
106 106
107 107 $ hg tglog
108 108 @ 6: 'E'
109 109 |
110 110 o 5: 'H'
111 111 |
112 112 o 4: 'F'
113 113 |
114 114 | o 3: 'D'
115 115 | |
116 116 | o 2: 'C'
117 117 | |
118 118 | o 1: 'B'
119 119 |/
120 120 o 0: 'A'
121 121
122 122 $ cd ..
123 123
124 124
125 125 F onto E - rebase of a branching point (skip G):
126 126
127 127 $ hg clone -q -u . a a4
128 128 $ cd a4
129 129
130 130 $ hg rebase -s 5 -d 4
131 131 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/*-backup.hg (glob)
132 132
133 133 $ hg tglog
134 134 @ 6: 'H'
135 135 |
136 136 o 5: 'F'
137 137 |
138 138 o 4: 'E'
139 139 |
140 140 | o 3: 'D'
141 141 | |
142 142 | o 2: 'C'
143 143 | |
144 144 | o 1: 'B'
145 145 |/
146 146 o 0: 'A'
147 147
148 148 $ cd ..
149 149
150 150
151 151 G onto H - merged revision having a parent in ancestors of target:
152 152
153 153 $ hg clone -q -u . a a5
154 154 $ cd a5
155 155
156 156 $ hg rebase -s 6 -d 7
157 157 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/*-backup.hg (glob)
158 158
159 159 $ hg tglog
160 160 @ 7: 'G'
161 161 |\
162 162 | o 6: 'H'
163 163 | |
164 164 | o 5: 'F'
165 165 | |
166 166 o | 4: 'E'
167 167 |/
168 168 | o 3: 'D'
169 169 | |
170 170 | o 2: 'C'
171 171 | |
172 172 | o 1: 'B'
173 173 |/
174 174 o 0: 'A'
175 175
176 176 $ cd ..
177 177
178 178
179 179 F onto B - G maintains E as parent:
180 180
181 181 $ hg clone -q -u . a a6
182 182 $ cd a6
183 183
184 184 $ hg rebase -s 5 -d 1
185 185 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/*-backup.hg (glob)
186 186
187 187 $ hg tglog
188 188 @ 7: 'H'
189 189 |
190 190 | o 6: 'G'
191 191 |/|
192 192 o | 5: 'F'
193 193 | |
194 194 | o 4: 'E'
195 195 | |
196 196 | | o 3: 'D'
197 197 | | |
198 198 +---o 2: 'C'
199 199 | |
200 200 o | 1: 'B'
201 201 |/
202 202 o 0: 'A'
203 203
204 204 $ cd ..
205 205
206 206
207 207 These will fail (using --source):
208 208
209 209 G onto F - rebase onto an ancestor:
210 210
211 211 $ hg clone -q -u . a a7
212 212 $ cd a7
213 213
214 214 $ hg rebase -s 6 -d 5
215 215 nothing to rebase
216 216 [1]
217 217
218 218 F onto G - rebase onto a descendant:
219 219
220 220 $ hg rebase -s 5 -d 6
221 221 abort: source is ancestor of destination
222 222 [255]
223 223
224 224 G onto B - merge revision with both parents not in ancestors of target:
225 225
226 226 $ hg rebase -s 6 -d 1
227 227 abort: cannot use revision 6 as base, result would have 3 parents
228 228 [255]
229 229
230 230
231 231 These will abort gracefully (using --base):
232 232
233 233 G onto G - rebase onto same changeset:
234 234
235 235 $ hg rebase -b 6 -d 6
236 236 nothing to rebase
237 237 [1]
238 238
239 239 G onto F - rebase onto an ancestor:
240 240
241 241 $ hg rebase -b 6 -d 5
242 242 nothing to rebase
243 243 [1]
244 244
245 245 F onto G - rebase onto a descendant:
246 246
247 247 $ hg rebase -b 5 -d 6
248 248 nothing to rebase
249 249 [1]
250 250
251 251 C onto A - rebase onto an ancestor:
252 252
253 253 $ hg rebase -d 0 -s 2
254 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-backup.hg
254 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-backup.hg (glob)
255 255 $ hg tglog
256 256 @ 7: 'D'
257 257 |
258 258 o 6: 'C'
259 259 |
260 260 | o 5: 'H'
261 261 | |
262 262 | | o 4: 'G'
263 263 | |/|
264 264 | o | 3: 'F'
265 265 |/ /
266 266 | o 2: 'E'
267 267 |/
268 268 | o 1: 'B'
269 269 |/
270 270 o 0: 'A'
271 271
272 272 $ cd ..
273 273
274 274 Test for revset
275 275
276 276 We need a bit different graph
277 277 All destination are B
278 278
279 279 $ hg init ah
280 280 $ cd ah
281 281 $ hg unbundle $TESTDIR/bundles/rebase-revset.hg
282 282 adding changesets
283 283 adding manifests
284 284 adding file changes
285 285 added 9 changesets with 9 changes to 9 files (+2 heads)
286 286 (run 'hg heads' to see heads, 'hg merge' to merge)
287 287 $ hg tglog
288 288 o 8: 'I'
289 289 |
290 290 o 7: 'H'
291 291 |
292 292 o 6: 'G'
293 293 |
294 294 | o 5: 'F'
295 295 | |
296 296 | o 4: 'E'
297 297 |/
298 298 o 3: 'D'
299 299 |
300 300 o 2: 'C'
301 301 |
302 302 | o 1: 'B'
303 303 |/
304 304 o 0: 'A'
305 305
306 306 $ cd ..
307 307
308 308
309 309 Simple case with keep:
310 310
311 311 Source on have two descendant heads but ask for one
312 312
313 313 $ hg clone -q -u . ah ah1
314 314 $ cd ah1
315 315 $ hg rebase -r '2::8' -d 1
316 316 abort: can't remove original changesets with unrebased descendants
317 317 (use --keep to keep original changesets)
318 318 [255]
319 319 $ hg rebase -r '2::8' -d 1 --keep
320 320 $ hg tglog
321 321 @ 13: 'I'
322 322 |
323 323 o 12: 'H'
324 324 |
325 325 o 11: 'G'
326 326 |
327 327 o 10: 'D'
328 328 |
329 329 o 9: 'C'
330 330 |
331 331 | o 8: 'I'
332 332 | |
333 333 | o 7: 'H'
334 334 | |
335 335 | o 6: 'G'
336 336 | |
337 337 | | o 5: 'F'
338 338 | | |
339 339 | | o 4: 'E'
340 340 | |/
341 341 | o 3: 'D'
342 342 | |
343 343 | o 2: 'C'
344 344 | |
345 345 o | 1: 'B'
346 346 |/
347 347 o 0: 'A'
348 348
349 349
350 350 $ cd ..
351 351
352 352 Base on have one descendant heads we ask for but common ancestor have two
353 353
354 354 $ hg clone -q -u . ah ah2
355 355 $ cd ah2
356 356 $ hg rebase -r '3::8' -d 1
357 357 abort: can't remove original changesets with unrebased descendants
358 358 (use --keep to keep original changesets)
359 359 [255]
360 360 $ hg rebase -r '3::8' -d 1 --keep
361 361 $ hg tglog
362 362 @ 12: 'I'
363 363 |
364 364 o 11: 'H'
365 365 |
366 366 o 10: 'G'
367 367 |
368 368 o 9: 'D'
369 369 |\
370 370 | | o 8: 'I'
371 371 | | |
372 372 | | o 7: 'H'
373 373 | | |
374 374 | | o 6: 'G'
375 375 | | |
376 376 | | | o 5: 'F'
377 377 | | | |
378 378 | | | o 4: 'E'
379 379 | | |/
380 380 | | o 3: 'D'
381 381 | |/
382 382 | o 2: 'C'
383 383 | |
384 384 o | 1: 'B'
385 385 |/
386 386 o 0: 'A'
387 387
388 388
389 389 $ cd ..
390 390
391 391 rebase subset
392 392
393 393 $ hg clone -q -u . ah ah3
394 394 $ cd ah3
395 395 $ hg rebase -r '3::7' -d 1
396 396 abort: can't remove original changesets with unrebased descendants
397 397 (use --keep to keep original changesets)
398 398 [255]
399 399 $ hg rebase -r '3::7' -d 1 --keep
400 400 $ hg tglog
401 401 @ 11: 'H'
402 402 |
403 403 o 10: 'G'
404 404 |
405 405 o 9: 'D'
406 406 |\
407 407 | | o 8: 'I'
408 408 | | |
409 409 | | o 7: 'H'
410 410 | | |
411 411 | | o 6: 'G'
412 412 | | |
413 413 | | | o 5: 'F'
414 414 | | | |
415 415 | | | o 4: 'E'
416 416 | | |/
417 417 | | o 3: 'D'
418 418 | |/
419 419 | o 2: 'C'
420 420 | |
421 421 o | 1: 'B'
422 422 |/
423 423 o 0: 'A'
424 424
425 425
426 426 $ cd ..
427 427
428 428 rebase subset with multiple head
429 429
430 430 $ hg clone -q -u . ah ah4
431 431 $ cd ah4
432 432 $ hg rebase -r '3::(7+5)' -d 1
433 433 abort: can't remove original changesets with unrebased descendants
434 434 (use --keep to keep original changesets)
435 435 [255]
436 436 $ hg rebase -r '3::(7+5)' -d 1 --keep
437 437 $ hg tglog
438 438 @ 13: 'H'
439 439 |
440 440 o 12: 'G'
441 441 |
442 442 | o 11: 'F'
443 443 | |
444 444 | o 10: 'E'
445 445 |/
446 446 o 9: 'D'
447 447 |\
448 448 | | o 8: 'I'
449 449 | | |
450 450 | | o 7: 'H'
451 451 | | |
452 452 | | o 6: 'G'
453 453 | | |
454 454 | | | o 5: 'F'
455 455 | | | |
456 456 | | | o 4: 'E'
457 457 | | |/
458 458 | | o 3: 'D'
459 459 | |/
460 460 | o 2: 'C'
461 461 | |
462 462 o | 1: 'B'
463 463 |/
464 464 o 0: 'A'
465 465
466 466
467 467 $ cd ..
468 468
469 469 More advanced tests
470 470
471 471 rebase on ancestor with revset
472 472
473 473 $ hg clone -q -u . ah ah5
474 474 $ cd ah5
475 475 $ hg rebase -r '6::' -d 2
476 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-backup.hg
476 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-backup.hg (glob)
477 477 $ hg tglog
478 478 @ 8: 'I'
479 479 |
480 480 o 7: 'H'
481 481 |
482 482 o 6: 'G'
483 483 |
484 484 | o 5: 'F'
485 485 | |
486 486 | o 4: 'E'
487 487 | |
488 488 | o 3: 'D'
489 489 |/
490 490 o 2: 'C'
491 491 |
492 492 | o 1: 'B'
493 493 |/
494 494 o 0: 'A'
495 495
496 496 $ cd ..
497 497
498 498
499 499 rebase with multiple root.
500 500 We rebase E and G on B
501 501 We would expect heads are I, F if it was supported
502 502
503 503 $ hg clone -q -u . ah ah6
504 504 $ cd ah6
505 505 $ hg rebase -r '(4+6)::' -d 1
506 506 abort: can't rebase multiple roots
507 507 [255]
508 508 $ cd ..
@@ -1,98 +1,98 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "relink=" >> $HGRCPATH
3 3
4 4 $ fix_path() {
5 5 > tr '\\' /
6 6 > }
7 7
8 8 $ cat > arelinked.py <<EOF
9 9 > import sys, os
10 10 > from mercurial import util
11 11 > path1, path2 = sys.argv[1:3]
12 12 > if util.samefile(path1, path2):
13 13 > print '%s == %s' % (path1, path2)
14 14 > else:
15 15 > print '%s != %s' % (path1, path2)
16 16 > EOF
17 17
18 18
19 19 create source repository
20 20
21 21 $ hg init repo
22 22 $ cd repo
23 23 $ echo a > a
24 24 $ echo b > b
25 25 $ hg ci -Am addfile
26 26 adding a
27 27 adding b
28 28 $ cat $TESTDIR/binfile.bin >> a
29 29 $ cat $TESTDIR/binfile.bin >> b
30 30 $ hg ci -Am changefiles
31 31
32 32 make another commit to create files larger than 1 KB to test
33 33 formatting of final byte count
34 34
35 35 $ cat $TESTDIR/binfile.bin >> a
36 36 $ cat $TESTDIR/binfile.bin >> b
37 37 $ hg ci -m anotherchange
38 38
39 39 don't sit forever trying to double-lock the source repo
40 40
41 41 $ hg relink .
42 relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store
42 relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store (glob)
43 43 there is nothing to relink
44 44
45 45
46 46 Test files are read in binary mode
47 47
48 48 $ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')"
49 49 $ cd ..
50 50
51 51
52 52 clone and pull to break links
53 53
54 54 $ hg clone --pull -r0 repo clone
55 55 adding changesets
56 56 adding manifests
57 57 adding file changes
58 58 added 1 changesets with 2 changes to 2 files
59 59 updating to branch default
60 60 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 61 $ cd clone
62 62 $ hg pull -q
63 63 $ echo b >> b
64 64 $ hg ci -m changeb
65 65 created new head
66 66 $ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')"
67 67
68 68
69 69 relink
70 70
71 71 $ hg relink --debug | fix_path
72 72 relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store
73 73 tip has 2 files, estimated total number of files: 3
74 74 collecting: 00changelog.i 1/3 files (33.33%)
75 75 collecting: 00manifest.i 2/3 files (66.67%)
76 76 collecting: a.i 3/3 files (100.00%)
77 77 collecting: b.i 4/3 files (133.33%)
78 78 collecting: dummy.i 5/3 files (166.67%)
79 79 collected 5 candidate storage files
80 80 not linkable: 00changelog.i
81 81 not linkable: 00manifest.i
82 82 pruning: data/a.i 3/5 files (60.00%)
83 83 not linkable: data/b.i
84 84 pruning: data/dummy.i 5/5 files (100.00%)
85 85 pruned down to 2 probably relinkable files
86 86 relinking: data/a.i 1/2 files (50.00%)
87 87 not linkable: data/dummy.i
88 88 relinked 1 files (1.37 KB reclaimed)
89 89 $ cd ..
90 90
91 91
92 92 check hardlinks
93 93
94 94 $ python arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i
95 95 repo/.hg/store/data/a.i == clone/.hg/store/data/a.i
96 96 $ python arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i
97 97 repo/.hg/store/data/b.i != clone/.hg/store/data/b.i
98 98
@@ -1,256 +1,256 b''
1 1 $ remove() {
2 2 > hg rm $@
3 3 > echo "exit code: $?" # no-check-code
4 4 > hg st
5 5 > # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5
6 6 > find . -name .hg -prune -o -type f -print | sort
7 7 > hg up -C
8 8 > }
9 9
10 10 $ hg init a
11 11 $ cd a
12 12 $ echo a > foo
13 13
14 14 file not managed
15 15
16 16 $ remove foo
17 17 not removing foo: file is untracked
18 18 exit code: 1
19 19 ? foo
20 20 ./foo
21 21 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 22
23 23 $ hg add foo
24 24 $ hg commit -m1
25 25
26 26 the table cases
27 27 00 state added, options none
28 28
29 29 $ echo b > bar
30 30 $ hg add bar
31 31 $ remove bar
32 32 not removing bar: file has been marked for add (use forget to undo)
33 33 exit code: 1
34 34 A bar
35 35 ./bar
36 36 ./foo
37 37 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 38
39 39 01 state clean, options none
40 40
41 41 $ remove foo
42 42 exit code: 0
43 43 R foo
44 44 ? bar
45 45 ./bar
46 46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 47
48 48 02 state modified, options none
49 49
50 50 $ echo b >> foo
51 51 $ remove foo
52 52 not removing foo: file is modified (use -f to force removal)
53 53 exit code: 1
54 54 M foo
55 55 ? bar
56 56 ./bar
57 57 ./foo
58 58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 59
60 60 03 state missing, options none
61 61
62 62 $ rm foo
63 63 $ remove foo
64 64 exit code: 0
65 65 R foo
66 66 ? bar
67 67 ./bar
68 68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 69
70 70 10 state added, options -f
71 71
72 72 $ echo b > bar
73 73 $ hg add bar
74 74 $ remove -f bar
75 75 exit code: 0
76 76 ? bar
77 77 ./bar
78 78 ./foo
79 79 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 80 $ rm bar
81 81
82 82 11 state clean, options -f
83 83
84 84 $ remove -f foo
85 85 exit code: 0
86 86 R foo
87 87 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 88
89 89 12 state modified, options -f
90 90
91 91 $ echo b >> foo
92 92 $ remove -f foo
93 93 exit code: 0
94 94 R foo
95 95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
96 96
97 97 13 state missing, options -f
98 98
99 99 $ rm foo
100 100 $ remove -f foo
101 101 exit code: 0
102 102 R foo
103 103 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
104 104
105 105 20 state added, options -A
106 106
107 107 $ echo b > bar
108 108 $ hg add bar
109 109 $ remove -A bar
110 110 not removing bar: file still exists (use -f to force removal)
111 111 exit code: 1
112 112 A bar
113 113 ./bar
114 114 ./foo
115 115 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
116 116
117 117 21 state clean, options -A
118 118
119 119 $ remove -A foo
120 120 not removing foo: file still exists (use -f to force removal)
121 121 exit code: 1
122 122 ? bar
123 123 ./bar
124 124 ./foo
125 125 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 126
127 127 22 state modified, options -A
128 128
129 129 $ echo b >> foo
130 130 $ remove -A foo
131 131 not removing foo: file still exists (use -f to force removal)
132 132 exit code: 1
133 133 M foo
134 134 ? bar
135 135 ./bar
136 136 ./foo
137 137 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
138 138
139 139 23 state missing, options -A
140 140
141 141 $ rm foo
142 142 $ remove -A foo
143 143 exit code: 0
144 144 R foo
145 145 ? bar
146 146 ./bar
147 147 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 148
149 149 30 state added, options -Af
150 150
151 151 $ echo b > bar
152 152 $ hg add bar
153 153 $ remove -Af bar
154 154 exit code: 0
155 155 ? bar
156 156 ./bar
157 157 ./foo
158 158 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
159 159 $ rm bar
160 160
161 161 31 state clean, options -Af
162 162
163 163 $ remove -Af foo
164 164 exit code: 0
165 165 R foo
166 166 ./foo
167 167 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 168
169 169 32 state modified, options -Af
170 170
171 171 $ echo b >> foo
172 172 $ remove -Af foo
173 173 exit code: 0
174 174 R foo
175 175 ./foo
176 176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 177
178 178 33 state missing, options -Af
179 179
180 180 $ rm foo
181 181 $ remove -Af foo
182 182 exit code: 0
183 183 R foo
184 184 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 185
186 186 test some directory stuff
187 187
188 188 $ mkdir test
189 189 $ echo a > test/foo
190 190 $ echo b > test/bar
191 191 $ hg ci -Am2
192 192 adding test/bar
193 193 adding test/foo
194 194
195 195 dir, options none
196 196
197 197 $ rm test/bar
198 198 $ remove test
199 removing test/bar
200 removing test/foo
199 removing test/bar (glob)
200 removing test/foo (glob)
201 201 exit code: 0
202 202 R test/bar
203 203 R test/foo
204 204 ./foo
205 205 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
206 206
207 207 dir, options -f
208 208
209 209 $ rm test/bar
210 210 $ remove -f test
211 removing test/bar
212 removing test/foo
211 removing test/bar (glob)
212 removing test/foo (glob)
213 213 exit code: 0
214 214 R test/bar
215 215 R test/foo
216 216 ./foo
217 217 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 218
219 219 dir, options -A
220 220
221 221 $ rm test/bar
222 222 $ remove -A test
223 not removing test/foo: file still exists (use -f to force removal)
224 removing test/bar
223 not removing test/foo: file still exists (use -f to force removal) (glob)
224 removing test/bar (glob)
225 225 exit code: 1
226 226 R test/bar
227 227 ./foo
228 228 ./test/foo
229 229 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
230 230
231 231 dir, options -Af
232 232
233 233 $ rm test/bar
234 234 $ remove -Af test
235 removing test/bar
236 removing test/foo
235 removing test/bar (glob)
236 removing test/foo (glob)
237 237 exit code: 0
238 238 R test/bar
239 239 R test/foo
240 240 ./foo
241 241 ./test/foo
242 242 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
243 243
244 244 test remove dropping empty trees (issue1861)
245 245
246 246 $ mkdir -p issue1861/b/c
247 247 $ echo x > issue1861/x
248 248 $ echo y > issue1861/b/c/y
249 249 $ hg ci -Am add
250 250 adding issue1861/b/c/y
251 251 adding issue1861/x
252 252 $ hg rm issue1861/b
253 removing issue1861/b/c/y
253 removing issue1861/b/c/y (glob)
254 254 $ hg ci -m remove
255 255 $ ls issue1861
256 256 x
@@ -1,163 +1,163 b''
1 1 $ hg init t
2 2 $ cd t
3 3
4 4 $ mkdir a
5 5 $ echo foo > a/a
6 6 $ echo bar > a/b
7 7 $ hg ci -Am "0"
8 8 adding a/a
9 9 adding a/b
10 10
11 11 $ hg co -C 0
12 12 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
13 13 $ hg mv a b
14 moving a/a to b/a
15 moving a/b to b/b
14 moving a/a to b/a (glob)
15 moving a/b to b/b (glob)
16 16 $ hg ci -m "1 mv a/ b/"
17 17
18 18 $ hg co -C 0
19 19 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
20 20 $ echo baz > a/c
21 21 $ echo quux > a/d
22 22 $ hg add a/c
23 23 $ hg ci -m "2 add a/c"
24 24 created new head
25 25
26 26 $ hg merge --debug 1
27 27 searching for copies back to rev 1
28 28 unmatched files in local:
29 29 a/c
30 30 a/d
31 31 unmatched files in other:
32 32 b/a
33 33 b/b
34 34 all copies found (* = to merge, ! = divergent):
35 35 b/a -> a/a
36 36 b/b -> a/b
37 37 checking for directory renames
38 38 dir a/ -> b/
39 39 file a/c -> b/c
40 40 file a/d -> b/d
41 41 resolving manifests
42 42 overwrite None partial False
43 43 ancestor f9b20c0d4c51 local ce36d17b18fb+ remote 397f8b00a740
44 44 a/d: remote renamed directory to b/d -> d
45 45 a/c: remote renamed directory to b/c -> d
46 46 a/b: other deleted -> r
47 47 a/a: other deleted -> r
48 48 b/a: remote created -> g
49 49 b/b: remote created -> g
50 50 updating: a/a 1/6 files (16.67%)
51 51 removing a/a
52 52 updating: a/b 2/6 files (33.33%)
53 53 removing a/b
54 54 updating: a/c 3/6 files (50.00%)
55 55 moving a/c to b/c
56 56 updating: a/d 4/6 files (66.67%)
57 57 moving a/d to b/d
58 58 updating: b/a 5/6 files (83.33%)
59 59 getting b/a
60 60 updating: b/b 6/6 files (100.00%)
61 61 getting b/b
62 62 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
63 63 (branch merge, don't forget to commit)
64 64
65 65 $ echo a/* b/*
66 66 a/* b/a b/b b/c b/d
67 67 $ hg st -C
68 68 M b/a
69 69 M b/b
70 70 A b/c
71 71 a/c
72 72 R a/a
73 73 R a/b
74 74 R a/c
75 75 ? b/d
76 76 $ hg ci -m "3 merge 2+1"
77 77 $ hg debugrename b/c
78 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88
78 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
79 79
80 80 $ hg co -C 1
81 81 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
82 82 $ hg merge --debug 2
83 83 searching for copies back to rev 1
84 84 unmatched files in local:
85 85 b/a
86 86 b/b
87 87 b/d
88 88 unmatched files in other:
89 89 a/c
90 90 all copies found (* = to merge, ! = divergent):
91 91 b/a -> a/a
92 92 b/b -> a/b
93 93 checking for directory renames
94 94 dir a/ -> b/
95 95 file a/c -> b/c
96 96 resolving manifests
97 97 overwrite None partial False
98 98 ancestor f9b20c0d4c51 local 397f8b00a740+ remote ce36d17b18fb
99 99 None: local renamed directory to b/c -> d
100 100 updating:None 1/1 files (100.00%)
101 101 getting a/c to b/c
102 102 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
103 103 (branch merge, don't forget to commit)
104 104
105 105 $ echo a/* b/*
106 106 a/* b/a b/b b/c b/d
107 107 $ hg st -C
108 108 A b/c
109 109 a/c
110 110 ? b/d
111 111 $ hg ci -m "4 merge 1+2"
112 112 created new head
113 113 $ hg debugrename b/c
114 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88
114 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
115 115
116 116
117 117 Second scenario with two repos:
118 118
119 119 $ cd ..
120 120 $ hg init r1
121 121 $ cd r1
122 122 $ mkdir a
123 123 $ echo foo > a/f
124 124 $ hg add a
125 adding a/f
125 adding a/f (glob)
126 126 $ hg ci -m "a/f == foo"
127 127 $ cd ..
128 128
129 129 $ hg clone r1 r2
130 130 updating to branch default
131 131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
132 132 $ cd r2
133 133 $ hg mv a b
134 moving a/f to b/f
134 moving a/f to b/f (glob)
135 135 $ echo foo1 > b/f
136 136 $ hg ci -m" a -> b, b/f == foo1"
137 137 $ cd ..
138 138
139 139 $ cd r1
140 140 $ mkdir a/aa
141 141 $ echo bar > a/aa/g
142 142 $ hg add a/aa
143 adding a/aa/g
143 adding a/aa/g (glob)
144 144 $ hg ci -m "a/aa/g"
145 145 $ hg pull ../r2
146 146 pulling from ../r2
147 147 searching for changes
148 148 adding changesets
149 149 adding manifests
150 150 adding file changes
151 151 added 1 changesets with 1 changes to 1 files (+1 heads)
152 152 (run 'hg heads' to see heads, 'hg merge' to merge)
153 153
154 154 $ hg merge
155 155 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
156 156 (branch merge, don't forget to commit)
157 157
158 158 $ hg st -C
159 159 M b/f
160 160 A b/aa/g
161 161 a/aa/g
162 162 R a/aa/g
163 163 R a/f
@@ -1,637 +1,637 b''
1 1 $ "$TESTDIR/hghave" symlink || exit 80
2 2
3 3 $ hg init
4 4 $ mkdir d1 d1/d11 d2
5 5 $ echo d1/a > d1/a
6 6 $ echo d1/ba > d1/ba
7 7 $ echo d1/a1 > d1/d11/a1
8 8 $ echo d1/b > d1/b
9 9 $ echo d2/b > d2/b
10 10 $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
11 11 $ hg commit -m "1"
12 12
13 13 rename a single file
14 14
15 15 $ hg rename d1/d11/a1 d2/c
16 16 $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
17 17 abort: filename contains 'con', which is reserved on Windows: 'd1/con.xml'
18 18 [255]
19 19 $ hg sum
20 20 parent: 0:9b4b6e7b2c26 tip
21 21 1
22 22 branch: default
23 23 commit: 1 renamed
24 24 update: (current)
25 25 $ hg status -C
26 26 A d2/c
27 27 d1/d11/a1
28 28 R d1/d11/a1
29 29 $ hg update -C
30 30 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 31 $ rm d2/c
32 32
33 33 rename a single file using absolute paths
34 34
35 35 $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c
36 36 $ hg status -C
37 37 A d2/c
38 38 d1/d11/a1
39 39 R d1/d11/a1
40 40 $ hg update -C
41 41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 42 $ rm d2/c
43 43
44 44 rename --after a single file
45 45
46 46 $ mv d1/d11/a1 d2/c
47 47 $ hg rename --after d1/d11/a1 d2/c
48 48 $ hg status -C
49 49 A d2/c
50 50 d1/d11/a1
51 51 R d1/d11/a1
52 52 $ hg update -C
53 53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 54 $ rm d2/c
55 55
56 56 rename --after a single file when src and tgt already tracked
57 57
58 58 $ mv d1/d11/a1 d2/c
59 59 $ hg addrem -s 0
60 60 removing d1/d11/a1
61 61 adding d2/c
62 62 $ hg rename --after d1/d11/a1 d2/c
63 63 $ hg status -C
64 64 A d2/c
65 65 d1/d11/a1
66 66 R d1/d11/a1
67 67 $ hg update -C
68 68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 69 $ rm d2/c
70 70
71 71 rename --after a single file to a nonexistant target filename
72 72
73 73 $ hg rename --after d1/a dummy
74 d1/a: not recording move - dummy does not exist
74 d1/a: not recording move - dummy does not exist (glob)
75 75
76 76 move a single file to an existing directory
77 77
78 78 $ hg rename d1/d11/a1 d2
79 79 $ hg status -C
80 80 A d2/a1
81 81 d1/d11/a1
82 82 R d1/d11/a1
83 83 $ hg update -C
84 84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 85 $ rm d2/a1
86 86
87 87 move --after a single file to an existing directory
88 88
89 89 $ mv d1/d11/a1 d2
90 90 $ hg rename --after d1/d11/a1 d2
91 91 $ hg status -C
92 92 A d2/a1
93 93 d1/d11/a1
94 94 R d1/d11/a1
95 95 $ hg update -C
96 96 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 97 $ rm d2/a1
98 98
99 99 rename a file using a relative path
100 100
101 101 $ (cd d1/d11; hg rename ../../d2/b e)
102 102 $ hg status -C
103 103 A d1/d11/e
104 104 d2/b
105 105 R d2/b
106 106 $ hg update -C
107 107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 108 $ rm d1/d11/e
109 109
110 110 rename --after a file using a relative path
111 111
112 112 $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
113 113 $ hg status -C
114 114 A d1/d11/e
115 115 d2/b
116 116 R d2/b
117 117 $ hg update -C
118 118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 119 $ rm d1/d11/e
120 120
121 121 rename directory d1 as d3
122 122
123 123 $ hg rename d1/ d3
124 moving d1/a to d3/a
125 moving d1/b to d3/b
126 moving d1/ba to d3/ba
127 moving d1/d11/a1 to d3/d11/a1
124 moving d1/a to d3/a (glob)
125 moving d1/b to d3/b (glob)
126 moving d1/ba to d3/ba (glob)
127 moving d1/d11/a1 to d3/d11/a1 (glob)
128 128 $ hg status -C
129 129 A d3/a
130 130 d1/a
131 131 A d3/b
132 132 d1/b
133 133 A d3/ba
134 134 d1/ba
135 135 A d3/d11/a1
136 136 d1/d11/a1
137 137 R d1/a
138 138 R d1/b
139 139 R d1/ba
140 140 R d1/d11/a1
141 141 $ hg update -C
142 142 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 143 $ rm -rf d3
144 144
145 145 rename --after directory d1 as d3
146 146
147 147 $ mv d1 d3
148 148 $ hg rename --after d1 d3
149 moving d1/a to d3/a
150 moving d1/b to d3/b
151 moving d1/ba to d3/ba
152 moving d1/d11/a1 to d3/d11/a1
149 moving d1/a to d3/a (glob)
150 moving d1/b to d3/b (glob)
151 moving d1/ba to d3/ba (glob)
152 moving d1/d11/a1 to d3/d11/a1 (glob)
153 153 $ hg status -C
154 154 A d3/a
155 155 d1/a
156 156 A d3/b
157 157 d1/b
158 158 A d3/ba
159 159 d1/ba
160 160 A d3/d11/a1
161 161 d1/d11/a1
162 162 R d1/a
163 163 R d1/b
164 164 R d1/ba
165 165 R d1/d11/a1
166 166 $ hg update -C
167 167 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 168 $ rm -rf d3
169 169
170 170 move a directory using a relative path
171 171
172 172 $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
173 moving ../d1/d11/a1 to d3/d11/a1
173 moving ../d1/d11/a1 to d3/d11/a1 (glob)
174 174 $ hg status -C
175 175 A d2/d3/d11/a1
176 176 d1/d11/a1
177 177 R d1/d11/a1
178 178 $ hg update -C
179 179 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
180 180 $ rm -rf d2/d3
181 181
182 182 move --after a directory using a relative path
183 183
184 184 $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
185 moving ../d1/d11/a1 to d3/d11/a1
185 moving ../d1/d11/a1 to d3/d11/a1 (glob)
186 186 $ hg status -C
187 187 A d2/d3/d11/a1
188 188 d1/d11/a1
189 189 R d1/d11/a1
190 190 $ hg update -C
191 191 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 192 $ rm -rf d2/d3
193 193
194 194 move directory d1/d11 to an existing directory d2 (removes empty d1)
195 195
196 196 $ hg rename d1/d11/ d2
197 moving d1/d11/a1 to d2/d11/a1
197 moving d1/d11/a1 to d2/d11/a1 (glob)
198 198 $ hg status -C
199 199 A d2/d11/a1
200 200 d1/d11/a1
201 201 R d1/d11/a1
202 202 $ hg update -C
203 203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 204 $ rm -rf d2/d11
205 205
206 206 move directories d1 and d2 to a new directory d3
207 207
208 208 $ mkdir d3
209 209 $ hg rename d1 d2 d3
210 moving d1/a to d3/d1/a
211 moving d1/b to d3/d1/b
212 moving d1/ba to d3/d1/ba
213 moving d1/d11/a1 to d3/d1/d11/a1
214 moving d2/b to d3/d2/b
210 moving d1/a to d3/d1/a (glob)
211 moving d1/b to d3/d1/b (glob)
212 moving d1/ba to d3/d1/ba (glob)
213 moving d1/d11/a1 to d3/d1/d11/a1 (glob)
214 moving d2/b to d3/d2/b (glob)
215 215 $ hg status -C
216 216 A d3/d1/a
217 217 d1/a
218 218 A d3/d1/b
219 219 d1/b
220 220 A d3/d1/ba
221 221 d1/ba
222 222 A d3/d1/d11/a1
223 223 d1/d11/a1
224 224 A d3/d2/b
225 225 d2/b
226 226 R d1/a
227 227 R d1/b
228 228 R d1/ba
229 229 R d1/d11/a1
230 230 R d2/b
231 231 $ hg update -C
232 232 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 233 $ rm -rf d3
234 234
235 235 move --after directories d1 and d2 to a new directory d3
236 236
237 237 $ mkdir d3
238 238 $ mv d1 d2 d3
239 239 $ hg rename --after d1 d2 d3
240 moving d1/a to d3/d1/a
241 moving d1/b to d3/d1/b
242 moving d1/ba to d3/d1/ba
243 moving d1/d11/a1 to d3/d1/d11/a1
244 moving d2/b to d3/d2/b
240 moving d1/a to d3/d1/a (glob)
241 moving d1/b to d3/d1/b (glob)
242 moving d1/ba to d3/d1/ba (glob)
243 moving d1/d11/a1 to d3/d1/d11/a1 (glob)
244 moving d2/b to d3/d2/b (glob)
245 245 $ hg status -C
246 246 A d3/d1/a
247 247 d1/a
248 248 A d3/d1/b
249 249 d1/b
250 250 A d3/d1/ba
251 251 d1/ba
252 252 A d3/d1/d11/a1
253 253 d1/d11/a1
254 254 A d3/d2/b
255 255 d2/b
256 256 R d1/a
257 257 R d1/b
258 258 R d1/ba
259 259 R d1/d11/a1
260 260 R d2/b
261 261 $ hg update -C
262 262 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 263 $ rm -rf d3
264 264
265 265 move everything under directory d1 to existing directory d2, do not
266 266 overwrite existing files (d2/b)
267 267
268 268 $ hg rename d1/* d2
269 269 d2/b: not overwriting - file exists
270 moving d1/d11/a1 to d2/d11/a1
270 moving d1/d11/a1 to d2/d11/a1 (glob)
271 271 $ hg status -C
272 272 A d2/a
273 273 d1/a
274 274 A d2/ba
275 275 d1/ba
276 276 A d2/d11/a1
277 277 d1/d11/a1
278 278 R d1/a
279 279 R d1/ba
280 280 R d1/d11/a1
281 281 $ diff -u d1/b d2/b
282 282 --- d1/b * (glob)
283 283 +++ d2/b * (glob)
284 284 @@ * (glob)
285 285 -d1/b
286 286 +d2/b
287 287 [1]
288 288 $ hg update -C
289 289 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
290 290 $ rm d2/a d2/ba d2/d11/a1
291 291
292 292 attempt to move one file into a non-existent directory
293 293
294 294 $ hg rename d1/a dx/
295 295 abort: destination dx/ is not a directory
296 296 [255]
297 297 $ hg status -C
298 298 $ hg update -C
299 299 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
300 300
301 301 attempt to move potentially more than one file into a non-existent directory
302 302
303 303 $ hg rename 'glob:d1/**' dx
304 304 abort: with multiple sources, destination must be an existing directory
305 305 [255]
306 306
307 307 move every file under d1 to d2/d21 (glob)
308 308
309 309 $ mkdir d2/d21
310 310 $ hg rename 'glob:d1/**' d2/d21
311 moving d1/a to d2/d21/a
312 moving d1/b to d2/d21/b
313 moving d1/ba to d2/d21/ba
314 moving d1/d11/a1 to d2/d21/a1
311 moving d1/a to d2/d21/a (glob)
312 moving d1/b to d2/d21/b (glob)
313 moving d1/ba to d2/d21/ba (glob)
314 moving d1/d11/a1 to d2/d21/a1 (glob)
315 315 $ hg status -C
316 316 A d2/d21/a
317 317 d1/a
318 318 A d2/d21/a1
319 319 d1/d11/a1
320 320 A d2/d21/b
321 321 d1/b
322 322 A d2/d21/ba
323 323 d1/ba
324 324 R d1/a
325 325 R d1/b
326 326 R d1/ba
327 327 R d1/d11/a1
328 328 $ hg update -C
329 329 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
330 330 $ rm -rf d2/d21
331 331
332 332 move --after some files under d1 to d2/d21 (glob)
333 333
334 334 $ mkdir d2/d21
335 335 $ mv d1/a d1/d11/a1 d2/d21
336 336 $ hg rename --after 'glob:d1/**' d2/d21
337 moving d1/a to d2/d21/a
338 d1/b: not recording move - d2/d21/b does not exist
339 d1/ba: not recording move - d2/d21/ba does not exist
340 moving d1/d11/a1 to d2/d21/a1
337 moving d1/a to d2/d21/a (glob)
338 d1/b: not recording move - d2/d21/b does not exist (glob)
339 d1/ba: not recording move - d2/d21/ba does not exist (glob)
340 moving d1/d11/a1 to d2/d21/a1 (glob)
341 341 $ hg status -C
342 342 A d2/d21/a
343 343 d1/a
344 344 A d2/d21/a1
345 345 d1/d11/a1
346 346 R d1/a
347 347 R d1/d11/a1
348 348 $ hg update -C
349 349 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
350 350 $ rm -rf d2/d21
351 351
352 352 move every file under d1 starting with an 'a' to d2/d21 (regexp)
353 353
354 354 $ mkdir d2/d21
355 355 $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
356 moving d1/a to d2/d21/a
357 moving d1/d11/a1 to d2/d21/a1
356 moving d1/a to d2/d21/a (glob)
357 moving d1/d11/a1 to d2/d21/a1 (glob)
358 358 $ hg status -C
359 359 A d2/d21/a
360 360 d1/a
361 361 A d2/d21/a1
362 362 d1/d11/a1
363 363 R d1/a
364 364 R d1/d11/a1
365 365 $ hg update -C
366 366 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 367 $ rm -rf d2/d21
368 368
369 369 attempt to overwrite an existing file
370 370
371 371 $ echo "ca" > d1/ca
372 372 $ hg rename d1/ba d1/ca
373 373 d1/ca: not overwriting - file exists
374 374 $ hg status -C
375 375 ? d1/ca
376 376 $ hg update -C
377 377 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
378 378
379 379 forced overwrite of an existing file
380 380
381 381 $ echo "ca" > d1/ca
382 382 $ hg rename --force d1/ba d1/ca
383 383 $ hg status -C
384 384 A d1/ca
385 385 d1/ba
386 386 R d1/ba
387 387 $ hg update -C
388 388 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 389 $ rm d1/ca
390 390
391 391 attempt to overwrite an existing broken symlink
392 392
393 393 $ ln -s ba d1/ca
394 394 $ hg rename --traceback d1/ba d1/ca
395 395 d1/ca: not overwriting - file exists
396 396 $ hg status -C
397 397 ? d1/ca
398 398 $ hg update -C
399 399 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
400 400 $ rm d1/ca
401 401
402 402 replace a symlink with a file
403 403
404 404 $ ln -s ba d1/ca
405 405 $ hg rename --force d1/ba d1/ca
406 406 $ hg status -C
407 407 A d1/ca
408 408 d1/ba
409 409 R d1/ba
410 410 $ hg update -C
411 411 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
412 412 $ rm d1/ca
413 413
414 414 do not copy more than one source file to the same destination file
415 415
416 416 $ mkdir d3
417 417 $ hg rename d1/* d2/* d3
418 moving d1/d11/a1 to d3/d11/a1
418 moving d1/d11/a1 to d3/d11/a1 (glob)
419 419 d3/b: not overwriting - d2/b collides with d1/b
420 420 $ hg status -C
421 421 A d3/a
422 422 d1/a
423 423 A d3/b
424 424 d1/b
425 425 A d3/ba
426 426 d1/ba
427 427 A d3/d11/a1
428 428 d1/d11/a1
429 429 R d1/a
430 430 R d1/b
431 431 R d1/ba
432 432 R d1/d11/a1
433 433 $ hg update -C
434 434 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
435 435 $ rm -rf d3
436 436
437 437 move a whole subtree with "hg rename ."
438 438
439 439 $ mkdir d3
440 440 $ (cd d1; hg rename . ../d3)
441 441 moving a to ../d3/d1/a
442 442 moving b to ../d3/d1/b
443 443 moving ba to ../d3/d1/ba
444 moving d11/a1 to ../d3/d1/d11/a1
444 moving d11/a1 to ../d3/d1/d11/a1 (glob)
445 445 $ hg status -C
446 446 A d3/d1/a
447 447 d1/a
448 448 A d3/d1/b
449 449 d1/b
450 450 A d3/d1/ba
451 451 d1/ba
452 452 A d3/d1/d11/a1
453 453 d1/d11/a1
454 454 R d1/a
455 455 R d1/b
456 456 R d1/ba
457 457 R d1/d11/a1
458 458 $ hg update -C
459 459 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
460 460 $ rm -rf d3
461 461
462 462 move a whole subtree with "hg rename --after ."
463 463
464 464 $ mkdir d3
465 465 $ mv d1/* d3
466 466 $ (cd d1; hg rename --after . ../d3)
467 467 moving a to ../d3/a
468 468 moving b to ../d3/b
469 469 moving ba to ../d3/ba
470 moving d11/a1 to ../d3/d11/a1
470 moving d11/a1 to ../d3/d11/a1 (glob)
471 471 $ hg status -C
472 472 A d3/a
473 473 d1/a
474 474 A d3/b
475 475 d1/b
476 476 A d3/ba
477 477 d1/ba
478 478 A d3/d11/a1
479 479 d1/d11/a1
480 480 R d1/a
481 481 R d1/b
482 482 R d1/ba
483 483 R d1/d11/a1
484 484 $ hg update -C
485 485 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
486 486 $ rm -rf d3
487 487
488 488 move the parent tree with "hg rename .."
489 489
490 490 $ (cd d1/d11; hg rename .. ../../d3)
491 moving ../a to ../../d3/a
492 moving ../b to ../../d3/b
493 moving ../ba to ../../d3/ba
491 moving ../a to ../../d3/a (glob)
492 moving ../b to ../../d3/b (glob)
493 moving ../ba to ../../d3/ba (glob)
494 494 moving a1 to ../../d3/d11/a1
495 495 $ hg status -C
496 496 A d3/a
497 497 d1/a
498 498 A d3/b
499 499 d1/b
500 500 A d3/ba
501 501 d1/ba
502 502 A d3/d11/a1
503 503 d1/d11/a1
504 504 R d1/a
505 505 R d1/b
506 506 R d1/ba
507 507 R d1/d11/a1
508 508 $ hg update -C
509 509 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
510 510 $ rm -rf d3
511 511
512 512 skip removed files
513 513
514 514 $ hg remove d1/b
515 515 $ hg rename d1 d3
516 moving d1/a to d3/a
517 moving d1/ba to d3/ba
518 moving d1/d11/a1 to d3/d11/a1
516 moving d1/a to d3/a (glob)
517 moving d1/ba to d3/ba (glob)
518 moving d1/d11/a1 to d3/d11/a1 (glob)
519 519 $ hg status -C
520 520 A d3/a
521 521 d1/a
522 522 A d3/ba
523 523 d1/ba
524 524 A d3/d11/a1
525 525 d1/d11/a1
526 526 R d1/a
527 527 R d1/b
528 528 R d1/ba
529 529 R d1/d11/a1
530 530 $ hg update -C
531 531 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
532 532 $ rm -rf d3
533 533
534 534 transitive rename
535 535
536 536 $ hg rename d1/b d1/bb
537 537 $ hg rename d1/bb d1/bc
538 538 $ hg status -C
539 539 A d1/bc
540 540 d1/b
541 541 R d1/b
542 542 $ hg update -C
543 543 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
544 544 $ rm d1/bc
545 545
546 546 transitive rename --after
547 547
548 548 $ hg rename d1/b d1/bb
549 549 $ mv d1/bb d1/bc
550 550 $ hg rename --after d1/bb d1/bc
551 551 $ hg status -C
552 552 A d1/bc
553 553 d1/b
554 554 R d1/b
555 555 $ hg update -C
556 556 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
557 557 $ rm d1/bc
558 558
559 559 $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
560 560 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
561 561 $ hg rename d1/b d1/bb
562 562 $ echo "some stuff added to d1/bb" >> d1/bb
563 563 $ hg rename d1/bb d1/b
564 564 $ hg status -C
565 565 M d1/b
566 566 $ hg update -C
567 567 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
568 568
569 569 overwriting with renames (issue1959)
570 570
571 571 $ hg rename d1/a d1/c
572 572 $ hg rename d1/b d1/a
573 573 $ hg status -C
574 574 A d1/a
575 575 d1/b
576 576 A d1/c
577 577 d1/a
578 578 R d1/b
579 579 $ hg diff --git
580 580 diff --git a/d1/b b/d1/a
581 581 rename from d1/b
582 582 rename to d1/a
583 583 diff --git a/d1/a b/d1/c
584 584 copy from d1/a
585 585 copy to d1/c
586 586 $ hg update -C
587 587 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
588 588
589 589 check illegal path components
590 590
591 591 $ hg rename d1/d11/a1 .hg/foo
592 abort: path contains illegal component: .hg/foo
592 abort: path contains illegal component: .hg/foo (glob)
593 593 [255]
594 594 $ hg status -C
595 595 $ hg rename d1/d11/a1 ../foo
596 596 abort: ../foo not under root
597 597 [255]
598 598 $ hg status -C
599 599
600 600 $ mv d1/d11/a1 .hg/foo
601 601 $ hg rename --after d1/d11/a1 .hg/foo
602 abort: path contains illegal component: .hg/foo
602 abort: path contains illegal component: .hg/foo (glob)
603 603 [255]
604 604 $ hg status -C
605 605 ! d1/d11/a1
606 606 $ hg update -C
607 607 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 608 $ rm .hg/foo
609 609
610 610 $ hg rename d1/d11/a1 .hg
611 abort: path contains illegal component: .hg/a1
611 abort: path contains illegal component: .hg/a1 (glob)
612 612 [255]
613 613 $ hg status -C
614 614 $ hg rename d1/d11/a1 ..
615 abort: ../a1 not under root
615 abort: ../a1 not under root (glob)
616 616 [255]
617 617 $ hg status -C
618 618
619 619 $ mv d1/d11/a1 .hg
620 620 $ hg rename --after d1/d11/a1 .hg
621 abort: path contains illegal component: .hg/a1
621 abort: path contains illegal component: .hg/a1 (glob)
622 622 [255]
623 623 $ hg status -C
624 624 ! d1/d11/a1
625 625 $ hg update -C
626 626 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
627 627 $ rm .hg/a1
628 628
629 629 $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
630 abort: path contains illegal component: .hg/foo
630 abort: path contains illegal component: .hg/foo (glob)
631 631 [255]
632 632 $ hg status -C
633 633 $ (cd d1/d11; hg rename ../../d2/b ../../../foo)
634 634 abort: ../../../foo not under root
635 635 [255]
636 636 $ hg status -C
637 637
@@ -1,276 +1,276 b''
1 1 $ "$TESTDIR/hghave" execbit || exit 80
2 2
3 3 $ hg init repo
4 4 $ cd repo
5 5 $ echo 123 > a
6 6 $ echo 123 > c
7 7 $ echo 123 > e
8 8 $ hg add a c e
9 9 $ hg commit -m "first" a c e
10 10
11 11 nothing changed
12 12
13 13 $ hg revert
14 14 abort: no files or directories specified
15 15 (use --all to revert all files)
16 16 [255]
17 17 $ hg revert --all
18 18
19 19 $ echo 123 > b
20 20
21 21 should show b unknown
22 22
23 23 $ hg status
24 24 ? b
25 25 $ echo 12 > c
26 26
27 27 should show b unknown and c modified
28 28
29 29 $ hg status
30 30 M c
31 31 ? b
32 32 $ hg add b
33 33
34 34 should show b added and c modified
35 35
36 36 $ hg status
37 37 M c
38 38 A b
39 39 $ hg rm a
40 40
41 41 should show a removed, b added and c modified
42 42
43 43 $ hg status
44 44 M c
45 45 A b
46 46 R a
47 47 $ hg revert a
48 48
49 49 should show b added, copy saved, and c modified
50 50
51 51 $ hg status
52 52 M c
53 53 A b
54 54 $ hg revert b
55 55
56 56 should show b unknown, and c modified
57 57
58 58 $ hg status
59 59 M c
60 60 ? b
61 61 $ hg revert --no-backup c
62 62
63 63 should show unknown: b
64 64
65 65 $ hg status
66 66 ? b
67 67 $ hg add b
68 68
69 69 should show b added
70 70
71 71 $ hg status b
72 72 A b
73 73 $ rm b
74 74
75 75 should show b deleted
76 76
77 77 $ hg status b
78 78 ! b
79 79 $ hg revert -v b
80 80 forgetting b
81 81
82 82 should not find b
83 83
84 84 $ hg status b
85 85 b: No such file or directory
86 86
87 87 should show a c e
88 88
89 89 $ ls
90 90 a
91 91 c
92 92 e
93 93
94 94 should verbosely save backup to e.orig
95 95
96 96 $ echo z > e
97 97 $ hg revert --all -v
98 98 saving current version of e as e.orig
99 99 reverting e
100 100
101 101 should say no changes needed
102 102
103 103 $ hg revert a
104 104 no changes needed to a
105 105
106 106 should say file not managed
107 107
108 108 $ echo q > q
109 109 $ hg revert q
110 110 file not managed: q
111 111 $ rm q
112 112
113 113 should say file not found
114 114
115 115 $ hg revert notfound
116 116 notfound: no such file in rev 334a9e57682c
117 117 $ touch d
118 118 $ hg add d
119 119 $ hg rm a
120 120 $ hg commit -m "second"
121 121 $ echo z > z
122 122 $ hg add z
123 123 $ hg st
124 124 A z
125 125 ? e.orig
126 126
127 127 should add a, remove d, forget z
128 128
129 129 $ hg revert --all -r0
130 130 adding a
131 131 removing d
132 132 forgetting z
133 133
134 134 should forget a, undelete d
135 135
136 136 $ hg revert --all -rtip
137 137 forgetting a
138 138 undeleting d
139 139 $ rm a *.orig
140 140
141 141 should silently add a
142 142
143 143 $ hg revert -r0 a
144 144 $ hg st a
145 145 A a
146 146 $ hg rm d
147 147 $ hg st d
148 148 R d
149 149
150 150 should silently keep d removed
151 151
152 152 $ hg revert -r0 d
153 153 $ hg st d
154 154 R d
155 155
156 156 $ hg update -C
157 157 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
158 158 $ chmod +x c
159 159 $ hg revert --all
160 160 reverting c
161 161
162 162 should print non-executable
163 163
164 164 $ test -x c || echo non-executable
165 165 non-executable
166 166
167 167 $ chmod +x c
168 168 $ hg commit -m exe
169 169
170 170 $ chmod -x c
171 171 $ hg revert --all
172 172 reverting c
173 173
174 174 should print executable
175 175
176 176 $ test -x c && echo executable
177 177 executable
178 178
179 179 $ cd ..
180 180
181 181
182 182 Issue241: update and revert produces inconsistent repositories
183 183
184 184 $ hg init a
185 185 $ cd a
186 186 $ echo a >> a
187 187 $ hg commit -A -d '1 0' -m a
188 188 adding a
189 189 $ echo a >> a
190 190 $ hg commit -d '2 0' -m a
191 191 $ hg update 0
192 192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 193 $ mkdir b
194 194 $ echo b > b/b
195 195
196 196 should fail - no arguments
197 197
198 198 $ hg revert -rtip
199 199 abort: no files or directories specified
200 200 (use --all to revert all files, or 'hg update 1' to update)
201 201 [255]
202 202
203 203 should succeed
204 204
205 205 $ hg revert --all -rtip
206 206 reverting a
207 207
208 208
209 209 Issue332: confusing message when reverting directory
210 210
211 211 $ hg ci -A -m b
212 212 adding b/b
213 213 created new head
214 214 $ echo foobar > b/b
215 215 $ mkdir newdir
216 216 $ echo foo > newdir/newfile
217 217 $ hg add newdir/newfile
218 218 $ hg revert b newdir
219 reverting b/b
220 forgetting newdir/newfile
219 reverting b/b (glob)
220 forgetting newdir/newfile (glob)
221 221 $ echo foobar > b/b
222 222 $ hg revert .
223 reverting b/b
223 reverting b/b (glob)
224 224
225 225
226 226 reverting a rename target should revert the source
227 227
228 228 $ hg mv a newa
229 229 $ hg revert newa
230 230 $ hg st a newa
231 231 ? newa
232 232
233 233 $ cd ..
234 234
235 235 $ hg init ignored
236 236 $ cd ignored
237 237 $ echo '^ignored$' > .hgignore
238 238 $ echo '^ignoreddir$' >> .hgignore
239 239 $ echo '^removed$' >> .hgignore
240 240
241 241 $ mkdir ignoreddir
242 242 $ touch ignoreddir/file
243 243 $ touch ignoreddir/removed
244 244 $ touch ignored
245 245 $ touch removed
246 246
247 247 4 ignored files (we will add/commit everything)
248 248
249 249 $ hg st -A -X .hgignore
250 250 I ignored
251 251 I ignoreddir/file
252 252 I ignoreddir/removed
253 253 I removed
254 254 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
255 255
256 256 $ echo >> ignored
257 257 $ echo >> ignoreddir/file
258 258 $ hg rm removed ignoreddir/removed
259 259
260 260 should revert ignored* and undelete *removed
261 261
262 262 $ hg revert -a --no-backup
263 263 reverting ignored
264 reverting ignoreddir/file
265 undeleting ignoreddir/removed
264 reverting ignoreddir/file (glob)
265 undeleting ignoreddir/removed (glob)
266 266 undeleting removed
267 267 $ hg st -mardi
268 268
269 269 $ hg up -qC
270 270 $ echo >> ignored
271 271 $ hg rm removed
272 272
273 273 should silently revert the named files
274 274
275 275 $ hg revert --no-backup ignored removed
276 276 $ hg st -mardi
@@ -1,92 +1,92 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > graphlog=
4 4 >
5 5 > [alias]
6 6 > tlog = log --template "{rev}:{node|short}: '{desc}' {branches}\n"
7 7 > tglog = tlog -G
8 8 > tout = out --template "{rev}:{node|short}: '{desc}' {branches}\n"
9 9 > EOF
10 10
11 11 $ hg init a
12 12 $ cd a
13 13
14 14 $ echo a > a
15 15 $ hg ci -Aqm0
16 16
17 17 $ echo foo >> a
18 18 $ hg ci -Aqm1
19 19
20 20 $ hg up -q 0
21 21
22 22 $ hg branch stable
23 23 marked working directory as branch stable
24 24 $ echo bar >> a
25 25 $ hg ci -qm2
26 26
27 27 $ hg tglog
28 28 @ 2:7bee6c3bea3a: '2' stable
29 29 |
30 30 | o 1:3560197d8331: '1'
31 31 |/
32 32 o 0:f7b1eb17ad24: '0'
33 33
34 34
35 35 $ cd ..
36 36
37 37 $ hg clone -q a#stable b
38 38
39 39 $ cd b
40 40 $ cat .hg/hgrc
41 41 [paths]
42 default = $TESTTMP/a#stable
42 default = $TESTTMP/a#stable (glob)
43 43
44 44 $ echo red >> a
45 45 $ hg ci -qm3
46 46
47 47 $ hg up -q default
48 48
49 49 $ echo blue >> a
50 50 $ hg ci -qm4
51 51
52 52 $ hg tglog
53 53 @ 3:f0461977a3db: '4'
54 54 |
55 55 | o 2:1d4099801a4e: '3' stable
56 56 | |
57 57 | o 1:7bee6c3bea3a: '2' stable
58 58 |/
59 59 o 0:f7b1eb17ad24: '0'
60 60
61 61
62 62 $ hg tout
63 comparing with $TESTTMP/a
63 comparing with $TESTTMP/a (glob)
64 64 searching for changes
65 65 2:1d4099801a4e: '3' stable
66 66
67 67 $ hg tlog -r 'outgoing()'
68 68 2:1d4099801a4e: '3' stable
69 69
70 70 $ hg tout ../a#default
71 71 comparing with ../a
72 72 searching for changes
73 73 3:f0461977a3db: '4'
74 74
75 75 $ hg tlog -r 'outgoing("../a#default")'
76 76 3:f0461977a3db: '4'
77 77
78 78 $ echo "green = ../a#default" >> .hg/hgrc
79 79
80 80 $ cat .hg/hgrc
81 81 [paths]
82 default = $TESTTMP/a#stable
82 default = $TESTTMP/a#stable (glob)
83 83 green = ../a#default
84 84
85 85 $ hg tout green
86 comparing with $TESTTMP/a
86 comparing with $TESTTMP/a (glob)
87 87 searching for changes
88 88 3:f0461977a3db: '4'
89 89
90 90 $ hg tlog -r 'outgoing("green")'
91 91 3:f0461977a3db: '4'
92 92
@@ -1,127 +1,127 b''
1 1 $ "$TESTDIR/hghave" serve || exit 80
2 2
3 3 $ echo "[extensions]" >> $HGRCPATH
4 4 $ echo "share = " >> $HGRCPATH
5 5
6 6 prepare repo1
7 7
8 8 $ hg init repo1
9 9 $ cd repo1
10 10 $ echo a > a
11 11 $ hg commit -A -m'init'
12 12 adding a
13 13
14 14 share it
15 15
16 16 $ cd ..
17 17 $ hg share repo1 repo2
18 18 updating working directory
19 19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 20
21 21 share shouldn't have a store dir
22 22
23 23 $ cd repo2
24 24 $ test -d .hg/store
25 25 [1]
26 26
27 27 Some sed versions appends newline, some don't, and some just fails
28 28
29 29 $ cat .hg/sharedpath; echo
30 $TESTTMP/repo1/.hg
30 $TESTTMP/repo1/.hg (glob)
31 31
32 32 trailing newline on .hg/sharedpath is ok
33 33 $ hg tip -q
34 34 0:d3873e73d99e
35 35 $ echo '' >> .hg/sharedpath
36 36 $ cat .hg/sharedpath
37 $TESTTMP/repo1/.hg
37 $TESTTMP/repo1/.hg (glob)
38 38 $ hg tip -q
39 39 0:d3873e73d99e
40 40
41 41 commit in shared clone
42 42
43 43 $ echo a >> a
44 44 $ hg commit -m'change in shared clone'
45 45
46 46 check original
47 47
48 48 $ cd ../repo1
49 49 $ hg log
50 50 changeset: 1:8af4dc49db9e
51 51 tag: tip
52 52 user: test
53 53 date: Thu Jan 01 00:00:00 1970 +0000
54 54 summary: change in shared clone
55 55
56 56 changeset: 0:d3873e73d99e
57 57 user: test
58 58 date: Thu Jan 01 00:00:00 1970 +0000
59 59 summary: init
60 60
61 61 $ hg update
62 62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 63 $ cat a # should be two lines of "a"
64 64 a
65 65 a
66 66
67 67 commit in original
68 68
69 69 $ echo b > b
70 70 $ hg commit -A -m'another file'
71 71 adding b
72 72
73 73 check in shared clone
74 74
75 75 $ cd ../repo2
76 76 $ hg log
77 77 changeset: 2:c2e0ac586386
78 78 tag: tip
79 79 user: test
80 80 date: Thu Jan 01 00:00:00 1970 +0000
81 81 summary: another file
82 82
83 83 changeset: 1:8af4dc49db9e
84 84 user: test
85 85 date: Thu Jan 01 00:00:00 1970 +0000
86 86 summary: change in shared clone
87 87
88 88 changeset: 0:d3873e73d99e
89 89 user: test
90 90 date: Thu Jan 01 00:00:00 1970 +0000
91 91 summary: init
92 92
93 93 $ hg update
94 94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 95 $ cat b # should exist with one "b"
96 96 b
97 97
98 98 hg serve shared clone
99 99
100 100 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid
101 101 $ cat hg.pid >> $DAEMON_PIDS
102 102 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-file/'
103 103 200 Script output follows
104 104
105 105
106 106 -rw-r--r-- 4 a
107 107 -rw-r--r-- 2 b
108 108
109 109
110 110
111 111 test unshare command
112 112
113 113 $ hg unshare
114 114 $ test -d .hg/store
115 115 $ test -f .hg/sharedpath
116 116 [1]
117 117 $ hg unshare
118 118 abort: this is not a shared repo
119 119 [255]
120 120
121 121 check that a change does not propagate
122 122
123 123 $ echo b >> b
124 124 $ hg commit -m'change in unshared'
125 125 $ cd ../repo1
126 126 $ hg id -r tip
127 127 c2e0ac586386 tip
@@ -1,102 +1,102 b''
1 1 Preparing the subrepository 'sub2'
2 2
3 3 $ hg init sub2
4 4 $ echo sub2 > sub2/sub2
5 5 $ hg add -R sub2
6 adding sub2/sub2
6 adding sub2/sub2 (glob)
7 7 $ hg commit -R sub2 -m "sub2 import"
8 8
9 9 Preparing the 'sub1' repo which depends on the subrepo 'sub2'
10 10
11 11 $ hg init sub1
12 12 $ echo sub1 > sub1/sub1
13 13 $ echo "sub2 = ../sub2" > sub1/.hgsub
14 14 $ hg clone sub2 sub1/sub2
15 15 updating to branch default
16 16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 17 $ hg add -R sub1
18 adding sub1/.hgsub
19 adding sub1/sub1
18 adding sub1/.hgsub (glob)
19 adding sub1/sub1 (glob)
20 20 $ hg commit -R sub1 -m "sub1 import"
21 21 committing subrepository sub2
22 22
23 23 Preparing the 'main' repo which depends on the subrepo 'sub1'
24 24
25 25 $ hg init main
26 26 $ echo main > main/main
27 27 $ echo "sub1 = ../sub1" > main/.hgsub
28 28 $ hg clone sub1 main/sub1
29 29 updating to branch default
30 30 cloning subrepo sub2 from $TESTTMP/sub2
31 31 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 32 $ hg add -R main
33 adding main/.hgsub
34 adding main/main
33 adding main/.hgsub (glob)
34 adding main/main (glob)
35 35 $ hg commit -R main -m "main import"
36 36 committing subrepository sub1
37 37
38 38 Cleaning both repositories, just as a clone -U
39 39
40 40 $ hg up -C -R sub2 null
41 41 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
42 42 $ hg up -C -R sub1 null
43 43 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
44 44 $ hg up -C -R main null
45 45 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
46 46 $ rm -rf main/sub1
47 47 $ rm -rf sub1/sub2
48 48
49 49 Clone main
50 50
51 51 $ hg clone main cloned
52 52 updating to branch default
53 53 cloning subrepo sub1 from $TESTTMP/sub1
54 cloning subrepo sub1/sub2 from $TESTTMP/sub2
54 cloning subrepo sub1/sub2 from $TESTTMP/sub2 (glob)
55 55 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 56
57 57 Checking cloned repo ids
58 58
59 59 $ printf "cloned " ; hg id -R cloned
60 60 cloned 7f491f53a367 tip
61 61 $ printf "cloned/sub1 " ; hg id -R cloned/sub1
62 62 cloned/sub1 fc3b4ce2696f tip
63 63 $ printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2
64 64 cloned/sub1/sub2 c57a0840e3ba tip
65 65
66 66 debugsub output for main and sub1
67 67
68 68 $ hg debugsub -R cloned
69 69 path sub1
70 70 source ../sub1
71 71 revision fc3b4ce2696f7741438c79207583768f2ce6b0dd
72 72 $ hg debugsub -R cloned/sub1
73 73 path sub2
74 74 source ../sub2
75 75 revision c57a0840e3badd667ef3c3ef65471609acb2ba3c
76 76
77 77 Modifying deeply nested 'sub2'
78 78
79 79 $ echo modified > cloned/sub1/sub2/sub2
80 80 $ hg commit --subrepos -m "deep nested modif should trigger a commit" -R cloned
81 81 committing subrepository sub1
82 committing subrepository sub1/sub2
82 committing subrepository sub1/sub2 (glob)
83 83
84 84 Checking modified node ids
85 85
86 86 $ printf "cloned " ; hg id -R cloned
87 87 cloned ffe6649062fe tip
88 88 $ printf "cloned/sub1 " ; hg id -R cloned/sub1
89 89 cloned/sub1 2ecb03bf44a9 tip
90 90 $ printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2
91 91 cloned/sub1/sub2 53dd3430bcaf tip
92 92
93 93 debugsub output for main and sub1
94 94
95 95 $ hg debugsub -R cloned
96 96 path sub1
97 97 source ../sub1
98 98 revision 2ecb03bf44a94e749e8669481dd9069526ce7cb9
99 99 $ hg debugsub -R cloned/sub1
100 100 path sub2
101 101 source ../sub2
102 102 revision 53dd3430bcaf5ab4a7c48262bcad6d441f510487
@@ -1,59 +1,59 b''
1 1 $ hg init outer
2 2 $ cd outer
3 3
4 4 $ echo '[paths]' >> .hg/hgrc
5 5 $ echo 'default = http://example.net/' >> .hg/hgrc
6 6
7 7 hg debugsub with no remapping
8 8
9 9 $ echo 'sub = libfoo' > .hgsub
10 10 $ hg add .hgsub
11 11
12 12 $ hg debugsub
13 13 path sub
14 14 source libfoo
15 15 revision
16 16
17 17 hg debugsub with remapping
18 18
19 19 $ echo '[subpaths]' >> .hg/hgrc
20 20 $ printf 'http://example.net/lib(.*) = C:\\libs\\\\1-lib\\\n' >> .hg/hgrc
21 21
22 22 $ hg debugsub
23 23 path sub
24 24 source C:\libs\foo-lib\
25 25 revision
26 26
27 27 test cumulative remapping, the $HGRCPATH file is loaded first
28 28
29 29 $ echo '[subpaths]' >> $HGRCPATH
30 30 $ echo 'libfoo = libbar' >> $HGRCPATH
31 31 $ hg debugsub
32 32 path sub
33 33 source C:\libs\bar-lib\
34 34 revision
35 35
36 36 test absolute source path -- testing with a URL is important since
37 37 standard os.path.join wont treat that as an absolute path
38 38
39 39 $ echo 'abs = http://example.net/abs' > .hgsub
40 40 $ hg debugsub
41 41 path abs
42 42 source http://example.net/abs
43 43 revision
44 44
45 45 $ echo 'abs = /abs' > .hgsub
46 46 $ hg debugsub
47 47 path abs
48 48 source /abs
49 49 revision
50 50
51 51 test bad subpaths pattern
52 52
53 53 $ cat > .hg/hgrc <<EOF
54 54 > [subpaths]
55 55 > .* = \1
56 56 > EOF
57 57 $ hg debugsub
58 abort: bad subrepository pattern in $TESTTMP/outer/.hg/hgrc:2: invalid group reference
58 abort: bad subrepository pattern in $TESTTMP/outer/.hg/hgrc:2: invalid group reference (glob)
59 59 [255]
@@ -1,477 +1,477 b''
1 1 Create test repository:
2 2
3 3 $ hg init repo
4 4 $ cd repo
5 5 $ echo x1 > x.txt
6 6
7 7 $ hg init foo
8 8 $ cd foo
9 9 $ echo y1 > y.txt
10 10
11 11 $ hg init bar
12 12 $ cd bar
13 13 $ echo z1 > z.txt
14 14
15 15 $ cd ..
16 16 $ echo 'bar = bar' > .hgsub
17 17
18 18 $ cd ..
19 19 $ echo 'foo = foo' > .hgsub
20 20
21 21 Add files --- .hgsub files must go first to trigger subrepos:
22 22
23 23 $ hg add -S .hgsub
24 24 $ hg add -S foo/.hgsub
25 25 $ hg add -S foo/bar
26 26 adding foo/bar/z.txt
27 27 $ hg add -S
28 28 adding x.txt
29 29 adding foo/y.txt
30 30
31 31 Test recursive status without committing anything:
32 32
33 33 $ hg status -S
34 34 A .hgsub
35 35 A foo/.hgsub
36 36 A foo/bar/z.txt
37 37 A foo/y.txt
38 38 A x.txt
39 39
40 40 Test recursive diff without committing anything:
41 41
42 42 $ hg diff --nodates -S foo
43 43 diff -r 000000000000 foo/.hgsub
44 44 --- /dev/null
45 45 +++ b/foo/.hgsub
46 46 @@ -0,0 +1,1 @@
47 47 +bar = bar
48 48 diff -r 000000000000 foo/y.txt
49 49 --- /dev/null
50 50 +++ b/foo/y.txt
51 51 @@ -0,0 +1,1 @@
52 52 +y1
53 53 diff -r 000000000000 foo/bar/z.txt
54 54 --- /dev/null
55 55 +++ b/foo/bar/z.txt
56 56 @@ -0,0 +1,1 @@
57 57 +z1
58 58
59 59 Commits:
60 60
61 61 $ hg commit -m fails
62 62 abort: uncommitted changes in subrepo foo
63 63 (use --subrepos for recursive commit)
64 64 [255]
65 65
66 66 The --subrepos flag overwrite the config setting:
67 67
68 68 $ hg commit -m 0-0-0 --config ui.commitsubrepos=No --subrepos
69 69 committing subrepository foo
70 70 committing subrepository foo/bar
71 71
72 72 $ cd foo
73 73 $ echo y2 >> y.txt
74 74 $ hg commit -m 0-1-0
75 75
76 76 $ cd bar
77 77 $ echo z2 >> z.txt
78 78 $ hg commit -m 0-1-1
79 79
80 80 $ cd ..
81 81 $ hg commit -m 0-2-1
82 82 committing subrepository bar
83 83
84 84 $ cd ..
85 85 $ hg commit -m 1-2-1
86 86 committing subrepository foo
87 87
88 88 Change working directory:
89 89
90 90 $ echo y3 >> foo/y.txt
91 91 $ echo z3 >> foo/bar/z.txt
92 92 $ hg status -S
93 93 M foo/bar/z.txt
94 94 M foo/y.txt
95 95 $ hg diff --nodates -S
96 96 diff -r d254738c5f5e foo/y.txt
97 97 --- a/foo/y.txt
98 98 +++ b/foo/y.txt
99 99 @@ -1,2 +1,3 @@
100 100 y1
101 101 y2
102 102 +y3
103 103 diff -r 9647f22de499 foo/bar/z.txt
104 104 --- a/foo/bar/z.txt
105 105 +++ b/foo/bar/z.txt
106 106 @@ -1,2 +1,3 @@
107 107 z1
108 108 z2
109 109 +z3
110 110
111 111 Status call crossing repository boundaries:
112 112
113 113 $ hg status -S foo/bar/z.txt
114 114 M foo/bar/z.txt
115 115 $ hg status -S -I 'foo/?.txt'
116 116 M foo/y.txt
117 117 $ hg status -S -I '**/?.txt'
118 118 M foo/bar/z.txt
119 119 M foo/y.txt
120 120 $ hg diff --nodates -S -I '**/?.txt'
121 121 diff -r d254738c5f5e foo/y.txt
122 122 --- a/foo/y.txt
123 123 +++ b/foo/y.txt
124 124 @@ -1,2 +1,3 @@
125 125 y1
126 126 y2
127 127 +y3
128 128 diff -r 9647f22de499 foo/bar/z.txt
129 129 --- a/foo/bar/z.txt
130 130 +++ b/foo/bar/z.txt
131 131 @@ -1,2 +1,3 @@
132 132 z1
133 133 z2
134 134 +z3
135 135
136 136 Status from within a subdirectory:
137 137
138 138 $ mkdir dir
139 139 $ cd dir
140 140 $ echo a1 > a.txt
141 141 $ hg status -S
142 142 M foo/bar/z.txt
143 143 M foo/y.txt
144 144 ? dir/a.txt
145 145 $ hg diff --nodates -S
146 146 diff -r d254738c5f5e foo/y.txt
147 147 --- a/foo/y.txt
148 148 +++ b/foo/y.txt
149 149 @@ -1,2 +1,3 @@
150 150 y1
151 151 y2
152 152 +y3
153 153 diff -r 9647f22de499 foo/bar/z.txt
154 154 --- a/foo/bar/z.txt
155 155 +++ b/foo/bar/z.txt
156 156 @@ -1,2 +1,3 @@
157 157 z1
158 158 z2
159 159 +z3
160 160
161 161 Status with relative path:
162 162
163 163 $ hg status -S ..
164 164 M ../foo/bar/z.txt
165 165 M ../foo/y.txt
166 166 ? a.txt
167 167 $ hg diff --nodates -S ..
168 168 diff -r d254738c5f5e foo/y.txt
169 169 --- a/foo/y.txt
170 170 +++ b/foo/y.txt
171 171 @@ -1,2 +1,3 @@
172 172 y1
173 173 y2
174 174 +y3
175 175 diff -r 9647f22de499 foo/bar/z.txt
176 176 --- a/foo/bar/z.txt
177 177 +++ b/foo/bar/z.txt
178 178 @@ -1,2 +1,3 @@
179 179 z1
180 180 z2
181 181 +z3
182 182 $ cd ..
183 183
184 184 Cleanup and final commit:
185 185
186 186 $ rm -r dir
187 187 $ hg commit --subrepos -m 2-3-2
188 188 committing subrepository foo
189 189 committing subrepository foo/bar
190 190
191 191 Log with the relationships between repo and its subrepo:
192 192
193 193 $ hg log --template '{rev}:{node|short} {desc}\n'
194 194 2:1326fa26d0c0 2-3-2
195 195 1:4b3c9ff4f66b 1-2-1
196 196 0:23376cbba0d8 0-0-0
197 197
198 198 $ hg -R foo log --template '{rev}:{node|short} {desc}\n'
199 199 3:65903cebad86 2-3-2
200 200 2:d254738c5f5e 0-2-1
201 201 1:8629ce7dcc39 0-1-0
202 202 0:af048e97ade2 0-0-0
203 203
204 204 $ hg -R foo/bar log --template '{rev}:{node|short} {desc}\n'
205 205 2:31ecbdafd357 2-3-2
206 206 1:9647f22de499 0-1-1
207 207 0:4904098473f9 0-0-0
208 208
209 209 Status between revisions:
210 210
211 211 $ hg status -S
212 212 $ hg status -S --rev 0:1
213 213 M .hgsubstate
214 214 M foo/.hgsubstate
215 215 M foo/bar/z.txt
216 216 M foo/y.txt
217 217 $ hg diff --nodates -S -I '**/?.txt' --rev 0:1
218 218 diff -r af048e97ade2 -r d254738c5f5e foo/y.txt
219 219 --- a/foo/y.txt
220 220 +++ b/foo/y.txt
221 221 @@ -1,1 +1,2 @@
222 222 y1
223 223 +y2
224 224 diff -r 4904098473f9 -r 9647f22de499 foo/bar/z.txt
225 225 --- a/foo/bar/z.txt
226 226 +++ b/foo/bar/z.txt
227 227 @@ -1,1 +1,2 @@
228 228 z1
229 229 +z2
230 230
231 231 Enable progress extension for archive tests:
232 232
233 233 $ cp $HGRCPATH $HGRCPATH.no-progress
234 234 $ cat >> $HGRCPATH <<EOF
235 235 > [extensions]
236 236 > progress =
237 237 > [progress]
238 238 > assume-tty = 1
239 239 > delay = 0
240 240 > format = topic bar number
241 241 > refresh = 0
242 242 > width = 60
243 243 > EOF
244 244
245 245 Test archiving to a directory tree (the doubled lines in the output
246 246 only show up in the test output, not in real usage):
247 247
248 248 $ hg archive --subrepos ../archive 2>&1 | $TESTDIR/filtercr.py
249 249
250 250 archiving [ ] 0/3
251 251 archiving [ ] 0/3
252 252 archiving [=============> ] 1/3
253 253 archiving [=============> ] 1/3
254 254 archiving [===========================> ] 2/3
255 255 archiving [===========================> ] 2/3
256 256 archiving [==========================================>] 3/3
257 257 archiving [==========================================>] 3/3
258 258
259 259 archiving (foo) [ ] 0/3
260 260 archiving (foo) [ ] 0/3
261 261 archiving (foo) [===========> ] 1/3
262 262 archiving (foo) [===========> ] 1/3
263 263 archiving (foo) [=======================> ] 2/3
264 264 archiving (foo) [=======================> ] 2/3
265 265 archiving (foo) [====================================>] 3/3
266 266 archiving (foo) [====================================>] 3/3
267 267
268 archiving (foo/bar) [ ] 0/1
269 archiving (foo/bar) [ ] 0/1
270 archiving (foo/bar) [================================>] 1/1
271 archiving (foo/bar) [================================>] 1/1
268 archiving (foo/bar) [ ] 0/1 (glob)
269 archiving (foo/bar) [ ] 0/1 (glob)
270 archiving (foo/bar) [================================>] 1/1 (glob)
271 archiving (foo/bar) [================================>] 1/1 (glob)
272 272 \r (esc)
273 273 $ find ../archive | sort
274 274 ../archive
275 275 ../archive/.hg_archival.txt
276 276 ../archive/.hgsub
277 277 ../archive/.hgsubstate
278 278 ../archive/foo
279 279 ../archive/foo/.hgsub
280 280 ../archive/foo/.hgsubstate
281 281 ../archive/foo/bar
282 282 ../archive/foo/bar/z.txt
283 283 ../archive/foo/y.txt
284 284 ../archive/x.txt
285 285
286 286 Test archiving to zip file (unzip output is unstable):
287 287
288 288 $ hg archive --subrepos ../archive.zip 2>&1 | $TESTDIR/filtercr.py
289 289
290 290 archiving [ ] 0/3
291 291 archiving [ ] 0/3
292 292 archiving [=============> ] 1/3
293 293 archiving [=============> ] 1/3
294 294 archiving [===========================> ] 2/3
295 295 archiving [===========================> ] 2/3
296 296 archiving [==========================================>] 3/3
297 297 archiving [==========================================>] 3/3
298 298
299 299 archiving (foo) [ ] 0/3
300 300 archiving (foo) [ ] 0/3
301 301 archiving (foo) [===========> ] 1/3
302 302 archiving (foo) [===========> ] 1/3
303 303 archiving (foo) [=======================> ] 2/3
304 304 archiving (foo) [=======================> ] 2/3
305 305 archiving (foo) [====================================>] 3/3
306 306 archiving (foo) [====================================>] 3/3
307 307
308 archiving (foo/bar) [ ] 0/1
309 archiving (foo/bar) [ ] 0/1
310 archiving (foo/bar) [================================>] 1/1
311 archiving (foo/bar) [================================>] 1/1
308 archiving (foo/bar) [ ] 0/1 (glob)
309 archiving (foo/bar) [ ] 0/1 (glob)
310 archiving (foo/bar) [================================>] 1/1 (glob)
311 archiving (foo/bar) [================================>] 1/1 (glob)
312 312 \r (esc)
313 313
314 314 Test archiving a revision that references a subrepo that is not yet
315 315 cloned:
316 316
317 317 $ hg clone -U . ../empty
318 318 $ cd ../empty
319 319 $ hg archive --subrepos -r tip ../archive.tar.gz 2>&1 | $TESTDIR/filtercr.py
320 320
321 321 archiving [ ] 0/3
322 322 archiving [ ] 0/3
323 323 archiving [=============> ] 1/3
324 324 archiving [=============> ] 1/3
325 325 archiving [===========================> ] 2/3
326 326 archiving [===========================> ] 2/3
327 327 archiving [==========================================>] 3/3
328 328 archiving [==========================================>] 3/3
329 329
330 330 archiving (foo) [ ] 0/3
331 331 archiving (foo) [ ] 0/3
332 332 archiving (foo) [===========> ] 1/3
333 333 archiving (foo) [===========> ] 1/3
334 334 archiving (foo) [=======================> ] 2/3
335 335 archiving (foo) [=======================> ] 2/3
336 336 archiving (foo) [====================================>] 3/3
337 337 archiving (foo) [====================================>] 3/3
338 338
339 archiving (foo/bar) [ ] 0/1
340 archiving (foo/bar) [ ] 0/1
341 archiving (foo/bar) [================================>] 1/1
342 archiving (foo/bar) [================================>] 1/1
339 archiving (foo/bar) [ ] 0/1 (glob)
340 archiving (foo/bar) [ ] 0/1 (glob)
341 archiving (foo/bar) [================================>] 1/1 (glob)
342 archiving (foo/bar) [================================>] 1/1 (glob)
343 343
344 344 cloning subrepo foo from $TESTTMP/repo/foo
345 345 cloning subrepo foo/bar from $TESTTMP/repo/foo/bar
346 346
347 347 The newly cloned subrepos contain no working copy:
348 348
349 349 $ hg -R foo summary
350 350 parent: -1:000000000000 (no revision checked out)
351 351 branch: default
352 352 commit: (clean)
353 353 update: 4 new changesets (update)
354 354
355 355 Disable progress extension and cleanup:
356 356
357 357 $ mv $HGRCPATH.no-progress $HGRCPATH
358 358
359 359 Test archiving when there is a directory in the way for a subrepo
360 360 created by archive:
361 361
362 362 $ hg clone -U . ../almost-empty
363 363 $ cd ../almost-empty
364 364 $ mkdir foo
365 365 $ echo f > foo/f
366 366 $ hg archive --subrepos -r tip archive
367 367 cloning subrepo foo from $TESTTMP/empty/foo
368 368 abort: destination '$TESTTMP/almost-empty/foo' is not empty
369 369 [255]
370 370
371 371 Clone and test outgoing:
372 372
373 373 $ cd ..
374 374 $ hg clone repo repo2
375 375 updating to branch default
376 376 cloning subrepo foo from $TESTTMP/repo/foo
377 377 cloning subrepo foo/bar from $TESTTMP/repo/foo/bar
378 378 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
379 379 $ cd repo2
380 380 $ hg outgoing -S
381 381 comparing with $TESTTMP/repo
382 382 searching for changes
383 383 no changes found
384 384 comparing with $TESTTMP/repo/foo
385 385 searching for changes
386 386 no changes found
387 387 comparing with $TESTTMP/repo/foo/bar
388 388 searching for changes
389 389 no changes found
390 390 [1]
391 391
392 392 Make nested change:
393 393
394 394 $ echo y4 >> foo/y.txt
395 395 $ hg diff --nodates -S
396 396 diff -r 65903cebad86 foo/y.txt
397 397 --- a/foo/y.txt
398 398 +++ b/foo/y.txt
399 399 @@ -1,3 +1,4 @@
400 400 y1
401 401 y2
402 402 y3
403 403 +y4
404 404 $ hg commit --subrepos -m 3-4-2
405 405 committing subrepository foo
406 406 $ hg outgoing -S
407 407 comparing with $TESTTMP/repo
408 408 searching for changes
409 409 changeset: 3:2655b8ecc4ee
410 410 tag: tip
411 411 user: test
412 412 date: Thu Jan 01 00:00:00 1970 +0000
413 413 summary: 3-4-2
414 414
415 415 comparing with $TESTTMP/repo/foo
416 416 searching for changes
417 417 changeset: 4:e96193d6cb36
418 418 tag: tip
419 419 user: test
420 420 date: Thu Jan 01 00:00:00 1970 +0000
421 421 summary: 3-4-2
422 422
423 423 comparing with $TESTTMP/repo/foo/bar
424 424 searching for changes
425 425 no changes found
426 426
427 427
428 428 Switch to original repo and setup default path:
429 429
430 430 $ cd ../repo
431 431 $ echo '[paths]' >> .hg/hgrc
432 432 $ echo 'default = ../repo2' >> .hg/hgrc
433 433
434 434 Test incoming:
435 435
436 436 $ hg incoming -S
437 437 comparing with $TESTTMP/repo2
438 438 searching for changes
439 439 changeset: 3:2655b8ecc4ee
440 440 tag: tip
441 441 user: test
442 442 date: Thu Jan 01 00:00:00 1970 +0000
443 443 summary: 3-4-2
444 444
445 445 comparing with $TESTTMP/repo2/foo
446 446 searching for changes
447 447 changeset: 4:e96193d6cb36
448 448 tag: tip
449 449 user: test
450 450 date: Thu Jan 01 00:00:00 1970 +0000
451 451 summary: 3-4-2
452 452
453 453 comparing with $TESTTMP/repo2/foo/bar
454 454 searching for changes
455 455 no changes found
456 456
457 457 $ hg incoming -S --bundle incoming.hg
458 458 abort: cannot combine --bundle and --subrepos
459 459 [255]
460 460
461 461 Test missing subrepo:
462 462
463 463 $ rm -r foo
464 464 $ hg status -S
465 465 warning: error "unknown revision '65903cebad86f1a84bd4f1134f62fa7dcb7a1c98'" in subrepository "foo"
466 466
467 467 Issue2619: IndexError: list index out of range on hg add with subrepos
468 468 The subrepo must sorts after the explicit filename.
469 469
470 470 $ cd ..
471 471 $ hg init test
472 472 $ cd test
473 473 $ hg init x
474 474 $ echo "x = x" >> .hgsub
475 475 $ hg add .hgsub
476 476 $ touch a x/a
477 477 $ hg add a x/a
@@ -1,105 +1,105 b''
1 1 $ "$TESTDIR/hghave" serve || exit 80
2 2
3 3 Preparing the subrepository 'sub'
4 4
5 5 $ hg init sub
6 6 $ echo sub > sub/sub
7 7 $ hg add -R sub
8 adding sub/sub
8 adding sub/sub (glob)
9 9 $ hg commit -R sub -m "sub import"
10 10
11 11 Preparing the 'main' repo which depends on the subrepo 'sub'
12 12
13 13 $ hg init main
14 14 $ echo main > main/main
15 15 $ echo "sub = ../sub" > main/.hgsub
16 16 $ hg clone sub main/sub
17 17 updating to branch default
18 18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 19 $ hg add -R main
20 adding main/.hgsub
21 adding main/main
20 adding main/.hgsub (glob)
21 adding main/main (glob)
22 22 $ hg commit -R main -m "main import"
23 23 committing subrepository sub
24 24
25 25 Cleaning both repositories, just as a clone -U
26 26
27 27 $ hg up -C -R sub null
28 28 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
29 29 $ hg up -C -R main null
30 30 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
31 31 $ rm -rf main/sub
32 32
33 33 Serving them both using hgweb
34 34
35 35 $ printf '[paths]\n/main = main\nsub = sub\n' > webdir.conf
36 36 $ hg serve --webdir-conf webdir.conf -a localhost -p $HGPORT \
37 37 > -A /dev/null -E /dev/null --pid-file hg.pid -d
38 38 $ cat hg.pid >> $DAEMON_PIDS
39 39
40 40 Clone main from hgweb
41 41
42 42 $ hg clone "http://localhost:$HGPORT/main" cloned
43 43 requesting all changes
44 44 adding changesets
45 45 adding manifests
46 46 adding file changes
47 47 added 1 changesets with 3 changes to 3 files
48 48 updating to branch default
49 49 cloning subrepo sub from http://localhost:$HGPORT/sub
50 50 requesting all changes
51 51 adding changesets
52 52 adding manifests
53 53 adding file changes
54 54 added 1 changesets with 1 changes to 1 files
55 55 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 56
57 57 Checking cloned repo ids
58 58
59 59 $ hg id -R cloned
60 60 fdfeeb3e979e tip
61 61 $ hg id -R cloned/sub
62 62 863c1745b441 tip
63 63
64 64 subrepo debug for 'main' clone
65 65
66 66 $ hg debugsub -R cloned
67 67 path sub
68 68 source ../sub
69 69 revision 863c1745b441bd97a8c4a096e87793073f4fb215
70 70
71 71 $ "$TESTDIR/killdaemons.py"
72 72
73 73 subrepo paths with ssh urls
74 74
75 75 $ cp $TESTDIR/dummyssh $BINDIR/ssh
76 76
77 77 $ hg clone ssh://user@dummy/cloned sshclone
78 78 requesting all changes
79 79 adding changesets
80 80 adding manifests
81 81 adding file changes
82 82 added 1 changesets with 3 changes to 3 files
83 83 updating to branch default
84 84 cloning subrepo sub from ssh://user@dummy/sub
85 85 requesting all changes
86 86 adding changesets
87 87 adding manifests
88 88 adding file changes
89 89 added 1 changesets with 1 changes to 1 files
90 90 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 91
92 92 $ hg -R sshclone push ssh://user@dummy/$TESTTMP/cloned
93 93 pushing to ssh://user@dummy/$TESTTMP/cloned
94 94 pushing subrepo sub to ssh://user@dummy/$TESTTMP/sub
95 95 searching for changes
96 96 no changes found
97 97 searching for changes
98 98 no changes found
99 99
100 100 $ cat dummylog
101 101 Got arguments 1:user@dummy 2:hg -R cloned serve --stdio
102 102 Got arguments 1:user@dummy 2:hg -R sub serve --stdio
103 103 Got arguments 1:user@dummy 2:hg -R $TESTTMP/cloned serve --stdio
104 104 Got arguments 1:user@dummy 2:hg -R $TESTTMP/sub serve --stdio
105 105 $ rm $BINDIR/ssh
@@ -1,1007 +1,1007 b''
1 1 Let commit recurse into subrepos by default to match pre-2.0 behavior:
2 2
3 3 $ echo "[ui]" >> $HGRCPATH
4 4 $ echo "commitsubrepos = Yes" >> $HGRCPATH
5 5
6 6 $ rm -rf sub
7 7 $ mkdir sub
8 8 $ cd sub
9 9 $ hg init t
10 10 $ cd t
11 11
12 12 first revision, no sub
13 13
14 14 $ echo a > a
15 15 $ hg ci -Am0
16 16 adding a
17 17
18 18 add first sub
19 19
20 20 $ echo s = s > .hgsub
21 21 $ hg add .hgsub
22 22 $ hg init s
23 23 $ echo a > s/a
24 24
25 25 Issue2232: committing a subrepo without .hgsub
26 26
27 27 $ hg ci -mbad s
28 28 abort: can't commit subrepos without .hgsub
29 29 [255]
30 30
31 31 $ hg -R s ci -Ams0
32 32 adding a
33 33 $ hg sum
34 34 parent: 0:f7b1eb17ad24 tip
35 35 0
36 36 branch: default
37 37 commit: 1 added, 1 subrepos
38 38 update: (current)
39 39 $ hg ci -m1
40 40 committing subrepository s
41 41
42 42 Revert can't (yet) revert subrepos:
43 43
44 44 $ echo b > s/a
45 45 $ hg revert s
46 46 s: reverting subrepos is unsupported
47 47
48 48 Revert currently ignores subrepos by default
49 49
50 50 $ hg revert -a
51 51 $ hg revert -R s -a -C
52 reverting s/a
52 reverting s/a (glob)
53 53
54 54 Issue2022: update -C
55 55
56 56 $ echo b > s/a
57 57 $ hg sum
58 58 parent: 1:7cf8cfea66e4 tip
59 59 1
60 60 branch: default
61 61 commit: 1 subrepos
62 62 update: (current)
63 63 $ hg co -C 1
64 64 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 65 $ hg sum
66 66 parent: 1:7cf8cfea66e4 tip
67 67 1
68 68 branch: default
69 69 commit: (clean)
70 70 update: (current)
71 71
72 72 commands that require a clean repo should respect subrepos
73 73
74 74 $ echo b >> s/a
75 75 $ hg backout tip
76 76 abort: uncommitted changes in subrepo s
77 77 [255]
78 78 $ hg revert -C -R s s/a
79 79
80 80 add sub sub
81 81
82 82 $ echo ss = ss > s/.hgsub
83 83 $ hg init s/ss
84 84 $ echo a > s/ss/a
85 85 $ hg -R s add s/.hgsub
86 86 $ hg -R s/ss add s/ss/a
87 87 $ hg sum
88 88 parent: 1:7cf8cfea66e4 tip
89 89 1
90 90 branch: default
91 91 commit: 1 subrepos
92 92 update: (current)
93 93 $ hg ci -m2
94 94 committing subrepository s
95 committing subrepository s/ss
95 committing subrepository s/ss (glob)
96 96 $ hg sum
97 97 parent: 2:df30734270ae tip
98 98 2
99 99 branch: default
100 100 commit: (clean)
101 101 update: (current)
102 102
103 103 bump sub rev (and check it is ignored by ui.commitsubrepos)
104 104
105 105 $ echo b > s/a
106 106 $ hg -R s ci -ms1
107 107 $ hg --config ui.commitsubrepos=no ci -m3
108 108 committing subrepository s
109 109
110 110 leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
111 111
112 112 $ echo c > s/a
113 113 $ hg --config ui.commitsubrepos=no ci -m4
114 114 abort: uncommitted changes in subrepo s
115 115 (use --subrepos for recursive commit)
116 116 [255]
117 117 $ hg ci -m4
118 118 committing subrepository s
119 119 $ hg tip -R s
120 120 changeset: 3:1c833a7a9e3a
121 121 tag: tip
122 122 user: test
123 123 date: Thu Jan 01 00:00:00 1970 +0000
124 124 summary: 4
125 125
126 126
127 127 check caching
128 128
129 129 $ hg co 0
130 130 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
131 131 $ hg debugsub
132 132
133 133 restore
134 134
135 135 $ hg co
136 136 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 137 $ hg debugsub
138 138 path s
139 139 source s
140 140 revision 1c833a7a9e3a4445c711aaf0f012379cd0d4034e
141 141
142 142 new branch for merge tests
143 143
144 144 $ hg co 1
145 145 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
146 146 $ echo t = t >> .hgsub
147 147 $ hg init t
148 148 $ echo t > t/t
149 149 $ hg -R t add t
150 adding t/t
150 adding t/t (glob)
151 151
152 152 5
153 153
154 154 $ hg ci -m5 # add sub
155 155 committing subrepository t
156 156 created new head
157 157 $ echo t2 > t/t
158 158
159 159 6
160 160
161 161 $ hg st -R s
162 162 $ hg ci -m6 # change sub
163 163 committing subrepository t
164 164 $ hg debugsub
165 165 path s
166 166 source s
167 167 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
168 168 path t
169 169 source t
170 170 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
171 171 $ echo t3 > t/t
172 172
173 173 7
174 174
175 175 $ hg ci -m7 # change sub again for conflict test
176 176 committing subrepository t
177 177 $ hg rm .hgsub
178 178
179 179 8
180 180
181 181 $ hg ci -m8 # remove sub
182 182
183 183 merge tests
184 184
185 185 $ hg co -C 3
186 186 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
187 187 $ hg merge 5 # test adding
188 188 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 189 (branch merge, don't forget to commit)
190 190 $ hg debugsub
191 191 path s
192 192 source s
193 193 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
194 194 path t
195 195 source t
196 196 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
197 197 $ hg ci -m9
198 198 created new head
199 199 $ hg merge 6 --debug # test change
200 200 searching for copies back to rev 2
201 201 resolving manifests
202 202 overwrite None partial False
203 203 ancestor 1f14a2e2d3ec local f0d2028bf86d+ remote 1831e14459c4
204 204 .hgsubstate: versions differ -> m
205 205 updating: .hgsubstate 1/1 files (100.00%)
206 206 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
207 207 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
208 208 getting subrepo t
209 209 resolving manifests
210 210 overwrite True partial False
211 211 ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a
212 212 t: remote is newer -> g
213 213 updating: t 1/1 files (100.00%)
214 214 getting t
215 215 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
216 216 (branch merge, don't forget to commit)
217 217 $ hg debugsub
218 218 path s
219 219 source s
220 220 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
221 221 path t
222 222 source t
223 223 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
224 224 $ echo conflict > t/t
225 225 $ hg ci -m10
226 226 committing subrepository t
227 227 $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
228 228 searching for copies back to rev 2
229 229 resolving manifests
230 230 overwrite None partial False
231 231 ancestor 1831e14459c4 local e45c8b14af55+ remote f94576341bcf
232 232 .hgsubstate: versions differ -> m
233 233 updating: .hgsubstate 1/1 files (100.00%)
234 234 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
235 235 subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
236 236 merging subrepo t
237 237 searching for copies back to rev 2
238 238 resolving manifests
239 239 overwrite None partial False
240 240 ancestor 6747d179aa9a local 20a0db6fbf6c+ remote 7af322bc1198
241 241 t: versions differ -> m
242 242 preserving t for resolve of t
243 243 updating: t 1/1 files (100.00%)
244 244 picked tool 'internal:merge' for t (binary False symlink False)
245 245 merging t
246 246 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
247 247 warning: conflicts during merge.
248 248 merging t failed!
249 249 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
250 250 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
251 251 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 252 (branch merge, don't forget to commit)
253 253
254 254 should conflict
255 255
256 256 $ cat t/t
257 257 <<<<<<< local
258 258 conflict
259 259 =======
260 260 t3
261 261 >>>>>>> other
262 262
263 263 clone
264 264
265 265 $ cd ..
266 266 $ hg clone t tc
267 267 updating to branch default
268 cloning subrepo s from $TESTTMP/sub/t/s
269 cloning subrepo s/ss from $TESTTMP/sub/t/s/ss
270 cloning subrepo t from $TESTTMP/sub/t/t
268 cloning subrepo s from $TESTTMP/sub/t/s (glob)
269 cloning subrepo s/ss from $TESTTMP/sub/t/s/ss (glob)
270 cloning subrepo t from $TESTTMP/sub/t/t (glob)
271 271 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 272 $ cd tc
273 273 $ hg debugsub
274 274 path s
275 275 source s
276 276 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
277 277 path t
278 278 source t
279 279 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
280 280
281 281 push
282 282
283 283 $ echo bah > t/t
284 284 $ hg ci -m11
285 285 committing subrepository t
286 286 $ hg push
287 pushing to $TESTTMP/sub/t
288 pushing subrepo s/ss to $TESTTMP/sub/t/s/ss
287 pushing to $TESTTMP/sub/t (glob)
288 pushing subrepo s/ss to $TESTTMP/sub/t/s/ss (glob)
289 289 searching for changes
290 290 no changes found
291 pushing subrepo s to $TESTTMP/sub/t/s
291 pushing subrepo s to $TESTTMP/sub/t/s (glob)
292 292 searching for changes
293 293 no changes found
294 pushing subrepo t to $TESTTMP/sub/t/t
294 pushing subrepo t to $TESTTMP/sub/t/t (glob)
295 295 searching for changes
296 296 adding changesets
297 297 adding manifests
298 298 adding file changes
299 299 added 1 changesets with 1 changes to 1 files
300 300 searching for changes
301 301 adding changesets
302 302 adding manifests
303 303 adding file changes
304 304 added 1 changesets with 1 changes to 1 files
305 305
306 306 push -f
307 307
308 308 $ echo bah > s/a
309 309 $ hg ci -m12
310 310 committing subrepository s
311 311 $ hg push
312 pushing to $TESTTMP/sub/t
313 pushing subrepo s/ss to $TESTTMP/sub/t/s/ss
312 pushing to $TESTTMP/sub/t (glob)
313 pushing subrepo s/ss to $TESTTMP/sub/t/s/ss (glob)
314 314 searching for changes
315 315 no changes found
316 pushing subrepo s to $TESTTMP/sub/t/s
316 pushing subrepo s to $TESTTMP/sub/t/s (glob)
317 317 searching for changes
318 318 abort: push creates new remote head 12a213df6fa9!
319 319 (did you forget to merge? use push -f to force)
320 320 [255]
321 321 $ hg push -f
322 pushing to $TESTTMP/sub/t
323 pushing subrepo s/ss to $TESTTMP/sub/t/s/ss
322 pushing to $TESTTMP/sub/t (glob)
323 pushing subrepo s/ss to $TESTTMP/sub/t/s/ss (glob)
324 324 searching for changes
325 325 no changes found
326 pushing subrepo s to $TESTTMP/sub/t/s
326 pushing subrepo s to $TESTTMP/sub/t/s (glob)
327 327 searching for changes
328 328 adding changesets
329 329 adding manifests
330 330 adding file changes
331 331 added 1 changesets with 1 changes to 1 files (+1 heads)
332 pushing subrepo t to $TESTTMP/sub/t/t
332 pushing subrepo t to $TESTTMP/sub/t/t (glob)
333 333 searching for changes
334 334 no changes found
335 335 searching for changes
336 336 adding changesets
337 337 adding manifests
338 338 adding file changes
339 339 added 1 changesets with 1 changes to 1 files
340 340
341 341 update
342 342
343 343 $ cd ../t
344 344 $ hg up -C # discard our earlier merge
345 345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
346 346 $ echo blah > t/t
347 347 $ hg ci -m13
348 348 committing subrepository t
349 349
350 350 pull
351 351
352 352 $ cd ../tc
353 353 $ hg pull
354 pulling from $TESTTMP/sub/t
354 pulling from $TESTTMP/sub/t (glob)
355 355 searching for changes
356 356 adding changesets
357 357 adding manifests
358 358 adding file changes
359 359 added 1 changesets with 1 changes to 1 files
360 360 (run 'hg update' to get a working copy)
361 361
362 362 should pull t
363 363
364 364 $ hg up
365 pulling subrepo t from $TESTTMP/sub/t/t
365 pulling subrepo t from $TESTTMP/sub/t/t (glob)
366 366 searching for changes
367 367 adding changesets
368 368 adding manifests
369 369 adding file changes
370 370 added 1 changesets with 1 changes to 1 files
371 371 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
372 372 $ cat t/t
373 373 blah
374 374
375 375 bogus subrepo path aborts
376 376
377 377 $ echo 'bogus=[boguspath' >> .hgsub
378 378 $ hg ci -m 'bogus subrepo path'
379 379 abort: missing ] in subrepo source
380 380 [255]
381 381
382 382 Issue1986: merge aborts when trying to merge a subrepo that
383 383 shouldn't need merging
384 384
385 385 # subrepo layout
386 386 #
387 387 # o 5 br
388 388 # /|
389 389 # o | 4 default
390 390 # | |
391 391 # | o 3 br
392 392 # |/|
393 393 # o | 2 default
394 394 # | |
395 395 # | o 1 br
396 396 # |/
397 397 # o 0 default
398 398
399 399 $ cd ..
400 400 $ rm -rf sub
401 401 $ hg init main
402 402 $ cd main
403 403 $ hg init s
404 404 $ cd s
405 405 $ echo a > a
406 406 $ hg ci -Am1
407 407 adding a
408 408 $ hg branch br
409 409 marked working directory as branch br
410 410 $ echo a >> a
411 411 $ hg ci -m1
412 412 $ hg up default
413 413 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
414 414 $ echo b > b
415 415 $ hg ci -Am1
416 416 adding b
417 417 $ hg up br
418 418 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
419 419 $ hg merge tip
420 420 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
421 421 (branch merge, don't forget to commit)
422 422 $ hg ci -m1
423 423 $ hg up 2
424 424 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
425 425 $ echo c > c
426 426 $ hg ci -Am1
427 427 adding c
428 428 $ hg up 3
429 429 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
430 430 $ hg merge 4
431 431 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
432 432 (branch merge, don't forget to commit)
433 433 $ hg ci -m1
434 434
435 435 # main repo layout:
436 436 #
437 437 # * <-- try to merge default into br again
438 438 # .`|
439 439 # . o 5 br --> substate = 5
440 440 # . |
441 441 # o | 4 default --> substate = 4
442 442 # | |
443 443 # | o 3 br --> substate = 2
444 444 # |/|
445 445 # o | 2 default --> substate = 2
446 446 # | |
447 447 # | o 1 br --> substate = 3
448 448 # |/
449 449 # o 0 default --> substate = 2
450 450
451 451 $ cd ..
452 452 $ echo 's = s' > .hgsub
453 453 $ hg -R s up 2
454 454 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
455 455 $ hg ci -Am1
456 456 adding .hgsub
457 457 committing subrepository s
458 458 $ hg branch br
459 459 marked working directory as branch br
460 460 $ echo b > b
461 461 $ hg -R s up 3
462 462 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
463 463 $ hg ci -Am1
464 464 adding b
465 465 committing subrepository s
466 466 $ hg up default
467 467 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
468 468 $ echo c > c
469 469 $ hg ci -Am1
470 470 adding c
471 471 $ hg up 1
472 472 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
473 473 $ hg merge 2
474 474 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
475 475 (branch merge, don't forget to commit)
476 476 $ hg ci -m1
477 477 $ hg up 2
478 478 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
479 479 $ hg -R s up 4
480 480 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
481 481 $ echo d > d
482 482 $ hg ci -Am1
483 483 adding d
484 484 committing subrepository s
485 485 $ hg up 3
486 486 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
487 487 $ hg -R s up 5
488 488 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
489 489 $ echo e > e
490 490 $ hg ci -Am1
491 491 adding e
492 492 committing subrepository s
493 493
494 494 $ hg up 5
495 495 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
496 496 $ hg merge 4 # try to merge default into br again
497 497 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
498 498 (branch merge, don't forget to commit)
499 499 $ cd ..
500 500
501 501 test subrepo delete from .hgsubstate
502 502
503 503 $ hg init testdelete
504 504 $ mkdir testdelete/nested testdelete/nested2
505 505 $ hg init testdelete/nested
506 506 $ hg init testdelete/nested2
507 507 $ echo test > testdelete/nested/foo
508 508 $ echo test > testdelete/nested2/foo
509 509 $ hg -R testdelete/nested add
510 adding testdelete/nested/foo
510 adding testdelete/nested/foo (glob)
511 511 $ hg -R testdelete/nested2 add
512 adding testdelete/nested2/foo
512 adding testdelete/nested2/foo (glob)
513 513 $ hg -R testdelete/nested ci -m test
514 514 $ hg -R testdelete/nested2 ci -m test
515 515 $ echo nested = nested > testdelete/.hgsub
516 516 $ echo nested2 = nested2 >> testdelete/.hgsub
517 517 $ hg -R testdelete add
518 adding testdelete/.hgsub
518 adding testdelete/.hgsub (glob)
519 519 $ hg -R testdelete ci -m "nested 1 & 2 added"
520 520 committing subrepository nested
521 521 committing subrepository nested2
522 522 $ echo nested = nested > testdelete/.hgsub
523 523 $ hg -R testdelete ci -m "nested 2 deleted"
524 524 $ cat testdelete/.hgsubstate
525 525 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
526 526 $ hg -R testdelete remove testdelete/.hgsub
527 527 $ hg -R testdelete ci -m ".hgsub deleted"
528 528 $ cat testdelete/.hgsubstate
529 529 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
530 530
531 531 test repository cloning
532 532
533 533 $ mkdir mercurial mercurial2
534 534 $ hg init nested_absolute
535 535 $ echo test > nested_absolute/foo
536 536 $ hg -R nested_absolute add
537 adding nested_absolute/foo
537 adding nested_absolute/foo (glob)
538 538 $ hg -R nested_absolute ci -mtest
539 539 $ cd mercurial
540 540 $ hg init nested_relative
541 541 $ echo test2 > nested_relative/foo2
542 542 $ hg -R nested_relative add
543 adding nested_relative/foo2
543 adding nested_relative/foo2 (glob)
544 544 $ hg -R nested_relative ci -mtest2
545 545 $ hg init main
546 546 $ echo "nested_relative = ../nested_relative" > main/.hgsub
547 547 $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
548 548 $ hg -R main add
549 adding main/.hgsub
549 adding main/.hgsub (glob)
550 550 $ hg -R main ci -m "add subrepos"
551 551 committing subrepository nested_absolute
552 552 committing subrepository nested_relative
553 553 $ cd ..
554 554 $ hg clone mercurial/main mercurial2/main
555 555 updating to branch default
556 556 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
557 557 $ cat mercurial2/main/nested_absolute/.hg/hgrc \
558 558 > mercurial2/main/nested_relative/.hg/hgrc
559 559 [paths]
560 560 default = $TESTTMP/sub/mercurial/nested_absolute
561 561 [paths]
562 562 default = $TESTTMP/sub/mercurial/nested_relative
563 563 $ rm -rf mercurial mercurial2
564 564
565 565 Issue1977: multirepo push should fail if subrepo push fails
566 566
567 567 $ hg init repo
568 568 $ hg init repo/s
569 569 $ echo a > repo/s/a
570 570 $ hg -R repo/s ci -Am0
571 571 adding a
572 572 $ echo s = s > repo/.hgsub
573 573 $ hg -R repo ci -Am1
574 574 adding .hgsub
575 575 committing subrepository s
576 576 $ hg clone repo repo2
577 577 updating to branch default
578 cloning subrepo s from $TESTTMP/sub/repo/s
578 cloning subrepo s from $TESTTMP/sub/repo/s (glob)
579 579 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
580 580 $ hg -q -R repo2 pull -u
581 581 $ echo 1 > repo2/s/a
582 582 $ hg -R repo2/s ci -m2
583 583 $ hg -q -R repo2/s push
584 584 $ hg -R repo2/s up -C 0
585 585 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
586 586 $ echo 2 > repo2/s/a
587 587 $ hg -R repo2/s ci -m3
588 588 created new head
589 589 $ hg -R repo2 ci -m3
590 590 committing subrepository s
591 591 $ hg -q -R repo2 push
592 592 abort: push creates new remote head 9d66565e64e1!
593 593 (did you forget to merge? use push -f to force)
594 594 [255]
595 595 $ hg -R repo update
596 596 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
597 597 $ rm -rf repo2 repo
598 598
599 599
600 600 Issue1852 subrepos with relative paths always push/pull relative to default
601 601
602 602 Prepare a repo with subrepo
603 603
604 604 $ hg init issue1852a
605 605 $ cd issue1852a
606 606 $ hg init sub/repo
607 607 $ echo test > sub/repo/foo
608 608 $ hg -R sub/repo add sub/repo/foo
609 609 $ echo sub/repo = sub/repo > .hgsub
610 610 $ hg add .hgsub
611 611 $ hg ci -mtest
612 committing subrepository sub/repo
612 committing subrepository sub/repo (glob)
613 613 $ echo test >> sub/repo/foo
614 614 $ hg ci -mtest
615 committing subrepository sub/repo
615 committing subrepository sub/repo (glob)
616 616 $ cd ..
617 617
618 618 Create repo without default path, pull top repo, and see what happens on update
619 619
620 620 $ hg init issue1852b
621 621 $ hg -R issue1852b pull issue1852a
622 622 pulling from issue1852a
623 623 requesting all changes
624 624 adding changesets
625 625 adding manifests
626 626 adding file changes
627 627 added 2 changesets with 3 changes to 2 files
628 628 (run 'hg update' to get a working copy)
629 629 $ hg -R issue1852b update
630 abort: default path for subrepository sub/repo not found
630 abort: default path for subrepository sub/repo not found (glob)
631 631 [255]
632 632
633 633 Pull -u now doesn't help
634 634
635 635 $ hg -R issue1852b pull -u issue1852a
636 636 pulling from issue1852a
637 637 searching for changes
638 638 no changes found
639 639
640 640 Try the same, but with pull -u
641 641
642 642 $ hg init issue1852c
643 643 $ hg -R issue1852c pull -r0 -u issue1852a
644 644 pulling from issue1852a
645 645 adding changesets
646 646 adding manifests
647 647 adding file changes
648 648 added 1 changesets with 2 changes to 2 files
649 cloning subrepo sub/repo from issue1852a/sub/repo
649 cloning subrepo sub/repo from issue1852a/sub/repo (glob)
650 650 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
651 651
652 652 Try to push from the other side
653 653
654 654 $ hg -R issue1852a push `pwd`/issue1852c
655 655 pushing to $TESTTMP/sub/issue1852c
656 pushing subrepo sub/repo to $TESTTMP/sub/issue1852c/sub/repo
656 pushing subrepo sub/repo to $TESTTMP/sub/issue1852c/sub/repo (glob)
657 657 searching for changes
658 658 no changes found
659 659 searching for changes
660 660 adding changesets
661 661 adding manifests
662 662 adding file changes
663 663 added 1 changesets with 1 changes to 1 files
664 664
665 665 Incoming and outgoing should not use the default path:
666 666
667 667 $ hg clone -q issue1852a issue1852d
668 668 $ hg -R issue1852d outgoing --subrepos issue1852c
669 669 comparing with issue1852c
670 670 searching for changes
671 671 no changes found
672 672 comparing with issue1852c/sub/repo
673 673 searching for changes
674 674 no changes found
675 675 [1]
676 676 $ hg -R issue1852d incoming --subrepos issue1852c
677 677 comparing with issue1852c
678 678 searching for changes
679 679 no changes found
680 680 comparing with issue1852c/sub/repo
681 681 searching for changes
682 682 no changes found
683 683 [1]
684 684
685 685 Check status of files when none of them belong to the first
686 686 subrepository:
687 687
688 688 $ hg init subrepo-status
689 689 $ cd subrepo-status
690 690 $ hg init subrepo-1
691 691 $ hg init subrepo-2
692 692 $ cd subrepo-2
693 693 $ touch file
694 694 $ hg add file
695 695 $ cd ..
696 696 $ echo subrepo-1 = subrepo-1 > .hgsub
697 697 $ echo subrepo-2 = subrepo-2 >> .hgsub
698 698 $ hg add .hgsub
699 699 $ hg ci -m 'Added subrepos'
700 700 committing subrepository subrepo-1
701 701 committing subrepository subrepo-2
702 702 $ hg st subrepo-2/file
703 703
704 704 Check hg update --clean
705 705 $ cd $TESTTMP/sub/t
706 706 $ rm -r t/t.orig
707 707 $ hg status -S --all
708 708 C .hgsub
709 709 C .hgsubstate
710 710 C a
711 711 C s/.hgsub
712 712 C s/.hgsubstate
713 713 C s/a
714 714 C s/ss/a
715 715 C t/t
716 716 $ echo c1 > s/a
717 717 $ cd s
718 718 $ echo c1 > b
719 719 $ echo c1 > c
720 720 $ hg add b
721 721 $ cd ..
722 722 $ hg status -S
723 723 M s/a
724 724 A s/b
725 725 ? s/c
726 726 $ hg update -C
727 727 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
728 728 $ hg status -S
729 729 ? s/b
730 730 ? s/c
731 731
732 732 Sticky subrepositories, no changes
733 733 $ cd $TESTTMP/sub/t
734 734 $ hg id
735 735 925c17564ef8 tip
736 736 $ hg -R s id
737 737 12a213df6fa9 tip
738 738 $ hg -R t id
739 739 52c0adc0515a tip
740 740 $ hg update 11
741 741 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
742 742 $ hg id
743 743 365661e5936a
744 744 $ hg -R s id
745 745 fc627a69481f
746 746 $ hg -R t id
747 747 e95bcfa18a35
748 748
749 749 Sticky subrepositorys, file changes
750 750 $ touch s/f1
751 751 $ touch t/f1
752 752 $ hg add -S s/f1
753 753 $ hg add -S t/f1
754 754 $ hg id
755 755 365661e5936a
756 756 $ hg -R s id
757 757 fc627a69481f+
758 758 $ hg -R t id
759 759 e95bcfa18a35+
760 760 $ hg update tip
761 761 subrepository sources for s differ
762 762 use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)?
763 763 l
764 764 subrepository sources for t differ
765 765 use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)?
766 766 l
767 767 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
768 768 $ hg id
769 769 925c17564ef8+ tip
770 770 $ hg -R s id
771 771 fc627a69481f+
772 772 $ hg -R t id
773 773 e95bcfa18a35+
774 774 $ hg update --clean tip
775 775 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
776 776
777 777 Sticky subrepository, revision updates
778 778 $ hg id
779 779 925c17564ef8 tip
780 780 $ hg -R s id
781 781 12a213df6fa9 tip
782 782 $ hg -R t id
783 783 52c0adc0515a tip
784 784 $ cd s
785 785 $ hg update -r -2
786 786 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
787 787 $ cd ../t
788 788 $ hg update -r 2
789 789 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
790 790 $ cd ..
791 791 $ hg update 10
792 792 subrepository sources for t differ (in checked out version)
793 793 use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)?
794 794 l
795 795 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
796 796 $ hg id
797 797 e45c8b14af55+
798 798 $ hg -R s id
799 799 1c833a7a9e3a
800 800 $ hg -R t id
801 801 7af322bc1198
802 802
803 803 Sticky subrepository, file changes and revision updates
804 804 $ touch s/f1
805 805 $ touch t/f1
806 806 $ hg add -S s/f1
807 807 $ hg add -S t/f1
808 808 $ hg id
809 809 e45c8b14af55+
810 810 $ hg -R s id
811 811 1c833a7a9e3a+
812 812 $ hg -R t id
813 813 7af322bc1198+
814 814 $ hg update tip
815 815 subrepository sources for s differ
816 816 use (l)ocal source (1c833a7a9e3a) or (r)emote source (12a213df6fa9)?
817 817 l
818 818 subrepository sources for t differ
819 819 use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)?
820 820 l
821 821 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
822 822 $ hg id
823 823 925c17564ef8 tip
824 824 $ hg -R s id
825 825 1c833a7a9e3a+
826 826 $ hg -R t id
827 827 7af322bc1198+
828 828
829 829 Sticky repository, update --clean
830 830 $ hg update --clean tip
831 831 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
832 832 $ hg id
833 833 925c17564ef8 tip
834 834 $ hg -R s id
835 835 12a213df6fa9 tip
836 836 $ hg -R t id
837 837 52c0adc0515a tip
838 838
839 839 Test subrepo already at intended revision:
840 840 $ cd s
841 841 $ hg update fc627a69481f
842 842 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
843 843 $ cd ..
844 844 $ hg update 11
845 845 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
846 846 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
847 847 $ hg id -n
848 848 11+
849 849 $ hg -R s id
850 850 fc627a69481f
851 851 $ hg -R t id
852 852 e95bcfa18a35
853 853
854 854 Test that removing .hgsubstate doesn't break anything:
855 855
856 856 $ hg rm -f .hgsubstate
857 857 $ hg ci -mrm
858 858 committing subrepository s
859 859 committing subrepository t
860 860 created new head
861 861 $ hg log -vr tip
862 862 changeset: 14:3941e0aa5236
863 863 tag: tip
864 864 parent: 11:365661e5936a
865 865 user: test
866 866 date: Thu Jan 01 00:00:00 1970 +0000
867 867 description:
868 868 rm
869 869
870 870
871 871
872 872 Test that removing .hgsub removes .hgsubstate:
873 873
874 874 $ hg rm .hgsub
875 875 $ hg ci -mrm2
876 876 $ hg log -vr tip
877 877 changeset: 15:8b31de9d13d1
878 878 tag: tip
879 879 user: test
880 880 date: Thu Jan 01 00:00:00 1970 +0000
881 881 files: .hgsub .hgsubstate
882 882 description:
883 883 rm2
884 884
885 885
886 886 Test behavior of add for explicit path in subrepo:
887 887 $ cd ..
888 888 $ hg init addtests
889 889 $ cd addtests
890 890 $ echo s = s > .hgsub
891 891 $ hg add .hgsub
892 892 $ hg init s
893 893 $ hg ci -m0
894 894 committing subrepository s
895 895 Adding with an explicit path in a subrepo adds the file
896 896 $ echo c1 > f1
897 897 $ echo c2 > s/f2
898 898 $ hg st -S
899 899 ? f1
900 900 ? s/f2
901 901 $ hg add s/f2
902 902 $ hg st -S
903 903 A s/f2
904 904 ? f1
905 905 $ hg ci -R s -m0
906 906 $ hg ci -Am1
907 907 adding f1
908 908 committing subrepository s
909 909 Adding with an explicit path in a subrepo with -S has the same behavior
910 910 $ echo c3 > f3
911 911 $ echo c4 > s/f4
912 912 $ hg st -S
913 913 ? f3
914 914 ? s/f4
915 915 $ hg add -S s/f4
916 916 $ hg st -S
917 917 A s/f4
918 918 ? f3
919 919 $ hg ci -R s -m1
920 920 $ hg ci -Ama2
921 921 adding f3
922 922 committing subrepository s
923 923 Adding without a path or pattern silently ignores subrepos
924 924 $ echo c5 > f5
925 925 $ echo c6 > s/f6
926 926 $ echo c7 > s/f7
927 927 $ hg st -S
928 928 ? f5
929 929 ? s/f6
930 930 ? s/f7
931 931 $ hg add
932 932 adding f5
933 933 $ hg st -S
934 934 A f5
935 935 ? s/f6
936 936 ? s/f7
937 937 $ hg ci -R s -Am2
938 938 adding f6
939 939 adding f7
940 940 $ hg ci -m3
941 941 committing subrepository s
942 942 Adding without a path or pattern with -S also adds files in subrepos
943 943 $ echo c8 > f8
944 944 $ echo c9 > s/f9
945 945 $ echo c10 > s/f10
946 946 $ hg st -S
947 947 ? f8
948 948 ? s/f10
949 949 ? s/f9
950 950 $ hg add -S
951 951 adding f8
952 952 adding s/f10
953 953 adding s/f9
954 954 $ hg st -S
955 955 A f8
956 956 A s/f10
957 957 A s/f9
958 958 $ hg ci -R s -m3
959 959 $ hg ci -m4
960 960 committing subrepository s
961 961 Adding with a pattern silently ignores subrepos
962 962 $ echo c11 > fm11
963 963 $ echo c12 > fn12
964 964 $ echo c13 > s/fm13
965 965 $ echo c14 > s/fn14
966 966 $ hg st -S
967 967 ? fm11
968 968 ? fn12
969 969 ? s/fm13
970 970 ? s/fn14
971 971 $ hg add 'glob:**fm*'
972 972 adding fm11
973 973 $ hg st -S
974 974 A fm11
975 975 ? fn12
976 976 ? s/fm13
977 977 ? s/fn14
978 978 $ hg ci -R s -Am4
979 979 adding fm13
980 980 adding fn14
981 981 $ hg ci -Am5
982 982 adding fn12
983 983 committing subrepository s
984 984 Adding with a pattern with -S also adds matches in subrepos
985 985 $ echo c15 > fm15
986 986 $ echo c16 > fn16
987 987 $ echo c17 > s/fm17
988 988 $ echo c18 > s/fn18
989 989 $ hg st -S
990 990 ? fm15
991 991 ? fn16
992 992 ? s/fm17
993 993 ? s/fn18
994 994 $ hg add -S 'glob:**fm*'
995 995 adding fm15
996 996 adding s/fm17
997 997 $ hg st -S
998 998 A fm15
999 999 A s/fm17
1000 1000 ? fn16
1001 1001 ? s/fn18
1002 1002 $ hg ci -R s -Am5
1003 1003 adding fn18
1004 1004 $ hg ci -Am6
1005 1005 adding fn16
1006 1006 committing subrepository s
1007 1007 $ cd ..
@@ -1,207 +1,207 b''
1 1 Test basic functionality of url#rev syntax
2 2
3 3 $ hg init repo
4 4 $ cd repo
5 5 $ echo a > a
6 6 $ hg ci -qAm 'add a'
7 7 $ hg branch foo
8 8 marked working directory as branch foo
9 9 $ echo >> a
10 10 $ hg ci -m 'change a'
11 11 $ cd ..
12 12
13 13 $ hg clone 'repo#foo' clone
14 14 adding changesets
15 15 adding manifests
16 16 adding file changes
17 17 added 2 changesets with 2 changes to 1 files
18 18 updating to branch foo
19 19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 20
21 21 $ hg --cwd clone heads
22 22 changeset: 1:cd2a86ecc814
23 23 branch: foo
24 24 tag: tip
25 25 user: test
26 26 date: Thu Jan 01 00:00:00 1970 +0000
27 27 summary: change a
28 28
29 29 changeset: 0:1f0dee641bb7
30 30 user: test
31 31 date: Thu Jan 01 00:00:00 1970 +0000
32 32 summary: add a
33 33
34 34 $ hg --cwd clone parents
35 35 changeset: 1:cd2a86ecc814
36 36 branch: foo
37 37 tag: tip
38 38 user: test
39 39 date: Thu Jan 01 00:00:00 1970 +0000
40 40 summary: change a
41 41
42 42 $ cat clone/.hg/hgrc
43 43 [paths]
44 default = $TESTTMP/repo#foo
44 default = $TESTTMP/repo#foo (glob)
45 45
46 46 Changing original repo:
47 47
48 48 $ cd repo
49 49
50 50 $ echo >> a
51 51 $ hg ci -m 'new head of branch foo'
52 52
53 53 $ hg up -qC default
54 54 $ echo bar > bar
55 55 $ hg ci -qAm 'add bar'
56 56
57 57 $ hg log
58 58 changeset: 3:4cd725637392
59 59 tag: tip
60 60 parent: 0:1f0dee641bb7
61 61 user: test
62 62 date: Thu Jan 01 00:00:00 1970 +0000
63 63 summary: add bar
64 64
65 65 changeset: 2:faba9097cad4
66 66 branch: foo
67 67 user: test
68 68 date: Thu Jan 01 00:00:00 1970 +0000
69 69 summary: new head of branch foo
70 70
71 71 changeset: 1:cd2a86ecc814
72 72 branch: foo
73 73 user: test
74 74 date: Thu Jan 01 00:00:00 1970 +0000
75 75 summary: change a
76 76
77 77 changeset: 0:1f0dee641bb7
78 78 user: test
79 79 date: Thu Jan 01 00:00:00 1970 +0000
80 80 summary: add a
81 81
82 82 $ hg -q outgoing '../clone#foo'
83 83 2:faba9097cad4
84 84
85 85 $ hg -q push '../clone#foo'
86 86
87 87 $ hg --cwd ../clone heads
88 88 changeset: 2:faba9097cad4
89 89 branch: foo
90 90 tag: tip
91 91 user: test
92 92 date: Thu Jan 01 00:00:00 1970 +0000
93 93 summary: new head of branch foo
94 94
95 95 changeset: 0:1f0dee641bb7
96 96 user: test
97 97 date: Thu Jan 01 00:00:00 1970 +0000
98 98 summary: add a
99 99
100 100 $ cd ..
101 101
102 102 $ cd clone
103 103 $ hg rollback
104 104 repository tip rolled back to revision 1 (undo push)
105 105
106 106 $ hg -q incoming
107 107 2:faba9097cad4
108 108
109 109 $ hg -q pull
110 110
111 111 $ hg heads
112 112 changeset: 2:faba9097cad4
113 113 branch: foo
114 114 tag: tip
115 115 user: test
116 116 date: Thu Jan 01 00:00:00 1970 +0000
117 117 summary: new head of branch foo
118 118
119 119 changeset: 0:1f0dee641bb7
120 120 user: test
121 121 date: Thu Jan 01 00:00:00 1970 +0000
122 122 summary: add a
123 123
124 124 Pull should not have updated:
125 125
126 126 $ hg parents -q
127 127 1:cd2a86ecc814
128 128
129 129 Going back to the default branch:
130 130
131 131 $ hg up -C 0
132 132 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
133 133
134 134 $ hg parents
135 135 changeset: 0:1f0dee641bb7
136 136 user: test
137 137 date: Thu Jan 01 00:00:00 1970 +0000
138 138 summary: add a
139 139
140 140 No new revs, no update:
141 141
142 142 $ hg pull -qu
143 143
144 144 $ hg parents -q
145 145 0:1f0dee641bb7
146 146
147 147 $ hg rollback
148 148 repository tip rolled back to revision 1 (undo pull)
149 149
150 150 $ hg parents -q
151 151 0:1f0dee641bb7
152 152
153 153 Pull -u takes us back to branch foo:
154 154
155 155 $ hg pull -qu
156 156
157 157 $ hg parents
158 158 changeset: 2:faba9097cad4
159 159 branch: foo
160 160 tag: tip
161 161 user: test
162 162 date: Thu Jan 01 00:00:00 1970 +0000
163 163 summary: new head of branch foo
164 164
165 165 $ hg rollback
166 166 repository tip rolled back to revision 1 (undo pull)
167 167 working directory now based on revision 0
168 168
169 169 $ hg up -C 0
170 170 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 171
172 172 $ hg parents -q
173 173 0:1f0dee641bb7
174 174
175 175 $ hg heads -q
176 176 1:cd2a86ecc814
177 177 0:1f0dee641bb7
178 178
179 179 $ hg pull -qur default default
180 180
181 181 $ hg parents
182 182 changeset: 3:4cd725637392
183 183 tag: tip
184 184 parent: 0:1f0dee641bb7
185 185 user: test
186 186 date: Thu Jan 01 00:00:00 1970 +0000
187 187 summary: add bar
188 188
189 189 $ hg heads
190 190 changeset: 3:4cd725637392
191 191 tag: tip
192 192 parent: 0:1f0dee641bb7
193 193 user: test
194 194 date: Thu Jan 01 00:00:00 1970 +0000
195 195 summary: add bar
196 196
197 197 changeset: 2:faba9097cad4
198 198 branch: foo
199 199 user: test
200 200 date: Thu Jan 01 00:00:00 1970 +0000
201 201 summary: new head of branch foo
202 202
203 203 Test handling of invalid urls
204 204
205 205 $ hg id http://foo/?bar
206 206 abort: unsupported URL component: "bar"
207 207 [255]
@@ -1,424 +1,424 b''
1 1
2 2 $ hg init t
3 3 $ cd t
4 4 $ cat > unix2dos.py <<EOF
5 5 > import sys
6 6 >
7 7 > for path in sys.argv[1:]:
8 8 > data = file(path, 'rb').read()
9 9 > data = data.replace('\n', '\r\n')
10 10 > file(path, 'wb').write(data)
11 11 > EOF
12 12 $ echo '[hooks]' >> .hg/hgrc
13 13 $ echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
14 14 $ echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
15 15 $ cat .hg/hgrc
16 16 [hooks]
17 17 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
18 18 pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
19 19
20 20 $ echo hello > f
21 21 $ hg add f
22 22
23 23 commit should succeed
24 24
25 25 $ hg ci -m 1
26 26
27 27 $ hg clone . ../zoz
28 28 updating to branch default
29 29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 30 $ cp .hg/hgrc ../zoz/.hg
31 31 $ python unix2dos.py f
32 32
33 33 commit should fail
34 34
35 35 $ hg ci -m 2.1
36 36 Attempt to commit or push text file(s) using CRLF line endings
37 37 in f583ea08d42a: f
38 38 transaction abort!
39 39 rollback completed
40 40 abort: pretxncommit.crlf hook failed
41 41 [255]
42 42
43 43 $ mv .hg/hgrc .hg/hgrc.bak
44 44
45 45 commits should succeed
46 46
47 47 $ hg ci -m 2
48 48 $ hg cp f g
49 49 $ hg ci -m 2.2
50 50
51 51 push should fail
52 52
53 53 $ hg push ../zoz
54 54 pushing to ../zoz
55 55 searching for changes
56 56 adding changesets
57 57 adding manifests
58 58 adding file changes
59 59 added 2 changesets with 2 changes to 2 files
60 60 Attempt to commit or push text file(s) using CRLF line endings
61 61 in bc2d09796734: g
62 62 in b1aa5cde7ff4: f
63 63
64 64 To prevent this mistake in your local repository,
65 65 add to Mercurial.ini or .hg/hgrc:
66 66
67 67 [hooks]
68 68 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
69 69
70 70 and also consider adding:
71 71
72 72 [extensions]
73 73 win32text =
74 74 [encode]
75 75 ** = cleverencode:
76 76 [decode]
77 77 ** = cleverdecode:
78 78 transaction abort!
79 79 rollback completed
80 80 abort: pretxnchangegroup.crlf hook failed
81 81 [255]
82 82
83 83 $ mv .hg/hgrc.bak .hg/hgrc
84 84 $ echo hello > f
85 85 $ hg rm g
86 86
87 87 commit should succeed
88 88
89 89 $ hg ci -m 2.3
90 90
91 91 push should succeed
92 92
93 93 $ hg push ../zoz
94 94 pushing to ../zoz
95 95 searching for changes
96 96 adding changesets
97 97 adding manifests
98 98 adding file changes
99 99 added 3 changesets with 3 changes to 2 files
100 100
101 101 and now for something completely different
102 102
103 103 $ mkdir d
104 104 $ echo hello > d/f2
105 105 $ python unix2dos.py d/f2
106 106 $ hg add d/f2
107 107 $ hg ci -m 3
108 108 Attempt to commit or push text file(s) using CRLF line endings
109 109 in 053ba1a3035a: d/f2
110 110 transaction abort!
111 111 rollback completed
112 112 abort: pretxncommit.crlf hook failed
113 113 [255]
114 114 $ hg revert -a
115 115 forgetting d/f2
116 116 $ rm d/f2
117 117
118 118 $ hg rem f
119 119 $ hg ci -m 4
120 120
121 121 $ python -c 'file("bin", "wb").write("hello\x00\x0D\x0A")'
122 122 $ hg add bin
123 123 $ hg ci -m 5
124 124 $ hg log -v
125 125 changeset: 5:f0b1c8d75fce
126 126 tag: tip
127 127 user: test
128 128 date: Thu Jan 01 00:00:00 1970 +0000
129 129 files: bin
130 130 description:
131 131 5
132 132
133 133
134 134 changeset: 4:77796dbcd4ad
135 135 user: test
136 136 date: Thu Jan 01 00:00:00 1970 +0000
137 137 files: f
138 138 description:
139 139 4
140 140
141 141
142 142 changeset: 3:7c1b5430b350
143 143 user: test
144 144 date: Thu Jan 01 00:00:00 1970 +0000
145 145 files: f g
146 146 description:
147 147 2.3
148 148
149 149
150 150 changeset: 2:bc2d09796734
151 151 user: test
152 152 date: Thu Jan 01 00:00:00 1970 +0000
153 153 files: g
154 154 description:
155 155 2.2
156 156
157 157
158 158 changeset: 1:b1aa5cde7ff4
159 159 user: test
160 160 date: Thu Jan 01 00:00:00 1970 +0000
161 161 files: f
162 162 description:
163 163 2
164 164
165 165
166 166 changeset: 0:fcf06d5c4e1d
167 167 user: test
168 168 date: Thu Jan 01 00:00:00 1970 +0000
169 169 files: f
170 170 description:
171 171 1
172 172
173 173
174 174 $ hg clone . dupe
175 175 updating to branch default
176 176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 177
178 178 $ for x in a b c d; do echo content > dupe/$x; done
179 179 $ hg -R dupe add
180 180 adding dupe/a
181 181 adding dupe/b
182 182 adding dupe/c
183 183 adding dupe/d
184 184 $ python unix2dos.py dupe/b dupe/c dupe/d
185 185 $ hg -R dupe ci -m a dupe/a
186 186 $ hg -R dupe ci -m b/c dupe/[bc]
187 187 $ hg -R dupe ci -m d dupe/d
188 188 $ hg -R dupe log -v
189 189 changeset: 8:67ac5962ab43
190 190 tag: tip
191 191 user: test
192 192 date: Thu Jan 01 00:00:00 1970 +0000
193 193 files: d
194 194 description:
195 195 d
196 196
197 197
198 198 changeset: 7:68c127d1834e
199 199 user: test
200 200 date: Thu Jan 01 00:00:00 1970 +0000
201 201 files: b c
202 202 description:
203 203 b/c
204 204
205 205
206 206 changeset: 6:adbf8bf7f31d
207 207 user: test
208 208 date: Thu Jan 01 00:00:00 1970 +0000
209 209 files: a
210 210 description:
211 211 a
212 212
213 213
214 214 changeset: 5:f0b1c8d75fce
215 215 user: test
216 216 date: Thu Jan 01 00:00:00 1970 +0000
217 217 files: bin
218 218 description:
219 219 5
220 220
221 221
222 222 changeset: 4:77796dbcd4ad
223 223 user: test
224 224 date: Thu Jan 01 00:00:00 1970 +0000
225 225 files: f
226 226 description:
227 227 4
228 228
229 229
230 230 changeset: 3:7c1b5430b350
231 231 user: test
232 232 date: Thu Jan 01 00:00:00 1970 +0000
233 233 files: f g
234 234 description:
235 235 2.3
236 236
237 237
238 238 changeset: 2:bc2d09796734
239 239 user: test
240 240 date: Thu Jan 01 00:00:00 1970 +0000
241 241 files: g
242 242 description:
243 243 2.2
244 244
245 245
246 246 changeset: 1:b1aa5cde7ff4
247 247 user: test
248 248 date: Thu Jan 01 00:00:00 1970 +0000
249 249 files: f
250 250 description:
251 251 2
252 252
253 253
254 254 changeset: 0:fcf06d5c4e1d
255 255 user: test
256 256 date: Thu Jan 01 00:00:00 1970 +0000
257 257 files: f
258 258 description:
259 259 1
260 260
261 261
262 262 $ hg pull dupe
263 263 pulling from dupe
264 264 searching for changes
265 265 adding changesets
266 266 adding manifests
267 267 adding file changes
268 268 added 3 changesets with 4 changes to 4 files
269 269 Attempt to commit or push text file(s) using CRLF line endings
270 270 in 67ac5962ab43: d
271 271 in 68c127d1834e: b
272 272 in 68c127d1834e: c
273 273
274 274 To prevent this mistake in your local repository,
275 275 add to Mercurial.ini or .hg/hgrc:
276 276
277 277 [hooks]
278 278 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
279 279
280 280 and also consider adding:
281 281
282 282 [extensions]
283 283 win32text =
284 284 [encode]
285 285 ** = cleverencode:
286 286 [decode]
287 287 ** = cleverdecode:
288 288 transaction abort!
289 289 rollback completed
290 290 abort: pretxnchangegroup.crlf hook failed
291 291 [255]
292 292
293 293 $ hg log -v
294 294 changeset: 5:f0b1c8d75fce
295 295 tag: tip
296 296 user: test
297 297 date: Thu Jan 01 00:00:00 1970 +0000
298 298 files: bin
299 299 description:
300 300 5
301 301
302 302
303 303 changeset: 4:77796dbcd4ad
304 304 user: test
305 305 date: Thu Jan 01 00:00:00 1970 +0000
306 306 files: f
307 307 description:
308 308 4
309 309
310 310
311 311 changeset: 3:7c1b5430b350
312 312 user: test
313 313 date: Thu Jan 01 00:00:00 1970 +0000
314 314 files: f g
315 315 description:
316 316 2.3
317 317
318 318
319 319 changeset: 2:bc2d09796734
320 320 user: test
321 321 date: Thu Jan 01 00:00:00 1970 +0000
322 322 files: g
323 323 description:
324 324 2.2
325 325
326 326
327 327 changeset: 1:b1aa5cde7ff4
328 328 user: test
329 329 date: Thu Jan 01 00:00:00 1970 +0000
330 330 files: f
331 331 description:
332 332 2
333 333
334 334
335 335 changeset: 0:fcf06d5c4e1d
336 336 user: test
337 337 date: Thu Jan 01 00:00:00 1970 +0000
338 338 files: f
339 339 description:
340 340 1
341 341
342 342
343 343 $ rm .hg/hgrc
344 344 $ (echo some; echo text) > f3
345 345 $ python -c 'file("f4.bat", "wb").write("rem empty\x0D\x0A")'
346 346 $ hg add f3 f4.bat
347 347 $ hg ci -m 6
348 348 $ cat bin
349 349 hello\x00\r (esc)
350 350 $ cat f3
351 351 some
352 352 text
353 353 $ cat f4.bat
354 354 rem empty\r (esc)
355 355
356 356 $ echo '[extensions]' >> .hg/hgrc
357 357 $ echo 'win32text = ' >> .hg/hgrc
358 358 $ echo '[decode]' >> .hg/hgrc
359 359 $ echo '** = cleverdecode:' >> .hg/hgrc
360 360 $ echo '[encode]' >> .hg/hgrc
361 361 $ echo '** = cleverencode:' >> .hg/hgrc
362 362 $ cat .hg/hgrc
363 363 [extensions]
364 364 win32text =
365 365 [decode]
366 366 ** = cleverdecode:
367 367 [encode]
368 368 ** = cleverencode:
369 369
370 370 Trigger deprecation warning:
371 371
372 372 $ hg id -t
373 373 win32text is deprecated: http://mercurial.selenic.com/wiki/Win32TextExtension
374 374 tip
375 375
376 376 Disable warning:
377 377
378 378 $ echo '[win32text]' >> .hg/hgrc
379 379 $ echo 'warn = no' >> .hg/hgrc
380 380 $ hg id -t
381 381 tip
382 382
383 383 $ rm f3 f4.bat bin
384 384 $ hg co -C
385 385 WARNING: f4.bat already has CRLF line endings
386 386 and does not need EOL conversion by the win32text plugin.
387 387 Before your next commit, please reconsider your encode/decode settings in
388 Mercurial.ini or $TESTTMP/t/.hg/hgrc.
388 Mercurial.ini or $TESTTMP/t/.hg/hgrc. (glob)
389 389 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
390 390 $ cat bin
391 391 hello\x00\r (esc)
392 392 $ cat f3
393 393 some\r (esc)
394 394 text\r (esc)
395 395 $ cat f4.bat
396 396 rem empty\r (esc)
397 397
398 398 $ python -c 'file("f5.sh", "wb").write("# empty\x0D\x0A")'
399 399 $ hg add f5.sh
400 400 $ hg ci -m 7
401 401 $ cat f5.sh
402 402 # empty\r (esc)
403 403 $ hg cat f5.sh
404 404 # empty
405 405 $ echo '% just linefeed' > linefeed
406 406 $ hg ci -qAm 8 linefeed
407 407 $ cat linefeed
408 408 % just linefeed
409 409 $ hg cat linefeed
410 410 % just linefeed
411 411 $ hg st -q
412 412 $ hg revert -a linefeed
413 413 no changes needed to linefeed
414 414 $ cat linefeed
415 415 % just linefeed
416 416 $ hg st -q
417 417 $ echo modified >> linefeed
418 418 $ hg st -q
419 419 M linefeed
420 420 $ hg revert -a
421 421 reverting linefeed
422 422 $ hg st -q
423 423 $ cat linefeed
424 424 % just linefeed\r (esc)
General Comments 0
You need to be logged in to leave comments. Login now