##// END OF EJS Templates
bundlespec: do not overwrite bundlespec value with the config one...
marmoute -
r50222:5bc3e76f default
parent child Browse files
Show More
@@ -1,7946 +1,7948 b''
1 1 # commands.py - command processing for mercurial
2 2 #
3 3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8
9 9 import os
10 10 import re
11 11 import sys
12 12
13 13 from .i18n import _
14 14 from .node import (
15 15 hex,
16 16 nullrev,
17 17 short,
18 18 wdirrev,
19 19 )
20 20 from .pycompat import open
21 21 from . import (
22 22 archival,
23 23 bookmarks,
24 24 bundle2,
25 25 bundlecaches,
26 26 changegroup,
27 27 cmdutil,
28 28 copies,
29 29 debugcommands as debugcommandsmod,
30 30 destutil,
31 31 dirstateguard,
32 32 discovery,
33 33 encoding,
34 34 error,
35 35 exchange,
36 36 extensions,
37 37 filemerge,
38 38 formatter,
39 39 graphmod,
40 40 grep as grepmod,
41 41 hbisect,
42 42 help,
43 43 hg,
44 44 logcmdutil,
45 45 merge as mergemod,
46 46 mergestate as mergestatemod,
47 47 narrowspec,
48 48 obsolete,
49 49 obsutil,
50 50 patch,
51 51 phases,
52 52 pycompat,
53 53 rcutil,
54 54 registrar,
55 55 requirements,
56 56 revsetlang,
57 57 rewriteutil,
58 58 scmutil,
59 59 server,
60 60 shelve as shelvemod,
61 61 state as statemod,
62 62 streamclone,
63 63 tags as tagsmod,
64 64 ui as uimod,
65 65 util,
66 66 verify as verifymod,
67 67 vfs as vfsmod,
68 68 wireprotoserver,
69 69 )
70 70 from .utils import (
71 71 dateutil,
72 72 stringutil,
73 73 urlutil,
74 74 )
75 75
76 76 table = {}
77 77 table.update(debugcommandsmod.command._table)
78 78
79 79 command = registrar.command(table)
80 80 INTENT_READONLY = registrar.INTENT_READONLY
81 81
82 82 # common command options
83 83
84 84 globalopts = [
85 85 (
86 86 b'R',
87 87 b'repository',
88 88 b'',
89 89 _(b'repository root directory or name of overlay bundle file'),
90 90 _(b'REPO'),
91 91 ),
92 92 (b'', b'cwd', b'', _(b'change working directory'), _(b'DIR')),
93 93 (
94 94 b'y',
95 95 b'noninteractive',
96 96 None,
97 97 _(
98 98 b'do not prompt, automatically pick the first choice for all prompts'
99 99 ),
100 100 ),
101 101 (b'q', b'quiet', None, _(b'suppress output')),
102 102 (b'v', b'verbose', None, _(b'enable additional output')),
103 103 (
104 104 b'',
105 105 b'color',
106 106 b'',
107 107 # i18n: 'always', 'auto', 'never', and 'debug' are keywords
108 108 # and should not be translated
109 109 _(b"when to colorize (boolean, always, auto, never, or debug)"),
110 110 _(b'TYPE'),
111 111 ),
112 112 (
113 113 b'',
114 114 b'config',
115 115 [],
116 116 _(b'set/override config option (use \'section.name=value\')'),
117 117 _(b'CONFIG'),
118 118 ),
119 119 (b'', b'debug', None, _(b'enable debugging output')),
120 120 (b'', b'debugger', None, _(b'start debugger')),
121 121 (
122 122 b'',
123 123 b'encoding',
124 124 encoding.encoding,
125 125 _(b'set the charset encoding'),
126 126 _(b'ENCODE'),
127 127 ),
128 128 (
129 129 b'',
130 130 b'encodingmode',
131 131 encoding.encodingmode,
132 132 _(b'set the charset encoding mode'),
133 133 _(b'MODE'),
134 134 ),
135 135 (b'', b'traceback', None, _(b'always print a traceback on exception')),
136 136 (b'', b'time', None, _(b'time how long the command takes')),
137 137 (b'', b'profile', None, _(b'print command execution profile')),
138 138 (b'', b'version', None, _(b'output version information and exit')),
139 139 (b'h', b'help', None, _(b'display help and exit')),
140 140 (b'', b'hidden', False, _(b'consider hidden changesets')),
141 141 (
142 142 b'',
143 143 b'pager',
144 144 b'auto',
145 145 _(b"when to paginate (boolean, always, auto, or never)"),
146 146 _(b'TYPE'),
147 147 ),
148 148 ]
149 149
150 150 dryrunopts = cmdutil.dryrunopts
151 151 remoteopts = cmdutil.remoteopts
152 152 walkopts = cmdutil.walkopts
153 153 commitopts = cmdutil.commitopts
154 154 commitopts2 = cmdutil.commitopts2
155 155 commitopts3 = cmdutil.commitopts3
156 156 formatteropts = cmdutil.formatteropts
157 157 templateopts = cmdutil.templateopts
158 158 logopts = cmdutil.logopts
159 159 diffopts = cmdutil.diffopts
160 160 diffwsopts = cmdutil.diffwsopts
161 161 diffopts2 = cmdutil.diffopts2
162 162 mergetoolopts = cmdutil.mergetoolopts
163 163 similarityopts = cmdutil.similarityopts
164 164 subrepoopts = cmdutil.subrepoopts
165 165 debugrevlogopts = cmdutil.debugrevlogopts
166 166
167 167 # Commands start here, listed alphabetically
168 168
169 169
170 170 @command(
171 171 b'abort',
172 172 dryrunopts,
173 173 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT,
174 174 helpbasic=True,
175 175 )
176 176 def abort(ui, repo, **opts):
177 177 """abort an unfinished operation (EXPERIMENTAL)
178 178
179 179 Aborts a multistep operation like graft, histedit, rebase, merge,
180 180 and unshelve if they are in an unfinished state.
181 181
182 182 use --dry-run/-n to dry run the command.
183 183 """
184 184 dryrun = opts.get('dry_run')
185 185 abortstate = cmdutil.getunfinishedstate(repo)
186 186 if not abortstate:
187 187 raise error.StateError(_(b'no operation in progress'))
188 188 if not abortstate.abortfunc:
189 189 raise error.InputError(
190 190 (
191 191 _(b"%s in progress but does not support 'hg abort'")
192 192 % (abortstate._opname)
193 193 ),
194 194 hint=abortstate.hint(),
195 195 )
196 196 if dryrun:
197 197 ui.status(
198 198 _(b'%s in progress, will be aborted\n') % (abortstate._opname)
199 199 )
200 200 return
201 201 return abortstate.abortfunc(ui, repo)
202 202
203 203
204 204 @command(
205 205 b'add',
206 206 walkopts + subrepoopts + dryrunopts,
207 207 _(b'[OPTION]... [FILE]...'),
208 208 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
209 209 helpbasic=True,
210 210 inferrepo=True,
211 211 )
212 212 def add(ui, repo, *pats, **opts):
213 213 """add the specified files on the next commit
214 214
215 215 Schedule files to be version controlled and added to the
216 216 repository.
217 217
218 218 The files will be added to the repository at the next commit. To
219 219 undo an add before that, see :hg:`forget`.
220 220
221 221 If no names are given, add all files to the repository (except
222 222 files matching ``.hgignore``).
223 223
224 224 .. container:: verbose
225 225
226 226 Examples:
227 227
228 228 - New (unknown) files are added
229 229 automatically by :hg:`add`::
230 230
231 231 $ ls
232 232 foo.c
233 233 $ hg status
234 234 ? foo.c
235 235 $ hg add
236 236 adding foo.c
237 237 $ hg status
238 238 A foo.c
239 239
240 240 - Specific files to be added can be specified::
241 241
242 242 $ ls
243 243 bar.c foo.c
244 244 $ hg status
245 245 ? bar.c
246 246 ? foo.c
247 247 $ hg add bar.c
248 248 $ hg status
249 249 A bar.c
250 250 ? foo.c
251 251
252 252 Returns 0 if all files are successfully added.
253 253 """
254 254
255 255 m = scmutil.match(repo[None], pats, pycompat.byteskwargs(opts))
256 256 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
257 257 rejected = cmdutil.add(ui, repo, m, b"", uipathfn, False, **opts)
258 258 return rejected and 1 or 0
259 259
260 260
261 261 @command(
262 262 b'addremove',
263 263 similarityopts + subrepoopts + walkopts + dryrunopts,
264 264 _(b'[OPTION]... [FILE]...'),
265 265 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
266 266 inferrepo=True,
267 267 )
268 268 def addremove(ui, repo, *pats, **opts):
269 269 """add all new files, delete all missing files
270 270
271 271 Add all new files and remove all missing files from the
272 272 repository.
273 273
274 274 Unless names are given, new files are ignored if they match any of
275 275 the patterns in ``.hgignore``. As with add, these changes take
276 276 effect at the next commit.
277 277
278 278 Use the -s/--similarity option to detect renamed files. This
279 279 option takes a percentage between 0 (disabled) and 100 (files must
280 280 be identical) as its parameter. With a parameter greater than 0,
281 281 this compares every removed file with every added file and records
282 282 those similar enough as renames. Detecting renamed files this way
283 283 can be expensive. After using this option, :hg:`status -C` can be
284 284 used to check which files were identified as moved or renamed. If
285 285 not specified, -s/--similarity defaults to 100 and only renames of
286 286 identical files are detected.
287 287
288 288 .. container:: verbose
289 289
290 290 Examples:
291 291
292 292 - A number of files (bar.c and foo.c) are new,
293 293 while foobar.c has been removed (without using :hg:`remove`)
294 294 from the repository::
295 295
296 296 $ ls
297 297 bar.c foo.c
298 298 $ hg status
299 299 ! foobar.c
300 300 ? bar.c
301 301 ? foo.c
302 302 $ hg addremove
303 303 adding bar.c
304 304 adding foo.c
305 305 removing foobar.c
306 306 $ hg status
307 307 A bar.c
308 308 A foo.c
309 309 R foobar.c
310 310
311 311 - A file foobar.c was moved to foo.c without using :hg:`rename`.
312 312 Afterwards, it was edited slightly::
313 313
314 314 $ ls
315 315 foo.c
316 316 $ hg status
317 317 ! foobar.c
318 318 ? foo.c
319 319 $ hg addremove --similarity 90
320 320 removing foobar.c
321 321 adding foo.c
322 322 recording removal of foobar.c as rename to foo.c (94% similar)
323 323 $ hg status -C
324 324 A foo.c
325 325 foobar.c
326 326 R foobar.c
327 327
328 328 Returns 0 if all files are successfully added.
329 329 """
330 330 opts = pycompat.byteskwargs(opts)
331 331 if not opts.get(b'similarity'):
332 332 opts[b'similarity'] = b'100'
333 333 matcher = scmutil.match(repo[None], pats, opts)
334 334 relative = scmutil.anypats(pats, opts)
335 335 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=relative)
336 336 return scmutil.addremove(repo, matcher, b"", uipathfn, opts)
337 337
338 338
339 339 @command(
340 340 b'annotate|blame',
341 341 [
342 342 (b'r', b'rev', b'', _(b'annotate the specified revision'), _(b'REV')),
343 343 (
344 344 b'',
345 345 b'follow',
346 346 None,
347 347 _(b'follow copies/renames and list the filename (DEPRECATED)'),
348 348 ),
349 349 (b'', b'no-follow', None, _(b"don't follow copies and renames")),
350 350 (b'a', b'text', None, _(b'treat all files as text')),
351 351 (b'u', b'user', None, _(b'list the author (long with -v)')),
352 352 (b'f', b'file', None, _(b'list the filename')),
353 353 (b'd', b'date', None, _(b'list the date (short with -q)')),
354 354 (b'n', b'number', None, _(b'list the revision number (default)')),
355 355 (b'c', b'changeset', None, _(b'list the changeset')),
356 356 (
357 357 b'l',
358 358 b'line-number',
359 359 None,
360 360 _(b'show line number at the first appearance'),
361 361 ),
362 362 (
363 363 b'',
364 364 b'skip',
365 365 [],
366 366 _(b'revset to not display (EXPERIMENTAL)'),
367 367 _(b'REV'),
368 368 ),
369 369 ]
370 370 + diffwsopts
371 371 + walkopts
372 372 + formatteropts,
373 373 _(b'[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
374 374 helpcategory=command.CATEGORY_FILE_CONTENTS,
375 375 helpbasic=True,
376 376 inferrepo=True,
377 377 )
378 378 def annotate(ui, repo, *pats, **opts):
379 379 """show changeset information by line for each file
380 380
381 381 List changes in files, showing the revision id responsible for
382 382 each line.
383 383
384 384 This command is useful for discovering when a change was made and
385 385 by whom.
386 386
387 387 If you include --file, --user, or --date, the revision number is
388 388 suppressed unless you also include --number.
389 389
390 390 Without the -a/--text option, annotate will avoid processing files
391 391 it detects as binary. With -a, annotate will annotate the file
392 392 anyway, although the results will probably be neither useful
393 393 nor desirable.
394 394
395 395 .. container:: verbose
396 396
397 397 Template:
398 398
399 399 The following keywords are supported in addition to the common template
400 400 keywords and functions. See also :hg:`help templates`.
401 401
402 402 :lines: List of lines with annotation data.
403 403 :path: String. Repository-absolute path of the specified file.
404 404
405 405 And each entry of ``{lines}`` provides the following sub-keywords in
406 406 addition to ``{date}``, ``{node}``, ``{rev}``, ``{user}``, etc.
407 407
408 408 :line: String. Line content.
409 409 :lineno: Integer. Line number at that revision.
410 410 :path: String. Repository-absolute path of the file at that revision.
411 411
412 412 See :hg:`help templates.operators` for the list expansion syntax.
413 413
414 414 Returns 0 on success.
415 415 """
416 416 opts = pycompat.byteskwargs(opts)
417 417 if not pats:
418 418 raise error.InputError(
419 419 _(b'at least one filename or pattern is required')
420 420 )
421 421
422 422 if opts.get(b'follow'):
423 423 # --follow is deprecated and now just an alias for -f/--file
424 424 # to mimic the behavior of Mercurial before version 1.5
425 425 opts[b'file'] = True
426 426
427 427 if (
428 428 not opts.get(b'user')
429 429 and not opts.get(b'changeset')
430 430 and not opts.get(b'date')
431 431 and not opts.get(b'file')
432 432 ):
433 433 opts[b'number'] = True
434 434
435 435 linenumber = opts.get(b'line_number') is not None
436 436 if (
437 437 linenumber
438 438 and (not opts.get(b'changeset'))
439 439 and (not opts.get(b'number'))
440 440 ):
441 441 raise error.InputError(_(b'at least one of -n/-c is required for -l'))
442 442
443 443 rev = opts.get(b'rev')
444 444 if rev:
445 445 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
446 446 ctx = logcmdutil.revsingle(repo, rev)
447 447
448 448 ui.pager(b'annotate')
449 449 rootfm = ui.formatter(b'annotate', opts)
450 450 if ui.debugflag:
451 451 shorthex = pycompat.identity
452 452 else:
453 453
454 454 def shorthex(h):
455 455 return h[:12]
456 456
457 457 if ui.quiet:
458 458 datefunc = dateutil.shortdate
459 459 else:
460 460 datefunc = dateutil.datestr
461 461 if ctx.rev() is None:
462 462 if opts.get(b'changeset'):
463 463 # omit "+" suffix which is appended to node hex
464 464 def formatrev(rev):
465 465 if rev == wdirrev:
466 466 return b'%d' % ctx.p1().rev()
467 467 else:
468 468 return b'%d' % rev
469 469
470 470 else:
471 471
472 472 def formatrev(rev):
473 473 if rev == wdirrev:
474 474 return b'%d+' % ctx.p1().rev()
475 475 else:
476 476 return b'%d ' % rev
477 477
478 478 def formathex(h):
479 479 if h == repo.nodeconstants.wdirhex:
480 480 return b'%s+' % shorthex(hex(ctx.p1().node()))
481 481 else:
482 482 return b'%s ' % shorthex(h)
483 483
484 484 else:
485 485 formatrev = b'%d'.__mod__
486 486 formathex = shorthex
487 487
488 488 opmap = [
489 489 (b'user', b' ', lambda x: x.fctx.user(), ui.shortuser),
490 490 (b'rev', b' ', lambda x: scmutil.intrev(x.fctx), formatrev),
491 491 (b'node', b' ', lambda x: hex(scmutil.binnode(x.fctx)), formathex),
492 492 (b'date', b' ', lambda x: x.fctx.date(), util.cachefunc(datefunc)),
493 493 (b'path', b' ', lambda x: x.fctx.path(), pycompat.bytestr),
494 494 (b'lineno', b':', lambda x: x.lineno, pycompat.bytestr),
495 495 ]
496 496 opnamemap = {
497 497 b'rev': b'number',
498 498 b'node': b'changeset',
499 499 b'path': b'file',
500 500 b'lineno': b'line_number',
501 501 }
502 502
503 503 if rootfm.isplain():
504 504
505 505 def makefunc(get, fmt):
506 506 return lambda x: fmt(get(x))
507 507
508 508 else:
509 509
510 510 def makefunc(get, fmt):
511 511 return get
512 512
513 513 datahint = rootfm.datahint()
514 514 funcmap = [
515 515 (makefunc(get, fmt), sep)
516 516 for fn, sep, get, fmt in opmap
517 517 if opts.get(opnamemap.get(fn, fn)) or fn in datahint
518 518 ]
519 519 funcmap[0] = (funcmap[0][0], b'') # no separator in front of first column
520 520 fields = b' '.join(
521 521 fn
522 522 for fn, sep, get, fmt in opmap
523 523 if opts.get(opnamemap.get(fn, fn)) or fn in datahint
524 524 )
525 525
526 526 def bad(x, y):
527 527 raise error.InputError(b"%s: %s" % (x, y))
528 528
529 529 m = scmutil.match(ctx, pats, opts, badfn=bad)
530 530
531 531 follow = not opts.get(b'no_follow')
532 532 diffopts = patch.difffeatureopts(
533 533 ui, opts, section=b'annotate', whitespace=True
534 534 )
535 535 skiprevs = opts.get(b'skip')
536 536 if skiprevs:
537 537 skiprevs = logcmdutil.revrange(repo, skiprevs)
538 538
539 539 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
540 540 for abs in ctx.walk(m):
541 541 fctx = ctx[abs]
542 542 rootfm.startitem()
543 543 rootfm.data(path=abs)
544 544 if not opts.get(b'text') and fctx.isbinary():
545 545 rootfm.plain(_(b"%s: binary file\n") % uipathfn(abs))
546 546 continue
547 547
548 548 fm = rootfm.nested(b'lines', tmpl=b'{rev}: {line}')
549 549 lines = fctx.annotate(
550 550 follow=follow, skiprevs=skiprevs, diffopts=diffopts
551 551 )
552 552 if not lines:
553 553 fm.end()
554 554 continue
555 555 formats = []
556 556 pieces = []
557 557
558 558 for f, sep in funcmap:
559 559 l = [f(n) for n in lines]
560 560 if fm.isplain():
561 561 sizes = [encoding.colwidth(x) for x in l]
562 562 ml = max(sizes)
563 563 formats.append([sep + b' ' * (ml - w) + b'%s' for w in sizes])
564 564 else:
565 565 formats.append([b'%s'] * len(l))
566 566 pieces.append(l)
567 567
568 568 for f, p, n in zip(zip(*formats), zip(*pieces), lines):
569 569 fm.startitem()
570 570 fm.context(fctx=n.fctx)
571 571 fm.write(fields, b"".join(f), *p)
572 572 if n.skip:
573 573 fmt = b"* %s"
574 574 else:
575 575 fmt = b": %s"
576 576 fm.write(b'line', fmt, n.text)
577 577
578 578 if not lines[-1].text.endswith(b'\n'):
579 579 fm.plain(b'\n')
580 580 fm.end()
581 581
582 582 rootfm.end()
583 583
584 584
585 585 @command(
586 586 b'archive',
587 587 [
588 588 (b'', b'no-decode', None, _(b'do not pass files through decoders')),
589 589 (
590 590 b'p',
591 591 b'prefix',
592 592 b'',
593 593 _(b'directory prefix for files in archive'),
594 594 _(b'PREFIX'),
595 595 ),
596 596 (b'r', b'rev', b'', _(b'revision to distribute'), _(b'REV')),
597 597 (b't', b'type', b'', _(b'type of distribution to create'), _(b'TYPE')),
598 598 ]
599 599 + subrepoopts
600 600 + walkopts,
601 601 _(b'[OPTION]... DEST'),
602 602 helpcategory=command.CATEGORY_IMPORT_EXPORT,
603 603 )
604 604 def archive(ui, repo, dest, **opts):
605 605 """create an unversioned archive of a repository revision
606 606
607 607 By default, the revision used is the parent of the working
608 608 directory; use -r/--rev to specify a different revision.
609 609
610 610 The archive type is automatically detected based on file
611 611 extension (to override, use -t/--type).
612 612
613 613 .. container:: verbose
614 614
615 615 Examples:
616 616
617 617 - create a zip file containing the 1.0 release::
618 618
619 619 hg archive -r 1.0 project-1.0.zip
620 620
621 621 - create a tarball excluding .hg files::
622 622
623 623 hg archive project.tar.gz -X ".hg*"
624 624
625 625 Valid types are:
626 626
627 627 :``files``: a directory full of files (default)
628 628 :``tar``: tar archive, uncompressed
629 629 :``tbz2``: tar archive, compressed using bzip2
630 630 :``tgz``: tar archive, compressed using gzip
631 631 :``txz``: tar archive, compressed using lzma (only in Python 3)
632 632 :``uzip``: zip archive, uncompressed
633 633 :``zip``: zip archive, compressed using deflate
634 634
635 635 The exact name of the destination archive or directory is given
636 636 using a format string; see :hg:`help export` for details.
637 637
638 638 Each member added to an archive file has a directory prefix
639 639 prepended. Use -p/--prefix to specify a format string for the
640 640 prefix. The default is the basename of the archive, with suffixes
641 641 removed.
642 642
643 643 Returns 0 on success.
644 644 """
645 645
646 646 opts = pycompat.byteskwargs(opts)
647 647 rev = opts.get(b'rev')
648 648 if rev:
649 649 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
650 650 ctx = logcmdutil.revsingle(repo, rev)
651 651 if not ctx:
652 652 raise error.InputError(
653 653 _(b'no working directory: please specify a revision')
654 654 )
655 655 node = ctx.node()
656 656 dest = cmdutil.makefilename(ctx, dest)
657 657 if os.path.realpath(dest) == repo.root:
658 658 raise error.InputError(_(b'repository root cannot be destination'))
659 659
660 660 kind = opts.get(b'type') or archival.guesskind(dest) or b'files'
661 661 prefix = opts.get(b'prefix')
662 662
663 663 if dest == b'-':
664 664 if kind == b'files':
665 665 raise error.InputError(_(b'cannot archive plain files to stdout'))
666 666 dest = cmdutil.makefileobj(ctx, dest)
667 667 if not prefix:
668 668 prefix = os.path.basename(repo.root) + b'-%h'
669 669
670 670 prefix = cmdutil.makefilename(ctx, prefix)
671 671 match = scmutil.match(ctx, [], opts)
672 672 archival.archive(
673 673 repo,
674 674 dest,
675 675 node,
676 676 kind,
677 677 not opts.get(b'no_decode'),
678 678 match,
679 679 prefix,
680 680 subrepos=opts.get(b'subrepos'),
681 681 )
682 682
683 683
684 684 @command(
685 685 b'backout',
686 686 [
687 687 (
688 688 b'',
689 689 b'merge',
690 690 None,
691 691 _(b'merge with old dirstate parent after backout'),
692 692 ),
693 693 (
694 694 b'',
695 695 b'commit',
696 696 None,
697 697 _(b'commit if no conflicts were encountered (DEPRECATED)'),
698 698 ),
699 699 (b'', b'no-commit', None, _(b'do not commit')),
700 700 (
701 701 b'',
702 702 b'parent',
703 703 b'',
704 704 _(b'parent to choose when backing out merge (DEPRECATED)'),
705 705 _(b'REV'),
706 706 ),
707 707 (b'r', b'rev', b'', _(b'revision to backout'), _(b'REV')),
708 708 (b'e', b'edit', False, _(b'invoke editor on commit messages')),
709 709 ]
710 710 + mergetoolopts
711 711 + walkopts
712 712 + commitopts
713 713 + commitopts2,
714 714 _(b'[OPTION]... [-r] REV'),
715 715 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT,
716 716 )
717 717 def backout(ui, repo, node=None, rev=None, **opts):
718 718 """reverse effect of earlier changeset
719 719
720 720 Prepare a new changeset with the effect of REV undone in the
721 721 current working directory. If no conflicts were encountered,
722 722 it will be committed immediately.
723 723
724 724 If REV is the parent of the working directory, then this new changeset
725 725 is committed automatically (unless --no-commit is specified).
726 726
727 727 .. note::
728 728
729 729 :hg:`backout` cannot be used to fix either an unwanted or
730 730 incorrect merge.
731 731
732 732 .. container:: verbose
733 733
734 734 Examples:
735 735
736 736 - Reverse the effect of the parent of the working directory.
737 737 This backout will be committed immediately::
738 738
739 739 hg backout -r .
740 740
741 741 - Reverse the effect of previous bad revision 23::
742 742
743 743 hg backout -r 23
744 744
745 745 - Reverse the effect of previous bad revision 23 and
746 746 leave changes uncommitted::
747 747
748 748 hg backout -r 23 --no-commit
749 749 hg commit -m "Backout revision 23"
750 750
751 751 By default, the pending changeset will have one parent,
752 752 maintaining a linear history. With --merge, the pending
753 753 changeset will instead have two parents: the old parent of the
754 754 working directory and a new child of REV that simply undoes REV.
755 755
756 756 Before version 1.7, the behavior without --merge was equivalent
757 757 to specifying --merge followed by :hg:`update --clean .` to
758 758 cancel the merge and leave the child of REV as a head to be
759 759 merged separately.
760 760
761 761 See :hg:`help dates` for a list of formats valid for -d/--date.
762 762
763 763 See :hg:`help revert` for a way to restore files to the state
764 764 of another revision.
765 765
766 766 Returns 0 on success, 1 if nothing to backout or there are unresolved
767 767 files.
768 768 """
769 769 with repo.wlock(), repo.lock():
770 770 return _dobackout(ui, repo, node, rev, **opts)
771 771
772 772
773 773 def _dobackout(ui, repo, node=None, rev=None, **opts):
774 774 cmdutil.check_incompatible_arguments(opts, 'no_commit', ['commit', 'merge'])
775 775 opts = pycompat.byteskwargs(opts)
776 776
777 777 if rev and node:
778 778 raise error.InputError(_(b"please specify just one revision"))
779 779
780 780 if not rev:
781 781 rev = node
782 782
783 783 if not rev:
784 784 raise error.InputError(_(b"please specify a revision to backout"))
785 785
786 786 date = opts.get(b'date')
787 787 if date:
788 788 opts[b'date'] = dateutil.parsedate(date)
789 789
790 790 cmdutil.checkunfinished(repo)
791 791 cmdutil.bailifchanged(repo)
792 792 ctx = logcmdutil.revsingle(repo, rev)
793 793 node = ctx.node()
794 794
795 795 op1, op2 = repo.dirstate.parents()
796 796 if not repo.changelog.isancestor(node, op1):
797 797 raise error.InputError(
798 798 _(b'cannot backout change that is not an ancestor')
799 799 )
800 800
801 801 p1, p2 = repo.changelog.parents(node)
802 802 if p1 == repo.nullid:
803 803 raise error.InputError(_(b'cannot backout a change with no parents'))
804 804 if p2 != repo.nullid:
805 805 if not opts.get(b'parent'):
806 806 raise error.InputError(_(b'cannot backout a merge changeset'))
807 807 p = repo.lookup(opts[b'parent'])
808 808 if p not in (p1, p2):
809 809 raise error.InputError(
810 810 _(b'%s is not a parent of %s') % (short(p), short(node))
811 811 )
812 812 parent = p
813 813 else:
814 814 if opts.get(b'parent'):
815 815 raise error.InputError(
816 816 _(b'cannot use --parent on non-merge changeset')
817 817 )
818 818 parent = p1
819 819
820 820 # the backout should appear on the same branch
821 821 branch = repo.dirstate.branch()
822 822 bheads = repo.branchheads(branch)
823 823 rctx = scmutil.revsingle(repo, hex(parent))
824 824 if not opts.get(b'merge') and op1 != node:
825 825 with dirstateguard.dirstateguard(repo, b'backout'):
826 826 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
827 827 with ui.configoverride(overrides, b'backout'):
828 828 stats = mergemod.back_out(ctx, parent=repo[parent])
829 829 repo.setparents(op1, op2)
830 830 hg._showstats(repo, stats)
831 831 if stats.unresolvedcount:
832 832 repo.ui.status(
833 833 _(b"use 'hg resolve' to retry unresolved file merges\n")
834 834 )
835 835 return 1
836 836 else:
837 837 hg.clean(repo, node, show_stats=False)
838 838 repo.dirstate.setbranch(branch)
839 839 cmdutil.revert(ui, repo, rctx)
840 840
841 841 if opts.get(b'no_commit'):
842 842 msg = _(b"changeset %s backed out, don't forget to commit.\n")
843 843 ui.status(msg % short(node))
844 844 return 0
845 845
846 846 def commitfunc(ui, repo, message, match, opts):
847 847 editform = b'backout'
848 848 e = cmdutil.getcommiteditor(
849 849 editform=editform, **pycompat.strkwargs(opts)
850 850 )
851 851 if not message:
852 852 # we don't translate commit messages
853 853 message = b"Backed out changeset %s" % short(node)
854 854 e = cmdutil.getcommiteditor(edit=True, editform=editform)
855 855 return repo.commit(
856 856 message, opts.get(b'user'), opts.get(b'date'), match, editor=e
857 857 )
858 858
859 859 # save to detect changes
860 860 tip = repo.changelog.tip()
861 861
862 862 newnode = cmdutil.commit(ui, repo, commitfunc, [], opts)
863 863 if not newnode:
864 864 ui.status(_(b"nothing changed\n"))
865 865 return 1
866 866 cmdutil.commitstatus(repo, newnode, branch, bheads, tip)
867 867
868 868 def nice(node):
869 869 return b'%d:%s' % (repo.changelog.rev(node), short(node))
870 870
871 871 ui.status(
872 872 _(b'changeset %s backs out changeset %s\n')
873 873 % (nice(newnode), nice(node))
874 874 )
875 875 if opts.get(b'merge') and op1 != node:
876 876 hg.clean(repo, op1, show_stats=False)
877 877 ui.status(_(b'merging with changeset %s\n') % nice(newnode))
878 878 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
879 879 with ui.configoverride(overrides, b'backout'):
880 880 return hg.merge(repo[b'tip'])
881 881 return 0
882 882
883 883
884 884 @command(
885 885 b'bisect',
886 886 [
887 887 (b'r', b'reset', False, _(b'reset bisect state')),
888 888 (b'g', b'good', False, _(b'mark changeset good')),
889 889 (b'b', b'bad', False, _(b'mark changeset bad')),
890 890 (b's', b'skip', False, _(b'skip testing changeset')),
891 891 (b'e', b'extend', False, _(b'extend the bisect range')),
892 892 (
893 893 b'c',
894 894 b'command',
895 895 b'',
896 896 _(b'use command to check changeset state'),
897 897 _(b'CMD'),
898 898 ),
899 899 (b'U', b'noupdate', False, _(b'do not update to target')),
900 900 ],
901 901 _(b"[-gbsr] [-U] [-c CMD] [REV]"),
902 902 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
903 903 )
904 904 def bisect(
905 905 ui,
906 906 repo,
907 907 positional_1=None,
908 908 positional_2=None,
909 909 command=None,
910 910 reset=None,
911 911 good=None,
912 912 bad=None,
913 913 skip=None,
914 914 extend=None,
915 915 noupdate=None,
916 916 ):
917 917 """subdivision search of changesets
918 918
919 919 This command helps to find changesets which introduce problems. To
920 920 use, mark the earliest changeset you know exhibits the problem as
921 921 bad, then mark the latest changeset which is free from the problem
922 922 as good. Bisect will update your working directory to a revision
923 923 for testing (unless the -U/--noupdate option is specified). Once
924 924 you have performed tests, mark the working directory as good or
925 925 bad, and bisect will either update to another candidate changeset
926 926 or announce that it has found the bad revision.
927 927
928 928 As a shortcut, you can also use the revision argument to mark a
929 929 revision as good or bad without checking it out first.
930 930
931 931 If you supply a command, it will be used for automatic bisection.
932 932 The environment variable HG_NODE will contain the ID of the
933 933 changeset being tested. The exit status of the command will be
934 934 used to mark revisions as good or bad: status 0 means good, 125
935 935 means to skip the revision, 127 (command not found) will abort the
936 936 bisection, and any other non-zero exit status means the revision
937 937 is bad.
938 938
939 939 .. container:: verbose
940 940
941 941 Some examples:
942 942
943 943 - start a bisection with known bad revision 34, and good revision 12::
944 944
945 945 hg bisect --bad 34
946 946 hg bisect --good 12
947 947
948 948 - advance the current bisection by marking current revision as good or
949 949 bad::
950 950
951 951 hg bisect --good
952 952 hg bisect --bad
953 953
954 954 - mark the current revision, or a known revision, to be skipped (e.g. if
955 955 that revision is not usable because of another issue)::
956 956
957 957 hg bisect --skip
958 958 hg bisect --skip 23
959 959
960 960 - skip all revisions that do not touch directories ``foo`` or ``bar``::
961 961
962 962 hg bisect --skip "!( file('path:foo') & file('path:bar') )"
963 963
964 964 - forget the current bisection::
965 965
966 966 hg bisect --reset
967 967
968 968 - use 'make && make tests' to automatically find the first broken
969 969 revision::
970 970
971 971 hg bisect --reset
972 972 hg bisect --bad 34
973 973 hg bisect --good 12
974 974 hg bisect --command "make && make tests"
975 975
976 976 - see all changesets whose states are already known in the current
977 977 bisection::
978 978
979 979 hg log -r "bisect(pruned)"
980 980
981 981 - see the changeset currently being bisected (especially useful
982 982 if running with -U/--noupdate)::
983 983
984 984 hg log -r "bisect(current)"
985 985
986 986 - see all changesets that took part in the current bisection::
987 987
988 988 hg log -r "bisect(range)"
989 989
990 990 - you can even get a nice graph::
991 991
992 992 hg log --graph -r "bisect(range)"
993 993
994 994 See :hg:`help revisions.bisect` for more about the `bisect()` predicate.
995 995
996 996 Returns 0 on success.
997 997 """
998 998 rev = []
999 999 # backward compatibility
1000 1000 if positional_1 in (b"good", b"bad", b"reset", b"init"):
1001 1001 ui.warn(_(b"(use of 'hg bisect <cmd>' is deprecated)\n"))
1002 1002 cmd = positional_1
1003 1003 rev.append(positional_2)
1004 1004 if cmd == b"good":
1005 1005 good = True
1006 1006 elif cmd == b"bad":
1007 1007 bad = True
1008 1008 else:
1009 1009 reset = True
1010 1010 elif positional_2:
1011 1011 raise error.InputError(_(b'incompatible arguments'))
1012 1012 elif positional_1 is not None:
1013 1013 rev.append(positional_1)
1014 1014
1015 1015 incompatibles = {
1016 1016 b'--bad': bad,
1017 1017 b'--command': bool(command),
1018 1018 b'--extend': extend,
1019 1019 b'--good': good,
1020 1020 b'--reset': reset,
1021 1021 b'--skip': skip,
1022 1022 }
1023 1023
1024 1024 enabled = [x for x in incompatibles if incompatibles[x]]
1025 1025
1026 1026 if len(enabled) > 1:
1027 1027 raise error.InputError(
1028 1028 _(b'%s and %s are incompatible') % tuple(sorted(enabled)[0:2])
1029 1029 )
1030 1030
1031 1031 if reset:
1032 1032 hbisect.resetstate(repo)
1033 1033 return
1034 1034
1035 1035 state = hbisect.load_state(repo)
1036 1036
1037 1037 if rev:
1038 1038 nodes = [repo[i].node() for i in logcmdutil.revrange(repo, rev)]
1039 1039 else:
1040 1040 nodes = [repo.lookup(b'.')]
1041 1041
1042 1042 # update state
1043 1043 if good or bad or skip:
1044 1044 if good:
1045 1045 state[b'good'] += nodes
1046 1046 elif bad:
1047 1047 state[b'bad'] += nodes
1048 1048 elif skip:
1049 1049 state[b'skip'] += nodes
1050 1050 hbisect.save_state(repo, state)
1051 1051 if not (state[b'good'] and state[b'bad']):
1052 1052 return
1053 1053
1054 1054 def mayupdate(repo, node, show_stats=True):
1055 1055 """common used update sequence"""
1056 1056 if noupdate:
1057 1057 return
1058 1058 cmdutil.checkunfinished(repo)
1059 1059 cmdutil.bailifchanged(repo)
1060 1060 return hg.clean(repo, node, show_stats=show_stats)
1061 1061
1062 1062 displayer = logcmdutil.changesetdisplayer(ui, repo, {})
1063 1063
1064 1064 if command:
1065 1065 changesets = 1
1066 1066 if noupdate:
1067 1067 try:
1068 1068 node = state[b'current'][0]
1069 1069 except LookupError:
1070 1070 raise error.StateError(
1071 1071 _(
1072 1072 b'current bisect revision is unknown - '
1073 1073 b'start a new bisect to fix'
1074 1074 )
1075 1075 )
1076 1076 else:
1077 1077 node, p2 = repo.dirstate.parents()
1078 1078 if p2 != repo.nullid:
1079 1079 raise error.StateError(_(b'current bisect revision is a merge'))
1080 1080 if rev:
1081 1081 if not nodes:
1082 1082 raise error.InputError(_(b'empty revision set'))
1083 1083 node = repo[nodes[-1]].node()
1084 1084 with hbisect.restore_state(repo, state, node):
1085 1085 while changesets:
1086 1086 # update state
1087 1087 state[b'current'] = [node]
1088 1088 hbisect.save_state(repo, state)
1089 1089 status = ui.system(
1090 1090 command,
1091 1091 environ={b'HG_NODE': hex(node)},
1092 1092 blockedtag=b'bisect_check',
1093 1093 )
1094 1094 if status == 125:
1095 1095 transition = b"skip"
1096 1096 elif status == 0:
1097 1097 transition = b"good"
1098 1098 # status < 0 means process was killed
1099 1099 elif status == 127:
1100 1100 raise error.Abort(_(b"failed to execute %s") % command)
1101 1101 elif status < 0:
1102 1102 raise error.Abort(_(b"%s killed") % command)
1103 1103 else:
1104 1104 transition = b"bad"
1105 1105 state[transition].append(node)
1106 1106 ctx = repo[node]
1107 1107 summary = cmdutil.format_changeset_summary(ui, ctx, b'bisect')
1108 1108 ui.status(_(b'changeset %s: %s\n') % (summary, transition))
1109 1109 hbisect.checkstate(state)
1110 1110 # bisect
1111 1111 nodes, changesets, bgood = hbisect.bisect(repo, state)
1112 1112 # update to next check
1113 1113 node = nodes[0]
1114 1114 mayupdate(repo, node, show_stats=False)
1115 1115 hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
1116 1116 return
1117 1117
1118 1118 hbisect.checkstate(state)
1119 1119
1120 1120 # actually bisect
1121 1121 nodes, changesets, good = hbisect.bisect(repo, state)
1122 1122 if extend:
1123 1123 if not changesets:
1124 1124 extendctx = hbisect.extendrange(repo, state, nodes, good)
1125 1125 if extendctx is not None:
1126 1126 ui.write(
1127 1127 _(b"Extending search to changeset %s\n")
1128 1128 % cmdutil.format_changeset_summary(ui, extendctx, b'bisect')
1129 1129 )
1130 1130 state[b'current'] = [extendctx.node()]
1131 1131 hbisect.save_state(repo, state)
1132 1132 return mayupdate(repo, extendctx.node())
1133 1133 raise error.StateError(_(b"nothing to extend"))
1134 1134
1135 1135 if changesets == 0:
1136 1136 hbisect.printresult(ui, repo, state, displayer, nodes, good)
1137 1137 else:
1138 1138 assert len(nodes) == 1 # only a single node can be tested next
1139 1139 node = nodes[0]
1140 1140 # compute the approximate number of remaining tests
1141 1141 tests, size = 0, 2
1142 1142 while size <= changesets:
1143 1143 tests, size = tests + 1, size * 2
1144 1144 rev = repo.changelog.rev(node)
1145 1145 summary = cmdutil.format_changeset_summary(ui, repo[rev], b'bisect')
1146 1146 ui.write(
1147 1147 _(
1148 1148 b"Testing changeset %s "
1149 1149 b"(%d changesets remaining, ~%d tests)\n"
1150 1150 )
1151 1151 % (summary, changesets, tests)
1152 1152 )
1153 1153 state[b'current'] = [node]
1154 1154 hbisect.save_state(repo, state)
1155 1155 return mayupdate(repo, node)
1156 1156
1157 1157
1158 1158 @command(
1159 1159 b'bookmarks|bookmark',
1160 1160 [
1161 1161 (b'f', b'force', False, _(b'force')),
1162 1162 (b'r', b'rev', b'', _(b'revision for bookmark action'), _(b'REV')),
1163 1163 (b'd', b'delete', False, _(b'delete a given bookmark')),
1164 1164 (b'm', b'rename', b'', _(b'rename a given bookmark'), _(b'OLD')),
1165 1165 (b'i', b'inactive', False, _(b'mark a bookmark inactive')),
1166 1166 (b'l', b'list', False, _(b'list existing bookmarks')),
1167 1167 ]
1168 1168 + formatteropts,
1169 1169 _(b'hg bookmarks [OPTIONS]... [NAME]...'),
1170 1170 helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
1171 1171 )
1172 1172 def bookmark(ui, repo, *names, **opts):
1173 1173 """create a new bookmark or list existing bookmarks
1174 1174
1175 1175 Bookmarks are labels on changesets to help track lines of development.
1176 1176 Bookmarks are unversioned and can be moved, renamed and deleted.
1177 1177 Deleting or moving a bookmark has no effect on the associated changesets.
1178 1178
1179 1179 Creating or updating to a bookmark causes it to be marked as 'active'.
1180 1180 The active bookmark is indicated with a '*'.
1181 1181 When a commit is made, the active bookmark will advance to the new commit.
1182 1182 A plain :hg:`update` will also advance an active bookmark, if possible.
1183 1183 Updating away from a bookmark will cause it to be deactivated.
1184 1184
1185 1185 Bookmarks can be pushed and pulled between repositories (see
1186 1186 :hg:`help push` and :hg:`help pull`). If a shared bookmark has
1187 1187 diverged, a new 'divergent bookmark' of the form 'name@path' will
1188 1188 be created. Using :hg:`merge` will resolve the divergence.
1189 1189
1190 1190 Specifying bookmark as '.' to -m/-d/-l options is equivalent to specifying
1191 1191 the active bookmark's name.
1192 1192
1193 1193 A bookmark named '@' has the special property that :hg:`clone` will
1194 1194 check it out by default if it exists.
1195 1195
1196 1196 .. container:: verbose
1197 1197
1198 1198 Template:
1199 1199
1200 1200 The following keywords are supported in addition to the common template
1201 1201 keywords and functions such as ``{bookmark}``. See also
1202 1202 :hg:`help templates`.
1203 1203
1204 1204 :active: Boolean. True if the bookmark is active.
1205 1205
1206 1206 Examples:
1207 1207
1208 1208 - create an active bookmark for a new line of development::
1209 1209
1210 1210 hg book new-feature
1211 1211
1212 1212 - create an inactive bookmark as a place marker::
1213 1213
1214 1214 hg book -i reviewed
1215 1215
1216 1216 - create an inactive bookmark on another changeset::
1217 1217
1218 1218 hg book -r .^ tested
1219 1219
1220 1220 - rename bookmark turkey to dinner::
1221 1221
1222 1222 hg book -m turkey dinner
1223 1223
1224 1224 - move the '@' bookmark from another branch::
1225 1225
1226 1226 hg book -f @
1227 1227
1228 1228 - print only the active bookmark name::
1229 1229
1230 1230 hg book -ql .
1231 1231 """
1232 1232 opts = pycompat.byteskwargs(opts)
1233 1233 force = opts.get(b'force')
1234 1234 rev = opts.get(b'rev')
1235 1235 inactive = opts.get(b'inactive') # meaning add/rename to inactive bookmark
1236 1236
1237 1237 action = cmdutil.check_at_most_one_arg(opts, b'delete', b'rename', b'list')
1238 1238 if action:
1239 1239 cmdutil.check_incompatible_arguments(opts, action, [b'rev'])
1240 1240 elif names or rev:
1241 1241 action = b'add'
1242 1242 elif inactive:
1243 1243 action = b'inactive' # meaning deactivate
1244 1244 else:
1245 1245 action = b'list'
1246 1246
1247 1247 cmdutil.check_incompatible_arguments(
1248 1248 opts, b'inactive', [b'delete', b'list']
1249 1249 )
1250 1250 if not names and action in {b'add', b'delete'}:
1251 1251 raise error.InputError(_(b"bookmark name required"))
1252 1252
1253 1253 if action in {b'add', b'delete', b'rename', b'inactive'}:
1254 1254 with repo.wlock(), repo.lock(), repo.transaction(b'bookmark') as tr:
1255 1255 if action == b'delete':
1256 1256 names = pycompat.maplist(repo._bookmarks.expandname, names)
1257 1257 bookmarks.delete(repo, tr, names)
1258 1258 elif action == b'rename':
1259 1259 if not names:
1260 1260 raise error.InputError(_(b"new bookmark name required"))
1261 1261 elif len(names) > 1:
1262 1262 raise error.InputError(
1263 1263 _(b"only one new bookmark name allowed")
1264 1264 )
1265 1265 oldname = repo._bookmarks.expandname(opts[b'rename'])
1266 1266 bookmarks.rename(repo, tr, oldname, names[0], force, inactive)
1267 1267 elif action == b'add':
1268 1268 bookmarks.addbookmarks(repo, tr, names, rev, force, inactive)
1269 1269 elif action == b'inactive':
1270 1270 if len(repo._bookmarks) == 0:
1271 1271 ui.status(_(b"no bookmarks set\n"))
1272 1272 elif not repo._activebookmark:
1273 1273 ui.status(_(b"no active bookmark\n"))
1274 1274 else:
1275 1275 bookmarks.deactivate(repo)
1276 1276 elif action == b'list':
1277 1277 names = pycompat.maplist(repo._bookmarks.expandname, names)
1278 1278 with ui.formatter(b'bookmarks', opts) as fm:
1279 1279 bookmarks.printbookmarks(ui, repo, fm, names)
1280 1280 else:
1281 1281 raise error.ProgrammingError(b'invalid action: %s' % action)
1282 1282
1283 1283
1284 1284 @command(
1285 1285 b'branch',
1286 1286 [
1287 1287 (
1288 1288 b'f',
1289 1289 b'force',
1290 1290 None,
1291 1291 _(b'set branch name even if it shadows an existing branch'),
1292 1292 ),
1293 1293 (b'C', b'clean', None, _(b'reset branch name to parent branch name')),
1294 1294 (
1295 1295 b'r',
1296 1296 b'rev',
1297 1297 [],
1298 1298 _(b'change branches of the given revs (EXPERIMENTAL)'),
1299 1299 ),
1300 1300 ],
1301 1301 _(b'[-fC] [NAME]'),
1302 1302 helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
1303 1303 )
1304 1304 def branch(ui, repo, label=None, **opts):
1305 1305 """set or show the current branch name
1306 1306
1307 1307 .. note::
1308 1308
1309 1309 Branch names are permanent and global. Use :hg:`bookmark` to create a
1310 1310 light-weight bookmark instead. See :hg:`help glossary` for more
1311 1311 information about named branches and bookmarks.
1312 1312
1313 1313 With no argument, show the current branch name. With one argument,
1314 1314 set the working directory branch name (the branch will not exist
1315 1315 in the repository until the next commit). Standard practice
1316 1316 recommends that primary development take place on the 'default'
1317 1317 branch.
1318 1318
1319 1319 Unless -f/--force is specified, branch will not let you set a
1320 1320 branch name that already exists.
1321 1321
1322 1322 Use -C/--clean to reset the working directory branch to that of
1323 1323 the parent of the working directory, negating a previous branch
1324 1324 change.
1325 1325
1326 1326 Use the command :hg:`update` to switch to an existing branch. Use
1327 1327 :hg:`commit --close-branch` to mark this branch head as closed.
1328 1328 When all heads of a branch are closed, the branch will be
1329 1329 considered closed.
1330 1330
1331 1331 Returns 0 on success.
1332 1332 """
1333 1333 opts = pycompat.byteskwargs(opts)
1334 1334 revs = opts.get(b'rev')
1335 1335 if label:
1336 1336 label = label.strip()
1337 1337
1338 1338 if not opts.get(b'clean') and not label:
1339 1339 if revs:
1340 1340 raise error.InputError(
1341 1341 _(b"no branch name specified for the revisions")
1342 1342 )
1343 1343 ui.write(b"%s\n" % repo.dirstate.branch())
1344 1344 return
1345 1345
1346 1346 with repo.wlock():
1347 1347 if opts.get(b'clean'):
1348 1348 label = repo[b'.'].branch()
1349 1349 repo.dirstate.setbranch(label)
1350 1350 ui.status(_(b'reset working directory to branch %s\n') % label)
1351 1351 elif label:
1352 1352
1353 1353 scmutil.checknewlabel(repo, label, b'branch')
1354 1354 if revs:
1355 1355 return cmdutil.changebranch(ui, repo, revs, label, opts)
1356 1356
1357 1357 if not opts.get(b'force') and label in repo.branchmap():
1358 1358 if label not in [p.branch() for p in repo[None].parents()]:
1359 1359 raise error.InputError(
1360 1360 _(b'a branch of the same name already exists'),
1361 1361 # i18n: "it" refers to an existing branch
1362 1362 hint=_(b"use 'hg update' to switch to it"),
1363 1363 )
1364 1364
1365 1365 repo.dirstate.setbranch(label)
1366 1366 ui.status(_(b'marked working directory as branch %s\n') % label)
1367 1367
1368 1368 # find any open named branches aside from default
1369 1369 for n, h, t, c in repo.branchmap().iterbranches():
1370 1370 if n != b"default" and not c:
1371 1371 return 0
1372 1372 ui.status(
1373 1373 _(
1374 1374 b'(branches are permanent and global, '
1375 1375 b'did you want a bookmark?)\n'
1376 1376 )
1377 1377 )
1378 1378
1379 1379
1380 1380 @command(
1381 1381 b'branches',
1382 1382 [
1383 1383 (
1384 1384 b'a',
1385 1385 b'active',
1386 1386 False,
1387 1387 _(b'show only branches that have unmerged heads (DEPRECATED)'),
1388 1388 ),
1389 1389 (b'c', b'closed', False, _(b'show normal and closed branches')),
1390 1390 (b'r', b'rev', [], _(b'show branch name(s) of the given rev')),
1391 1391 ]
1392 1392 + formatteropts,
1393 1393 _(b'[-c]'),
1394 1394 helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
1395 1395 intents={INTENT_READONLY},
1396 1396 )
1397 1397 def branches(ui, repo, active=False, closed=False, **opts):
1398 1398 """list repository named branches
1399 1399
1400 1400 List the repository's named branches, indicating which ones are
1401 1401 inactive. If -c/--closed is specified, also list branches which have
1402 1402 been marked closed (see :hg:`commit --close-branch`).
1403 1403
1404 1404 Use the command :hg:`update` to switch to an existing branch.
1405 1405
1406 1406 .. container:: verbose
1407 1407
1408 1408 Template:
1409 1409
1410 1410 The following keywords are supported in addition to the common template
1411 1411 keywords and functions such as ``{branch}``. See also
1412 1412 :hg:`help templates`.
1413 1413
1414 1414 :active: Boolean. True if the branch is active.
1415 1415 :closed: Boolean. True if the branch is closed.
1416 1416 :current: Boolean. True if it is the current branch.
1417 1417
1418 1418 Returns 0.
1419 1419 """
1420 1420
1421 1421 opts = pycompat.byteskwargs(opts)
1422 1422 revs = opts.get(b'rev')
1423 1423 selectedbranches = None
1424 1424 if revs:
1425 1425 revs = logcmdutil.revrange(repo, revs)
1426 1426 getbi = repo.revbranchcache().branchinfo
1427 1427 selectedbranches = {getbi(r)[0] for r in revs}
1428 1428
1429 1429 ui.pager(b'branches')
1430 1430 fm = ui.formatter(b'branches', opts)
1431 1431 hexfunc = fm.hexfunc
1432 1432
1433 1433 allheads = set(repo.heads())
1434 1434 branches = []
1435 1435 for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
1436 1436 if selectedbranches is not None and tag not in selectedbranches:
1437 1437 continue
1438 1438 isactive = False
1439 1439 if not isclosed:
1440 1440 openheads = set(repo.branchmap().iteropen(heads))
1441 1441 isactive = bool(openheads & allheads)
1442 1442 branches.append((tag, repo[tip], isactive, not isclosed))
1443 1443 branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]), reverse=True)
1444 1444
1445 1445 for tag, ctx, isactive, isopen in branches:
1446 1446 if active and not isactive:
1447 1447 continue
1448 1448 if isactive:
1449 1449 label = b'branches.active'
1450 1450 notice = b''
1451 1451 elif not isopen:
1452 1452 if not closed:
1453 1453 continue
1454 1454 label = b'branches.closed'
1455 1455 notice = _(b' (closed)')
1456 1456 else:
1457 1457 label = b'branches.inactive'
1458 1458 notice = _(b' (inactive)')
1459 1459 current = tag == repo.dirstate.branch()
1460 1460 if current:
1461 1461 label = b'branches.current'
1462 1462
1463 1463 fm.startitem()
1464 1464 fm.write(b'branch', b'%s', tag, label=label)
1465 1465 rev = ctx.rev()
1466 1466 padsize = max(31 - len(b"%d" % rev) - encoding.colwidth(tag), 0)
1467 1467 fmt = b' ' * padsize + b' %d:%s'
1468 1468 fm.condwrite(
1469 1469 not ui.quiet,
1470 1470 b'rev node',
1471 1471 fmt,
1472 1472 rev,
1473 1473 hexfunc(ctx.node()),
1474 1474 label=b'log.changeset changeset.%s' % ctx.phasestr(),
1475 1475 )
1476 1476 fm.context(ctx=ctx)
1477 1477 fm.data(active=isactive, closed=not isopen, current=current)
1478 1478 if not ui.quiet:
1479 1479 fm.plain(notice)
1480 1480 fm.plain(b'\n')
1481 1481 fm.end()
1482 1482
1483 1483
1484 1484 @command(
1485 1485 b'bundle',
1486 1486 [
1487 1487 (
1488 1488 b'f',
1489 1489 b'force',
1490 1490 None,
1491 1491 _(b'run even when the destination is unrelated'),
1492 1492 ),
1493 1493 (
1494 1494 b'r',
1495 1495 b'rev',
1496 1496 [],
1497 1497 _(b'a changeset intended to be added to the destination'),
1498 1498 _(b'REV'),
1499 1499 ),
1500 1500 (
1501 1501 b'b',
1502 1502 b'branch',
1503 1503 [],
1504 1504 _(b'a specific branch you would like to bundle'),
1505 1505 _(b'BRANCH'),
1506 1506 ),
1507 1507 (
1508 1508 b'',
1509 1509 b'base',
1510 1510 [],
1511 1511 _(b'a base changeset assumed to be available at the destination'),
1512 1512 _(b'REV'),
1513 1513 ),
1514 1514 (b'a', b'all', None, _(b'bundle all changesets in the repository')),
1515 1515 (
1516 1516 b't',
1517 1517 b'type',
1518 1518 b'bzip2',
1519 1519 _(b'bundle compression type to use'),
1520 1520 _(b'TYPE'),
1521 1521 ),
1522 1522 ]
1523 1523 + remoteopts,
1524 1524 _(b'[-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]...'),
1525 1525 helpcategory=command.CATEGORY_IMPORT_EXPORT,
1526 1526 )
1527 1527 def bundle(ui, repo, fname, *dests, **opts):
1528 1528 """create a bundle file
1529 1529
1530 1530 Generate a bundle file containing data to be transferred to another
1531 1531 repository.
1532 1532
1533 1533 To create a bundle containing all changesets, use -a/--all
1534 1534 (or --base null). Otherwise, hg assumes the destination will have
1535 1535 all the nodes you specify with --base parameters. Otherwise, hg
1536 1536 will assume the repository has all the nodes in destination, or
1537 1537 default-push/default if no destination is specified, where destination
1538 1538 is the repositories you provide through DEST option.
1539 1539
1540 1540 You can change bundle format with the -t/--type option. See
1541 1541 :hg:`help bundlespec` for documentation on this format. By default,
1542 1542 the most appropriate format is used and compression defaults to
1543 1543 bzip2.
1544 1544
1545 1545 The bundle file can then be transferred using conventional means
1546 1546 and applied to another repository with the unbundle or pull
1547 1547 command. This is useful when direct push and pull are not
1548 1548 available or when exporting an entire repository is undesirable.
1549 1549
1550 1550 Applying bundles preserves all changeset contents including
1551 1551 permissions, copy/rename information, and revision history.
1552 1552
1553 1553 Returns 0 on success, 1 if no changes found.
1554 1554 """
1555 1555 opts = pycompat.byteskwargs(opts)
1556 1556 revs = None
1557 1557 if b'rev' in opts:
1558 1558 revstrings = opts[b'rev']
1559 1559 revs = logcmdutil.revrange(repo, revstrings)
1560 1560 if revstrings and not revs:
1561 1561 raise error.InputError(_(b'no commits to bundle'))
1562 1562
1563 1563 bundletype = opts.get(b'type', b'bzip2').lower()
1564 1564 try:
1565 1565 bundlespec = bundlecaches.parsebundlespec(
1566 1566 repo, bundletype, strict=False
1567 1567 )
1568 1568 except error.UnsupportedBundleSpecification as e:
1569 1569 raise error.InputError(
1570 1570 pycompat.bytestr(e),
1571 1571 hint=_(b"see 'hg help bundlespec' for supported values for --type"),
1572 1572 )
1573 1573 cgversion = bundlespec.params[b"cg.version"]
1574 1574
1575 1575 # Packed bundles are a pseudo bundle format for now.
1576 1576 if cgversion == b's1':
1577 1577 raise error.InputError(
1578 1578 _(b'packed bundles cannot be produced by "hg bundle"'),
1579 1579 hint=_(b"use 'hg debugcreatestreamclonebundle'"),
1580 1580 )
1581 1581
1582 1582 if opts.get(b'all'):
1583 1583 if dests:
1584 1584 raise error.InputError(
1585 1585 _(b"--all is incompatible with specifying destinations")
1586 1586 )
1587 1587 if opts.get(b'base'):
1588 1588 ui.warn(_(b"ignoring --base because --all was specified\n"))
1589 1589 base = [nullrev]
1590 1590 else:
1591 1591 base = logcmdutil.revrange(repo, opts.get(b'base'))
1592 1592 if cgversion not in changegroup.supportedoutgoingversions(repo):
1593 1593 raise error.Abort(
1594 1594 _(b"repository does not support bundle version %s") % cgversion
1595 1595 )
1596 1596
1597 1597 if base:
1598 1598 if dests:
1599 1599 raise error.InputError(
1600 1600 _(b"--base is incompatible with specifying destinations")
1601 1601 )
1602 1602 cl = repo.changelog
1603 1603 common = [cl.node(rev) for rev in base]
1604 1604 heads = [cl.node(r) for r in revs] if revs else None
1605 1605 outgoing = discovery.outgoing(repo, common, heads)
1606 1606 missing = outgoing.missing
1607 1607 excluded = outgoing.excluded
1608 1608 else:
1609 1609 missing = set()
1610 1610 excluded = set()
1611 1611 for path in urlutil.get_push_paths(repo, ui, dests):
1612 1612 other = hg.peer(repo, opts, path.rawloc)
1613 1613 if revs is not None:
1614 1614 hex_revs = [repo[r].hex() for r in revs]
1615 1615 else:
1616 1616 hex_revs = None
1617 1617 branches = (path.branch, [])
1618 1618 head_revs, checkout = hg.addbranchrevs(
1619 1619 repo, repo, branches, hex_revs
1620 1620 )
1621 1621 heads = (
1622 1622 head_revs
1623 1623 and pycompat.maplist(repo.lookup, head_revs)
1624 1624 or head_revs
1625 1625 )
1626 1626 outgoing = discovery.findcommonoutgoing(
1627 1627 repo,
1628 1628 other,
1629 1629 onlyheads=heads,
1630 1630 force=opts.get(b'force'),
1631 1631 portable=True,
1632 1632 )
1633 1633 missing.update(outgoing.missing)
1634 1634 excluded.update(outgoing.excluded)
1635 1635
1636 1636 if not missing:
1637 1637 scmutil.nochangesfound(ui, repo, not base and excluded)
1638 1638 return 1
1639 1639
1640 1640 if heads:
1641 1641 outgoing = discovery.outgoing(
1642 1642 repo, missingroots=missing, ancestorsof=heads
1643 1643 )
1644 1644 else:
1645 1645 outgoing = discovery.outgoing(repo, missingroots=missing)
1646 1646 outgoing.excluded = sorted(excluded)
1647 1647
1648 1648 if cgversion == b'01': # bundle1
1649 1649 bversion = b'HG10' + bundlespec.wirecompression
1650 1650 bcompression = None
1651 1651 elif cgversion in (b'02', b'03'):
1652 1652 bversion = b'HG20'
1653 1653 bcompression = bundlespec.wirecompression
1654 1654 else:
1655 1655 raise error.ProgrammingError(
1656 1656 b'bundle: unexpected changegroup version %s' % cgversion
1657 1657 )
1658 1658
1659 1659 # TODO compression options should be derived from bundlespec parsing.
1660 1660 # This is a temporary hack to allow adjusting bundle compression
1661 1661 # level without a) formalizing the bundlespec changes to declare it
1662 1662 # b) introducing a command flag.
1663 1663 compopts = {}
1664 1664 complevel = ui.configint(
1665 1665 b'experimental', b'bundlecomplevel.' + bundlespec.compression
1666 1666 )
1667 1667 if complevel is None:
1668 1668 complevel = ui.configint(b'experimental', b'bundlecomplevel')
1669 1669 if complevel is not None:
1670 1670 compopts[b'level'] = complevel
1671 1671
1672 1672 compthreads = ui.configint(
1673 1673 b'experimental', b'bundlecompthreads.' + bundlespec.compression
1674 1674 )
1675 1675 if compthreads is None:
1676 1676 compthreads = ui.configint(b'experimental', b'bundlecompthreads')
1677 1677 if compthreads is not None:
1678 1678 compopts[b'threads'] = compthreads
1679 1679
1680 1680 # Bundling of obsmarker and phases is optional as not all clients
1681 1681 # support the necessary features.
1682 1682 cfg = ui.configbool
1683 1683 obsolescence_cfg = cfg(b'experimental', b'evolution.bundle-obsmarker')
1684 bundlespec.set_param(b'obsolescence', obsolescence_cfg)
1684 bundlespec.set_param(b'obsolescence', obsolescence_cfg, overwrite=False)
1685 1685 obs_mand_cfg = cfg(b'experimental', b'evolution.bundle-obsmarker:mandatory')
1686 bundlespec.set_param(b'obsolescence-mandatory', obs_mand_cfg)
1686 bundlespec.set_param(
1687 b'obsolescence-mandatory', obs_mand_cfg, overwrite=False
1688 )
1687 1689 phases_cfg = cfg(b'experimental', b'bundle-phases')
1688 bundlespec.set_param(b'phases', phases_cfg)
1690 bundlespec.set_param(b'phases', phases_cfg, overwrite=False)
1689 1691
1690 1692 bundle2.writenewbundle(
1691 1693 ui,
1692 1694 repo,
1693 1695 b'bundle',
1694 1696 fname,
1695 1697 bversion,
1696 1698 outgoing,
1697 1699 bundlespec.params,
1698 1700 compression=bcompression,
1699 1701 compopts=compopts,
1700 1702 )
1701 1703
1702 1704
1703 1705 @command(
1704 1706 b'cat',
1705 1707 [
1706 1708 (
1707 1709 b'o',
1708 1710 b'output',
1709 1711 b'',
1710 1712 _(b'print output to file with formatted name'),
1711 1713 _(b'FORMAT'),
1712 1714 ),
1713 1715 (b'r', b'rev', b'', _(b'print the given revision'), _(b'REV')),
1714 1716 (b'', b'decode', None, _(b'apply any matching decode filter')),
1715 1717 ]
1716 1718 + walkopts
1717 1719 + formatteropts,
1718 1720 _(b'[OPTION]... FILE...'),
1719 1721 helpcategory=command.CATEGORY_FILE_CONTENTS,
1720 1722 inferrepo=True,
1721 1723 intents={INTENT_READONLY},
1722 1724 )
1723 1725 def cat(ui, repo, file1, *pats, **opts):
1724 1726 """output the current or given revision of files
1725 1727
1726 1728 Print the specified files as they were at the given revision. If
1727 1729 no revision is given, the parent of the working directory is used.
1728 1730
1729 1731 Output may be to a file, in which case the name of the file is
1730 1732 given using a template string. See :hg:`help templates`. In addition
1731 1733 to the common template keywords, the following formatting rules are
1732 1734 supported:
1733 1735
1734 1736 :``%%``: literal "%" character
1735 1737 :``%s``: basename of file being printed
1736 1738 :``%d``: dirname of file being printed, or '.' if in repository root
1737 1739 :``%p``: root-relative path name of file being printed
1738 1740 :``%H``: changeset hash (40 hexadecimal digits)
1739 1741 :``%R``: changeset revision number
1740 1742 :``%h``: short-form changeset hash (12 hexadecimal digits)
1741 1743 :``%r``: zero-padded changeset revision number
1742 1744 :``%b``: basename of the exporting repository
1743 1745 :``\\``: literal "\\" character
1744 1746
1745 1747 .. container:: verbose
1746 1748
1747 1749 Template:
1748 1750
1749 1751 The following keywords are supported in addition to the common template
1750 1752 keywords and functions. See also :hg:`help templates`.
1751 1753
1752 1754 :data: String. File content.
1753 1755 :path: String. Repository-absolute path of the file.
1754 1756
1755 1757 Returns 0 on success.
1756 1758 """
1757 1759 opts = pycompat.byteskwargs(opts)
1758 1760 rev = opts.get(b'rev')
1759 1761 if rev:
1760 1762 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
1761 1763 ctx = logcmdutil.revsingle(repo, rev)
1762 1764 m = scmutil.match(ctx, (file1,) + pats, opts)
1763 1765 fntemplate = opts.pop(b'output', b'')
1764 1766 if cmdutil.isstdiofilename(fntemplate):
1765 1767 fntemplate = b''
1766 1768
1767 1769 if fntemplate:
1768 1770 fm = formatter.nullformatter(ui, b'cat', opts)
1769 1771 else:
1770 1772 ui.pager(b'cat')
1771 1773 fm = ui.formatter(b'cat', opts)
1772 1774 with fm:
1773 1775 return cmdutil.cat(
1774 1776 ui, repo, ctx, m, fm, fntemplate, b'', **pycompat.strkwargs(opts)
1775 1777 )
1776 1778
1777 1779
1778 1780 @command(
1779 1781 b'clone',
1780 1782 [
1781 1783 (
1782 1784 b'U',
1783 1785 b'noupdate',
1784 1786 None,
1785 1787 _(
1786 1788 b'the clone will include an empty working '
1787 1789 b'directory (only a repository)'
1788 1790 ),
1789 1791 ),
1790 1792 (
1791 1793 b'u',
1792 1794 b'updaterev',
1793 1795 b'',
1794 1796 _(b'revision, tag, or branch to check out'),
1795 1797 _(b'REV'),
1796 1798 ),
1797 1799 (
1798 1800 b'r',
1799 1801 b'rev',
1800 1802 [],
1801 1803 _(
1802 1804 b'do not clone everything, but include this changeset'
1803 1805 b' and its ancestors'
1804 1806 ),
1805 1807 _(b'REV'),
1806 1808 ),
1807 1809 (
1808 1810 b'b',
1809 1811 b'branch',
1810 1812 [],
1811 1813 _(
1812 1814 b'do not clone everything, but include this branch\'s'
1813 1815 b' changesets and their ancestors'
1814 1816 ),
1815 1817 _(b'BRANCH'),
1816 1818 ),
1817 1819 (b'', b'pull', None, _(b'use pull protocol to copy metadata')),
1818 1820 (b'', b'uncompressed', None, _(b'an alias to --stream (DEPRECATED)')),
1819 1821 (b'', b'stream', None, _(b'clone with minimal data processing')),
1820 1822 ]
1821 1823 + remoteopts,
1822 1824 _(b'[OPTION]... SOURCE [DEST]'),
1823 1825 helpcategory=command.CATEGORY_REPO_CREATION,
1824 1826 helpbasic=True,
1825 1827 norepo=True,
1826 1828 )
1827 1829 def clone(ui, source, dest=None, **opts):
1828 1830 """make a copy of an existing repository
1829 1831
1830 1832 Create a copy of an existing repository in a new directory.
1831 1833
1832 1834 If no destination directory name is specified, it defaults to the
1833 1835 basename of the source.
1834 1836
1835 1837 The location of the source is added to the new repository's
1836 1838 ``.hg/hgrc`` file, as the default to be used for future pulls.
1837 1839
1838 1840 Only local paths and ``ssh://`` URLs are supported as
1839 1841 destinations. For ``ssh://`` destinations, no working directory or
1840 1842 ``.hg/hgrc`` will be created on the remote side.
1841 1843
1842 1844 If the source repository has a bookmark called '@' set, that
1843 1845 revision will be checked out in the new repository by default.
1844 1846
1845 1847 To check out a particular version, use -u/--update, or
1846 1848 -U/--noupdate to create a clone with no working directory.
1847 1849
1848 1850 To pull only a subset of changesets, specify one or more revisions
1849 1851 identifiers with -r/--rev or branches with -b/--branch. The
1850 1852 resulting clone will contain only the specified changesets and
1851 1853 their ancestors. These options (or 'clone src#rev dest') imply
1852 1854 --pull, even for local source repositories.
1853 1855
1854 1856 In normal clone mode, the remote normalizes repository data into a common
1855 1857 exchange format and the receiving end translates this data into its local
1856 1858 storage format. --stream activates a different clone mode that essentially
1857 1859 copies repository files from the remote with minimal data processing. This
1858 1860 significantly reduces the CPU cost of a clone both remotely and locally.
1859 1861 However, it often increases the transferred data size by 30-40%. This can
1860 1862 result in substantially faster clones where I/O throughput is plentiful,
1861 1863 especially for larger repositories. A side-effect of --stream clones is
1862 1864 that storage settings and requirements on the remote are applied locally:
1863 1865 a modern client may inherit legacy or inefficient storage used by the
1864 1866 remote or a legacy Mercurial client may not be able to clone from a
1865 1867 modern Mercurial remote.
1866 1868
1867 1869 .. note::
1868 1870
1869 1871 Specifying a tag will include the tagged changeset but not the
1870 1872 changeset containing the tag.
1871 1873
1872 1874 .. container:: verbose
1873 1875
1874 1876 For efficiency, hardlinks are used for cloning whenever the
1875 1877 source and destination are on the same filesystem (note this
1876 1878 applies only to the repository data, not to the working
1877 1879 directory). Some filesystems, such as AFS, implement hardlinking
1878 1880 incorrectly, but do not report errors. In these cases, use the
1879 1881 --pull option to avoid hardlinking.
1880 1882
1881 1883 Mercurial will update the working directory to the first applicable
1882 1884 revision from this list:
1883 1885
1884 1886 a) null if -U or the source repository has no changesets
1885 1887 b) if -u . and the source repository is local, the first parent of
1886 1888 the source repository's working directory
1887 1889 c) the changeset specified with -u (if a branch name, this means the
1888 1890 latest head of that branch)
1889 1891 d) the changeset specified with -r
1890 1892 e) the tipmost head specified with -b
1891 1893 f) the tipmost head specified with the url#branch source syntax
1892 1894 g) the revision marked with the '@' bookmark, if present
1893 1895 h) the tipmost head of the default branch
1894 1896 i) tip
1895 1897
1896 1898 When cloning from servers that support it, Mercurial may fetch
1897 1899 pre-generated data from a server-advertised URL or inline from the
1898 1900 same stream. When this is done, hooks operating on incoming changesets
1899 1901 and changegroups may fire more than once, once for each pre-generated
1900 1902 bundle and as well as for any additional remaining data. In addition,
1901 1903 if an error occurs, the repository may be rolled back to a partial
1902 1904 clone. This behavior may change in future releases.
1903 1905 See :hg:`help -e clonebundles` for more.
1904 1906
1905 1907 Examples:
1906 1908
1907 1909 - clone a remote repository to a new directory named hg/::
1908 1910
1909 1911 hg clone https://www.mercurial-scm.org/repo/hg/
1910 1912
1911 1913 - create a lightweight local clone::
1912 1914
1913 1915 hg clone project/ project-feature/
1914 1916
1915 1917 - clone from an absolute path on an ssh server (note double-slash)::
1916 1918
1917 1919 hg clone ssh://user@server//home/projects/alpha/
1918 1920
1919 1921 - do a streaming clone while checking out a specified version::
1920 1922
1921 1923 hg clone --stream http://server/repo -u 1.5
1922 1924
1923 1925 - create a repository without changesets after a particular revision::
1924 1926
1925 1927 hg clone -r 04e544 experimental/ good/
1926 1928
1927 1929 - clone (and track) a particular named branch::
1928 1930
1929 1931 hg clone https://www.mercurial-scm.org/repo/hg/#stable
1930 1932
1931 1933 See :hg:`help urls` for details on specifying URLs.
1932 1934
1933 1935 Returns 0 on success.
1934 1936 """
1935 1937 opts = pycompat.byteskwargs(opts)
1936 1938 cmdutil.check_at_most_one_arg(opts, b'noupdate', b'updaterev')
1937 1939
1938 1940 # --include/--exclude can come from narrow or sparse.
1939 1941 includepats, excludepats = None, None
1940 1942
1941 1943 # hg.clone() differentiates between None and an empty set. So make sure
1942 1944 # patterns are sets if narrow is requested without patterns.
1943 1945 if opts.get(b'narrow'):
1944 1946 includepats = set()
1945 1947 excludepats = set()
1946 1948
1947 1949 if opts.get(b'include'):
1948 1950 includepats = narrowspec.parsepatterns(opts.get(b'include'))
1949 1951 if opts.get(b'exclude'):
1950 1952 excludepats = narrowspec.parsepatterns(opts.get(b'exclude'))
1951 1953
1952 1954 r = hg.clone(
1953 1955 ui,
1954 1956 opts,
1955 1957 source,
1956 1958 dest,
1957 1959 pull=opts.get(b'pull'),
1958 1960 stream=opts.get(b'stream') or opts.get(b'uncompressed'),
1959 1961 revs=opts.get(b'rev'),
1960 1962 update=opts.get(b'updaterev') or not opts.get(b'noupdate'),
1961 1963 branch=opts.get(b'branch'),
1962 1964 shareopts=opts.get(b'shareopts'),
1963 1965 storeincludepats=includepats,
1964 1966 storeexcludepats=excludepats,
1965 1967 depth=opts.get(b'depth') or None,
1966 1968 )
1967 1969
1968 1970 return r is None
1969 1971
1970 1972
1971 1973 @command(
1972 1974 b'commit|ci',
1973 1975 [
1974 1976 (
1975 1977 b'A',
1976 1978 b'addremove',
1977 1979 None,
1978 1980 _(b'mark new/missing files as added/removed before committing'),
1979 1981 ),
1980 1982 (b'', b'close-branch', None, _(b'mark a branch head as closed')),
1981 1983 (b'', b'amend', None, _(b'amend the parent of the working directory')),
1982 1984 (b's', b'secret', None, _(b'use the secret phase for committing')),
1983 1985 (b'e', b'edit', None, _(b'invoke editor on commit messages')),
1984 1986 (
1985 1987 b'',
1986 1988 b'force-close-branch',
1987 1989 None,
1988 1990 _(b'forcibly close branch from a non-head changeset (ADVANCED)'),
1989 1991 ),
1990 1992 (b'i', b'interactive', None, _(b'use interactive mode')),
1991 1993 ]
1992 1994 + walkopts
1993 1995 + commitopts
1994 1996 + commitopts2
1995 1997 + subrepoopts,
1996 1998 _(b'[OPTION]... [FILE]...'),
1997 1999 helpcategory=command.CATEGORY_COMMITTING,
1998 2000 helpbasic=True,
1999 2001 inferrepo=True,
2000 2002 )
2001 2003 def commit(ui, repo, *pats, **opts):
2002 2004 """commit the specified files or all outstanding changes
2003 2005
2004 2006 Commit changes to the given files into the repository. Unlike a
2005 2007 centralized SCM, this operation is a local operation. See
2006 2008 :hg:`push` for a way to actively distribute your changes.
2007 2009
2008 2010 If a list of files is omitted, all changes reported by :hg:`status`
2009 2011 will be committed.
2010 2012
2011 2013 If you are committing the result of a merge, do not provide any
2012 2014 filenames or -I/-X filters.
2013 2015
2014 2016 If no commit message is specified, Mercurial starts your
2015 2017 configured editor where you can enter a message. In case your
2016 2018 commit fails, you will find a backup of your message in
2017 2019 ``.hg/last-message.txt``.
2018 2020
2019 2021 The --close-branch flag can be used to mark the current branch
2020 2022 head closed. When all heads of a branch are closed, the branch
2021 2023 will be considered closed and no longer listed.
2022 2024
2023 2025 The --amend flag can be used to amend the parent of the
2024 2026 working directory with a new commit that contains the changes
2025 2027 in the parent in addition to those currently reported by :hg:`status`,
2026 2028 if there are any. The old commit is stored in a backup bundle in
2027 2029 ``.hg/strip-backup`` (see :hg:`help bundle` and :hg:`help unbundle`
2028 2030 on how to restore it).
2029 2031
2030 2032 Message, user and date are taken from the amended commit unless
2031 2033 specified. When a message isn't specified on the command line,
2032 2034 the editor will open with the message of the amended commit.
2033 2035
2034 2036 It is not possible to amend public changesets (see :hg:`help phases`)
2035 2037 or changesets that have children.
2036 2038
2037 2039 See :hg:`help dates` for a list of formats valid for -d/--date.
2038 2040
2039 2041 Returns 0 on success, 1 if nothing changed.
2040 2042
2041 2043 .. container:: verbose
2042 2044
2043 2045 Examples:
2044 2046
2045 2047 - commit all files ending in .py::
2046 2048
2047 2049 hg commit --include "set:**.py"
2048 2050
2049 2051 - commit all non-binary files::
2050 2052
2051 2053 hg commit --exclude "set:binary()"
2052 2054
2053 2055 - amend the current commit and set the date to now::
2054 2056
2055 2057 hg commit --amend --date now
2056 2058 """
2057 2059 with repo.wlock(), repo.lock():
2058 2060 return _docommit(ui, repo, *pats, **opts)
2059 2061
2060 2062
2061 2063 def _docommit(ui, repo, *pats, **opts):
2062 2064 if opts.get('interactive'):
2063 2065 opts.pop('interactive')
2064 2066 ret = cmdutil.dorecord(
2065 2067 ui, repo, commit, None, False, cmdutil.recordfilter, *pats, **opts
2066 2068 )
2067 2069 # ret can be 0 (no changes to record) or the value returned by
2068 2070 # commit(), 1 if nothing changed or None on success.
2069 2071 return 1 if ret == 0 else ret
2070 2072
2071 2073 if opts.get('subrepos'):
2072 2074 cmdutil.check_incompatible_arguments(opts, 'subrepos', ['amend'])
2073 2075 # Let --subrepos on the command line override config setting.
2074 2076 ui.setconfig(b'ui', b'commitsubrepos', True, b'commit')
2075 2077
2076 2078 cmdutil.checkunfinished(repo, commit=True)
2077 2079
2078 2080 branch = repo[None].branch()
2079 2081 bheads = repo.branchheads(branch)
2080 2082 tip = repo.changelog.tip()
2081 2083
2082 2084 extra = {}
2083 2085 if opts.get('close_branch') or opts.get('force_close_branch'):
2084 2086 extra[b'close'] = b'1'
2085 2087
2086 2088 if repo[b'.'].closesbranch():
2087 2089 raise error.InputError(
2088 2090 _(b'current revision is already a branch closing head')
2089 2091 )
2090 2092 elif not bheads:
2091 2093 raise error.InputError(
2092 2094 _(b'branch "%s" has no heads to close') % branch
2093 2095 )
2094 2096 elif (
2095 2097 branch == repo[b'.'].branch()
2096 2098 and repo[b'.'].node() not in bheads
2097 2099 and not opts.get('force_close_branch')
2098 2100 ):
2099 2101 hint = _(
2100 2102 b'use --force-close-branch to close branch from a non-head'
2101 2103 b' changeset'
2102 2104 )
2103 2105 raise error.InputError(_(b'can only close branch heads'), hint=hint)
2104 2106 elif opts.get('amend'):
2105 2107 if (
2106 2108 repo[b'.'].p1().branch() != branch
2107 2109 and repo[b'.'].p2().branch() != branch
2108 2110 ):
2109 2111 raise error.InputError(_(b'can only close branch heads'))
2110 2112
2111 2113 if opts.get('amend'):
2112 2114 if ui.configbool(b'ui', b'commitsubrepos'):
2113 2115 raise error.InputError(
2114 2116 _(b'cannot amend with ui.commitsubrepos enabled')
2115 2117 )
2116 2118
2117 2119 old = repo[b'.']
2118 2120 rewriteutil.precheck(repo, [old.rev()], b'amend')
2119 2121
2120 2122 # Currently histedit gets confused if an amend happens while histedit
2121 2123 # is in progress. Since we have a checkunfinished command, we are
2122 2124 # temporarily honoring it.
2123 2125 #
2124 2126 # Note: eventually this guard will be removed. Please do not expect
2125 2127 # this behavior to remain.
2126 2128 if not obsolete.isenabled(repo, obsolete.createmarkersopt):
2127 2129 cmdutil.checkunfinished(repo)
2128 2130
2129 2131 node = cmdutil.amend(ui, repo, old, extra, pats, opts)
2130 2132 opts = pycompat.byteskwargs(opts)
2131 2133 if node == old.node():
2132 2134 ui.status(_(b"nothing changed\n"))
2133 2135 return 1
2134 2136 else:
2135 2137
2136 2138 def commitfunc(ui, repo, message, match, opts):
2137 2139 overrides = {}
2138 2140 if opts.get(b'secret'):
2139 2141 overrides[(b'phases', b'new-commit')] = b'secret'
2140 2142
2141 2143 baseui = repo.baseui
2142 2144 with baseui.configoverride(overrides, b'commit'):
2143 2145 with ui.configoverride(overrides, b'commit'):
2144 2146 editform = cmdutil.mergeeditform(
2145 2147 repo[None], b'commit.normal'
2146 2148 )
2147 2149 editor = cmdutil.getcommiteditor(
2148 2150 editform=editform, **pycompat.strkwargs(opts)
2149 2151 )
2150 2152 return repo.commit(
2151 2153 message,
2152 2154 opts.get(b'user'),
2153 2155 opts.get(b'date'),
2154 2156 match,
2155 2157 editor=editor,
2156 2158 extra=extra,
2157 2159 )
2158 2160
2159 2161 opts = pycompat.byteskwargs(opts)
2160 2162 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
2161 2163
2162 2164 if not node:
2163 2165 stat = cmdutil.postcommitstatus(repo, pats, opts)
2164 2166 if stat.deleted:
2165 2167 ui.status(
2166 2168 _(
2167 2169 b"nothing changed (%d missing files, see "
2168 2170 b"'hg status')\n"
2169 2171 )
2170 2172 % len(stat.deleted)
2171 2173 )
2172 2174 else:
2173 2175 ui.status(_(b"nothing changed\n"))
2174 2176 return 1
2175 2177
2176 2178 cmdutil.commitstatus(repo, node, branch, bheads, tip, opts)
2177 2179
2178 2180 if not ui.quiet and ui.configbool(b'commands', b'commit.post-status'):
2179 2181 status(
2180 2182 ui,
2181 2183 repo,
2182 2184 modified=True,
2183 2185 added=True,
2184 2186 removed=True,
2185 2187 deleted=True,
2186 2188 unknown=True,
2187 2189 subrepos=opts.get(b'subrepos'),
2188 2190 )
2189 2191
2190 2192
2191 2193 @command(
2192 2194 b'config|showconfig|debugconfig',
2193 2195 [
2194 2196 (b'u', b'untrusted', None, _(b'show untrusted configuration options')),
2195 2197 # This is experimental because we need
2196 2198 # * reasonable behavior around aliases,
2197 2199 # * decide if we display [debug] [experimental] and [devel] section par
2198 2200 # default
2199 2201 # * some way to display "generic" config entry (the one matching
2200 2202 # regexp,
2201 2203 # * proper display of the different value type
2202 2204 # * a better way to handle <DYNAMIC> values (and variable types),
2203 2205 # * maybe some type information ?
2204 2206 (
2205 2207 b'',
2206 2208 b'exp-all-known',
2207 2209 None,
2208 2210 _(b'show all known config option (EXPERIMENTAL)'),
2209 2211 ),
2210 2212 (b'e', b'edit', None, _(b'edit user config')),
2211 2213 (b'l', b'local', None, _(b'edit repository config')),
2212 2214 (b'', b'source', None, _(b'show source of configuration value')),
2213 2215 (
2214 2216 b'',
2215 2217 b'shared',
2216 2218 None,
2217 2219 _(b'edit shared source repository config (EXPERIMENTAL)'),
2218 2220 ),
2219 2221 (b'', b'non-shared', None, _(b'edit non shared config (EXPERIMENTAL)')),
2220 2222 (b'g', b'global', None, _(b'edit global config')),
2221 2223 ]
2222 2224 + formatteropts,
2223 2225 _(b'[-u] [NAME]...'),
2224 2226 helpcategory=command.CATEGORY_HELP,
2225 2227 optionalrepo=True,
2226 2228 intents={INTENT_READONLY},
2227 2229 )
2228 2230 def config(ui, repo, *values, **opts):
2229 2231 """show combined config settings from all hgrc files
2230 2232
2231 2233 With no arguments, print names and values of all config items.
2232 2234
2233 2235 With one argument of the form section.name, print just the value
2234 2236 of that config item.
2235 2237
2236 2238 With multiple arguments, print names and values of all config
2237 2239 items with matching section names or section.names.
2238 2240
2239 2241 With --edit, start an editor on the user-level config file. With
2240 2242 --global, edit the system-wide config file. With --local, edit the
2241 2243 repository-level config file.
2242 2244
2243 2245 With --source, the source (filename and line number) is printed
2244 2246 for each config item.
2245 2247
2246 2248 See :hg:`help config` for more information about config files.
2247 2249
2248 2250 .. container:: verbose
2249 2251
2250 2252 --non-shared flag is used to edit `.hg/hgrc-not-shared` config file.
2251 2253 This file is not shared across shares when in share-safe mode.
2252 2254
2253 2255 Template:
2254 2256
2255 2257 The following keywords are supported. See also :hg:`help templates`.
2256 2258
2257 2259 :name: String. Config name.
2258 2260 :source: String. Filename and line number where the item is defined.
2259 2261 :value: String. Config value.
2260 2262
2261 2263 The --shared flag can be used to edit the config file of shared source
2262 2264 repository. It only works when you have shared using the experimental
2263 2265 share safe feature.
2264 2266
2265 2267 Returns 0 on success, 1 if NAME does not exist.
2266 2268
2267 2269 """
2268 2270
2269 2271 opts = pycompat.byteskwargs(opts)
2270 2272 editopts = (b'edit', b'local', b'global', b'shared', b'non_shared')
2271 2273 if any(opts.get(o) for o in editopts):
2272 2274 cmdutil.check_at_most_one_arg(opts, *editopts[1:])
2273 2275 if opts.get(b'local'):
2274 2276 if not repo:
2275 2277 raise error.InputError(
2276 2278 _(b"can't use --local outside a repository")
2277 2279 )
2278 2280 paths = [repo.vfs.join(b'hgrc')]
2279 2281 elif opts.get(b'global'):
2280 2282 paths = rcutil.systemrcpath()
2281 2283 elif opts.get(b'shared'):
2282 2284 if not repo.shared():
2283 2285 raise error.InputError(
2284 2286 _(b"repository is not shared; can't use --shared")
2285 2287 )
2286 2288 if requirements.SHARESAFE_REQUIREMENT not in repo.requirements:
2287 2289 raise error.InputError(
2288 2290 _(
2289 2291 b"share safe feature not enabled; "
2290 2292 b"unable to edit shared source repository config"
2291 2293 )
2292 2294 )
2293 2295 paths = [vfsmod.vfs(repo.sharedpath).join(b'hgrc')]
2294 2296 elif opts.get(b'non_shared'):
2295 2297 paths = [repo.vfs.join(b'hgrc-not-shared')]
2296 2298 else:
2297 2299 paths = rcutil.userrcpath()
2298 2300
2299 2301 for f in paths:
2300 2302 if os.path.exists(f):
2301 2303 break
2302 2304 else:
2303 2305 if opts.get(b'global'):
2304 2306 samplehgrc = uimod.samplehgrcs[b'global']
2305 2307 elif opts.get(b'local'):
2306 2308 samplehgrc = uimod.samplehgrcs[b'local']
2307 2309 else:
2308 2310 samplehgrc = uimod.samplehgrcs[b'user']
2309 2311
2310 2312 f = paths[0]
2311 2313 fp = open(f, b"wb")
2312 2314 fp.write(util.tonativeeol(samplehgrc))
2313 2315 fp.close()
2314 2316
2315 2317 editor = ui.geteditor()
2316 2318 ui.system(
2317 2319 b"%s \"%s\"" % (editor, f),
2318 2320 onerr=error.InputError,
2319 2321 errprefix=_(b"edit failed"),
2320 2322 blockedtag=b'config_edit',
2321 2323 )
2322 2324 return
2323 2325 ui.pager(b'config')
2324 2326 fm = ui.formatter(b'config', opts)
2325 2327 for t, f in rcutil.rccomponents():
2326 2328 if t == b'path':
2327 2329 ui.debug(b'read config from: %s\n' % f)
2328 2330 elif t == b'resource':
2329 2331 ui.debug(b'read config from: resource:%s.%s\n' % (f[0], f[1]))
2330 2332 elif t == b'items':
2331 2333 # Don't print anything for 'items'.
2332 2334 pass
2333 2335 else:
2334 2336 raise error.ProgrammingError(b'unknown rctype: %s' % t)
2335 2337 untrusted = bool(opts.get(b'untrusted'))
2336 2338
2337 2339 selsections = selentries = []
2338 2340 if values:
2339 2341 selsections = [v for v in values if b'.' not in v]
2340 2342 selentries = [v for v in values if b'.' in v]
2341 2343 uniquesel = len(selentries) == 1 and not selsections
2342 2344 selsections = set(selsections)
2343 2345 selentries = set(selentries)
2344 2346
2345 2347 matched = False
2346 2348 all_known = opts[b'exp_all_known']
2347 2349 show_source = ui.debugflag or opts.get(b'source')
2348 2350 entries = ui.walkconfig(untrusted=untrusted, all_known=all_known)
2349 2351 for section, name, value in entries:
2350 2352 source = ui.configsource(section, name, untrusted)
2351 2353 value = pycompat.bytestr(value)
2352 2354 defaultvalue = ui.configdefault(section, name)
2353 2355 if fm.isplain():
2354 2356 source = source or b'none'
2355 2357 value = value.replace(b'\n', b'\\n')
2356 2358 entryname = section + b'.' + name
2357 2359 if values and not (section in selsections or entryname in selentries):
2358 2360 continue
2359 2361 fm.startitem()
2360 2362 fm.condwrite(show_source, b'source', b'%s: ', source)
2361 2363 if uniquesel:
2362 2364 fm.data(name=entryname)
2363 2365 fm.write(b'value', b'%s\n', value)
2364 2366 else:
2365 2367 fm.write(b'name value', b'%s=%s\n', entryname, value)
2366 2368 if formatter.isprintable(defaultvalue):
2367 2369 fm.data(defaultvalue=defaultvalue)
2368 2370 elif isinstance(defaultvalue, list) and all(
2369 2371 formatter.isprintable(e) for e in defaultvalue
2370 2372 ):
2371 2373 fm.data(defaultvalue=fm.formatlist(defaultvalue, name=b'value'))
2372 2374 # TODO: no idea how to process unsupported defaultvalue types
2373 2375 matched = True
2374 2376 fm.end()
2375 2377 if matched:
2376 2378 return 0
2377 2379 return 1
2378 2380
2379 2381
2380 2382 @command(
2381 2383 b'continue',
2382 2384 dryrunopts,
2383 2385 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT,
2384 2386 helpbasic=True,
2385 2387 )
2386 2388 def continuecmd(ui, repo, **opts):
2387 2389 """resumes an interrupted operation (EXPERIMENTAL)
2388 2390
2389 2391 Finishes a multistep operation like graft, histedit, rebase, merge,
2390 2392 and unshelve if they are in an interrupted state.
2391 2393
2392 2394 use --dry-run/-n to dry run the command.
2393 2395 """
2394 2396 dryrun = opts.get('dry_run')
2395 2397 contstate = cmdutil.getunfinishedstate(repo)
2396 2398 if not contstate:
2397 2399 raise error.StateError(_(b'no operation in progress'))
2398 2400 if not contstate.continuefunc:
2399 2401 raise error.StateError(
2400 2402 (
2401 2403 _(b"%s in progress but does not support 'hg continue'")
2402 2404 % (contstate._opname)
2403 2405 ),
2404 2406 hint=contstate.continuemsg(),
2405 2407 )
2406 2408 if dryrun:
2407 2409 ui.status(_(b'%s in progress, will be resumed\n') % (contstate._opname))
2408 2410 return
2409 2411 return contstate.continuefunc(ui, repo)
2410 2412
2411 2413
2412 2414 @command(
2413 2415 b'copy|cp',
2414 2416 [
2415 2417 (b'', b'forget', None, _(b'unmark a destination file as copied')),
2416 2418 (b'A', b'after', None, _(b'record a copy that has already occurred')),
2417 2419 (
2418 2420 b'',
2419 2421 b'at-rev',
2420 2422 b'',
2421 2423 _(b'(un)mark copies in the given revision (EXPERIMENTAL)'),
2422 2424 _(b'REV'),
2423 2425 ),
2424 2426 (
2425 2427 b'f',
2426 2428 b'force',
2427 2429 None,
2428 2430 _(b'forcibly copy over an existing managed file'),
2429 2431 ),
2430 2432 ]
2431 2433 + walkopts
2432 2434 + dryrunopts,
2433 2435 _(b'[OPTION]... (SOURCE... DEST | --forget DEST...)'),
2434 2436 helpcategory=command.CATEGORY_FILE_CONTENTS,
2435 2437 )
2436 2438 def copy(ui, repo, *pats, **opts):
2437 2439 """mark files as copied for the next commit
2438 2440
2439 2441 Mark dest as having copies of source files. If dest is a
2440 2442 directory, copies are put in that directory. If dest is a file,
2441 2443 the source must be a single file.
2442 2444
2443 2445 By default, this command copies the contents of files as they
2444 2446 exist in the working directory. If invoked with -A/--after, the
2445 2447 operation is recorded, but no copying is performed.
2446 2448
2447 2449 To undo marking a destination file as copied, use --forget. With that
2448 2450 option, all given (positional) arguments are unmarked as copies. The
2449 2451 destination file(s) will be left in place (still tracked). Note that
2450 2452 :hg:`copy --forget` behaves the same way as :hg:`rename --forget`.
2451 2453
2452 2454 This command takes effect with the next commit by default.
2453 2455
2454 2456 Returns 0 on success, 1 if errors are encountered.
2455 2457 """
2456 2458 opts = pycompat.byteskwargs(opts)
2457 2459 with repo.wlock():
2458 2460 return cmdutil.copy(ui, repo, pats, opts)
2459 2461
2460 2462
2461 2463 @command(
2462 2464 b'debugcommands',
2463 2465 [],
2464 2466 _(b'[COMMAND]'),
2465 2467 helpcategory=command.CATEGORY_HELP,
2466 2468 norepo=True,
2467 2469 )
2468 2470 def debugcommands(ui, cmd=b'', *args):
2469 2471 """list all available commands and options"""
2470 2472 for cmd, vals in sorted(table.items()):
2471 2473 cmd = cmd.split(b'|')[0]
2472 2474 opts = b', '.join([i[1] for i in vals[1]])
2473 2475 ui.write(b'%s: %s\n' % (cmd, opts))
2474 2476
2475 2477
2476 2478 @command(
2477 2479 b'debugcomplete',
2478 2480 [(b'o', b'options', None, _(b'show the command options'))],
2479 2481 _(b'[-o] CMD'),
2480 2482 helpcategory=command.CATEGORY_HELP,
2481 2483 norepo=True,
2482 2484 )
2483 2485 def debugcomplete(ui, cmd=b'', **opts):
2484 2486 """returns the completion list associated with the given command"""
2485 2487
2486 2488 if opts.get('options'):
2487 2489 options = []
2488 2490 otables = [globalopts]
2489 2491 if cmd:
2490 2492 aliases, entry = cmdutil.findcmd(cmd, table, False)
2491 2493 otables.append(entry[1])
2492 2494 for t in otables:
2493 2495 for o in t:
2494 2496 if b"(DEPRECATED)" in o[3]:
2495 2497 continue
2496 2498 if o[0]:
2497 2499 options.append(b'-%s' % o[0])
2498 2500 options.append(b'--%s' % o[1])
2499 2501 ui.write(b"%s\n" % b"\n".join(options))
2500 2502 return
2501 2503
2502 2504 cmdlist, unused_allcmds = cmdutil.findpossible(cmd, table)
2503 2505 if ui.verbose:
2504 2506 cmdlist = [b' '.join(c[0]) for c in cmdlist.values()]
2505 2507 ui.write(b"%s\n" % b"\n".join(sorted(cmdlist)))
2506 2508
2507 2509
2508 2510 @command(
2509 2511 b'diff',
2510 2512 [
2511 2513 (b'r', b'rev', [], _(b'revision (DEPRECATED)'), _(b'REV')),
2512 2514 (b'', b'from', b'', _(b'revision to diff from'), _(b'REV1')),
2513 2515 (b'', b'to', b'', _(b'revision to diff to'), _(b'REV2')),
2514 2516 (b'c', b'change', b'', _(b'change made by revision'), _(b'REV')),
2515 2517 ]
2516 2518 + diffopts
2517 2519 + diffopts2
2518 2520 + walkopts
2519 2521 + subrepoopts,
2520 2522 _(b'[OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]...'),
2521 2523 helpcategory=command.CATEGORY_FILE_CONTENTS,
2522 2524 helpbasic=True,
2523 2525 inferrepo=True,
2524 2526 intents={INTENT_READONLY},
2525 2527 )
2526 2528 def diff(ui, repo, *pats, **opts):
2527 2529 """diff repository (or selected files)
2528 2530
2529 2531 Show differences between revisions for the specified files.
2530 2532
2531 2533 Differences between files are shown using the unified diff format.
2532 2534
2533 2535 .. note::
2534 2536
2535 2537 :hg:`diff` may generate unexpected results for merges, as it will
2536 2538 default to comparing against the working directory's first
2537 2539 parent changeset if no revisions are specified. To diff against the
2538 2540 conflict regions, you can use `--config diff.merge=yes`.
2539 2541
2540 2542 By default, the working directory files are compared to its first parent. To
2541 2543 see the differences from another revision, use --from. To see the difference
2542 2544 to another revision, use --to. For example, :hg:`diff --from .^` will show
2543 2545 the differences from the working copy's grandparent to the working copy,
2544 2546 :hg:`diff --to .` will show the diff from the working copy to its parent
2545 2547 (i.e. the reverse of the default), and :hg:`diff --from 1.0 --to 1.2` will
2546 2548 show the diff between those two revisions.
2547 2549
2548 2550 Alternatively you can specify -c/--change with a revision to see the changes
2549 2551 in that changeset relative to its first parent (i.e. :hg:`diff -c 42` is
2550 2552 equivalent to :hg:`diff --from 42^ --to 42`)
2551 2553
2552 2554 Without the -a/--text option, diff will avoid generating diffs of
2553 2555 files it detects as binary. With -a, diff will generate a diff
2554 2556 anyway, probably with undesirable results.
2555 2557
2556 2558 Use the -g/--git option to generate diffs in the git extended diff
2557 2559 format. For more information, read :hg:`help diffs`.
2558 2560
2559 2561 .. container:: verbose
2560 2562
2561 2563 Examples:
2562 2564
2563 2565 - compare a file in the current working directory to its parent::
2564 2566
2565 2567 hg diff foo.c
2566 2568
2567 2569 - compare two historical versions of a directory, with rename info::
2568 2570
2569 2571 hg diff --git --from 1.0 --to 1.2 lib/
2570 2572
2571 2573 - get change stats relative to the last change on some date::
2572 2574
2573 2575 hg diff --stat --from "date('may 2')"
2574 2576
2575 2577 - diff all newly-added files that contain a keyword::
2576 2578
2577 2579 hg diff "set:added() and grep(GNU)"
2578 2580
2579 2581 - compare a revision and its parents::
2580 2582
2581 2583 hg diff -c 9353 # compare against first parent
2582 2584 hg diff --from 9353^ --to 9353 # same using revset syntax
2583 2585 hg diff --from 9353^2 --to 9353 # compare against the second parent
2584 2586
2585 2587 Returns 0 on success.
2586 2588 """
2587 2589
2588 2590 cmdutil.check_at_most_one_arg(opts, 'rev', 'change')
2589 2591 opts = pycompat.byteskwargs(opts)
2590 2592 revs = opts.get(b'rev')
2591 2593 change = opts.get(b'change')
2592 2594 from_rev = opts.get(b'from')
2593 2595 to_rev = opts.get(b'to')
2594 2596 stat = opts.get(b'stat')
2595 2597 reverse = opts.get(b'reverse')
2596 2598
2597 2599 cmdutil.check_incompatible_arguments(opts, b'from', [b'rev', b'change'])
2598 2600 cmdutil.check_incompatible_arguments(opts, b'to', [b'rev', b'change'])
2599 2601 if change:
2600 2602 repo = scmutil.unhidehashlikerevs(repo, [change], b'nowarn')
2601 2603 ctx2 = logcmdutil.revsingle(repo, change, None)
2602 2604 ctx1 = logcmdutil.diff_parent(ctx2)
2603 2605 elif from_rev or to_rev:
2604 2606 repo = scmutil.unhidehashlikerevs(
2605 2607 repo, [from_rev] + [to_rev], b'nowarn'
2606 2608 )
2607 2609 ctx1 = logcmdutil.revsingle(repo, from_rev, None)
2608 2610 ctx2 = logcmdutil.revsingle(repo, to_rev, None)
2609 2611 else:
2610 2612 repo = scmutil.unhidehashlikerevs(repo, revs, b'nowarn')
2611 2613 ctx1, ctx2 = logcmdutil.revpair(repo, revs)
2612 2614
2613 2615 if reverse:
2614 2616 ctxleft = ctx2
2615 2617 ctxright = ctx1
2616 2618 else:
2617 2619 ctxleft = ctx1
2618 2620 ctxright = ctx2
2619 2621
2620 2622 diffopts = patch.diffallopts(ui, opts)
2621 2623 m = scmutil.match(ctx2, pats, opts)
2622 2624 m = repo.narrowmatch(m)
2623 2625 ui.pager(b'diff')
2624 2626 logcmdutil.diffordiffstat(
2625 2627 ui,
2626 2628 repo,
2627 2629 diffopts,
2628 2630 ctxleft,
2629 2631 ctxright,
2630 2632 m,
2631 2633 stat=stat,
2632 2634 listsubrepos=opts.get(b'subrepos'),
2633 2635 root=opts.get(b'root'),
2634 2636 )
2635 2637
2636 2638
2637 2639 @command(
2638 2640 b'export',
2639 2641 [
2640 2642 (
2641 2643 b'B',
2642 2644 b'bookmark',
2643 2645 b'',
2644 2646 _(b'export changes only reachable by given bookmark'),
2645 2647 _(b'BOOKMARK'),
2646 2648 ),
2647 2649 (
2648 2650 b'o',
2649 2651 b'output',
2650 2652 b'',
2651 2653 _(b'print output to file with formatted name'),
2652 2654 _(b'FORMAT'),
2653 2655 ),
2654 2656 (b'', b'switch-parent', None, _(b'diff against the second parent')),
2655 2657 (b'r', b'rev', [], _(b'revisions to export'), _(b'REV')),
2656 2658 ]
2657 2659 + diffopts
2658 2660 + formatteropts,
2659 2661 _(b'[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'),
2660 2662 helpcategory=command.CATEGORY_IMPORT_EXPORT,
2661 2663 helpbasic=True,
2662 2664 intents={INTENT_READONLY},
2663 2665 )
2664 2666 def export(ui, repo, *changesets, **opts):
2665 2667 """dump the header and diffs for one or more changesets
2666 2668
2667 2669 Print the changeset header and diffs for one or more revisions.
2668 2670 If no revision is given, the parent of the working directory is used.
2669 2671
2670 2672 The information shown in the changeset header is: author, date,
2671 2673 branch name (if non-default), changeset hash, parent(s) and commit
2672 2674 comment.
2673 2675
2674 2676 .. note::
2675 2677
2676 2678 :hg:`export` may generate unexpected diff output for merge
2677 2679 changesets, as it will compare the merge changeset against its
2678 2680 first parent only.
2679 2681
2680 2682 Output may be to a file, in which case the name of the file is
2681 2683 given using a template string. See :hg:`help templates`. In addition
2682 2684 to the common template keywords, the following formatting rules are
2683 2685 supported:
2684 2686
2685 2687 :``%%``: literal "%" character
2686 2688 :``%H``: changeset hash (40 hexadecimal digits)
2687 2689 :``%N``: number of patches being generated
2688 2690 :``%R``: changeset revision number
2689 2691 :``%b``: basename of the exporting repository
2690 2692 :``%h``: short-form changeset hash (12 hexadecimal digits)
2691 2693 :``%m``: first line of the commit message (only alphanumeric characters)
2692 2694 :``%n``: zero-padded sequence number, starting at 1
2693 2695 :``%r``: zero-padded changeset revision number
2694 2696 :``\\``: literal "\\" character
2695 2697
2696 2698 Without the -a/--text option, export will avoid generating diffs
2697 2699 of files it detects as binary. With -a, export will generate a
2698 2700 diff anyway, probably with undesirable results.
2699 2701
2700 2702 With -B/--bookmark changesets reachable by the given bookmark are
2701 2703 selected.
2702 2704
2703 2705 Use the -g/--git option to generate diffs in the git extended diff
2704 2706 format. See :hg:`help diffs` for more information.
2705 2707
2706 2708 With the --switch-parent option, the diff will be against the
2707 2709 second parent. It can be useful to review a merge.
2708 2710
2709 2711 .. container:: verbose
2710 2712
2711 2713 Template:
2712 2714
2713 2715 The following keywords are supported in addition to the common template
2714 2716 keywords and functions. See also :hg:`help templates`.
2715 2717
2716 2718 :diff: String. Diff content.
2717 2719 :parents: List of strings. Parent nodes of the changeset.
2718 2720
2719 2721 Examples:
2720 2722
2721 2723 - use export and import to transplant a bugfix to the current
2722 2724 branch::
2723 2725
2724 2726 hg export -r 9353 | hg import -
2725 2727
2726 2728 - export all the changesets between two revisions to a file with
2727 2729 rename information::
2728 2730
2729 2731 hg export --git -r 123:150 > changes.txt
2730 2732
2731 2733 - split outgoing changes into a series of patches with
2732 2734 descriptive names::
2733 2735
2734 2736 hg export -r "outgoing()" -o "%n-%m.patch"
2735 2737
2736 2738 Returns 0 on success.
2737 2739 """
2738 2740 opts = pycompat.byteskwargs(opts)
2739 2741 bookmark = opts.get(b'bookmark')
2740 2742 changesets += tuple(opts.get(b'rev', []))
2741 2743
2742 2744 cmdutil.check_at_most_one_arg(opts, b'rev', b'bookmark')
2743 2745
2744 2746 if bookmark:
2745 2747 if bookmark not in repo._bookmarks:
2746 2748 raise error.InputError(_(b"bookmark '%s' not found") % bookmark)
2747 2749
2748 2750 revs = scmutil.bookmarkrevs(repo, bookmark)
2749 2751 else:
2750 2752 if not changesets:
2751 2753 changesets = [b'.']
2752 2754
2753 2755 repo = scmutil.unhidehashlikerevs(repo, changesets, b'nowarn')
2754 2756 revs = logcmdutil.revrange(repo, changesets)
2755 2757
2756 2758 if not revs:
2757 2759 raise error.InputError(_(b"export requires at least one changeset"))
2758 2760 if len(revs) > 1:
2759 2761 ui.note(_(b'exporting patches:\n'))
2760 2762 else:
2761 2763 ui.note(_(b'exporting patch:\n'))
2762 2764
2763 2765 fntemplate = opts.get(b'output')
2764 2766 if cmdutil.isstdiofilename(fntemplate):
2765 2767 fntemplate = b''
2766 2768
2767 2769 if fntemplate:
2768 2770 fm = formatter.nullformatter(ui, b'export', opts)
2769 2771 else:
2770 2772 ui.pager(b'export')
2771 2773 fm = ui.formatter(b'export', opts)
2772 2774 with fm:
2773 2775 cmdutil.export(
2774 2776 repo,
2775 2777 revs,
2776 2778 fm,
2777 2779 fntemplate=fntemplate,
2778 2780 switch_parent=opts.get(b'switch_parent'),
2779 2781 opts=patch.diffallopts(ui, opts),
2780 2782 )
2781 2783
2782 2784
2783 2785 @command(
2784 2786 b'files',
2785 2787 [
2786 2788 (
2787 2789 b'r',
2788 2790 b'rev',
2789 2791 b'',
2790 2792 _(b'search the repository as it is in REV'),
2791 2793 _(b'REV'),
2792 2794 ),
2793 2795 (
2794 2796 b'0',
2795 2797 b'print0',
2796 2798 None,
2797 2799 _(b'end filenames with NUL, for use with xargs'),
2798 2800 ),
2799 2801 ]
2800 2802 + walkopts
2801 2803 + formatteropts
2802 2804 + subrepoopts,
2803 2805 _(b'[OPTION]... [FILE]...'),
2804 2806 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
2805 2807 intents={INTENT_READONLY},
2806 2808 )
2807 2809 def files(ui, repo, *pats, **opts):
2808 2810 """list tracked files
2809 2811
2810 2812 Print files under Mercurial control in the working directory or
2811 2813 specified revision for given files (excluding removed files).
2812 2814 Files can be specified as filenames or filesets.
2813 2815
2814 2816 If no files are given to match, this command prints the names
2815 2817 of all files under Mercurial control.
2816 2818
2817 2819 .. container:: verbose
2818 2820
2819 2821 Template:
2820 2822
2821 2823 The following keywords are supported in addition to the common template
2822 2824 keywords and functions. See also :hg:`help templates`.
2823 2825
2824 2826 :flags: String. Character denoting file's symlink and executable bits.
2825 2827 :path: String. Repository-absolute path of the file.
2826 2828 :size: Integer. Size of the file in bytes.
2827 2829
2828 2830 Examples:
2829 2831
2830 2832 - list all files under the current directory::
2831 2833
2832 2834 hg files .
2833 2835
2834 2836 - shows sizes and flags for current revision::
2835 2837
2836 2838 hg files -vr .
2837 2839
2838 2840 - list all files named README::
2839 2841
2840 2842 hg files -I "**/README"
2841 2843
2842 2844 - list all binary files::
2843 2845
2844 2846 hg files "set:binary()"
2845 2847
2846 2848 - find files containing a regular expression::
2847 2849
2848 2850 hg files "set:grep('bob')"
2849 2851
2850 2852 - search tracked file contents with xargs and grep::
2851 2853
2852 2854 hg files -0 | xargs -0 grep foo
2853 2855
2854 2856 See :hg:`help patterns` and :hg:`help filesets` for more information
2855 2857 on specifying file patterns.
2856 2858
2857 2859 Returns 0 if a match is found, 1 otherwise.
2858 2860
2859 2861 """
2860 2862
2861 2863 opts = pycompat.byteskwargs(opts)
2862 2864 rev = opts.get(b'rev')
2863 2865 if rev:
2864 2866 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
2865 2867 ctx = logcmdutil.revsingle(repo, rev, None)
2866 2868
2867 2869 end = b'\n'
2868 2870 if opts.get(b'print0'):
2869 2871 end = b'\0'
2870 2872 fmt = b'%s' + end
2871 2873
2872 2874 m = scmutil.match(ctx, pats, opts)
2873 2875 ui.pager(b'files')
2874 2876 uipathfn = scmutil.getuipathfn(ctx.repo(), legacyrelativevalue=True)
2875 2877 with ui.formatter(b'files', opts) as fm:
2876 2878 return cmdutil.files(
2877 2879 ui, ctx, m, uipathfn, fm, fmt, opts.get(b'subrepos')
2878 2880 )
2879 2881
2880 2882
2881 2883 @command(
2882 2884 b'forget',
2883 2885 [
2884 2886 (b'i', b'interactive', None, _(b'use interactive mode')),
2885 2887 ]
2886 2888 + walkopts
2887 2889 + dryrunopts,
2888 2890 _(b'[OPTION]... FILE...'),
2889 2891 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
2890 2892 helpbasic=True,
2891 2893 inferrepo=True,
2892 2894 )
2893 2895 def forget(ui, repo, *pats, **opts):
2894 2896 """forget the specified files on the next commit
2895 2897
2896 2898 Mark the specified files so they will no longer be tracked
2897 2899 after the next commit.
2898 2900
2899 2901 This only removes files from the current branch, not from the
2900 2902 entire project history, and it does not delete them from the
2901 2903 working directory.
2902 2904
2903 2905 To delete the file from the working directory, see :hg:`remove`.
2904 2906
2905 2907 To undo a forget before the next commit, see :hg:`add`.
2906 2908
2907 2909 .. container:: verbose
2908 2910
2909 2911 Examples:
2910 2912
2911 2913 - forget newly-added binary files::
2912 2914
2913 2915 hg forget "set:added() and binary()"
2914 2916
2915 2917 - forget files that would be excluded by .hgignore::
2916 2918
2917 2919 hg forget "set:hgignore()"
2918 2920
2919 2921 Returns 0 on success.
2920 2922 """
2921 2923
2922 2924 opts = pycompat.byteskwargs(opts)
2923 2925 if not pats:
2924 2926 raise error.InputError(_(b'no files specified'))
2925 2927
2926 2928 m = scmutil.match(repo[None], pats, opts)
2927 2929 dryrun, interactive = opts.get(b'dry_run'), opts.get(b'interactive')
2928 2930 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
2929 2931 rejected = cmdutil.forget(
2930 2932 ui,
2931 2933 repo,
2932 2934 m,
2933 2935 prefix=b"",
2934 2936 uipathfn=uipathfn,
2935 2937 explicitonly=False,
2936 2938 dryrun=dryrun,
2937 2939 interactive=interactive,
2938 2940 )[0]
2939 2941 return rejected and 1 or 0
2940 2942
2941 2943
2942 2944 @command(
2943 2945 b'graft',
2944 2946 [
2945 2947 (b'r', b'rev', [], _(b'revisions to graft'), _(b'REV')),
2946 2948 (
2947 2949 b'',
2948 2950 b'base',
2949 2951 b'',
2950 2952 _(b'base revision when doing the graft merge (ADVANCED)'),
2951 2953 _(b'REV'),
2952 2954 ),
2953 2955 (b'c', b'continue', False, _(b'resume interrupted graft')),
2954 2956 (b'', b'stop', False, _(b'stop interrupted graft')),
2955 2957 (b'', b'abort', False, _(b'abort interrupted graft')),
2956 2958 (b'e', b'edit', False, _(b'invoke editor on commit messages')),
2957 2959 (b'', b'log', None, _(b'append graft info to log message')),
2958 2960 (
2959 2961 b'',
2960 2962 b'no-commit',
2961 2963 None,
2962 2964 _(b"don't commit, just apply the changes in working directory"),
2963 2965 ),
2964 2966 (b'f', b'force', False, _(b'force graft')),
2965 2967 (
2966 2968 b'D',
2967 2969 b'currentdate',
2968 2970 False,
2969 2971 _(b'record the current date as commit date'),
2970 2972 ),
2971 2973 (
2972 2974 b'U',
2973 2975 b'currentuser',
2974 2976 False,
2975 2977 _(b'record the current user as committer'),
2976 2978 ),
2977 2979 ]
2978 2980 + commitopts2
2979 2981 + mergetoolopts
2980 2982 + dryrunopts,
2981 2983 _(b'[OPTION]... [-r REV]... REV...'),
2982 2984 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT,
2983 2985 )
2984 2986 def graft(ui, repo, *revs, **opts):
2985 2987 """copy changes from other branches onto the current branch
2986 2988
2987 2989 This command uses Mercurial's merge logic to copy individual
2988 2990 changes from other branches without merging branches in the
2989 2991 history graph. This is sometimes known as 'backporting' or
2990 2992 'cherry-picking'. By default, graft will copy user, date, and
2991 2993 description from the source changesets.
2992 2994
2993 2995 Changesets that are ancestors of the current revision, that have
2994 2996 already been grafted, or that are merges will be skipped.
2995 2997
2996 2998 If --log is specified, log messages will have a comment appended
2997 2999 of the form::
2998 3000
2999 3001 (grafted from CHANGESETHASH)
3000 3002
3001 3003 If --force is specified, revisions will be grafted even if they
3002 3004 are already ancestors of, or have been grafted to, the destination.
3003 3005 This is useful when the revisions have since been backed out.
3004 3006
3005 3007 If a graft merge results in conflicts, the graft process is
3006 3008 interrupted so that the current merge can be manually resolved.
3007 3009 Once all conflicts are addressed, the graft process can be
3008 3010 continued with the -c/--continue option.
3009 3011
3010 3012 The -c/--continue option reapplies all the earlier options.
3011 3013
3012 3014 .. container:: verbose
3013 3015
3014 3016 The --base option exposes more of how graft internally uses merge with a
3015 3017 custom base revision. --base can be used to specify another ancestor than
3016 3018 the first and only parent.
3017 3019
3018 3020 The command::
3019 3021
3020 3022 hg graft -r 345 --base 234
3021 3023
3022 3024 is thus pretty much the same as::
3023 3025
3024 3026 hg diff --from 234 --to 345 | hg import
3025 3027
3026 3028 but using merge to resolve conflicts and track moved files.
3027 3029
3028 3030 The result of a merge can thus be backported as a single commit by
3029 3031 specifying one of the merge parents as base, and thus effectively
3030 3032 grafting the changes from the other side.
3031 3033
3032 3034 It is also possible to collapse multiple changesets and clean up history
3033 3035 by specifying another ancestor as base, much like rebase --collapse
3034 3036 --keep.
3035 3037
3036 3038 The commit message can be tweaked after the fact using commit --amend .
3037 3039
3038 3040 For using non-ancestors as the base to backout changes, see the backout
3039 3041 command and the hidden --parent option.
3040 3042
3041 3043 .. container:: verbose
3042 3044
3043 3045 Examples:
3044 3046
3045 3047 - copy a single change to the stable branch and edit its description::
3046 3048
3047 3049 hg update stable
3048 3050 hg graft --edit 9393
3049 3051
3050 3052 - graft a range of changesets with one exception, updating dates::
3051 3053
3052 3054 hg graft -D "2085::2093 and not 2091"
3053 3055
3054 3056 - continue a graft after resolving conflicts::
3055 3057
3056 3058 hg graft -c
3057 3059
3058 3060 - show the source of a grafted changeset::
3059 3061
3060 3062 hg log --debug -r .
3061 3063
3062 3064 - show revisions sorted by date::
3063 3065
3064 3066 hg log -r "sort(all(), date)"
3065 3067
3066 3068 - backport the result of a merge as a single commit::
3067 3069
3068 3070 hg graft -r 123 --base 123^
3069 3071
3070 3072 - land a feature branch as one changeset::
3071 3073
3072 3074 hg up -cr default
3073 3075 hg graft -r featureX --base "ancestor('featureX', 'default')"
3074 3076
3075 3077 See :hg:`help revisions` for more about specifying revisions.
3076 3078
3077 3079 Returns 0 on successful completion, 1 if there are unresolved files.
3078 3080 """
3079 3081 with repo.wlock():
3080 3082 return _dograft(ui, repo, *revs, **opts)
3081 3083
3082 3084
3083 3085 def _dograft(ui, repo, *revs, **opts):
3084 3086 if revs and opts.get('rev'):
3085 3087 ui.warn(
3086 3088 _(
3087 3089 b'warning: inconsistent use of --rev might give unexpected '
3088 3090 b'revision ordering!\n'
3089 3091 )
3090 3092 )
3091 3093
3092 3094 revs = list(revs)
3093 3095 revs.extend(opts.get('rev'))
3094 3096 # a dict of data to be stored in state file
3095 3097 statedata = {}
3096 3098 # list of new nodes created by ongoing graft
3097 3099 statedata[b'newnodes'] = []
3098 3100
3099 3101 cmdutil.resolve_commit_options(ui, opts)
3100 3102
3101 3103 editor = cmdutil.getcommiteditor(editform=b'graft', **opts)
3102 3104
3103 3105 cmdutil.check_at_most_one_arg(opts, 'abort', 'stop', 'continue')
3104 3106
3105 3107 cont = False
3106 3108 if opts.get('no_commit'):
3107 3109 cmdutil.check_incompatible_arguments(
3108 3110 opts,
3109 3111 'no_commit',
3110 3112 ['edit', 'currentuser', 'currentdate', 'log'],
3111 3113 )
3112 3114
3113 3115 graftstate = statemod.cmdstate(repo, b'graftstate')
3114 3116
3115 3117 if opts.get('stop'):
3116 3118 cmdutil.check_incompatible_arguments(
3117 3119 opts,
3118 3120 'stop',
3119 3121 [
3120 3122 'edit',
3121 3123 'log',
3122 3124 'user',
3123 3125 'date',
3124 3126 'currentdate',
3125 3127 'currentuser',
3126 3128 'rev',
3127 3129 ],
3128 3130 )
3129 3131 return _stopgraft(ui, repo, graftstate)
3130 3132 elif opts.get('abort'):
3131 3133 cmdutil.check_incompatible_arguments(
3132 3134 opts,
3133 3135 'abort',
3134 3136 [
3135 3137 'edit',
3136 3138 'log',
3137 3139 'user',
3138 3140 'date',
3139 3141 'currentdate',
3140 3142 'currentuser',
3141 3143 'rev',
3142 3144 ],
3143 3145 )
3144 3146 return cmdutil.abortgraft(ui, repo, graftstate)
3145 3147 elif opts.get('continue'):
3146 3148 cont = True
3147 3149 if revs:
3148 3150 raise error.InputError(_(b"can't specify --continue and revisions"))
3149 3151 # read in unfinished revisions
3150 3152 if graftstate.exists():
3151 3153 statedata = cmdutil.readgraftstate(repo, graftstate)
3152 3154 if statedata.get(b'date'):
3153 3155 opts['date'] = statedata[b'date']
3154 3156 if statedata.get(b'user'):
3155 3157 opts['user'] = statedata[b'user']
3156 3158 if statedata.get(b'log'):
3157 3159 opts['log'] = True
3158 3160 if statedata.get(b'no_commit'):
3159 3161 opts['no_commit'] = statedata.get(b'no_commit')
3160 3162 if statedata.get(b'base'):
3161 3163 opts['base'] = statedata.get(b'base')
3162 3164 nodes = statedata[b'nodes']
3163 3165 revs = [repo[node].rev() for node in nodes]
3164 3166 else:
3165 3167 cmdutil.wrongtooltocontinue(repo, _(b'graft'))
3166 3168 else:
3167 3169 if not revs:
3168 3170 raise error.InputError(_(b'no revisions specified'))
3169 3171 cmdutil.checkunfinished(repo)
3170 3172 cmdutil.bailifchanged(repo)
3171 3173 revs = logcmdutil.revrange(repo, revs)
3172 3174
3173 3175 skipped = set()
3174 3176 basectx = None
3175 3177 if opts.get('base'):
3176 3178 basectx = logcmdutil.revsingle(repo, opts['base'], None)
3177 3179 if basectx is None:
3178 3180 # check for merges
3179 3181 for rev in repo.revs(b'%ld and merge()', revs):
3180 3182 ui.warn(_(b'skipping ungraftable merge revision %d\n') % rev)
3181 3183 skipped.add(rev)
3182 3184 revs = [r for r in revs if r not in skipped]
3183 3185 if not revs:
3184 3186 return -1
3185 3187 if basectx is not None and len(revs) != 1:
3186 3188 raise error.InputError(_(b'only one revision allowed with --base '))
3187 3189
3188 3190 # Don't check in the --continue case, in effect retaining --force across
3189 3191 # --continues. That's because without --force, any revisions we decided to
3190 3192 # skip would have been filtered out here, so they wouldn't have made their
3191 3193 # way to the graftstate. With --force, any revisions we would have otherwise
3192 3194 # skipped would not have been filtered out, and if they hadn't been applied
3193 3195 # already, they'd have been in the graftstate.
3194 3196 if not (cont or opts.get('force')) and basectx is None:
3195 3197 # check for ancestors of dest branch
3196 3198 ancestors = repo.revs(b'%ld & (::.)', revs)
3197 3199 for rev in ancestors:
3198 3200 ui.warn(_(b'skipping ancestor revision %d:%s\n') % (rev, repo[rev]))
3199 3201
3200 3202 revs = [r for r in revs if r not in ancestors]
3201 3203
3202 3204 if not revs:
3203 3205 return -1
3204 3206
3205 3207 # analyze revs for earlier grafts
3206 3208 ids = {}
3207 3209 for ctx in repo.set(b"%ld", revs):
3208 3210 ids[ctx.hex()] = ctx.rev()
3209 3211 n = ctx.extra().get(b'source')
3210 3212 if n:
3211 3213 ids[n] = ctx.rev()
3212 3214
3213 3215 # check ancestors for earlier grafts
3214 3216 ui.debug(b'scanning for duplicate grafts\n')
3215 3217
3216 3218 # The only changesets we can be sure doesn't contain grafts of any
3217 3219 # revs, are the ones that are common ancestors of *all* revs:
3218 3220 for rev in repo.revs(b'only(%d,ancestor(%ld))', repo[b'.'].rev(), revs):
3219 3221 ctx = repo[rev]
3220 3222 n = ctx.extra().get(b'source')
3221 3223 if n in ids:
3222 3224 try:
3223 3225 r = repo[n].rev()
3224 3226 except error.RepoLookupError:
3225 3227 r = None
3226 3228 if r in revs:
3227 3229 ui.warn(
3228 3230 _(
3229 3231 b'skipping revision %d:%s '
3230 3232 b'(already grafted to %d:%s)\n'
3231 3233 )
3232 3234 % (r, repo[r], rev, ctx)
3233 3235 )
3234 3236 revs.remove(r)
3235 3237 elif ids[n] in revs:
3236 3238 if r is None:
3237 3239 ui.warn(
3238 3240 _(
3239 3241 b'skipping already grafted revision %d:%s '
3240 3242 b'(%d:%s also has unknown origin %s)\n'
3241 3243 )
3242 3244 % (ids[n], repo[ids[n]], rev, ctx, n[:12])
3243 3245 )
3244 3246 else:
3245 3247 ui.warn(
3246 3248 _(
3247 3249 b'skipping already grafted revision %d:%s '
3248 3250 b'(%d:%s also has origin %d:%s)\n'
3249 3251 )
3250 3252 % (ids[n], repo[ids[n]], rev, ctx, r, n[:12])
3251 3253 )
3252 3254 revs.remove(ids[n])
3253 3255 elif ctx.hex() in ids:
3254 3256 r = ids[ctx.hex()]
3255 3257 if r in revs:
3256 3258 ui.warn(
3257 3259 _(
3258 3260 b'skipping already grafted revision %d:%s '
3259 3261 b'(was grafted from %d:%s)\n'
3260 3262 )
3261 3263 % (r, repo[r], rev, ctx)
3262 3264 )
3263 3265 revs.remove(r)
3264 3266 if not revs:
3265 3267 return -1
3266 3268
3267 3269 if opts.get('no_commit'):
3268 3270 statedata[b'no_commit'] = True
3269 3271 if opts.get('base'):
3270 3272 statedata[b'base'] = opts['base']
3271 3273 for pos, ctx in enumerate(repo.set(b"%ld", revs)):
3272 3274 desc = b'%d:%s "%s"' % (
3273 3275 ctx.rev(),
3274 3276 ctx,
3275 3277 ctx.description().split(b'\n', 1)[0],
3276 3278 )
3277 3279 names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
3278 3280 if names:
3279 3281 desc += b' (%s)' % b' '.join(names)
3280 3282 ui.status(_(b'grafting %s\n') % desc)
3281 3283 if opts.get('dry_run'):
3282 3284 continue
3283 3285
3284 3286 source = ctx.extra().get(b'source')
3285 3287 extra = {}
3286 3288 if source:
3287 3289 extra[b'source'] = source
3288 3290 extra[b'intermediate-source'] = ctx.hex()
3289 3291 else:
3290 3292 extra[b'source'] = ctx.hex()
3291 3293 user = ctx.user()
3292 3294 if opts.get('user'):
3293 3295 user = opts['user']
3294 3296 statedata[b'user'] = user
3295 3297 date = ctx.date()
3296 3298 if opts.get('date'):
3297 3299 date = opts['date']
3298 3300 statedata[b'date'] = date
3299 3301 message = ctx.description()
3300 3302 if opts.get('log'):
3301 3303 message += b'\n(grafted from %s)' % ctx.hex()
3302 3304 statedata[b'log'] = True
3303 3305
3304 3306 # we don't merge the first commit when continuing
3305 3307 if not cont:
3306 3308 # perform the graft merge with p1(rev) as 'ancestor'
3307 3309 overrides = {(b'ui', b'forcemerge'): opts.get('tool', b'')}
3308 3310 base = ctx.p1() if basectx is None else basectx
3309 3311 with ui.configoverride(overrides, b'graft'):
3310 3312 stats = mergemod.graft(
3311 3313 repo, ctx, base, [b'local', b'graft', b'parent of graft']
3312 3314 )
3313 3315 # report any conflicts
3314 3316 if stats.unresolvedcount > 0:
3315 3317 # write out state for --continue
3316 3318 nodes = [repo[rev].hex() for rev in revs[pos:]]
3317 3319 statedata[b'nodes'] = nodes
3318 3320 stateversion = 1
3319 3321 graftstate.save(stateversion, statedata)
3320 3322 ui.error(_(b"abort: unresolved conflicts, can't continue\n"))
3321 3323 ui.error(_(b"(use 'hg resolve' and 'hg graft --continue')\n"))
3322 3324 return 1
3323 3325 else:
3324 3326 cont = False
3325 3327
3326 3328 # commit if --no-commit is false
3327 3329 if not opts.get('no_commit'):
3328 3330 node = repo.commit(
3329 3331 text=message, user=user, date=date, extra=extra, editor=editor
3330 3332 )
3331 3333 if node is None:
3332 3334 ui.warn(
3333 3335 _(b'note: graft of %d:%s created no changes to commit\n')
3334 3336 % (ctx.rev(), ctx)
3335 3337 )
3336 3338 # checking that newnodes exist because old state files won't have it
3337 3339 elif statedata.get(b'newnodes') is not None:
3338 3340 nn = statedata[b'newnodes']
3339 3341 assert isinstance(nn, list) # list of bytes
3340 3342 nn.append(node)
3341 3343
3342 3344 # remove state when we complete successfully
3343 3345 if not opts.get('dry_run'):
3344 3346 graftstate.delete()
3345 3347
3346 3348 return 0
3347 3349
3348 3350
3349 3351 def _stopgraft(ui, repo, graftstate):
3350 3352 """stop the interrupted graft"""
3351 3353 if not graftstate.exists():
3352 3354 raise error.StateError(_(b"no interrupted graft found"))
3353 3355 pctx = repo[b'.']
3354 3356 mergemod.clean_update(pctx)
3355 3357 graftstate.delete()
3356 3358 ui.status(_(b"stopped the interrupted graft\n"))
3357 3359 ui.status(_(b"working directory is now at %s\n") % pctx.hex()[:12])
3358 3360 return 0
3359 3361
3360 3362
3361 3363 statemod.addunfinished(
3362 3364 b'graft',
3363 3365 fname=b'graftstate',
3364 3366 clearable=True,
3365 3367 stopflag=True,
3366 3368 continueflag=True,
3367 3369 abortfunc=cmdutil.hgabortgraft,
3368 3370 cmdhint=_(b"use 'hg graft --continue' or 'hg graft --stop' to stop"),
3369 3371 )
3370 3372
3371 3373
3372 3374 @command(
3373 3375 b'grep',
3374 3376 [
3375 3377 (b'0', b'print0', None, _(b'end fields with NUL')),
3376 3378 (b'', b'all', None, _(b'an alias to --diff (DEPRECATED)')),
3377 3379 (
3378 3380 b'',
3379 3381 b'diff',
3380 3382 None,
3381 3383 _(
3382 3384 b'search revision differences for when the pattern was added '
3383 3385 b'or removed'
3384 3386 ),
3385 3387 ),
3386 3388 (b'a', b'text', None, _(b'treat all files as text')),
3387 3389 (
3388 3390 b'f',
3389 3391 b'follow',
3390 3392 None,
3391 3393 _(
3392 3394 b'follow changeset history,'
3393 3395 b' or file history across copies and renames'
3394 3396 ),
3395 3397 ),
3396 3398 (b'i', b'ignore-case', None, _(b'ignore case when matching')),
3397 3399 (
3398 3400 b'l',
3399 3401 b'files-with-matches',
3400 3402 None,
3401 3403 _(b'print only filenames and revisions that match'),
3402 3404 ),
3403 3405 (b'n', b'line-number', None, _(b'print matching line numbers')),
3404 3406 (
3405 3407 b'r',
3406 3408 b'rev',
3407 3409 [],
3408 3410 _(b'search files changed within revision range'),
3409 3411 _(b'REV'),
3410 3412 ),
3411 3413 (
3412 3414 b'',
3413 3415 b'all-files',
3414 3416 None,
3415 3417 _(
3416 3418 b'include all files in the changeset while grepping (DEPRECATED)'
3417 3419 ),
3418 3420 ),
3419 3421 (b'u', b'user', None, _(b'list the author (long with -v)')),
3420 3422 (b'd', b'date', None, _(b'list the date (short with -q)')),
3421 3423 ]
3422 3424 + formatteropts
3423 3425 + walkopts,
3424 3426 _(b'[--diff] [OPTION]... PATTERN [FILE]...'),
3425 3427 helpcategory=command.CATEGORY_FILE_CONTENTS,
3426 3428 inferrepo=True,
3427 3429 intents={INTENT_READONLY},
3428 3430 )
3429 3431 def grep(ui, repo, pattern, *pats, **opts):
3430 3432 """search for a pattern in specified files
3431 3433
3432 3434 Search the working directory or revision history for a regular
3433 3435 expression in the specified files for the entire repository.
3434 3436
3435 3437 By default, grep searches the repository files in the working
3436 3438 directory and prints the files where it finds a match. To specify
3437 3439 historical revisions instead of the working directory, use the
3438 3440 --rev flag.
3439 3441
3440 3442 To search instead historical revision differences that contains a
3441 3443 change in match status ("-" for a match that becomes a non-match,
3442 3444 or "+" for a non-match that becomes a match), use the --diff flag.
3443 3445
3444 3446 PATTERN can be any Python (roughly Perl-compatible) regular
3445 3447 expression.
3446 3448
3447 3449 If no FILEs are specified and the --rev flag isn't supplied, all
3448 3450 files in the working directory are searched. When using the --rev
3449 3451 flag and specifying FILEs, use the --follow argument to also
3450 3452 follow the specified FILEs across renames and copies.
3451 3453
3452 3454 .. container:: verbose
3453 3455
3454 3456 Template:
3455 3457
3456 3458 The following keywords are supported in addition to the common template
3457 3459 keywords and functions. See also :hg:`help templates`.
3458 3460
3459 3461 :change: String. Character denoting insertion ``+`` or removal ``-``.
3460 3462 Available if ``--diff`` is specified.
3461 3463 :lineno: Integer. Line number of the match.
3462 3464 :path: String. Repository-absolute path of the file.
3463 3465 :texts: List of text chunks.
3464 3466
3465 3467 And each entry of ``{texts}`` provides the following sub-keywords.
3466 3468
3467 3469 :matched: Boolean. True if the chunk matches the specified pattern.
3468 3470 :text: String. Chunk content.
3469 3471
3470 3472 See :hg:`help templates.operators` for the list expansion syntax.
3471 3473
3472 3474 Returns 0 if a match is found, 1 otherwise.
3473 3475
3474 3476 """
3475 3477 cmdutil.check_incompatible_arguments(opts, 'all_files', ['all', 'diff'])
3476 3478 opts = pycompat.byteskwargs(opts)
3477 3479 diff = opts.get(b'all') or opts.get(b'diff')
3478 3480 follow = opts.get(b'follow')
3479 3481 if opts.get(b'all_files') is None and not diff:
3480 3482 opts[b'all_files'] = True
3481 3483 plaingrep = (
3482 3484 opts.get(b'all_files')
3483 3485 and not opts.get(b'rev')
3484 3486 and not opts.get(b'follow')
3485 3487 )
3486 3488 all_files = opts.get(b'all_files')
3487 3489 if plaingrep:
3488 3490 opts[b'rev'] = [b'wdir()']
3489 3491
3490 3492 reflags = re.M
3491 3493 if opts.get(b'ignore_case'):
3492 3494 reflags |= re.I
3493 3495 try:
3494 3496 regexp = util.re.compile(pattern, reflags)
3495 3497 except re.error as inst:
3496 3498 ui.warn(
3497 3499 _(b"grep: invalid match pattern: %s\n")
3498 3500 % stringutil.forcebytestr(inst)
3499 3501 )
3500 3502 return 1
3501 3503 sep, eol = b':', b'\n'
3502 3504 if opts.get(b'print0'):
3503 3505 sep = eol = b'\0'
3504 3506
3505 3507 searcher = grepmod.grepsearcher(
3506 3508 ui, repo, regexp, all_files=all_files, diff=diff, follow=follow
3507 3509 )
3508 3510
3509 3511 getfile = searcher._getfile
3510 3512
3511 3513 uipathfn = scmutil.getuipathfn(repo)
3512 3514
3513 3515 def display(fm, fn, ctx, pstates, states):
3514 3516 rev = scmutil.intrev(ctx)
3515 3517 if fm.isplain():
3516 3518 formatuser = ui.shortuser
3517 3519 else:
3518 3520 formatuser = pycompat.bytestr
3519 3521 if ui.quiet:
3520 3522 datefmt = b'%Y-%m-%d'
3521 3523 else:
3522 3524 datefmt = b'%a %b %d %H:%M:%S %Y %1%2'
3523 3525 found = False
3524 3526
3525 3527 @util.cachefunc
3526 3528 def binary():
3527 3529 flog = getfile(fn)
3528 3530 try:
3529 3531 return stringutil.binary(flog.read(ctx.filenode(fn)))
3530 3532 except error.WdirUnsupported:
3531 3533 return ctx[fn].isbinary()
3532 3534
3533 3535 fieldnamemap = {b'linenumber': b'lineno'}
3534 3536 if diff:
3535 3537 iter = grepmod.difflinestates(pstates, states)
3536 3538 else:
3537 3539 iter = [(b'', l) for l in states]
3538 3540 for change, l in iter:
3539 3541 fm.startitem()
3540 3542 fm.context(ctx=ctx)
3541 3543 fm.data(node=fm.hexfunc(scmutil.binnode(ctx)), path=fn)
3542 3544 fm.plain(uipathfn(fn), label=b'grep.filename')
3543 3545
3544 3546 cols = [
3545 3547 (b'rev', b'%d', rev, not plaingrep, b''),
3546 3548 (
3547 3549 b'linenumber',
3548 3550 b'%d',
3549 3551 l.linenum,
3550 3552 opts.get(b'line_number'),
3551 3553 b'',
3552 3554 ),
3553 3555 ]
3554 3556 if diff:
3555 3557 cols.append(
3556 3558 (
3557 3559 b'change',
3558 3560 b'%s',
3559 3561 change,
3560 3562 True,
3561 3563 b'grep.inserted '
3562 3564 if change == b'+'
3563 3565 else b'grep.deleted ',
3564 3566 )
3565 3567 )
3566 3568 cols.extend(
3567 3569 [
3568 3570 (
3569 3571 b'user',
3570 3572 b'%s',
3571 3573 formatuser(ctx.user()),
3572 3574 opts.get(b'user'),
3573 3575 b'',
3574 3576 ),
3575 3577 (
3576 3578 b'date',
3577 3579 b'%s',
3578 3580 fm.formatdate(ctx.date(), datefmt),
3579 3581 opts.get(b'date'),
3580 3582 b'',
3581 3583 ),
3582 3584 ]
3583 3585 )
3584 3586 for name, fmt, data, cond, extra_label in cols:
3585 3587 if cond:
3586 3588 fm.plain(sep, label=b'grep.sep')
3587 3589 field = fieldnamemap.get(name, name)
3588 3590 label = extra_label + (b'grep.%s' % name)
3589 3591 fm.condwrite(cond, field, fmt, data, label=label)
3590 3592 if not opts.get(b'files_with_matches'):
3591 3593 fm.plain(sep, label=b'grep.sep')
3592 3594 if not opts.get(b'text') and binary():
3593 3595 fm.plain(_(b" Binary file matches"))
3594 3596 else:
3595 3597 displaymatches(fm.nested(b'texts', tmpl=b'{text}'), l)
3596 3598 fm.plain(eol)
3597 3599 found = True
3598 3600 if opts.get(b'files_with_matches'):
3599 3601 break
3600 3602 return found
3601 3603
3602 3604 def displaymatches(fm, l):
3603 3605 p = 0
3604 3606 for s, e in l.findpos(regexp):
3605 3607 if p < s:
3606 3608 fm.startitem()
3607 3609 fm.write(b'text', b'%s', l.line[p:s])
3608 3610 fm.data(matched=False)
3609 3611 fm.startitem()
3610 3612 fm.write(b'text', b'%s', l.line[s:e], label=b'grep.match')
3611 3613 fm.data(matched=True)
3612 3614 p = e
3613 3615 if p < len(l.line):
3614 3616 fm.startitem()
3615 3617 fm.write(b'text', b'%s', l.line[p:])
3616 3618 fm.data(matched=False)
3617 3619 fm.end()
3618 3620
3619 3621 found = False
3620 3622
3621 3623 wopts = logcmdutil.walkopts(
3622 3624 pats=pats,
3623 3625 opts=opts,
3624 3626 revspec=opts[b'rev'],
3625 3627 include_pats=opts[b'include'],
3626 3628 exclude_pats=opts[b'exclude'],
3627 3629 follow=follow,
3628 3630 force_changelog_traversal=all_files,
3629 3631 filter_revisions_by_pats=not all_files,
3630 3632 )
3631 3633 revs, makefilematcher = logcmdutil.makewalker(repo, wopts)
3632 3634
3633 3635 ui.pager(b'grep')
3634 3636 fm = ui.formatter(b'grep', opts)
3635 3637 for fn, ctx, pstates, states in searcher.searchfiles(revs, makefilematcher):
3636 3638 r = display(fm, fn, ctx, pstates, states)
3637 3639 found = found or r
3638 3640 if r and not diff and not all_files:
3639 3641 searcher.skipfile(fn, ctx.rev())
3640 3642 fm.end()
3641 3643
3642 3644 return not found
3643 3645
3644 3646
3645 3647 @command(
3646 3648 b'heads',
3647 3649 [
3648 3650 (
3649 3651 b'r',
3650 3652 b'rev',
3651 3653 b'',
3652 3654 _(b'show only heads which are descendants of STARTREV'),
3653 3655 _(b'STARTREV'),
3654 3656 ),
3655 3657 (b't', b'topo', False, _(b'show topological heads only')),
3656 3658 (
3657 3659 b'a',
3658 3660 b'active',
3659 3661 False,
3660 3662 _(b'show active branchheads only (DEPRECATED)'),
3661 3663 ),
3662 3664 (b'c', b'closed', False, _(b'show normal and closed branch heads')),
3663 3665 ]
3664 3666 + templateopts,
3665 3667 _(b'[-ct] [-r STARTREV] [REV]...'),
3666 3668 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
3667 3669 intents={INTENT_READONLY},
3668 3670 )
3669 3671 def heads(ui, repo, *branchrevs, **opts):
3670 3672 """show branch heads
3671 3673
3672 3674 With no arguments, show all open branch heads in the repository.
3673 3675 Branch heads are changesets that have no descendants on the
3674 3676 same branch. They are where development generally takes place and
3675 3677 are the usual targets for update and merge operations.
3676 3678
3677 3679 If one or more REVs are given, only open branch heads on the
3678 3680 branches associated with the specified changesets are shown. This
3679 3681 means that you can use :hg:`heads .` to see the heads on the
3680 3682 currently checked-out branch.
3681 3683
3682 3684 If -c/--closed is specified, also show branch heads marked closed
3683 3685 (see :hg:`commit --close-branch`).
3684 3686
3685 3687 If STARTREV is specified, only those heads that are descendants of
3686 3688 STARTREV will be displayed.
3687 3689
3688 3690 If -t/--topo is specified, named branch mechanics will be ignored and only
3689 3691 topological heads (changesets with no children) will be shown.
3690 3692
3691 3693 Returns 0 if matching heads are found, 1 if not.
3692 3694 """
3693 3695
3694 3696 opts = pycompat.byteskwargs(opts)
3695 3697 start = None
3696 3698 rev = opts.get(b'rev')
3697 3699 if rev:
3698 3700 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
3699 3701 start = logcmdutil.revsingle(repo, rev, None).node()
3700 3702
3701 3703 if opts.get(b'topo'):
3702 3704 heads = [repo[h] for h in repo.heads(start)]
3703 3705 else:
3704 3706 heads = []
3705 3707 for branch in repo.branchmap():
3706 3708 heads += repo.branchheads(branch, start, opts.get(b'closed'))
3707 3709 heads = [repo[h] for h in heads]
3708 3710
3709 3711 if branchrevs:
3710 3712 branches = {
3711 3713 repo[r].branch() for r in logcmdutil.revrange(repo, branchrevs)
3712 3714 }
3713 3715 heads = [h for h in heads if h.branch() in branches]
3714 3716
3715 3717 if opts.get(b'active') and branchrevs:
3716 3718 dagheads = repo.heads(start)
3717 3719 heads = [h for h in heads if h.node() in dagheads]
3718 3720
3719 3721 if branchrevs:
3720 3722 haveheads = {h.branch() for h in heads}
3721 3723 if branches - haveheads:
3722 3724 headless = b', '.join(b for b in branches - haveheads)
3723 3725 msg = _(b'no open branch heads found on branches %s')
3724 3726 if opts.get(b'rev'):
3725 3727 msg += _(b' (started at %s)') % opts[b'rev']
3726 3728 ui.warn((msg + b'\n') % headless)
3727 3729
3728 3730 if not heads:
3729 3731 return 1
3730 3732
3731 3733 ui.pager(b'heads')
3732 3734 heads = sorted(heads, key=lambda x: -(x.rev()))
3733 3735 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
3734 3736 for ctx in heads:
3735 3737 displayer.show(ctx)
3736 3738 displayer.close()
3737 3739
3738 3740
3739 3741 @command(
3740 3742 b'help',
3741 3743 [
3742 3744 (b'e', b'extension', None, _(b'show only help for extensions')),
3743 3745 (b'c', b'command', None, _(b'show only help for commands')),
3744 3746 (b'k', b'keyword', None, _(b'show topics matching keyword')),
3745 3747 (
3746 3748 b's',
3747 3749 b'system',
3748 3750 [],
3749 3751 _(b'show help for specific platform(s)'),
3750 3752 _(b'PLATFORM'),
3751 3753 ),
3752 3754 ],
3753 3755 _(b'[-eck] [-s PLATFORM] [TOPIC]'),
3754 3756 helpcategory=command.CATEGORY_HELP,
3755 3757 norepo=True,
3756 3758 intents={INTENT_READONLY},
3757 3759 )
3758 3760 def help_(ui, name=None, **opts):
3759 3761 """show help for a given topic or a help overview
3760 3762
3761 3763 With no arguments, print a list of commands with short help messages.
3762 3764
3763 3765 Given a topic, extension, or command name, print help for that
3764 3766 topic.
3765 3767
3766 3768 Returns 0 if successful.
3767 3769 """
3768 3770
3769 3771 keep = opts.get('system') or []
3770 3772 if len(keep) == 0:
3771 3773 if pycompat.sysplatform.startswith(b'win'):
3772 3774 keep.append(b'windows')
3773 3775 elif pycompat.sysplatform == b'OpenVMS':
3774 3776 keep.append(b'vms')
3775 3777 elif pycompat.sysplatform == b'plan9':
3776 3778 keep.append(b'plan9')
3777 3779 else:
3778 3780 keep.append(b'unix')
3779 3781 keep.append(pycompat.sysplatform.lower())
3780 3782 if ui.verbose:
3781 3783 keep.append(b'verbose')
3782 3784
3783 3785 commands = sys.modules[__name__]
3784 3786 formatted = help.formattedhelp(ui, commands, name, keep=keep, **opts)
3785 3787 ui.pager(b'help')
3786 3788 ui.write(formatted)
3787 3789
3788 3790
3789 3791 @command(
3790 3792 b'identify|id',
3791 3793 [
3792 3794 (b'r', b'rev', b'', _(b'identify the specified revision'), _(b'REV')),
3793 3795 (b'n', b'num', None, _(b'show local revision number')),
3794 3796 (b'i', b'id', None, _(b'show global revision id')),
3795 3797 (b'b', b'branch', None, _(b'show branch')),
3796 3798 (b't', b'tags', None, _(b'show tags')),
3797 3799 (b'B', b'bookmarks', None, _(b'show bookmarks')),
3798 3800 ]
3799 3801 + remoteopts
3800 3802 + formatteropts,
3801 3803 _(b'[-nibtB] [-r REV] [SOURCE]'),
3802 3804 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
3803 3805 optionalrepo=True,
3804 3806 intents={INTENT_READONLY},
3805 3807 )
3806 3808 def identify(
3807 3809 ui,
3808 3810 repo,
3809 3811 source=None,
3810 3812 rev=None,
3811 3813 num=None,
3812 3814 id=None,
3813 3815 branch=None,
3814 3816 tags=None,
3815 3817 bookmarks=None,
3816 3818 **opts
3817 3819 ):
3818 3820 """identify the working directory or specified revision
3819 3821
3820 3822 Print a summary identifying the repository state at REV using one or
3821 3823 two parent hash identifiers, followed by a "+" if the working
3822 3824 directory has uncommitted changes, the branch name (if not default),
3823 3825 a list of tags, and a list of bookmarks.
3824 3826
3825 3827 When REV is not given, print a summary of the current state of the
3826 3828 repository including the working directory. Specify -r. to get information
3827 3829 of the working directory parent without scanning uncommitted changes.
3828 3830
3829 3831 Specifying a path to a repository root or Mercurial bundle will
3830 3832 cause lookup to operate on that repository/bundle.
3831 3833
3832 3834 .. container:: verbose
3833 3835
3834 3836 Template:
3835 3837
3836 3838 The following keywords are supported in addition to the common template
3837 3839 keywords and functions. See also :hg:`help templates`.
3838 3840
3839 3841 :dirty: String. Character ``+`` denoting if the working directory has
3840 3842 uncommitted changes.
3841 3843 :id: String. One or two nodes, optionally followed by ``+``.
3842 3844 :parents: List of strings. Parent nodes of the changeset.
3843 3845
3844 3846 Examples:
3845 3847
3846 3848 - generate a build identifier for the working directory::
3847 3849
3848 3850 hg id --id > build-id.dat
3849 3851
3850 3852 - find the revision corresponding to a tag::
3851 3853
3852 3854 hg id -n -r 1.3
3853 3855
3854 3856 - check the most recent revision of a remote repository::
3855 3857
3856 3858 hg id -r tip https://www.mercurial-scm.org/repo/hg/
3857 3859
3858 3860 See :hg:`log` for generating more information about specific revisions,
3859 3861 including full hash identifiers.
3860 3862
3861 3863 Returns 0 if successful.
3862 3864 """
3863 3865
3864 3866 opts = pycompat.byteskwargs(opts)
3865 3867 if not repo and not source:
3866 3868 raise error.InputError(
3867 3869 _(b"there is no Mercurial repository here (.hg not found)")
3868 3870 )
3869 3871
3870 3872 default = not (num or id or branch or tags or bookmarks)
3871 3873 output = []
3872 3874 revs = []
3873 3875
3874 3876 peer = None
3875 3877 try:
3876 3878 if source:
3877 3879 source, branches = urlutil.get_unique_pull_path(
3878 3880 b'identify', repo, ui, source
3879 3881 )
3880 3882 # only pass ui when no repo
3881 3883 peer = hg.peer(repo or ui, opts, source)
3882 3884 repo = peer.local()
3883 3885 revs, checkout = hg.addbranchrevs(repo, peer, branches, None)
3884 3886
3885 3887 fm = ui.formatter(b'identify', opts)
3886 3888 fm.startitem()
3887 3889
3888 3890 if not repo:
3889 3891 if num or branch or tags:
3890 3892 raise error.InputError(
3891 3893 _(b"can't query remote revision number, branch, or tags")
3892 3894 )
3893 3895 if not rev and revs:
3894 3896 rev = revs[0]
3895 3897 if not rev:
3896 3898 rev = b"tip"
3897 3899
3898 3900 remoterev = peer.lookup(rev)
3899 3901 hexrev = fm.hexfunc(remoterev)
3900 3902 if default or id:
3901 3903 output = [hexrev]
3902 3904 fm.data(id=hexrev)
3903 3905
3904 3906 @util.cachefunc
3905 3907 def getbms():
3906 3908 bms = []
3907 3909
3908 3910 if b'bookmarks' in peer.listkeys(b'namespaces'):
3909 3911 hexremoterev = hex(remoterev)
3910 3912 bms = [
3911 3913 bm
3912 3914 for bm, bmr in peer.listkeys(b'bookmarks').items()
3913 3915 if bmr == hexremoterev
3914 3916 ]
3915 3917
3916 3918 return sorted(bms)
3917 3919
3918 3920 if fm.isplain():
3919 3921 if bookmarks:
3920 3922 output.extend(getbms())
3921 3923 elif default and not ui.quiet:
3922 3924 # multiple bookmarks for a single parent separated by '/'
3923 3925 bm = b'/'.join(getbms())
3924 3926 if bm:
3925 3927 output.append(bm)
3926 3928 else:
3927 3929 fm.data(node=hex(remoterev))
3928 3930 if bookmarks or b'bookmarks' in fm.datahint():
3929 3931 fm.data(bookmarks=fm.formatlist(getbms(), name=b'bookmark'))
3930 3932 else:
3931 3933 if rev:
3932 3934 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
3933 3935 ctx = logcmdutil.revsingle(repo, rev, None)
3934 3936
3935 3937 if ctx.rev() is None:
3936 3938 ctx = repo[None]
3937 3939 parents = ctx.parents()
3938 3940 taglist = []
3939 3941 for p in parents:
3940 3942 taglist.extend(p.tags())
3941 3943
3942 3944 dirty = b""
3943 3945 if ctx.dirty(missing=True, merge=False, branch=False):
3944 3946 dirty = b'+'
3945 3947 fm.data(dirty=dirty)
3946 3948
3947 3949 hexoutput = [fm.hexfunc(p.node()) for p in parents]
3948 3950 if default or id:
3949 3951 output = [b"%s%s" % (b'+'.join(hexoutput), dirty)]
3950 3952 fm.data(id=b"%s%s" % (b'+'.join(hexoutput), dirty))
3951 3953
3952 3954 if num:
3953 3955 numoutput = [b"%d" % p.rev() for p in parents]
3954 3956 output.append(b"%s%s" % (b'+'.join(numoutput), dirty))
3955 3957
3956 3958 fm.data(
3957 3959 parents=fm.formatlist(
3958 3960 [fm.hexfunc(p.node()) for p in parents], name=b'node'
3959 3961 )
3960 3962 )
3961 3963 else:
3962 3964 hexoutput = fm.hexfunc(ctx.node())
3963 3965 if default or id:
3964 3966 output = [hexoutput]
3965 3967 fm.data(id=hexoutput)
3966 3968
3967 3969 if num:
3968 3970 output.append(pycompat.bytestr(ctx.rev()))
3969 3971 taglist = ctx.tags()
3970 3972
3971 3973 if default and not ui.quiet:
3972 3974 b = ctx.branch()
3973 3975 if b != b'default':
3974 3976 output.append(b"(%s)" % b)
3975 3977
3976 3978 # multiple tags for a single parent separated by '/'
3977 3979 t = b'/'.join(taglist)
3978 3980 if t:
3979 3981 output.append(t)
3980 3982
3981 3983 # multiple bookmarks for a single parent separated by '/'
3982 3984 bm = b'/'.join(ctx.bookmarks())
3983 3985 if bm:
3984 3986 output.append(bm)
3985 3987 else:
3986 3988 if branch:
3987 3989 output.append(ctx.branch())
3988 3990
3989 3991 if tags:
3990 3992 output.extend(taglist)
3991 3993
3992 3994 if bookmarks:
3993 3995 output.extend(ctx.bookmarks())
3994 3996
3995 3997 fm.data(node=ctx.hex())
3996 3998 fm.data(branch=ctx.branch())
3997 3999 fm.data(tags=fm.formatlist(taglist, name=b'tag', sep=b':'))
3998 4000 fm.data(bookmarks=fm.formatlist(ctx.bookmarks(), name=b'bookmark'))
3999 4001 fm.context(ctx=ctx)
4000 4002
4001 4003 fm.plain(b"%s\n" % b' '.join(output))
4002 4004 fm.end()
4003 4005 finally:
4004 4006 if peer:
4005 4007 peer.close()
4006 4008
4007 4009
4008 4010 @command(
4009 4011 b'import|patch',
4010 4012 [
4011 4013 (
4012 4014 b'p',
4013 4015 b'strip',
4014 4016 1,
4015 4017 _(
4016 4018 b'directory strip option for patch. This has the same '
4017 4019 b'meaning as the corresponding patch option'
4018 4020 ),
4019 4021 _(b'NUM'),
4020 4022 ),
4021 4023 (b'b', b'base', b'', _(b'base path (DEPRECATED)'), _(b'PATH')),
4022 4024 (b'', b'secret', None, _(b'use the secret phase for committing')),
4023 4025 (b'e', b'edit', False, _(b'invoke editor on commit messages')),
4024 4026 (
4025 4027 b'f',
4026 4028 b'force',
4027 4029 None,
4028 4030 _(b'skip check for outstanding uncommitted changes (DEPRECATED)'),
4029 4031 ),
4030 4032 (
4031 4033 b'',
4032 4034 b'no-commit',
4033 4035 None,
4034 4036 _(b"don't commit, just update the working directory"),
4035 4037 ),
4036 4038 (
4037 4039 b'',
4038 4040 b'bypass',
4039 4041 None,
4040 4042 _(b"apply patch without touching the working directory"),
4041 4043 ),
4042 4044 (b'', b'partial', None, _(b'commit even if some hunks fail')),
4043 4045 (b'', b'exact', None, _(b'abort if patch would apply lossily')),
4044 4046 (b'', b'prefix', b'', _(b'apply patch to subdirectory'), _(b'DIR')),
4045 4047 (
4046 4048 b'',
4047 4049 b'import-branch',
4048 4050 None,
4049 4051 _(b'use any branch information in patch (implied by --exact)'),
4050 4052 ),
4051 4053 ]
4052 4054 + commitopts
4053 4055 + commitopts2
4054 4056 + similarityopts,
4055 4057 _(b'[OPTION]... PATCH...'),
4056 4058 helpcategory=command.CATEGORY_IMPORT_EXPORT,
4057 4059 )
4058 4060 def import_(ui, repo, patch1=None, *patches, **opts):
4059 4061 """import an ordered set of patches
4060 4062
4061 4063 Import a list of patches and commit them individually (unless
4062 4064 --no-commit is specified).
4063 4065
4064 4066 To read a patch from standard input (stdin), use "-" as the patch
4065 4067 name. If a URL is specified, the patch will be downloaded from
4066 4068 there.
4067 4069
4068 4070 Import first applies changes to the working directory (unless
4069 4071 --bypass is specified), import will abort if there are outstanding
4070 4072 changes.
4071 4073
4072 4074 Use --bypass to apply and commit patches directly to the
4073 4075 repository, without affecting the working directory. Without
4074 4076 --exact, patches will be applied on top of the working directory
4075 4077 parent revision.
4076 4078
4077 4079 You can import a patch straight from a mail message. Even patches
4078 4080 as attachments work (to use the body part, it must have type
4079 4081 text/plain or text/x-patch). From and Subject headers of email
4080 4082 message are used as default committer and commit message. All
4081 4083 text/plain body parts before first diff are added to the commit
4082 4084 message.
4083 4085
4084 4086 If the imported patch was generated by :hg:`export`, user and
4085 4087 description from patch override values from message headers and
4086 4088 body. Values given on command line with -m/--message and -u/--user
4087 4089 override these.
4088 4090
4089 4091 If --exact is specified, import will set the working directory to
4090 4092 the parent of each patch before applying it, and will abort if the
4091 4093 resulting changeset has a different ID than the one recorded in
4092 4094 the patch. This will guard against various ways that portable
4093 4095 patch formats and mail systems might fail to transfer Mercurial
4094 4096 data or metadata. See :hg:`bundle` for lossless transmission.
4095 4097
4096 4098 Use --partial to ensure a changeset will be created from the patch
4097 4099 even if some hunks fail to apply. Hunks that fail to apply will be
4098 4100 written to a <target-file>.rej file. Conflicts can then be resolved
4099 4101 by hand before :hg:`commit --amend` is run to update the created
4100 4102 changeset. This flag exists to let people import patches that
4101 4103 partially apply without losing the associated metadata (author,
4102 4104 date, description, ...).
4103 4105
4104 4106 .. note::
4105 4107
4106 4108 When no hunks apply cleanly, :hg:`import --partial` will create
4107 4109 an empty changeset, importing only the patch metadata.
4108 4110
4109 4111 With -s/--similarity, hg will attempt to discover renames and
4110 4112 copies in the patch in the same way as :hg:`addremove`.
4111 4113
4112 4114 It is possible to use external patch programs to perform the patch
4113 4115 by setting the ``ui.patch`` configuration option. For the default
4114 4116 internal tool, the fuzz can also be configured via ``patch.fuzz``.
4115 4117 See :hg:`help config` for more information about configuration
4116 4118 files and how to use these options.
4117 4119
4118 4120 See :hg:`help dates` for a list of formats valid for -d/--date.
4119 4121
4120 4122 .. container:: verbose
4121 4123
4122 4124 Examples:
4123 4125
4124 4126 - import a traditional patch from a website and detect renames::
4125 4127
4126 4128 hg import -s 80 http://example.com/bugfix.patch
4127 4129
4128 4130 - import a changeset from an hgweb server::
4129 4131
4130 4132 hg import https://www.mercurial-scm.org/repo/hg/rev/5ca8c111e9aa
4131 4133
4132 4134 - import all the patches in an Unix-style mbox::
4133 4135
4134 4136 hg import incoming-patches.mbox
4135 4137
4136 4138 - import patches from stdin::
4137 4139
4138 4140 hg import -
4139 4141
4140 4142 - attempt to exactly restore an exported changeset (not always
4141 4143 possible)::
4142 4144
4143 4145 hg import --exact proposed-fix.patch
4144 4146
4145 4147 - use an external tool to apply a patch which is too fuzzy for
4146 4148 the default internal tool.
4147 4149
4148 4150 hg import --config ui.patch="patch --merge" fuzzy.patch
4149 4151
4150 4152 - change the default fuzzing from 2 to a less strict 7
4151 4153
4152 4154 hg import --config ui.fuzz=7 fuzz.patch
4153 4155
4154 4156 Returns 0 on success, 1 on partial success (see --partial).
4155 4157 """
4156 4158
4157 4159 cmdutil.check_incompatible_arguments(
4158 4160 opts, 'no_commit', ['bypass', 'secret']
4159 4161 )
4160 4162 cmdutil.check_incompatible_arguments(opts, 'exact', ['edit', 'prefix'])
4161 4163 opts = pycompat.byteskwargs(opts)
4162 4164 if not patch1:
4163 4165 raise error.InputError(_(b'need at least one patch to import'))
4164 4166
4165 4167 patches = (patch1,) + patches
4166 4168
4167 4169 date = opts.get(b'date')
4168 4170 if date:
4169 4171 opts[b'date'] = dateutil.parsedate(date)
4170 4172
4171 4173 exact = opts.get(b'exact')
4172 4174 update = not opts.get(b'bypass')
4173 4175 try:
4174 4176 sim = float(opts.get(b'similarity') or 0)
4175 4177 except ValueError:
4176 4178 raise error.InputError(_(b'similarity must be a number'))
4177 4179 if sim < 0 or sim > 100:
4178 4180 raise error.InputError(_(b'similarity must be between 0 and 100'))
4179 4181 if sim and not update:
4180 4182 raise error.InputError(_(b'cannot use --similarity with --bypass'))
4181 4183
4182 4184 base = opts[b"base"]
4183 4185 msgs = []
4184 4186 ret = 0
4185 4187
4186 4188 with repo.wlock():
4187 4189 if update:
4188 4190 cmdutil.checkunfinished(repo)
4189 4191 if exact or not opts.get(b'force'):
4190 4192 cmdutil.bailifchanged(repo)
4191 4193
4192 4194 if not opts.get(b'no_commit'):
4193 4195 lock = repo.lock
4194 4196 tr = lambda: repo.transaction(b'import')
4195 4197 dsguard = util.nullcontextmanager
4196 4198 else:
4197 4199 lock = util.nullcontextmanager
4198 4200 tr = util.nullcontextmanager
4199 4201 dsguard = lambda: dirstateguard.dirstateguard(repo, b'import')
4200 4202 with lock(), tr(), dsguard():
4201 4203 parents = repo[None].parents()
4202 4204 for patchurl in patches:
4203 4205 if patchurl == b'-':
4204 4206 ui.status(_(b'applying patch from stdin\n'))
4205 4207 patchfile = ui.fin
4206 4208 patchurl = b'stdin' # for error message
4207 4209 else:
4208 4210 patchurl = os.path.join(base, patchurl)
4209 4211 ui.status(_(b'applying %s\n') % patchurl)
4210 4212 patchfile = hg.openpath(ui, patchurl, sendaccept=False)
4211 4213
4212 4214 haspatch = False
4213 4215 for hunk in patch.split(patchfile):
4214 4216 with patch.extract(ui, hunk) as patchdata:
4215 4217 msg, node, rej = cmdutil.tryimportone(
4216 4218 ui, repo, patchdata, parents, opts, msgs, hg.clean
4217 4219 )
4218 4220 if msg:
4219 4221 haspatch = True
4220 4222 ui.note(msg + b'\n')
4221 4223 if update or exact:
4222 4224 parents = repo[None].parents()
4223 4225 else:
4224 4226 parents = [repo[node]]
4225 4227 if rej:
4226 4228 ui.write_err(_(b"patch applied partially\n"))
4227 4229 ui.write_err(
4228 4230 _(
4229 4231 b"(fix the .rej files and run "
4230 4232 b"`hg commit --amend`)\n"
4231 4233 )
4232 4234 )
4233 4235 ret = 1
4234 4236 break
4235 4237
4236 4238 if not haspatch:
4237 4239 raise error.InputError(_(b'%s: no diffs found') % patchurl)
4238 4240
4239 4241 if msgs:
4240 4242 repo.savecommitmessage(b'\n* * *\n'.join(msgs))
4241 4243 return ret
4242 4244
4243 4245
4244 4246 @command(
4245 4247 b'incoming|in',
4246 4248 [
4247 4249 (
4248 4250 b'f',
4249 4251 b'force',
4250 4252 None,
4251 4253 _(b'run even if remote repository is unrelated'),
4252 4254 ),
4253 4255 (b'n', b'newest-first', None, _(b'show newest record first')),
4254 4256 (b'', b'bundle', b'', _(b'file to store the bundles into'), _(b'FILE')),
4255 4257 (
4256 4258 b'r',
4257 4259 b'rev',
4258 4260 [],
4259 4261 _(b'a remote changeset intended to be added'),
4260 4262 _(b'REV'),
4261 4263 ),
4262 4264 (b'B', b'bookmarks', False, _(b"compare bookmarks")),
4263 4265 (
4264 4266 b'b',
4265 4267 b'branch',
4266 4268 [],
4267 4269 _(b'a specific branch you would like to pull'),
4268 4270 _(b'BRANCH'),
4269 4271 ),
4270 4272 ]
4271 4273 + logopts
4272 4274 + remoteopts
4273 4275 + subrepoopts,
4274 4276 _(b'[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]'),
4275 4277 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
4276 4278 )
4277 4279 def incoming(ui, repo, source=b"default", **opts):
4278 4280 """show new changesets found in source
4279 4281
4280 4282 Show new changesets found in the specified path/URL or the default
4281 4283 pull location. These are the changesets that would have been pulled
4282 4284 by :hg:`pull` at the time you issued this command.
4283 4285
4284 4286 See pull for valid source format details.
4285 4287
4286 4288 .. container:: verbose
4287 4289
4288 4290 With -B/--bookmarks, the result of bookmark comparison between
4289 4291 local and remote repositories is displayed. With -v/--verbose,
4290 4292 status is also displayed for each bookmark like below::
4291 4293
4292 4294 BM1 01234567890a added
4293 4295 BM2 1234567890ab advanced
4294 4296 BM3 234567890abc diverged
4295 4297 BM4 34567890abcd changed
4296 4298
4297 4299 The action taken locally when pulling depends on the
4298 4300 status of each bookmark:
4299 4301
4300 4302 :``added``: pull will create it
4301 4303 :``advanced``: pull will update it
4302 4304 :``diverged``: pull will create a divergent bookmark
4303 4305 :``changed``: result depends on remote changesets
4304 4306
4305 4307 From the point of view of pulling behavior, bookmark
4306 4308 existing only in the remote repository are treated as ``added``,
4307 4309 even if it is in fact locally deleted.
4308 4310
4309 4311 .. container:: verbose
4310 4312
4311 4313 For remote repository, using --bundle avoids downloading the
4312 4314 changesets twice if the incoming is followed by a pull.
4313 4315
4314 4316 Examples:
4315 4317
4316 4318 - show incoming changes with patches and full description::
4317 4319
4318 4320 hg incoming -vp
4319 4321
4320 4322 - show incoming changes excluding merges, store a bundle::
4321 4323
4322 4324 hg in -vpM --bundle incoming.hg
4323 4325 hg pull incoming.hg
4324 4326
4325 4327 - briefly list changes inside a bundle::
4326 4328
4327 4329 hg in changes.hg -T "{desc|firstline}\\n"
4328 4330
4329 4331 Returns 0 if there are incoming changes, 1 otherwise.
4330 4332 """
4331 4333 opts = pycompat.byteskwargs(opts)
4332 4334 if opts.get(b'graph'):
4333 4335 logcmdutil.checkunsupportedgraphflags([], opts)
4334 4336
4335 4337 def display(other, chlist, displayer):
4336 4338 revdag = logcmdutil.graphrevs(other, chlist, opts)
4337 4339 logcmdutil.displaygraph(
4338 4340 ui, repo, revdag, displayer, graphmod.asciiedges
4339 4341 )
4340 4342
4341 4343 hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True)
4342 4344 return 0
4343 4345
4344 4346 cmdutil.check_incompatible_arguments(opts, b'subrepos', [b'bundle'])
4345 4347
4346 4348 if opts.get(b'bookmarks'):
4347 4349 srcs = urlutil.get_pull_paths(repo, ui, [source])
4348 4350 for path in srcs:
4349 4351 source, branches = urlutil.parseurl(
4350 4352 path.rawloc, opts.get(b'branch')
4351 4353 )
4352 4354 other = hg.peer(repo, opts, source)
4353 4355 try:
4354 4356 if b'bookmarks' not in other.listkeys(b'namespaces'):
4355 4357 ui.warn(_(b"remote doesn't support bookmarks\n"))
4356 4358 return 0
4357 4359 ui.pager(b'incoming')
4358 4360 ui.status(
4359 4361 _(b'comparing with %s\n') % urlutil.hidepassword(source)
4360 4362 )
4361 4363 return bookmarks.incoming(
4362 4364 ui, repo, other, mode=path.bookmarks_mode
4363 4365 )
4364 4366 finally:
4365 4367 other.close()
4366 4368
4367 4369 return hg.incoming(ui, repo, source, opts)
4368 4370
4369 4371
4370 4372 @command(
4371 4373 b'init',
4372 4374 remoteopts,
4373 4375 _(b'[-e CMD] [--remotecmd CMD] [DEST]'),
4374 4376 helpcategory=command.CATEGORY_REPO_CREATION,
4375 4377 helpbasic=True,
4376 4378 norepo=True,
4377 4379 )
4378 4380 def init(ui, dest=b".", **opts):
4379 4381 """create a new repository in the given directory
4380 4382
4381 4383 Initialize a new repository in the given directory. If the given
4382 4384 directory does not exist, it will be created.
4383 4385
4384 4386 If no directory is given, the current directory is used.
4385 4387
4386 4388 It is possible to specify an ``ssh://`` URL as the destination.
4387 4389 See :hg:`help urls` for more information.
4388 4390
4389 4391 Returns 0 on success.
4390 4392 """
4391 4393 opts = pycompat.byteskwargs(opts)
4392 4394 path = urlutil.get_clone_path(ui, dest)[1]
4393 4395 peer = hg.peer(ui, opts, path, create=True)
4394 4396 peer.close()
4395 4397
4396 4398
4397 4399 @command(
4398 4400 b'locate',
4399 4401 [
4400 4402 (
4401 4403 b'r',
4402 4404 b'rev',
4403 4405 b'',
4404 4406 _(b'search the repository as it is in REV'),
4405 4407 _(b'REV'),
4406 4408 ),
4407 4409 (
4408 4410 b'0',
4409 4411 b'print0',
4410 4412 None,
4411 4413 _(b'end filenames with NUL, for use with xargs'),
4412 4414 ),
4413 4415 (
4414 4416 b'f',
4415 4417 b'fullpath',
4416 4418 None,
4417 4419 _(b'print complete paths from the filesystem root'),
4418 4420 ),
4419 4421 ]
4420 4422 + walkopts,
4421 4423 _(b'[OPTION]... [PATTERN]...'),
4422 4424 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
4423 4425 )
4424 4426 def locate(ui, repo, *pats, **opts):
4425 4427 """locate files matching specific patterns (DEPRECATED)
4426 4428
4427 4429 Print files under Mercurial control in the working directory whose
4428 4430 names match the given patterns.
4429 4431
4430 4432 By default, this command searches all directories in the working
4431 4433 directory. To search just the current directory and its
4432 4434 subdirectories, use "--include .".
4433 4435
4434 4436 If no patterns are given to match, this command prints the names
4435 4437 of all files under Mercurial control in the working directory.
4436 4438
4437 4439 If you want to feed the output of this command into the "xargs"
4438 4440 command, use the -0 option to both this command and "xargs". This
4439 4441 will avoid the problem of "xargs" treating single filenames that
4440 4442 contain whitespace as multiple filenames.
4441 4443
4442 4444 See :hg:`help files` for a more versatile command.
4443 4445
4444 4446 Returns 0 if a match is found, 1 otherwise.
4445 4447 """
4446 4448 opts = pycompat.byteskwargs(opts)
4447 4449 if opts.get(b'print0'):
4448 4450 end = b'\0'
4449 4451 else:
4450 4452 end = b'\n'
4451 4453 ctx = logcmdutil.revsingle(repo, opts.get(b'rev'), None)
4452 4454
4453 4455 ret = 1
4454 4456 m = scmutil.match(
4455 4457 ctx, pats, opts, default=b'relglob', badfn=lambda x, y: False
4456 4458 )
4457 4459
4458 4460 ui.pager(b'locate')
4459 4461 if ctx.rev() is None:
4460 4462 # When run on the working copy, "locate" includes removed files, so
4461 4463 # we get the list of files from the dirstate.
4462 4464 filesgen = sorted(repo.dirstate.matches(m))
4463 4465 else:
4464 4466 filesgen = ctx.matches(m)
4465 4467 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=bool(pats))
4466 4468 for abs in filesgen:
4467 4469 if opts.get(b'fullpath'):
4468 4470 ui.write(repo.wjoin(abs), end)
4469 4471 else:
4470 4472 ui.write(uipathfn(abs), end)
4471 4473 ret = 0
4472 4474
4473 4475 return ret
4474 4476
4475 4477
4476 4478 @command(
4477 4479 b'log|history',
4478 4480 [
4479 4481 (
4480 4482 b'f',
4481 4483 b'follow',
4482 4484 None,
4483 4485 _(
4484 4486 b'follow changeset history, or file history across copies and renames'
4485 4487 ),
4486 4488 ),
4487 4489 (
4488 4490 b'',
4489 4491 b'follow-first',
4490 4492 None,
4491 4493 _(b'only follow the first parent of merge changesets (DEPRECATED)'),
4492 4494 ),
4493 4495 (
4494 4496 b'd',
4495 4497 b'date',
4496 4498 b'',
4497 4499 _(b'show revisions matching date spec'),
4498 4500 _(b'DATE'),
4499 4501 ),
4500 4502 (b'C', b'copies', None, _(b'show copied files')),
4501 4503 (
4502 4504 b'k',
4503 4505 b'keyword',
4504 4506 [],
4505 4507 _(b'do case-insensitive search for a given text'),
4506 4508 _(b'TEXT'),
4507 4509 ),
4508 4510 (
4509 4511 b'r',
4510 4512 b'rev',
4511 4513 [],
4512 4514 _(b'revisions to select or follow from'),
4513 4515 _(b'REV'),
4514 4516 ),
4515 4517 (
4516 4518 b'L',
4517 4519 b'line-range',
4518 4520 [],
4519 4521 _(b'follow line range of specified file (EXPERIMENTAL)'),
4520 4522 _(b'FILE,RANGE'),
4521 4523 ),
4522 4524 (
4523 4525 b'',
4524 4526 b'removed',
4525 4527 None,
4526 4528 _(b'include revisions where files were removed'),
4527 4529 ),
4528 4530 (
4529 4531 b'm',
4530 4532 b'only-merges',
4531 4533 None,
4532 4534 _(b'show only merges (DEPRECATED) (use -r "merge()" instead)'),
4533 4535 ),
4534 4536 (b'u', b'user', [], _(b'revisions committed by user'), _(b'USER')),
4535 4537 (
4536 4538 b'',
4537 4539 b'only-branch',
4538 4540 [],
4539 4541 _(
4540 4542 b'show only changesets within the given named branch (DEPRECATED)'
4541 4543 ),
4542 4544 _(b'BRANCH'),
4543 4545 ),
4544 4546 (
4545 4547 b'b',
4546 4548 b'branch',
4547 4549 [],
4548 4550 _(b'show changesets within the given named branch'),
4549 4551 _(b'BRANCH'),
4550 4552 ),
4551 4553 (
4552 4554 b'B',
4553 4555 b'bookmark',
4554 4556 [],
4555 4557 _(b"show changesets within the given bookmark"),
4556 4558 _(b'BOOKMARK'),
4557 4559 ),
4558 4560 (
4559 4561 b'P',
4560 4562 b'prune',
4561 4563 [],
4562 4564 _(b'do not display revision or any of its ancestors'),
4563 4565 _(b'REV'),
4564 4566 ),
4565 4567 ]
4566 4568 + logopts
4567 4569 + walkopts,
4568 4570 _(b'[OPTION]... [FILE]'),
4569 4571 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
4570 4572 helpbasic=True,
4571 4573 inferrepo=True,
4572 4574 intents={INTENT_READONLY},
4573 4575 )
4574 4576 def log(ui, repo, *pats, **opts):
4575 4577 """show revision history of entire repository or files
4576 4578
4577 4579 Print the revision history of the specified files or the entire
4578 4580 project.
4579 4581
4580 4582 If no revision range is specified, the default is ``tip:0`` unless
4581 4583 --follow is set.
4582 4584
4583 4585 File history is shown without following rename or copy history of
4584 4586 files. Use -f/--follow with a filename to follow history across
4585 4587 renames and copies. --follow without a filename will only show
4586 4588 ancestors of the starting revisions. The starting revisions can be
4587 4589 specified by -r/--rev, which default to the working directory parent.
4588 4590
4589 4591 By default this command prints revision number and changeset id,
4590 4592 tags, non-trivial parents, user, date and time, and a summary for
4591 4593 each commit. When the -v/--verbose switch is used, the list of
4592 4594 changed files and full commit message are shown.
4593 4595
4594 4596 With --graph the revisions are shown as an ASCII art DAG with the most
4595 4597 recent changeset at the top.
4596 4598 'o' is a changeset, '@' is a working directory parent, '%' is a changeset
4597 4599 involved in an unresolved merge conflict, '_' closes a branch,
4598 4600 'x' is obsolete, '*' is unstable, and '+' represents a fork where the
4599 4601 changeset from the lines below is a parent of the 'o' merge on the same
4600 4602 line.
4601 4603 Paths in the DAG are represented with '|', '/' and so forth. ':' in place
4602 4604 of a '|' indicates one or more revisions in a path are omitted.
4603 4605
4604 4606 .. container:: verbose
4605 4607
4606 4608 Use -L/--line-range FILE,M:N options to follow the history of lines
4607 4609 from M to N in FILE. With -p/--patch only diff hunks affecting
4608 4610 specified line range will be shown. This option requires --follow;
4609 4611 it can be specified multiple times. Currently, this option is not
4610 4612 compatible with --graph. This option is experimental.
4611 4613
4612 4614 .. note::
4613 4615
4614 4616 :hg:`log --patch` may generate unexpected diff output for merge
4615 4617 changesets, as it will only compare the merge changeset against
4616 4618 its first parent. Also, only files different from BOTH parents
4617 4619 will appear in files:.
4618 4620
4619 4621 .. note::
4620 4622
4621 4623 For performance reasons, :hg:`log FILE` may omit duplicate changes
4622 4624 made on branches and will not show removals or mode changes. To
4623 4625 see all such changes, use the --removed switch.
4624 4626
4625 4627 .. container:: verbose
4626 4628
4627 4629 .. note::
4628 4630
4629 4631 The history resulting from -L/--line-range options depends on diff
4630 4632 options; for instance if white-spaces are ignored, respective changes
4631 4633 with only white-spaces in specified line range will not be listed.
4632 4634
4633 4635 .. container:: verbose
4634 4636
4635 4637 Some examples:
4636 4638
4637 4639 - changesets with full descriptions and file lists::
4638 4640
4639 4641 hg log -v
4640 4642
4641 4643 - changesets ancestral to the working directory::
4642 4644
4643 4645 hg log -f
4644 4646
4645 4647 - last 10 commits on the current branch::
4646 4648
4647 4649 hg log -l 10 -b .
4648 4650
4649 4651 - changesets showing all modifications of a file, including removals::
4650 4652
4651 4653 hg log --removed file.c
4652 4654
4653 4655 - all changesets that touch a directory, with diffs, excluding merges::
4654 4656
4655 4657 hg log -Mp lib/
4656 4658
4657 4659 - all revision numbers that match a keyword::
4658 4660
4659 4661 hg log -k bug --template "{rev}\\n"
4660 4662
4661 4663 - the full hash identifier of the working directory parent::
4662 4664
4663 4665 hg log -r . --template "{node}\\n"
4664 4666
4665 4667 - list available log templates::
4666 4668
4667 4669 hg log -T list
4668 4670
4669 4671 - check if a given changeset is included in a tagged release::
4670 4672
4671 4673 hg log -r "a21ccf and ancestor(1.9)"
4672 4674
4673 4675 - find all changesets by some user in a date range::
4674 4676
4675 4677 hg log -k alice -d "may 2008 to jul 2008"
4676 4678
4677 4679 - summary of all changesets after the last tag::
4678 4680
4679 4681 hg log -r "last(tagged())::" --template "{desc|firstline}\\n"
4680 4682
4681 4683 - changesets touching lines 13 to 23 for file.c::
4682 4684
4683 4685 hg log -L file.c,13:23
4684 4686
4685 4687 - changesets touching lines 13 to 23 for file.c and lines 2 to 6 of
4686 4688 main.c with patch::
4687 4689
4688 4690 hg log -L file.c,13:23 -L main.c,2:6 -p
4689 4691
4690 4692 See :hg:`help dates` for a list of formats valid for -d/--date.
4691 4693
4692 4694 See :hg:`help revisions` for more about specifying and ordering
4693 4695 revisions.
4694 4696
4695 4697 See :hg:`help templates` for more about pre-packaged styles and
4696 4698 specifying custom templates. The default template used by the log
4697 4699 command can be customized via the ``command-templates.log`` configuration
4698 4700 setting.
4699 4701
4700 4702 Returns 0 on success.
4701 4703
4702 4704 """
4703 4705 opts = pycompat.byteskwargs(opts)
4704 4706 linerange = opts.get(b'line_range')
4705 4707
4706 4708 if linerange and not opts.get(b'follow'):
4707 4709 raise error.InputError(_(b'--line-range requires --follow'))
4708 4710
4709 4711 if linerange and pats:
4710 4712 # TODO: take pats as patterns with no line-range filter
4711 4713 raise error.InputError(
4712 4714 _(b'FILE arguments are not compatible with --line-range option')
4713 4715 )
4714 4716
4715 4717 repo = scmutil.unhidehashlikerevs(repo, opts.get(b'rev'), b'nowarn')
4716 4718 walk_opts = logcmdutil.parseopts(ui, pats, opts)
4717 4719 revs, differ = logcmdutil.getrevs(repo, walk_opts)
4718 4720 if linerange:
4719 4721 # TODO: should follow file history from logcmdutil._initialrevs(),
4720 4722 # then filter the result by logcmdutil._makerevset() and --limit
4721 4723 revs, differ = logcmdutil.getlinerangerevs(repo, revs, opts)
4722 4724
4723 4725 getcopies = None
4724 4726 if opts.get(b'copies'):
4725 4727 endrev = None
4726 4728 if revs:
4727 4729 endrev = revs.max() + 1
4728 4730 getcopies = scmutil.getcopiesfn(repo, endrev=endrev)
4729 4731
4730 4732 ui.pager(b'log')
4731 4733 displayer = logcmdutil.changesetdisplayer(
4732 4734 ui, repo, opts, differ, buffered=True
4733 4735 )
4734 4736 if opts.get(b'graph'):
4735 4737 displayfn = logcmdutil.displaygraphrevs
4736 4738 else:
4737 4739 displayfn = logcmdutil.displayrevs
4738 4740 displayfn(ui, repo, revs, displayer, getcopies)
4739 4741
4740 4742
4741 4743 @command(
4742 4744 b'manifest',
4743 4745 [
4744 4746 (b'r', b'rev', b'', _(b'revision to display'), _(b'REV')),
4745 4747 (b'', b'all', False, _(b"list files from all revisions")),
4746 4748 ]
4747 4749 + formatteropts,
4748 4750 _(b'[-r REV]'),
4749 4751 helpcategory=command.CATEGORY_MAINTENANCE,
4750 4752 intents={INTENT_READONLY},
4751 4753 )
4752 4754 def manifest(ui, repo, node=None, rev=None, **opts):
4753 4755 """output the current or given revision of the project manifest
4754 4756
4755 4757 Print a list of version controlled files for the given revision.
4756 4758 If no revision is given, the first parent of the working directory
4757 4759 is used, or the null revision if no revision is checked out.
4758 4760
4759 4761 With -v, print file permissions, symlink and executable bits.
4760 4762 With --debug, print file revision hashes.
4761 4763
4762 4764 If option --all is specified, the list of all files from all revisions
4763 4765 is printed. This includes deleted and renamed files.
4764 4766
4765 4767 Returns 0 on success.
4766 4768 """
4767 4769 opts = pycompat.byteskwargs(opts)
4768 4770 fm = ui.formatter(b'manifest', opts)
4769 4771
4770 4772 if opts.get(b'all'):
4771 4773 if rev or node:
4772 4774 raise error.InputError(_(b"can't specify a revision with --all"))
4773 4775
4774 4776 res = set()
4775 4777 for rev in repo:
4776 4778 ctx = repo[rev]
4777 4779 res |= set(ctx.files())
4778 4780
4779 4781 ui.pager(b'manifest')
4780 4782 for f in sorted(res):
4781 4783 fm.startitem()
4782 4784 fm.write(b"path", b'%s\n', f)
4783 4785 fm.end()
4784 4786 return
4785 4787
4786 4788 if rev and node:
4787 4789 raise error.InputError(_(b"please specify just one revision"))
4788 4790
4789 4791 if not node:
4790 4792 node = rev
4791 4793
4792 4794 char = {b'l': b'@', b'x': b'*', b'': b'', b't': b'd'}
4793 4795 mode = {b'l': b'644', b'x': b'755', b'': b'644', b't': b'755'}
4794 4796 if node:
4795 4797 repo = scmutil.unhidehashlikerevs(repo, [node], b'nowarn')
4796 4798 ctx = logcmdutil.revsingle(repo, node)
4797 4799 mf = ctx.manifest()
4798 4800 ui.pager(b'manifest')
4799 4801 for f in ctx:
4800 4802 fm.startitem()
4801 4803 fm.context(ctx=ctx)
4802 4804 fl = ctx[f].flags()
4803 4805 fm.condwrite(ui.debugflag, b'hash', b'%s ', hex(mf[f]))
4804 4806 fm.condwrite(ui.verbose, b'mode type', b'%s %1s ', mode[fl], char[fl])
4805 4807 fm.write(b'path', b'%s\n', f)
4806 4808 fm.end()
4807 4809
4808 4810
4809 4811 @command(
4810 4812 b'merge',
4811 4813 [
4812 4814 (
4813 4815 b'f',
4814 4816 b'force',
4815 4817 None,
4816 4818 _(b'force a merge including outstanding changes (DEPRECATED)'),
4817 4819 ),
4818 4820 (b'r', b'rev', b'', _(b'revision to merge'), _(b'REV')),
4819 4821 (
4820 4822 b'P',
4821 4823 b'preview',
4822 4824 None,
4823 4825 _(b'review revisions to merge (no merge is performed)'),
4824 4826 ),
4825 4827 (b'', b'abort', None, _(b'abort the ongoing merge')),
4826 4828 ]
4827 4829 + mergetoolopts,
4828 4830 _(b'[-P] [[-r] REV]'),
4829 4831 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT,
4830 4832 helpbasic=True,
4831 4833 )
4832 4834 def merge(ui, repo, node=None, **opts):
4833 4835 """merge another revision into working directory
4834 4836
4835 4837 The current working directory is updated with all changes made in
4836 4838 the requested revision since the last common predecessor revision.
4837 4839
4838 4840 Files that changed between either parent are marked as changed for
4839 4841 the next commit and a commit must be performed before any further
4840 4842 updates to the repository are allowed. The next commit will have
4841 4843 two parents.
4842 4844
4843 4845 ``--tool`` can be used to specify the merge tool used for file
4844 4846 merges. It overrides the HGMERGE environment variable and your
4845 4847 configuration files. See :hg:`help merge-tools` for options.
4846 4848
4847 4849 If no revision is specified, the working directory's parent is a
4848 4850 head revision, and the current branch contains exactly one other
4849 4851 head, the other head is merged with by default. Otherwise, an
4850 4852 explicit revision with which to merge must be provided.
4851 4853
4852 4854 See :hg:`help resolve` for information on handling file conflicts.
4853 4855
4854 4856 To undo an uncommitted merge, use :hg:`merge --abort` which
4855 4857 will check out a clean copy of the original merge parent, losing
4856 4858 all changes.
4857 4859
4858 4860 Returns 0 on success, 1 if there are unresolved files.
4859 4861 """
4860 4862
4861 4863 opts = pycompat.byteskwargs(opts)
4862 4864 abort = opts.get(b'abort')
4863 4865 if abort and repo.dirstate.p2() == repo.nullid:
4864 4866 cmdutil.wrongtooltocontinue(repo, _(b'merge'))
4865 4867 cmdutil.check_incompatible_arguments(opts, b'abort', [b'rev', b'preview'])
4866 4868 if abort:
4867 4869 state = cmdutil.getunfinishedstate(repo)
4868 4870 if state and state._opname != b'merge':
4869 4871 raise error.StateError(
4870 4872 _(b'cannot abort merge with %s in progress') % (state._opname),
4871 4873 hint=state.hint(),
4872 4874 )
4873 4875 if node:
4874 4876 raise error.InputError(_(b"cannot specify a node with --abort"))
4875 4877 return hg.abortmerge(repo.ui, repo)
4876 4878
4877 4879 if opts.get(b'rev') and node:
4878 4880 raise error.InputError(_(b"please specify just one revision"))
4879 4881 if not node:
4880 4882 node = opts.get(b'rev')
4881 4883
4882 4884 if node:
4883 4885 ctx = logcmdutil.revsingle(repo, node)
4884 4886 else:
4885 4887 if ui.configbool(b'commands', b'merge.require-rev'):
4886 4888 raise error.InputError(
4887 4889 _(
4888 4890 b'configuration requires specifying revision to merge '
4889 4891 b'with'
4890 4892 )
4891 4893 )
4892 4894 ctx = repo[destutil.destmerge(repo)]
4893 4895
4894 4896 if ctx.node() is None:
4895 4897 raise error.InputError(
4896 4898 _(b'merging with the working copy has no effect')
4897 4899 )
4898 4900
4899 4901 if opts.get(b'preview'):
4900 4902 # find nodes that are ancestors of p2 but not of p1
4901 4903 p1 = repo[b'.'].node()
4902 4904 p2 = ctx.node()
4903 4905 nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
4904 4906
4905 4907 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
4906 4908 for node in nodes:
4907 4909 displayer.show(repo[node])
4908 4910 displayer.close()
4909 4911 return 0
4910 4912
4911 4913 # ui.forcemerge is an internal variable, do not document
4912 4914 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
4913 4915 with ui.configoverride(overrides, b'merge'):
4914 4916 force = opts.get(b'force')
4915 4917 labels = [b'working copy', b'merge rev', b'common ancestor']
4916 4918 return hg.merge(ctx, force=force, labels=labels)
4917 4919
4918 4920
4919 4921 statemod.addunfinished(
4920 4922 b'merge',
4921 4923 fname=None,
4922 4924 clearable=True,
4923 4925 allowcommit=True,
4924 4926 cmdmsg=_(b'outstanding uncommitted merge'),
4925 4927 abortfunc=hg.abortmerge,
4926 4928 statushint=_(
4927 4929 b'To continue: hg commit\nTo abort: hg merge --abort'
4928 4930 ),
4929 4931 cmdhint=_(b"use 'hg commit' or 'hg merge --abort'"),
4930 4932 )
4931 4933
4932 4934
4933 4935 @command(
4934 4936 b'outgoing|out',
4935 4937 [
4936 4938 (
4937 4939 b'f',
4938 4940 b'force',
4939 4941 None,
4940 4942 _(b'run even when the destination is unrelated'),
4941 4943 ),
4942 4944 (
4943 4945 b'r',
4944 4946 b'rev',
4945 4947 [],
4946 4948 _(b'a changeset intended to be included in the destination'),
4947 4949 _(b'REV'),
4948 4950 ),
4949 4951 (b'n', b'newest-first', None, _(b'show newest record first')),
4950 4952 (b'B', b'bookmarks', False, _(b'compare bookmarks')),
4951 4953 (
4952 4954 b'b',
4953 4955 b'branch',
4954 4956 [],
4955 4957 _(b'a specific branch you would like to push'),
4956 4958 _(b'BRANCH'),
4957 4959 ),
4958 4960 ]
4959 4961 + logopts
4960 4962 + remoteopts
4961 4963 + subrepoopts,
4962 4964 _(b'[-M] [-p] [-n] [-f] [-r REV]... [DEST]...'),
4963 4965 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
4964 4966 )
4965 4967 def outgoing(ui, repo, *dests, **opts):
4966 4968 """show changesets not found in the destination
4967 4969
4968 4970 Show changesets not found in the specified destination repository
4969 4971 or the default push location. These are the changesets that would
4970 4972 be pushed if a push was requested.
4971 4973
4972 4974 See pull for details of valid destination formats.
4973 4975
4974 4976 .. container:: verbose
4975 4977
4976 4978 With -B/--bookmarks, the result of bookmark comparison between
4977 4979 local and remote repositories is displayed. With -v/--verbose,
4978 4980 status is also displayed for each bookmark like below::
4979 4981
4980 4982 BM1 01234567890a added
4981 4983 BM2 deleted
4982 4984 BM3 234567890abc advanced
4983 4985 BM4 34567890abcd diverged
4984 4986 BM5 4567890abcde changed
4985 4987
4986 4988 The action taken when pushing depends on the
4987 4989 status of each bookmark:
4988 4990
4989 4991 :``added``: push with ``-B`` will create it
4990 4992 :``deleted``: push with ``-B`` will delete it
4991 4993 :``advanced``: push will update it
4992 4994 :``diverged``: push with ``-B`` will update it
4993 4995 :``changed``: push with ``-B`` will update it
4994 4996
4995 4997 From the point of view of pushing behavior, bookmarks
4996 4998 existing only in the remote repository are treated as
4997 4999 ``deleted``, even if it is in fact added remotely.
4998 5000
4999 5001 Returns 0 if there are outgoing changes, 1 otherwise.
5000 5002 """
5001 5003 opts = pycompat.byteskwargs(opts)
5002 5004 if opts.get(b'bookmarks'):
5003 5005 for path in urlutil.get_push_paths(repo, ui, dests):
5004 5006 dest = path.pushloc or path.loc
5005 5007 other = hg.peer(repo, opts, dest)
5006 5008 try:
5007 5009 if b'bookmarks' not in other.listkeys(b'namespaces'):
5008 5010 ui.warn(_(b"remote doesn't support bookmarks\n"))
5009 5011 return 0
5010 5012 ui.status(
5011 5013 _(b'comparing with %s\n') % urlutil.hidepassword(dest)
5012 5014 )
5013 5015 ui.pager(b'outgoing')
5014 5016 return bookmarks.outgoing(ui, repo, other)
5015 5017 finally:
5016 5018 other.close()
5017 5019
5018 5020 return hg.outgoing(ui, repo, dests, opts)
5019 5021
5020 5022
5021 5023 @command(
5022 5024 b'parents',
5023 5025 [
5024 5026 (
5025 5027 b'r',
5026 5028 b'rev',
5027 5029 b'',
5028 5030 _(b'show parents of the specified revision'),
5029 5031 _(b'REV'),
5030 5032 ),
5031 5033 ]
5032 5034 + templateopts,
5033 5035 _(b'[-r REV] [FILE]'),
5034 5036 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
5035 5037 inferrepo=True,
5036 5038 )
5037 5039 def parents(ui, repo, file_=None, **opts):
5038 5040 """show the parents of the working directory or revision (DEPRECATED)
5039 5041
5040 5042 Print the working directory's parent revisions. If a revision is
5041 5043 given via -r/--rev, the parent of that revision will be printed.
5042 5044 If a file argument is given, the revision in which the file was
5043 5045 last changed (before the working directory revision or the
5044 5046 argument to --rev if given) is printed.
5045 5047
5046 5048 This command is equivalent to::
5047 5049
5048 5050 hg log -r "p1()+p2()" or
5049 5051 hg log -r "p1(REV)+p2(REV)" or
5050 5052 hg log -r "max(::p1() and file(FILE))+max(::p2() and file(FILE))" or
5051 5053 hg log -r "max(::p1(REV) and file(FILE))+max(::p2(REV) and file(FILE))"
5052 5054
5053 5055 See :hg:`summary` and :hg:`help revsets` for related information.
5054 5056
5055 5057 Returns 0 on success.
5056 5058 """
5057 5059
5058 5060 opts = pycompat.byteskwargs(opts)
5059 5061 rev = opts.get(b'rev')
5060 5062 if rev:
5061 5063 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
5062 5064 ctx = logcmdutil.revsingle(repo, rev, None)
5063 5065
5064 5066 if file_:
5065 5067 m = scmutil.match(ctx, (file_,), opts)
5066 5068 if m.anypats() or len(m.files()) != 1:
5067 5069 raise error.InputError(_(b'can only specify an explicit filename'))
5068 5070 file_ = m.files()[0]
5069 5071 filenodes = []
5070 5072 for cp in ctx.parents():
5071 5073 if not cp:
5072 5074 continue
5073 5075 try:
5074 5076 filenodes.append(cp.filenode(file_))
5075 5077 except error.LookupError:
5076 5078 pass
5077 5079 if not filenodes:
5078 5080 raise error.InputError(_(b"'%s' not found in manifest") % file_)
5079 5081 p = []
5080 5082 for fn in filenodes:
5081 5083 fctx = repo.filectx(file_, fileid=fn)
5082 5084 p.append(fctx.node())
5083 5085 else:
5084 5086 p = [cp.node() for cp in ctx.parents()]
5085 5087
5086 5088 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
5087 5089 for n in p:
5088 5090 if n != repo.nullid:
5089 5091 displayer.show(repo[n])
5090 5092 displayer.close()
5091 5093
5092 5094
5093 5095 @command(
5094 5096 b'paths',
5095 5097 formatteropts,
5096 5098 _(b'[NAME]'),
5097 5099 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
5098 5100 optionalrepo=True,
5099 5101 intents={INTENT_READONLY},
5100 5102 )
5101 5103 def paths(ui, repo, search=None, **opts):
5102 5104 """show aliases for remote repositories
5103 5105
5104 5106 Show definition of symbolic path name NAME. If no name is given,
5105 5107 show definition of all available names.
5106 5108
5107 5109 Option -q/--quiet suppresses all output when searching for NAME
5108 5110 and shows only the path names when listing all definitions.
5109 5111
5110 5112 Path names are defined in the [paths] section of your
5111 5113 configuration file and in ``/etc/mercurial/hgrc``. If run inside a
5112 5114 repository, ``.hg/hgrc`` is used, too.
5113 5115
5114 5116 The path names ``default`` and ``default-push`` have a special
5115 5117 meaning. When performing a push or pull operation, they are used
5116 5118 as fallbacks if no location is specified on the command-line.
5117 5119 When ``default-push`` is set, it will be used for push and
5118 5120 ``default`` will be used for pull; otherwise ``default`` is used
5119 5121 as the fallback for both. When cloning a repository, the clone
5120 5122 source is written as ``default`` in ``.hg/hgrc``.
5121 5123
5122 5124 .. note::
5123 5125
5124 5126 ``default`` and ``default-push`` apply to all inbound (e.g.
5125 5127 :hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email`
5126 5128 and :hg:`bundle`) operations.
5127 5129
5128 5130 See :hg:`help urls` for more information.
5129 5131
5130 5132 .. container:: verbose
5131 5133
5132 5134 Template:
5133 5135
5134 5136 The following keywords are supported. See also :hg:`help templates`.
5135 5137
5136 5138 :name: String. Symbolic name of the path alias.
5137 5139 :pushurl: String. URL for push operations.
5138 5140 :url: String. URL or directory path for the other operations.
5139 5141
5140 5142 Returns 0 on success.
5141 5143 """
5142 5144
5143 5145 opts = pycompat.byteskwargs(opts)
5144 5146
5145 5147 pathitems = urlutil.list_paths(ui, search)
5146 5148 ui.pager(b'paths')
5147 5149
5148 5150 fm = ui.formatter(b'paths', opts)
5149 5151 if fm.isplain():
5150 5152 hidepassword = urlutil.hidepassword
5151 5153 else:
5152 5154 hidepassword = bytes
5153 5155 if ui.quiet:
5154 5156 namefmt = b'%s\n'
5155 5157 else:
5156 5158 namefmt = b'%s = '
5157 5159 showsubopts = not search and not ui.quiet
5158 5160
5159 5161 for name, path in pathitems:
5160 5162 fm.startitem()
5161 5163 fm.condwrite(not search, b'name', namefmt, name)
5162 5164 fm.condwrite(not ui.quiet, b'url', b'%s\n', hidepassword(path.rawloc))
5163 5165 for subopt, value in sorted(path.suboptions.items()):
5164 5166 assert subopt not in (b'name', b'url')
5165 5167 if showsubopts:
5166 5168 fm.plain(b'%s:%s = ' % (name, subopt))
5167 5169 if isinstance(value, bool):
5168 5170 if value:
5169 5171 value = b'yes'
5170 5172 else:
5171 5173 value = b'no'
5172 5174 fm.condwrite(showsubopts, subopt, b'%s\n', value)
5173 5175
5174 5176 fm.end()
5175 5177
5176 5178 if search and not pathitems:
5177 5179 if not ui.quiet:
5178 5180 ui.warn(_(b"not found!\n"))
5179 5181 return 1
5180 5182 else:
5181 5183 return 0
5182 5184
5183 5185
5184 5186 @command(
5185 5187 b'phase',
5186 5188 [
5187 5189 (b'p', b'public', False, _(b'set changeset phase to public')),
5188 5190 (b'd', b'draft', False, _(b'set changeset phase to draft')),
5189 5191 (b's', b'secret', False, _(b'set changeset phase to secret')),
5190 5192 (b'f', b'force', False, _(b'allow to move boundary backward')),
5191 5193 (b'r', b'rev', [], _(b'target revision'), _(b'REV')),
5192 5194 ],
5193 5195 _(b'[-p|-d|-s] [-f] [-r] [REV...]'),
5194 5196 helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
5195 5197 )
5196 5198 def phase(ui, repo, *revs, **opts):
5197 5199 """set or show the current phase name
5198 5200
5199 5201 With no argument, show the phase name of the current revision(s).
5200 5202
5201 5203 With one of -p/--public, -d/--draft or -s/--secret, change the
5202 5204 phase value of the specified revisions.
5203 5205
5204 5206 Unless -f/--force is specified, :hg:`phase` won't move changesets from a
5205 5207 lower phase to a higher phase. Phases are ordered as follows::
5206 5208
5207 5209 public < draft < secret
5208 5210
5209 5211 Returns 0 on success, 1 if some phases could not be changed.
5210 5212
5211 5213 (For more information about the phases concept, see :hg:`help phases`.)
5212 5214 """
5213 5215 opts = pycompat.byteskwargs(opts)
5214 5216 # search for a unique phase argument
5215 5217 targetphase = None
5216 5218 for idx, name in enumerate(phases.cmdphasenames):
5217 5219 if opts[name]:
5218 5220 if targetphase is not None:
5219 5221 raise error.InputError(_(b'only one phase can be specified'))
5220 5222 targetphase = idx
5221 5223
5222 5224 # look for specified revision
5223 5225 revs = list(revs)
5224 5226 revs.extend(opts[b'rev'])
5225 5227 if revs:
5226 5228 revs = logcmdutil.revrange(repo, revs)
5227 5229 else:
5228 5230 # display both parents as the second parent phase can influence
5229 5231 # the phase of a merge commit
5230 5232 revs = [c.rev() for c in repo[None].parents()]
5231 5233
5232 5234 ret = 0
5233 5235 if targetphase is None:
5234 5236 # display
5235 5237 for r in revs:
5236 5238 ctx = repo[r]
5237 5239 ui.write(b'%i: %s\n' % (ctx.rev(), ctx.phasestr()))
5238 5240 else:
5239 5241 with repo.lock(), repo.transaction(b"phase") as tr:
5240 5242 # set phase
5241 5243 if not revs:
5242 5244 raise error.InputError(_(b'empty revision set'))
5243 5245 nodes = [repo[r].node() for r in revs]
5244 5246 # moving revision from public to draft may hide them
5245 5247 # We have to check result on an unfiltered repository
5246 5248 unfi = repo.unfiltered()
5247 5249 getphase = unfi._phasecache.phase
5248 5250 olddata = [getphase(unfi, r) for r in unfi]
5249 5251 phases.advanceboundary(repo, tr, targetphase, nodes)
5250 5252 if opts[b'force']:
5251 5253 phases.retractboundary(repo, tr, targetphase, nodes)
5252 5254 getphase = unfi._phasecache.phase
5253 5255 newdata = [getphase(unfi, r) for r in unfi]
5254 5256 changes = sum(newdata[r] != olddata[r] for r in unfi)
5255 5257 cl = unfi.changelog
5256 5258 rejected = [n for n in nodes if newdata[cl.rev(n)] < targetphase]
5257 5259 if rejected:
5258 5260 ui.warn(
5259 5261 _(
5260 5262 b'cannot move %i changesets to a higher '
5261 5263 b'phase, use --force\n'
5262 5264 )
5263 5265 % len(rejected)
5264 5266 )
5265 5267 ret = 1
5266 5268 if changes:
5267 5269 msg = _(b'phase changed for %i changesets\n') % changes
5268 5270 if ret:
5269 5271 ui.status(msg)
5270 5272 else:
5271 5273 ui.note(msg)
5272 5274 else:
5273 5275 ui.warn(_(b'no phases changed\n'))
5274 5276 return ret
5275 5277
5276 5278
5277 5279 def postincoming(ui, repo, modheads, optupdate, checkout, brev):
5278 5280 """Run after a changegroup has been added via pull/unbundle
5279 5281
5280 5282 This takes arguments below:
5281 5283
5282 5284 :modheads: change of heads by pull/unbundle
5283 5285 :optupdate: updating working directory is needed or not
5284 5286 :checkout: update destination revision (or None to default destination)
5285 5287 :brev: a name, which might be a bookmark to be activated after updating
5286 5288
5287 5289 return True if update raise any conflict, False otherwise.
5288 5290 """
5289 5291 if modheads == 0:
5290 5292 return False
5291 5293 if optupdate:
5292 5294 try:
5293 5295 return hg.updatetotally(ui, repo, checkout, brev)
5294 5296 except error.UpdateAbort as inst:
5295 5297 msg = _(b"not updating: %s") % stringutil.forcebytestr(inst)
5296 5298 hint = inst.hint
5297 5299 raise error.UpdateAbort(msg, hint=hint)
5298 5300 if modheads is not None and modheads > 1:
5299 5301 currentbranchheads = len(repo.branchheads())
5300 5302 if currentbranchheads == modheads:
5301 5303 ui.status(
5302 5304 _(b"(run 'hg heads' to see heads, 'hg merge' to merge)\n")
5303 5305 )
5304 5306 elif currentbranchheads > 1:
5305 5307 ui.status(
5306 5308 _(b"(run 'hg heads .' to see heads, 'hg merge' to merge)\n")
5307 5309 )
5308 5310 else:
5309 5311 ui.status(_(b"(run 'hg heads' to see heads)\n"))
5310 5312 elif not ui.configbool(b'commands', b'update.requiredest'):
5311 5313 ui.status(_(b"(run 'hg update' to get a working copy)\n"))
5312 5314 return False
5313 5315
5314 5316
5315 5317 @command(
5316 5318 b'pull',
5317 5319 [
5318 5320 (
5319 5321 b'u',
5320 5322 b'update',
5321 5323 None,
5322 5324 _(b'update to new branch head if new descendants were pulled'),
5323 5325 ),
5324 5326 (
5325 5327 b'f',
5326 5328 b'force',
5327 5329 None,
5328 5330 _(b'run even when remote repository is unrelated'),
5329 5331 ),
5330 5332 (
5331 5333 b'',
5332 5334 b'confirm',
5333 5335 None,
5334 5336 _(b'confirm pull before applying changes'),
5335 5337 ),
5336 5338 (
5337 5339 b'r',
5338 5340 b'rev',
5339 5341 [],
5340 5342 _(b'a remote changeset intended to be added'),
5341 5343 _(b'REV'),
5342 5344 ),
5343 5345 (b'B', b'bookmark', [], _(b"bookmark to pull"), _(b'BOOKMARK')),
5344 5346 (
5345 5347 b'b',
5346 5348 b'branch',
5347 5349 [],
5348 5350 _(b'a specific branch you would like to pull'),
5349 5351 _(b'BRANCH'),
5350 5352 ),
5351 5353 ]
5352 5354 + remoteopts,
5353 5355 _(b'[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]...'),
5354 5356 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
5355 5357 helpbasic=True,
5356 5358 )
5357 5359 def pull(ui, repo, *sources, **opts):
5358 5360 """pull changes from the specified source
5359 5361
5360 5362 Pull changes from a remote repository to a local one.
5361 5363
5362 5364 This finds all changes from the repository at the specified path
5363 5365 or URL and adds them to a local repository (the current one unless
5364 5366 -R is specified). By default, this does not update the copy of the
5365 5367 project in the working directory.
5366 5368
5367 5369 When cloning from servers that support it, Mercurial may fetch
5368 5370 pre-generated data. When this is done, hooks operating on incoming
5369 5371 changesets and changegroups may fire more than once, once for each
5370 5372 pre-generated bundle and as well as for any additional remaining
5371 5373 data. See :hg:`help -e clonebundles` for more.
5372 5374
5373 5375 Use :hg:`incoming` if you want to see what would have been added
5374 5376 by a pull at the time you issued this command. If you then decide
5375 5377 to add those changes to the repository, you should use :hg:`pull
5376 5378 -r X` where ``X`` is the last changeset listed by :hg:`incoming`.
5377 5379
5378 5380 If SOURCE is omitted, the 'default' path will be used.
5379 5381 See :hg:`help urls` for more information.
5380 5382
5381 5383 If multiple sources are specified, they will be pulled sequentially as if
5382 5384 the command was run multiple time. If --update is specify and the command
5383 5385 will stop at the first failed --update.
5384 5386
5385 5387 Specifying bookmark as ``.`` is equivalent to specifying the active
5386 5388 bookmark's name.
5387 5389
5388 5390 Returns 0 on success, 1 if an update had unresolved files.
5389 5391 """
5390 5392
5391 5393 opts = pycompat.byteskwargs(opts)
5392 5394 if ui.configbool(b'commands', b'update.requiredest') and opts.get(
5393 5395 b'update'
5394 5396 ):
5395 5397 msg = _(b'update destination required by configuration')
5396 5398 hint = _(b'use hg pull followed by hg update DEST')
5397 5399 raise error.InputError(msg, hint=hint)
5398 5400
5399 5401 for path in urlutil.get_pull_paths(repo, ui, sources):
5400 5402 source, branches = urlutil.parseurl(path.rawloc, opts.get(b'branch'))
5401 5403 ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(source))
5402 5404 ui.flush()
5403 5405 other = hg.peer(repo, opts, source)
5404 5406 update_conflict = None
5405 5407 try:
5406 5408 revs, checkout = hg.addbranchrevs(
5407 5409 repo, other, branches, opts.get(b'rev')
5408 5410 )
5409 5411
5410 5412 pullopargs = {}
5411 5413
5412 5414 nodes = None
5413 5415 if opts.get(b'bookmark') or revs:
5414 5416 # The list of bookmark used here is the same used to actually update
5415 5417 # the bookmark names, to avoid the race from issue 4689 and we do
5416 5418 # all lookup and bookmark queries in one go so they see the same
5417 5419 # version of the server state (issue 4700).
5418 5420 nodes = []
5419 5421 fnodes = []
5420 5422 revs = revs or []
5421 5423 if revs and not other.capable(b'lookup'):
5422 5424 err = _(
5423 5425 b"other repository doesn't support revision lookup, "
5424 5426 b"so a rev cannot be specified."
5425 5427 )
5426 5428 raise error.Abort(err)
5427 5429 with other.commandexecutor() as e:
5428 5430 fremotebookmarks = e.callcommand(
5429 5431 b'listkeys', {b'namespace': b'bookmarks'}
5430 5432 )
5431 5433 for r in revs:
5432 5434 fnodes.append(e.callcommand(b'lookup', {b'key': r}))
5433 5435 remotebookmarks = fremotebookmarks.result()
5434 5436 remotebookmarks = bookmarks.unhexlifybookmarks(remotebookmarks)
5435 5437 pullopargs[b'remotebookmarks'] = remotebookmarks
5436 5438 for b in opts.get(b'bookmark', []):
5437 5439 b = repo._bookmarks.expandname(b)
5438 5440 if b not in remotebookmarks:
5439 5441 raise error.InputError(
5440 5442 _(b'remote bookmark %s not found!') % b
5441 5443 )
5442 5444 nodes.append(remotebookmarks[b])
5443 5445 for i, rev in enumerate(revs):
5444 5446 node = fnodes[i].result()
5445 5447 nodes.append(node)
5446 5448 if rev == checkout:
5447 5449 checkout = node
5448 5450
5449 5451 wlock = util.nullcontextmanager()
5450 5452 if opts.get(b'update'):
5451 5453 wlock = repo.wlock()
5452 5454 with wlock:
5453 5455 pullopargs.update(opts.get(b'opargs', {}))
5454 5456 modheads = exchange.pull(
5455 5457 repo,
5456 5458 other,
5457 5459 path=path,
5458 5460 heads=nodes,
5459 5461 force=opts.get(b'force'),
5460 5462 bookmarks=opts.get(b'bookmark', ()),
5461 5463 opargs=pullopargs,
5462 5464 confirm=opts.get(b'confirm'),
5463 5465 ).cgresult
5464 5466
5465 5467 # brev is a name, which might be a bookmark to be activated at
5466 5468 # the end of the update. In other words, it is an explicit
5467 5469 # destination of the update
5468 5470 brev = None
5469 5471
5470 5472 if checkout:
5471 5473 checkout = repo.unfiltered().changelog.rev(checkout)
5472 5474
5473 5475 # order below depends on implementation of
5474 5476 # hg.addbranchrevs(). opts['bookmark'] is ignored,
5475 5477 # because 'checkout' is determined without it.
5476 5478 if opts.get(b'rev'):
5477 5479 brev = opts[b'rev'][0]
5478 5480 elif opts.get(b'branch'):
5479 5481 brev = opts[b'branch'][0]
5480 5482 else:
5481 5483 brev = branches[0]
5482 5484 repo._subtoppath = source
5483 5485 try:
5484 5486 update_conflict = postincoming(
5485 5487 ui, repo, modheads, opts.get(b'update'), checkout, brev
5486 5488 )
5487 5489 except error.FilteredRepoLookupError as exc:
5488 5490 msg = _(b'cannot update to target: %s') % exc.args[0]
5489 5491 exc.args = (msg,) + exc.args[1:]
5490 5492 raise
5491 5493 finally:
5492 5494 del repo._subtoppath
5493 5495
5494 5496 finally:
5495 5497 other.close()
5496 5498 # skip the remaining pull source if they are some conflict.
5497 5499 if update_conflict:
5498 5500 break
5499 5501 if update_conflict:
5500 5502 return 1
5501 5503 else:
5502 5504 return 0
5503 5505
5504 5506
5505 5507 @command(
5506 5508 b'purge|clean',
5507 5509 [
5508 5510 (b'a', b'abort-on-err', None, _(b'abort if an error occurs')),
5509 5511 (b'', b'all', None, _(b'purge ignored files too')),
5510 5512 (b'i', b'ignored', None, _(b'purge only ignored files')),
5511 5513 (b'', b'dirs', None, _(b'purge empty directories')),
5512 5514 (b'', b'files', None, _(b'purge files')),
5513 5515 (b'p', b'print', None, _(b'print filenames instead of deleting them')),
5514 5516 (
5515 5517 b'0',
5516 5518 b'print0',
5517 5519 None,
5518 5520 _(
5519 5521 b'end filenames with NUL, for use with xargs'
5520 5522 b' (implies -p/--print)'
5521 5523 ),
5522 5524 ),
5523 5525 (b'', b'confirm', None, _(b'ask before permanently deleting files')),
5524 5526 ]
5525 5527 + cmdutil.walkopts,
5526 5528 _(b'hg purge [OPTION]... [DIR]...'),
5527 5529 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
5528 5530 )
5529 5531 def purge(ui, repo, *dirs, **opts):
5530 5532 """removes files not tracked by Mercurial
5531 5533
5532 5534 Delete files not known to Mercurial. This is useful to test local
5533 5535 and uncommitted changes in an otherwise-clean source tree.
5534 5536
5535 5537 This means that purge will delete the following by default:
5536 5538
5537 5539 - Unknown files: files marked with "?" by :hg:`status`
5538 5540 - Empty directories: in fact Mercurial ignores directories unless
5539 5541 they contain files under source control management
5540 5542
5541 5543 But it will leave untouched:
5542 5544
5543 5545 - Modified and unmodified tracked files
5544 5546 - Ignored files (unless -i or --all is specified)
5545 5547 - New files added to the repository (with :hg:`add`)
5546 5548
5547 5549 The --files and --dirs options can be used to direct purge to delete
5548 5550 only files, only directories, or both. If neither option is given,
5549 5551 both will be deleted.
5550 5552
5551 5553 If directories are given on the command line, only files in these
5552 5554 directories are considered.
5553 5555
5554 5556 Be careful with purge, as you could irreversibly delete some files
5555 5557 you forgot to add to the repository. If you only want to print the
5556 5558 list of files that this program would delete, use the --print
5557 5559 option.
5558 5560 """
5559 5561 opts = pycompat.byteskwargs(opts)
5560 5562 cmdutil.check_at_most_one_arg(opts, b'all', b'ignored')
5561 5563
5562 5564 act = not opts.get(b'print')
5563 5565 eol = b'\n'
5564 5566 if opts.get(b'print0'):
5565 5567 eol = b'\0'
5566 5568 act = False # --print0 implies --print
5567 5569 if opts.get(b'all', False):
5568 5570 ignored = True
5569 5571 unknown = True
5570 5572 else:
5571 5573 ignored = opts.get(b'ignored', False)
5572 5574 unknown = not ignored
5573 5575
5574 5576 removefiles = opts.get(b'files')
5575 5577 removedirs = opts.get(b'dirs')
5576 5578 confirm = opts.get(b'confirm')
5577 5579 if confirm is None:
5578 5580 try:
5579 5581 extensions.find(b'purge')
5580 5582 confirm = False
5581 5583 except KeyError:
5582 5584 confirm = True
5583 5585
5584 5586 if not removefiles and not removedirs:
5585 5587 removefiles = True
5586 5588 removedirs = True
5587 5589
5588 5590 match = scmutil.match(repo[None], dirs, opts)
5589 5591
5590 5592 paths = mergemod.purge(
5591 5593 repo,
5592 5594 match,
5593 5595 unknown=unknown,
5594 5596 ignored=ignored,
5595 5597 removeemptydirs=removedirs,
5596 5598 removefiles=removefiles,
5597 5599 abortonerror=opts.get(b'abort_on_err'),
5598 5600 noop=not act,
5599 5601 confirm=confirm,
5600 5602 )
5601 5603
5602 5604 for path in paths:
5603 5605 if not act:
5604 5606 ui.write(b'%s%s' % (path, eol))
5605 5607
5606 5608
5607 5609 @command(
5608 5610 b'push',
5609 5611 [
5610 5612 (b'f', b'force', None, _(b'force push')),
5611 5613 (
5612 5614 b'r',
5613 5615 b'rev',
5614 5616 [],
5615 5617 _(b'a changeset intended to be included in the destination'),
5616 5618 _(b'REV'),
5617 5619 ),
5618 5620 (b'B', b'bookmark', [], _(b"bookmark to push"), _(b'BOOKMARK')),
5619 5621 (b'', b'all-bookmarks', None, _(b"push all bookmarks (EXPERIMENTAL)")),
5620 5622 (
5621 5623 b'b',
5622 5624 b'branch',
5623 5625 [],
5624 5626 _(b'a specific branch you would like to push'),
5625 5627 _(b'BRANCH'),
5626 5628 ),
5627 5629 (b'', b'new-branch', False, _(b'allow pushing a new branch')),
5628 5630 (
5629 5631 b'',
5630 5632 b'pushvars',
5631 5633 [],
5632 5634 _(b'variables that can be sent to server (ADVANCED)'),
5633 5635 ),
5634 5636 (
5635 5637 b'',
5636 5638 b'publish',
5637 5639 False,
5638 5640 _(b'push the changeset as public (EXPERIMENTAL)'),
5639 5641 ),
5640 5642 ]
5641 5643 + remoteopts,
5642 5644 _(b'[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]...'),
5643 5645 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
5644 5646 helpbasic=True,
5645 5647 )
5646 5648 def push(ui, repo, *dests, **opts):
5647 5649 """push changes to the specified destination
5648 5650
5649 5651 Push changesets from the local repository to the specified
5650 5652 destination.
5651 5653
5652 5654 This operation is symmetrical to pull: it is identical to a pull
5653 5655 in the destination repository from the current one.
5654 5656
5655 5657 By default, push will not allow creation of new heads at the
5656 5658 destination, since multiple heads would make it unclear which head
5657 5659 to use. In this situation, it is recommended to pull and merge
5658 5660 before pushing.
5659 5661
5660 5662 Use --new-branch if you want to allow push to create a new named
5661 5663 branch that is not present at the destination. This allows you to
5662 5664 only create a new branch without forcing other changes.
5663 5665
5664 5666 .. note::
5665 5667
5666 5668 Extra care should be taken with the -f/--force option,
5667 5669 which will push all new heads on all branches, an action which will
5668 5670 almost always cause confusion for collaborators.
5669 5671
5670 5672 If -r/--rev is used, the specified revision and all its ancestors
5671 5673 will be pushed to the remote repository.
5672 5674
5673 5675 If -B/--bookmark is used, the specified bookmarked revision, its
5674 5676 ancestors, and the bookmark will be pushed to the remote
5675 5677 repository. Specifying ``.`` is equivalent to specifying the active
5676 5678 bookmark's name. Use the --all-bookmarks option for pushing all
5677 5679 current bookmarks.
5678 5680
5679 5681 Please see :hg:`help urls` for important details about ``ssh://``
5680 5682 URLs. If DESTINATION is omitted, a default path will be used.
5681 5683
5682 5684 When passed multiple destinations, push will process them one after the
5683 5685 other, but stop should an error occur.
5684 5686
5685 5687 .. container:: verbose
5686 5688
5687 5689 The --pushvars option sends strings to the server that become
5688 5690 environment variables prepended with ``HG_USERVAR_``. For example,
5689 5691 ``--pushvars ENABLE_FEATURE=true``, provides the server side hooks with
5690 5692 ``HG_USERVAR_ENABLE_FEATURE=true`` as part of their environment.
5691 5693
5692 5694 pushvars can provide for user-overridable hooks as well as set debug
5693 5695 levels. One example is having a hook that blocks commits containing
5694 5696 conflict markers, but enables the user to override the hook if the file
5695 5697 is using conflict markers for testing purposes or the file format has
5696 5698 strings that look like conflict markers.
5697 5699
5698 5700 By default, servers will ignore `--pushvars`. To enable it add the
5699 5701 following to your configuration file::
5700 5702
5701 5703 [push]
5702 5704 pushvars.server = true
5703 5705
5704 5706 Returns 0 if push was successful, 1 if nothing to push.
5705 5707 """
5706 5708
5707 5709 opts = pycompat.byteskwargs(opts)
5708 5710
5709 5711 if opts.get(b'all_bookmarks'):
5710 5712 cmdutil.check_incompatible_arguments(
5711 5713 opts,
5712 5714 b'all_bookmarks',
5713 5715 [b'bookmark', b'rev'],
5714 5716 )
5715 5717 opts[b'bookmark'] = list(repo._bookmarks)
5716 5718
5717 5719 if opts.get(b'bookmark'):
5718 5720 ui.setconfig(b'bookmarks', b'pushing', opts[b'bookmark'], b'push')
5719 5721 for b in opts[b'bookmark']:
5720 5722 # translate -B options to -r so changesets get pushed
5721 5723 b = repo._bookmarks.expandname(b)
5722 5724 if b in repo._bookmarks:
5723 5725 opts.setdefault(b'rev', []).append(b)
5724 5726 else:
5725 5727 # if we try to push a deleted bookmark, translate it to null
5726 5728 # this lets simultaneous -r, -b options continue working
5727 5729 opts.setdefault(b'rev', []).append(b"null")
5728 5730
5729 5731 some_pushed = False
5730 5732 result = 0
5731 5733 for path in urlutil.get_push_paths(repo, ui, dests):
5732 5734 dest = path.pushloc or path.loc
5733 5735 branches = (path.branch, opts.get(b'branch') or [])
5734 5736 ui.status(_(b'pushing to %s\n') % urlutil.hidepassword(dest))
5735 5737 revs, checkout = hg.addbranchrevs(
5736 5738 repo, repo, branches, opts.get(b'rev')
5737 5739 )
5738 5740 other = hg.peer(repo, opts, dest)
5739 5741
5740 5742 try:
5741 5743 if revs:
5742 5744 revs = [repo[r].node() for r in logcmdutil.revrange(repo, revs)]
5743 5745 if not revs:
5744 5746 raise error.InputError(
5745 5747 _(b"specified revisions evaluate to an empty set"),
5746 5748 hint=_(b"use different revision arguments"),
5747 5749 )
5748 5750 elif path.pushrev:
5749 5751 # It doesn't make any sense to specify ancestor revisions. So limit
5750 5752 # to DAG heads to make discovery simpler.
5751 5753 expr = revsetlang.formatspec(b'heads(%r)', path.pushrev)
5752 5754 revs = scmutil.revrange(repo, [expr])
5753 5755 revs = [repo[rev].node() for rev in revs]
5754 5756 if not revs:
5755 5757 raise error.InputError(
5756 5758 _(
5757 5759 b'default push revset for path evaluates to an empty set'
5758 5760 )
5759 5761 )
5760 5762 elif ui.configbool(b'commands', b'push.require-revs'):
5761 5763 raise error.InputError(
5762 5764 _(b'no revisions specified to push'),
5763 5765 hint=_(b'did you mean "hg push -r ."?'),
5764 5766 )
5765 5767
5766 5768 repo._subtoppath = dest
5767 5769 try:
5768 5770 # push subrepos depth-first for coherent ordering
5769 5771 c = repo[b'.']
5770 5772 subs = c.substate # only repos that are committed
5771 5773 for s in sorted(subs):
5772 5774 sub_result = c.sub(s).push(opts)
5773 5775 if sub_result == 0:
5774 5776 return 1
5775 5777 finally:
5776 5778 del repo._subtoppath
5777 5779
5778 5780 opargs = dict(
5779 5781 opts.get(b'opargs', {})
5780 5782 ) # copy opargs since we may mutate it
5781 5783 opargs.setdefault(b'pushvars', []).extend(opts.get(b'pushvars', []))
5782 5784
5783 5785 pushop = exchange.push(
5784 5786 repo,
5785 5787 other,
5786 5788 opts.get(b'force'),
5787 5789 revs=revs,
5788 5790 newbranch=opts.get(b'new_branch'),
5789 5791 bookmarks=opts.get(b'bookmark', ()),
5790 5792 publish=opts.get(b'publish'),
5791 5793 opargs=opargs,
5792 5794 )
5793 5795
5794 5796 if pushop.cgresult == 0:
5795 5797 result = 1
5796 5798 elif pushop.cgresult is not None:
5797 5799 some_pushed = True
5798 5800
5799 5801 if pushop.bkresult is not None:
5800 5802 if pushop.bkresult == 2:
5801 5803 result = 2
5802 5804 elif not result and pushop.bkresult:
5803 5805 result = 2
5804 5806
5805 5807 if result:
5806 5808 break
5807 5809
5808 5810 finally:
5809 5811 other.close()
5810 5812 if result == 0 and not some_pushed:
5811 5813 result = 1
5812 5814 return result
5813 5815
5814 5816
5815 5817 @command(
5816 5818 b'recover',
5817 5819 [
5818 5820 (b'', b'verify', False, b"run `hg verify` after successful recover"),
5819 5821 ],
5820 5822 helpcategory=command.CATEGORY_MAINTENANCE,
5821 5823 )
5822 5824 def recover(ui, repo, **opts):
5823 5825 """roll back an interrupted transaction
5824 5826
5825 5827 Recover from an interrupted commit or pull.
5826 5828
5827 5829 This command tries to fix the repository status after an
5828 5830 interrupted operation. It should only be necessary when Mercurial
5829 5831 suggests it.
5830 5832
5831 5833 Returns 0 if successful, 1 if nothing to recover or verify fails.
5832 5834 """
5833 5835 ret = repo.recover()
5834 5836 if ret:
5835 5837 if opts['verify']:
5836 5838 return hg.verify(repo)
5837 5839 else:
5838 5840 msg = _(
5839 5841 b"(verify step skipped, run `hg verify` to check your "
5840 5842 b"repository content)\n"
5841 5843 )
5842 5844 ui.warn(msg)
5843 5845 return 0
5844 5846 return 1
5845 5847
5846 5848
5847 5849 @command(
5848 5850 b'remove|rm',
5849 5851 [
5850 5852 (b'A', b'after', None, _(b'record delete for missing files')),
5851 5853 (b'f', b'force', None, _(b'forget added files, delete modified files')),
5852 5854 ]
5853 5855 + subrepoopts
5854 5856 + walkopts
5855 5857 + dryrunopts,
5856 5858 _(b'[OPTION]... FILE...'),
5857 5859 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
5858 5860 helpbasic=True,
5859 5861 inferrepo=True,
5860 5862 )
5861 5863 def remove(ui, repo, *pats, **opts):
5862 5864 """remove the specified files on the next commit
5863 5865
5864 5866 Schedule the indicated files for removal from the current branch.
5865 5867
5866 5868 This command schedules the files to be removed at the next commit.
5867 5869 To undo a remove before that, see :hg:`revert`. To undo added
5868 5870 files, see :hg:`forget`.
5869 5871
5870 5872 .. container:: verbose
5871 5873
5872 5874 -A/--after can be used to remove only files that have already
5873 5875 been deleted, -f/--force can be used to force deletion, and -Af
5874 5876 can be used to remove files from the next revision without
5875 5877 deleting them from the working directory.
5876 5878
5877 5879 The following table details the behavior of remove for different
5878 5880 file states (columns) and option combinations (rows). The file
5879 5881 states are Added [A], Clean [C], Modified [M] and Missing [!]
5880 5882 (as reported by :hg:`status`). The actions are Warn, Remove
5881 5883 (from branch) and Delete (from disk):
5882 5884
5883 5885 ========= == == == ==
5884 5886 opt/state A C M !
5885 5887 ========= == == == ==
5886 5888 none W RD W R
5887 5889 -f R RD RD R
5888 5890 -A W W W R
5889 5891 -Af R R R R
5890 5892 ========= == == == ==
5891 5893
5892 5894 .. note::
5893 5895
5894 5896 :hg:`remove` never deletes files in Added [A] state from the
5895 5897 working directory, not even if ``--force`` is specified.
5896 5898
5897 5899 Returns 0 on success, 1 if any warnings encountered.
5898 5900 """
5899 5901
5900 5902 opts = pycompat.byteskwargs(opts)
5901 5903 after, force = opts.get(b'after'), opts.get(b'force')
5902 5904 dryrun = opts.get(b'dry_run')
5903 5905 if not pats and not after:
5904 5906 raise error.InputError(_(b'no files specified'))
5905 5907
5906 5908 m = scmutil.match(repo[None], pats, opts)
5907 5909 subrepos = opts.get(b'subrepos')
5908 5910 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
5909 5911 return cmdutil.remove(
5910 5912 ui, repo, m, b"", uipathfn, after, force, subrepos, dryrun=dryrun
5911 5913 )
5912 5914
5913 5915
5914 5916 @command(
5915 5917 b'rename|move|mv',
5916 5918 [
5917 5919 (b'', b'forget', None, _(b'unmark a destination file as renamed')),
5918 5920 (b'A', b'after', None, _(b'record a rename that has already occurred')),
5919 5921 (
5920 5922 b'',
5921 5923 b'at-rev',
5922 5924 b'',
5923 5925 _(b'(un)mark renames in the given revision (EXPERIMENTAL)'),
5924 5926 _(b'REV'),
5925 5927 ),
5926 5928 (
5927 5929 b'f',
5928 5930 b'force',
5929 5931 None,
5930 5932 _(b'forcibly move over an existing managed file'),
5931 5933 ),
5932 5934 ]
5933 5935 + walkopts
5934 5936 + dryrunopts,
5935 5937 _(b'[OPTION]... SOURCE... DEST'),
5936 5938 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
5937 5939 )
5938 5940 def rename(ui, repo, *pats, **opts):
5939 5941 """rename files; equivalent of copy + remove
5940 5942
5941 5943 Mark dest as copies of sources; mark sources for deletion. If dest
5942 5944 is a directory, copies are put in that directory. If dest is a
5943 5945 file, there can only be one source.
5944 5946
5945 5947 By default, this command copies the contents of files as they
5946 5948 exist in the working directory. If invoked with -A/--after, the
5947 5949 operation is recorded, but no copying is performed.
5948 5950
5949 5951 To undo marking a destination file as renamed, use --forget. With that
5950 5952 option, all given (positional) arguments are unmarked as renames. The
5951 5953 destination file(s) will be left in place (still tracked). The source
5952 5954 file(s) will not be restored. Note that :hg:`rename --forget` behaves
5953 5955 the same way as :hg:`copy --forget`.
5954 5956
5955 5957 This command takes effect with the next commit by default.
5956 5958
5957 5959 Returns 0 on success, 1 if errors are encountered.
5958 5960 """
5959 5961 opts = pycompat.byteskwargs(opts)
5960 5962 with repo.wlock():
5961 5963 return cmdutil.copy(ui, repo, pats, opts, rename=True)
5962 5964
5963 5965
5964 5966 @command(
5965 5967 b'resolve',
5966 5968 [
5967 5969 (b'a', b'all', None, _(b'select all unresolved files')),
5968 5970 (b'l', b'list', None, _(b'list state of files needing merge')),
5969 5971 (b'm', b'mark', None, _(b'mark files as resolved')),
5970 5972 (b'u', b'unmark', None, _(b'mark files as unresolved')),
5971 5973 (b'n', b'no-status', None, _(b'hide status prefix')),
5972 5974 (b'', b're-merge', None, _(b're-merge files')),
5973 5975 ]
5974 5976 + mergetoolopts
5975 5977 + walkopts
5976 5978 + formatteropts,
5977 5979 _(b'[OPTION]... [FILE]...'),
5978 5980 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
5979 5981 inferrepo=True,
5980 5982 )
5981 5983 def resolve(ui, repo, *pats, **opts):
5982 5984 """redo merges or set/view the merge status of files
5983 5985
5984 5986 Merges with unresolved conflicts are often the result of
5985 5987 non-interactive merging using the ``internal:merge`` configuration
5986 5988 setting, or a command-line merge tool like ``diff3``. The resolve
5987 5989 command is used to manage the files involved in a merge, after
5988 5990 :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the
5989 5991 working directory must have two parents). See :hg:`help
5990 5992 merge-tools` for information on configuring merge tools.
5991 5993
5992 5994 The resolve command can be used in the following ways:
5993 5995
5994 5996 - :hg:`resolve [--re-merge] [--tool TOOL] FILE...`: attempt to re-merge
5995 5997 the specified files, discarding any previous merge attempts. Re-merging
5996 5998 is not performed for files already marked as resolved. Use ``--all/-a``
5997 5999 to select all unresolved files. ``--tool`` can be used to specify
5998 6000 the merge tool used for the given files. It overrides the HGMERGE
5999 6001 environment variable and your configuration files. Previous file
6000 6002 contents are saved with a ``.orig`` suffix.
6001 6003
6002 6004 - :hg:`resolve -m [FILE]`: mark a file as having been resolved
6003 6005 (e.g. after having manually fixed-up the files). The default is
6004 6006 to mark all unresolved files.
6005 6007
6006 6008 - :hg:`resolve -u [FILE]...`: mark a file as unresolved. The
6007 6009 default is to mark all resolved files.
6008 6010
6009 6011 - :hg:`resolve -l`: list files which had or still have conflicts.
6010 6012 In the printed list, ``U`` = unresolved and ``R`` = resolved.
6011 6013 You can use ``set:unresolved()`` or ``set:resolved()`` to filter
6012 6014 the list. See :hg:`help filesets` for details.
6013 6015
6014 6016 .. note::
6015 6017
6016 6018 Mercurial will not let you commit files with unresolved merge
6017 6019 conflicts. You must use :hg:`resolve -m ...` before you can
6018 6020 commit after a conflicting merge.
6019 6021
6020 6022 .. container:: verbose
6021 6023
6022 6024 Template:
6023 6025
6024 6026 The following keywords are supported in addition to the common template
6025 6027 keywords and functions. See also :hg:`help templates`.
6026 6028
6027 6029 :mergestatus: String. Character denoting merge conflicts, ``U`` or ``R``.
6028 6030 :path: String. Repository-absolute path of the file.
6029 6031
6030 6032 Returns 0 on success, 1 if any files fail a resolve attempt.
6031 6033 """
6032 6034
6033 6035 opts = pycompat.byteskwargs(opts)
6034 6036 confirm = ui.configbool(b'commands', b'resolve.confirm')
6035 6037 flaglist = b'all mark unmark list no_status re_merge'.split()
6036 6038 all, mark, unmark, show, nostatus, remerge = [opts.get(o) for o in flaglist]
6037 6039
6038 6040 actioncount = len(list(filter(None, [show, mark, unmark, remerge])))
6039 6041 if actioncount > 1:
6040 6042 raise error.InputError(_(b"too many actions specified"))
6041 6043 elif actioncount == 0 and ui.configbool(
6042 6044 b'commands', b'resolve.explicit-re-merge'
6043 6045 ):
6044 6046 hint = _(b'use --mark, --unmark, --list or --re-merge')
6045 6047 raise error.InputError(_(b'no action specified'), hint=hint)
6046 6048 if pats and all:
6047 6049 raise error.InputError(_(b"can't specify --all and patterns"))
6048 6050 if not (all or pats or show or mark or unmark):
6049 6051 raise error.InputError(
6050 6052 _(b'no files or directories specified'),
6051 6053 hint=b'use --all to re-merge all unresolved files',
6052 6054 )
6053 6055
6054 6056 if confirm:
6055 6057 if all:
6056 6058 if ui.promptchoice(
6057 6059 _(b're-merge all unresolved files (yn)?$$ &Yes $$ &No')
6058 6060 ):
6059 6061 raise error.CanceledError(_(b'user quit'))
6060 6062 if mark and not pats:
6061 6063 if ui.promptchoice(
6062 6064 _(
6063 6065 b'mark all unresolved files as resolved (yn)?'
6064 6066 b'$$ &Yes $$ &No'
6065 6067 )
6066 6068 ):
6067 6069 raise error.CanceledError(_(b'user quit'))
6068 6070 if unmark and not pats:
6069 6071 if ui.promptchoice(
6070 6072 _(
6071 6073 b'mark all resolved files as unresolved (yn)?'
6072 6074 b'$$ &Yes $$ &No'
6073 6075 )
6074 6076 ):
6075 6077 raise error.CanceledError(_(b'user quit'))
6076 6078
6077 6079 uipathfn = scmutil.getuipathfn(repo)
6078 6080
6079 6081 if show:
6080 6082 ui.pager(b'resolve')
6081 6083 fm = ui.formatter(b'resolve', opts)
6082 6084 ms = mergestatemod.mergestate.read(repo)
6083 6085 wctx = repo[None]
6084 6086 m = scmutil.match(wctx, pats, opts)
6085 6087
6086 6088 # Labels and keys based on merge state. Unresolved path conflicts show
6087 6089 # as 'P'. Resolved path conflicts show as 'R', the same as normal
6088 6090 # resolved conflicts.
6089 6091 mergestateinfo = {
6090 6092 mergestatemod.MERGE_RECORD_UNRESOLVED: (
6091 6093 b'resolve.unresolved',
6092 6094 b'U',
6093 6095 ),
6094 6096 mergestatemod.MERGE_RECORD_RESOLVED: (b'resolve.resolved', b'R'),
6095 6097 mergestatemod.MERGE_RECORD_UNRESOLVED_PATH: (
6096 6098 b'resolve.unresolved',
6097 6099 b'P',
6098 6100 ),
6099 6101 mergestatemod.MERGE_RECORD_RESOLVED_PATH: (
6100 6102 b'resolve.resolved',
6101 6103 b'R',
6102 6104 ),
6103 6105 }
6104 6106
6105 6107 for f in ms:
6106 6108 if not m(f):
6107 6109 continue
6108 6110
6109 6111 label, key = mergestateinfo[ms[f]]
6110 6112 fm.startitem()
6111 6113 fm.context(ctx=wctx)
6112 6114 fm.condwrite(not nostatus, b'mergestatus', b'%s ', key, label=label)
6113 6115 fm.data(path=f)
6114 6116 fm.plain(b'%s\n' % uipathfn(f), label=label)
6115 6117 fm.end()
6116 6118 return 0
6117 6119
6118 6120 with repo.wlock():
6119 6121 ms = mergestatemod.mergestate.read(repo)
6120 6122
6121 6123 if not (ms.active() or repo.dirstate.p2() != repo.nullid):
6122 6124 raise error.StateError(
6123 6125 _(b'resolve command not applicable when not merging')
6124 6126 )
6125 6127
6126 6128 wctx = repo[None]
6127 6129 m = scmutil.match(wctx, pats, opts)
6128 6130 ret = 0
6129 6131 didwork = False
6130 6132
6131 6133 hasconflictmarkers = []
6132 6134 if mark:
6133 6135 markcheck = ui.config(b'commands', b'resolve.mark-check')
6134 6136 if markcheck not in [b'warn', b'abort']:
6135 6137 # Treat all invalid / unrecognized values as 'none'.
6136 6138 markcheck = False
6137 6139 for f in ms:
6138 6140 if not m(f):
6139 6141 continue
6140 6142
6141 6143 didwork = True
6142 6144
6143 6145 # path conflicts must be resolved manually
6144 6146 if ms[f] in (
6145 6147 mergestatemod.MERGE_RECORD_UNRESOLVED_PATH,
6146 6148 mergestatemod.MERGE_RECORD_RESOLVED_PATH,
6147 6149 ):
6148 6150 if mark:
6149 6151 ms.mark(f, mergestatemod.MERGE_RECORD_RESOLVED_PATH)
6150 6152 elif unmark:
6151 6153 ms.mark(f, mergestatemod.MERGE_RECORD_UNRESOLVED_PATH)
6152 6154 elif ms[f] == mergestatemod.MERGE_RECORD_UNRESOLVED_PATH:
6153 6155 ui.warn(
6154 6156 _(b'%s: path conflict must be resolved manually\n')
6155 6157 % uipathfn(f)
6156 6158 )
6157 6159 continue
6158 6160
6159 6161 if mark:
6160 6162 if markcheck:
6161 6163 fdata = repo.wvfs.tryread(f)
6162 6164 if (
6163 6165 filemerge.hasconflictmarkers(fdata)
6164 6166 and ms[f] != mergestatemod.MERGE_RECORD_RESOLVED
6165 6167 ):
6166 6168 hasconflictmarkers.append(f)
6167 6169 ms.mark(f, mergestatemod.MERGE_RECORD_RESOLVED)
6168 6170 elif unmark:
6169 6171 ms.mark(f, mergestatemod.MERGE_RECORD_UNRESOLVED)
6170 6172 else:
6171 6173 # backup pre-resolve (merge uses .orig for its own purposes)
6172 6174 a = repo.wjoin(f)
6173 6175 try:
6174 6176 util.copyfile(a, a + b".resolve")
6175 6177 except FileNotFoundError:
6176 6178 pass
6177 6179
6178 6180 try:
6179 6181 # preresolve file
6180 6182 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
6181 6183 with ui.configoverride(overrides, b'resolve'):
6182 6184 r = ms.resolve(f, wctx)
6183 6185 if r:
6184 6186 ret = 1
6185 6187 finally:
6186 6188 ms.commit()
6187 6189
6188 6190 # replace filemerge's .orig file with our resolve file
6189 6191 try:
6190 6192 util.rename(
6191 6193 a + b".resolve", scmutil.backuppath(ui, repo, f)
6192 6194 )
6193 6195 except FileNotFoundError:
6194 6196 pass
6195 6197
6196 6198 if hasconflictmarkers:
6197 6199 ui.warn(
6198 6200 _(
6199 6201 b'warning: the following files still have conflict '
6200 6202 b'markers:\n'
6201 6203 )
6202 6204 + b''.join(
6203 6205 b' ' + uipathfn(f) + b'\n' for f in hasconflictmarkers
6204 6206 )
6205 6207 )
6206 6208 if markcheck == b'abort' and not all and not pats:
6207 6209 raise error.StateError(
6208 6210 _(b'conflict markers detected'),
6209 6211 hint=_(b'use --all to mark anyway'),
6210 6212 )
6211 6213
6212 6214 ms.commit()
6213 6215 branchmerge = repo.dirstate.p2() != repo.nullid
6214 6216 # resolve is not doing a parent change here, however, `record updates`
6215 6217 # will call some dirstate API that at intended for parent changes call.
6216 6218 # Ideally we would not need this and could implement a lighter version
6217 6219 # of the recordupdateslogic that will not have to deal with the part
6218 6220 # related to parent changes. However this would requires that:
6219 6221 # - we are sure we passed around enough information at update/merge
6220 6222 # time to no longer needs it at `hg resolve time`
6221 6223 # - we are sure we store that information well enough to be able to reuse it
6222 6224 # - we are the necessary logic to reuse it right.
6223 6225 #
6224 6226 # All this should eventually happens, but in the mean time, we use this
6225 6227 # context manager slightly out of the context it should be.
6226 6228 with repo.dirstate.parentchange():
6227 6229 mergestatemod.recordupdates(repo, ms.actions(), branchmerge, None)
6228 6230
6229 6231 if not didwork and pats:
6230 6232 hint = None
6231 6233 if not any([p for p in pats if p.find(b':') >= 0]):
6232 6234 pats = [b'path:%s' % p for p in pats]
6233 6235 m = scmutil.match(wctx, pats, opts)
6234 6236 for f in ms:
6235 6237 if not m(f):
6236 6238 continue
6237 6239
6238 6240 def flag(o):
6239 6241 if o == b're_merge':
6240 6242 return b'--re-merge '
6241 6243 return b'-%s ' % o[0:1]
6242 6244
6243 6245 flags = b''.join([flag(o) for o in flaglist if opts.get(o)])
6244 6246 hint = _(b"(try: hg resolve %s%s)\n") % (
6245 6247 flags,
6246 6248 b' '.join(pats),
6247 6249 )
6248 6250 break
6249 6251 ui.warn(_(b"arguments do not match paths that need resolving\n"))
6250 6252 if hint:
6251 6253 ui.warn(hint)
6252 6254
6253 6255 unresolvedf = ms.unresolvedcount()
6254 6256 if not unresolvedf:
6255 6257 ui.status(_(b'(no more unresolved files)\n'))
6256 6258 cmdutil.checkafterresolved(repo)
6257 6259
6258 6260 return ret
6259 6261
6260 6262
6261 6263 @command(
6262 6264 b'revert',
6263 6265 [
6264 6266 (b'a', b'all', None, _(b'revert all changes when no arguments given')),
6265 6267 (b'd', b'date', b'', _(b'tipmost revision matching date'), _(b'DATE')),
6266 6268 (b'r', b'rev', b'', _(b'revert to the specified revision'), _(b'REV')),
6267 6269 (b'C', b'no-backup', None, _(b'do not save backup copies of files')),
6268 6270 (b'i', b'interactive', None, _(b'interactively select the changes')),
6269 6271 ]
6270 6272 + walkopts
6271 6273 + dryrunopts,
6272 6274 _(b'[OPTION]... [-r REV] [NAME]...'),
6273 6275 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
6274 6276 )
6275 6277 def revert(ui, repo, *pats, **opts):
6276 6278 """restore files to their checkout state
6277 6279
6278 6280 .. note::
6279 6281
6280 6282 To check out earlier revisions, you should use :hg:`update REV`.
6281 6283 To cancel an uncommitted merge (and lose your changes),
6282 6284 use :hg:`merge --abort`.
6283 6285
6284 6286 With no revision specified, revert the specified files or directories
6285 6287 to the contents they had in the parent of the working directory.
6286 6288 This restores the contents of files to an unmodified
6287 6289 state and unschedules adds, removes, copies, and renames. If the
6288 6290 working directory has two parents, you must explicitly specify a
6289 6291 revision.
6290 6292
6291 6293 Using the -r/--rev or -d/--date options, revert the given files or
6292 6294 directories to their states as of a specific revision. Because
6293 6295 revert does not change the working directory parents, this will
6294 6296 cause these files to appear modified. This can be helpful to "back
6295 6297 out" some or all of an earlier change. See :hg:`backout` for a
6296 6298 related method.
6297 6299
6298 6300 Modified files are saved with a .orig suffix before reverting.
6299 6301 To disable these backups, use --no-backup. It is possible to store
6300 6302 the backup files in a custom directory relative to the root of the
6301 6303 repository by setting the ``ui.origbackuppath`` configuration
6302 6304 option.
6303 6305
6304 6306 See :hg:`help dates` for a list of formats valid for -d/--date.
6305 6307
6306 6308 See :hg:`help backout` for a way to reverse the effect of an
6307 6309 earlier changeset.
6308 6310
6309 6311 Returns 0 on success.
6310 6312 """
6311 6313
6312 6314 opts = pycompat.byteskwargs(opts)
6313 6315 if opts.get(b"date"):
6314 6316 cmdutil.check_incompatible_arguments(opts, b'date', [b'rev'])
6315 6317 opts[b"rev"] = cmdutil.finddate(ui, repo, opts[b"date"])
6316 6318
6317 6319 parent, p2 = repo.dirstate.parents()
6318 6320 if not opts.get(b'rev') and p2 != repo.nullid:
6319 6321 # revert after merge is a trap for new users (issue2915)
6320 6322 raise error.InputError(
6321 6323 _(b'uncommitted merge with no revision specified'),
6322 6324 hint=_(b"use 'hg update' or see 'hg help revert'"),
6323 6325 )
6324 6326
6325 6327 rev = opts.get(b'rev')
6326 6328 if rev:
6327 6329 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
6328 6330 ctx = logcmdutil.revsingle(repo, rev)
6329 6331
6330 6332 if not (
6331 6333 pats
6332 6334 or opts.get(b'include')
6333 6335 or opts.get(b'exclude')
6334 6336 or opts.get(b'all')
6335 6337 or opts.get(b'interactive')
6336 6338 ):
6337 6339 msg = _(b"no files or directories specified")
6338 6340 if p2 != repo.nullid:
6339 6341 hint = _(
6340 6342 b"uncommitted merge, use --all to discard all changes,"
6341 6343 b" or 'hg update -C .' to abort the merge"
6342 6344 )
6343 6345 raise error.InputError(msg, hint=hint)
6344 6346 dirty = any(repo.status())
6345 6347 node = ctx.node()
6346 6348 if node != parent:
6347 6349 if dirty:
6348 6350 hint = (
6349 6351 _(
6350 6352 b"uncommitted changes, use --all to discard all"
6351 6353 b" changes, or 'hg update %d' to update"
6352 6354 )
6353 6355 % ctx.rev()
6354 6356 )
6355 6357 else:
6356 6358 hint = (
6357 6359 _(
6358 6360 b"use --all to revert all files,"
6359 6361 b" or 'hg update %d' to update"
6360 6362 )
6361 6363 % ctx.rev()
6362 6364 )
6363 6365 elif dirty:
6364 6366 hint = _(b"uncommitted changes, use --all to discard all changes")
6365 6367 else:
6366 6368 hint = _(b"use --all to revert all files")
6367 6369 raise error.InputError(msg, hint=hint)
6368 6370
6369 6371 return cmdutil.revert(ui, repo, ctx, *pats, **pycompat.strkwargs(opts))
6370 6372
6371 6373
6372 6374 @command(
6373 6375 b'rollback',
6374 6376 dryrunopts + [(b'f', b'force', False, _(b'ignore safety measures'))],
6375 6377 helpcategory=command.CATEGORY_MAINTENANCE,
6376 6378 )
6377 6379 def rollback(ui, repo, **opts):
6378 6380 """roll back the last transaction (DANGEROUS) (DEPRECATED)
6379 6381
6380 6382 Please use :hg:`commit --amend` instead of rollback to correct
6381 6383 mistakes in the last commit.
6382 6384
6383 6385 This command should be used with care. There is only one level of
6384 6386 rollback, and there is no way to undo a rollback. It will also
6385 6387 restore the dirstate at the time of the last transaction, losing
6386 6388 any dirstate changes since that time. This command does not alter
6387 6389 the working directory.
6388 6390
6389 6391 Transactions are used to encapsulate the effects of all commands
6390 6392 that create new changesets or propagate existing changesets into a
6391 6393 repository.
6392 6394
6393 6395 .. container:: verbose
6394 6396
6395 6397 For example, the following commands are transactional, and their
6396 6398 effects can be rolled back:
6397 6399
6398 6400 - commit
6399 6401 - import
6400 6402 - pull
6401 6403 - push (with this repository as the destination)
6402 6404 - unbundle
6403 6405
6404 6406 To avoid permanent data loss, rollback will refuse to rollback a
6405 6407 commit transaction if it isn't checked out. Use --force to
6406 6408 override this protection.
6407 6409
6408 6410 The rollback command can be entirely disabled by setting the
6409 6411 ``ui.rollback`` configuration setting to false. If you're here
6410 6412 because you want to use rollback and it's disabled, you can
6411 6413 re-enable the command by setting ``ui.rollback`` to true.
6412 6414
6413 6415 This command is not intended for use on public repositories. Once
6414 6416 changes are visible for pull by other users, rolling a transaction
6415 6417 back locally is ineffective (someone else may already have pulled
6416 6418 the changes). Furthermore, a race is possible with readers of the
6417 6419 repository; for example an in-progress pull from the repository
6418 6420 may fail if a rollback is performed.
6419 6421
6420 6422 Returns 0 on success, 1 if no rollback data is available.
6421 6423 """
6422 6424 if not ui.configbool(b'ui', b'rollback'):
6423 6425 raise error.Abort(
6424 6426 _(b'rollback is disabled because it is unsafe'),
6425 6427 hint=b'see `hg help -v rollback` for information',
6426 6428 )
6427 6429 return repo.rollback(dryrun=opts.get('dry_run'), force=opts.get('force'))
6428 6430
6429 6431
6430 6432 @command(
6431 6433 b'root',
6432 6434 [] + formatteropts,
6433 6435 intents={INTENT_READONLY},
6434 6436 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
6435 6437 )
6436 6438 def root(ui, repo, **opts):
6437 6439 """print the root (top) of the current working directory
6438 6440
6439 6441 Print the root directory of the current repository.
6440 6442
6441 6443 .. container:: verbose
6442 6444
6443 6445 Template:
6444 6446
6445 6447 The following keywords are supported in addition to the common template
6446 6448 keywords and functions. See also :hg:`help templates`.
6447 6449
6448 6450 :hgpath: String. Path to the .hg directory.
6449 6451 :storepath: String. Path to the directory holding versioned data.
6450 6452
6451 6453 Returns 0 on success.
6452 6454 """
6453 6455 opts = pycompat.byteskwargs(opts)
6454 6456 with ui.formatter(b'root', opts) as fm:
6455 6457 fm.startitem()
6456 6458 fm.write(b'reporoot', b'%s\n', repo.root)
6457 6459 fm.data(hgpath=repo.path, storepath=repo.spath)
6458 6460
6459 6461
6460 6462 @command(
6461 6463 b'serve',
6462 6464 [
6463 6465 (
6464 6466 b'A',
6465 6467 b'accesslog',
6466 6468 b'',
6467 6469 _(b'name of access log file to write to'),
6468 6470 _(b'FILE'),
6469 6471 ),
6470 6472 (b'd', b'daemon', None, _(b'run server in background')),
6471 6473 (b'', b'daemon-postexec', [], _(b'used internally by daemon mode')),
6472 6474 (
6473 6475 b'E',
6474 6476 b'errorlog',
6475 6477 b'',
6476 6478 _(b'name of error log file to write to'),
6477 6479 _(b'FILE'),
6478 6480 ),
6479 6481 # use string type, then we can check if something was passed
6480 6482 (
6481 6483 b'p',
6482 6484 b'port',
6483 6485 b'',
6484 6486 _(b'port to listen on (default: 8000)'),
6485 6487 _(b'PORT'),
6486 6488 ),
6487 6489 (
6488 6490 b'a',
6489 6491 b'address',
6490 6492 b'',
6491 6493 _(b'address to listen on (default: all interfaces)'),
6492 6494 _(b'ADDR'),
6493 6495 ),
6494 6496 (
6495 6497 b'',
6496 6498 b'prefix',
6497 6499 b'',
6498 6500 _(b'prefix path to serve from (default: server root)'),
6499 6501 _(b'PREFIX'),
6500 6502 ),
6501 6503 (
6502 6504 b'n',
6503 6505 b'name',
6504 6506 b'',
6505 6507 _(b'name to show in web pages (default: working directory)'),
6506 6508 _(b'NAME'),
6507 6509 ),
6508 6510 (
6509 6511 b'',
6510 6512 b'web-conf',
6511 6513 b'',
6512 6514 _(b"name of the hgweb config file (see 'hg help hgweb')"),
6513 6515 _(b'FILE'),
6514 6516 ),
6515 6517 (
6516 6518 b'',
6517 6519 b'webdir-conf',
6518 6520 b'',
6519 6521 _(b'name of the hgweb config file (DEPRECATED)'),
6520 6522 _(b'FILE'),
6521 6523 ),
6522 6524 (
6523 6525 b'',
6524 6526 b'pid-file',
6525 6527 b'',
6526 6528 _(b'name of file to write process ID to'),
6527 6529 _(b'FILE'),
6528 6530 ),
6529 6531 (b'', b'stdio', None, _(b'for remote clients (ADVANCED)')),
6530 6532 (
6531 6533 b'',
6532 6534 b'cmdserver',
6533 6535 b'',
6534 6536 _(b'for remote clients (ADVANCED)'),
6535 6537 _(b'MODE'),
6536 6538 ),
6537 6539 (b't', b'templates', b'', _(b'web templates to use'), _(b'TEMPLATE')),
6538 6540 (b'', b'style', b'', _(b'template style to use'), _(b'STYLE')),
6539 6541 (b'6', b'ipv6', None, _(b'use IPv6 in addition to IPv4')),
6540 6542 (b'', b'certificate', b'', _(b'SSL certificate file'), _(b'FILE')),
6541 6543 (b'', b'print-url', None, _(b'start and print only the URL')),
6542 6544 ]
6543 6545 + subrepoopts,
6544 6546 _(b'[OPTION]...'),
6545 6547 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
6546 6548 helpbasic=True,
6547 6549 optionalrepo=True,
6548 6550 )
6549 6551 def serve(ui, repo, **opts):
6550 6552 """start stand-alone webserver
6551 6553
6552 6554 Start a local HTTP repository browser and pull server. You can use
6553 6555 this for ad-hoc sharing and browsing of repositories. It is
6554 6556 recommended to use a real web server to serve a repository for
6555 6557 longer periods of time.
6556 6558
6557 6559 Please note that the server does not implement access control.
6558 6560 This means that, by default, anybody can read from the server and
6559 6561 nobody can write to it by default. Set the ``web.allow-push``
6560 6562 option to ``*`` to allow everybody to push to the server. You
6561 6563 should use a real web server if you need to authenticate users.
6562 6564
6563 6565 By default, the server logs accesses to stdout and errors to
6564 6566 stderr. Use the -A/--accesslog and -E/--errorlog options to log to
6565 6567 files.
6566 6568
6567 6569 To have the server choose a free port number to listen on, specify
6568 6570 a port number of 0; in this case, the server will print the port
6569 6571 number it uses.
6570 6572
6571 6573 Returns 0 on success.
6572 6574 """
6573 6575
6574 6576 cmdutil.check_incompatible_arguments(opts, 'stdio', ['cmdserver'])
6575 6577 opts = pycompat.byteskwargs(opts)
6576 6578 if opts[b"print_url"] and ui.verbose:
6577 6579 raise error.InputError(_(b"cannot use --print-url with --verbose"))
6578 6580
6579 6581 if opts[b"stdio"]:
6580 6582 if repo is None:
6581 6583 raise error.RepoError(
6582 6584 _(b"there is no Mercurial repository here (.hg not found)")
6583 6585 )
6584 6586 s = wireprotoserver.sshserver(ui, repo)
6585 6587 s.serve_forever()
6586 6588 return
6587 6589
6588 6590 service = server.createservice(ui, repo, opts)
6589 6591 return server.runservice(opts, initfn=service.init, runfn=service.run)
6590 6592
6591 6593
6592 6594 @command(
6593 6595 b'shelve',
6594 6596 [
6595 6597 (
6596 6598 b'A',
6597 6599 b'addremove',
6598 6600 None,
6599 6601 _(b'mark new/missing files as added/removed before shelving'),
6600 6602 ),
6601 6603 (b'u', b'unknown', None, _(b'store unknown files in the shelve')),
6602 6604 (b'', b'cleanup', None, _(b'delete all shelved changes')),
6603 6605 (
6604 6606 b'',
6605 6607 b'date',
6606 6608 b'',
6607 6609 _(b'shelve with the specified commit date'),
6608 6610 _(b'DATE'),
6609 6611 ),
6610 6612 (b'd', b'delete', None, _(b'delete the named shelved change(s)')),
6611 6613 (b'e', b'edit', False, _(b'invoke editor on commit messages')),
6612 6614 (
6613 6615 b'k',
6614 6616 b'keep',
6615 6617 False,
6616 6618 _(b'shelve, but keep changes in the working directory'),
6617 6619 ),
6618 6620 (b'l', b'list', None, _(b'list current shelves')),
6619 6621 (b'm', b'message', b'', _(b'use text as shelve message'), _(b'TEXT')),
6620 6622 (
6621 6623 b'n',
6622 6624 b'name',
6623 6625 b'',
6624 6626 _(b'use the given name for the shelved commit'),
6625 6627 _(b'NAME'),
6626 6628 ),
6627 6629 (
6628 6630 b'p',
6629 6631 b'patch',
6630 6632 None,
6631 6633 _(
6632 6634 b'output patches for changes (provide the names of the shelved '
6633 6635 b'changes as positional arguments)'
6634 6636 ),
6635 6637 ),
6636 6638 (b'i', b'interactive', None, _(b'interactive mode')),
6637 6639 (
6638 6640 b'',
6639 6641 b'stat',
6640 6642 None,
6641 6643 _(
6642 6644 b'output diffstat-style summary of changes (provide the names of '
6643 6645 b'the shelved changes as positional arguments)'
6644 6646 ),
6645 6647 ),
6646 6648 ]
6647 6649 + cmdutil.walkopts,
6648 6650 _(b'hg shelve [OPTION]... [FILE]...'),
6649 6651 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
6650 6652 )
6651 6653 def shelve(ui, repo, *pats, **opts):
6652 6654 """save and set aside changes from the working directory
6653 6655
6654 6656 Shelving takes files that "hg status" reports as not clean, saves
6655 6657 the modifications to a bundle (a shelved change), and reverts the
6656 6658 files so that their state in the working directory becomes clean.
6657 6659
6658 6660 To restore these changes to the working directory, using "hg
6659 6661 unshelve"; this will work even if you switch to a different
6660 6662 commit.
6661 6663
6662 6664 When no files are specified, "hg shelve" saves all not-clean
6663 6665 files. If specific files or directories are named, only changes to
6664 6666 those files are shelved.
6665 6667
6666 6668 In bare shelve (when no files are specified, without interactive,
6667 6669 include and exclude option), shelving remembers information if the
6668 6670 working directory was on newly created branch, in other words working
6669 6671 directory was on different branch than its first parent. In this
6670 6672 situation unshelving restores branch information to the working directory.
6671 6673
6672 6674 Each shelved change has a name that makes it easier to find later.
6673 6675 The name of a shelved change defaults to being based on the active
6674 6676 bookmark, or if there is no active bookmark, the current named
6675 6677 branch. To specify a different name, use ``--name``.
6676 6678
6677 6679 To see a list of existing shelved changes, use the ``--list``
6678 6680 option. For each shelved change, this will print its name, age,
6679 6681 and description; use ``--patch`` or ``--stat`` for more details.
6680 6682
6681 6683 To delete specific shelved changes, use ``--delete``. To delete
6682 6684 all shelved changes, use ``--cleanup``.
6683 6685 """
6684 6686 opts = pycompat.byteskwargs(opts)
6685 6687 allowables = [
6686 6688 (b'addremove', {b'create'}), # 'create' is pseudo action
6687 6689 (b'unknown', {b'create'}),
6688 6690 (b'cleanup', {b'cleanup'}),
6689 6691 # ('date', {'create'}), # ignored for passing '--date "0 0"' in tests
6690 6692 (b'delete', {b'delete'}),
6691 6693 (b'edit', {b'create'}),
6692 6694 (b'keep', {b'create'}),
6693 6695 (b'list', {b'list'}),
6694 6696 (b'message', {b'create'}),
6695 6697 (b'name', {b'create'}),
6696 6698 (b'patch', {b'patch', b'list'}),
6697 6699 (b'stat', {b'stat', b'list'}),
6698 6700 ]
6699 6701
6700 6702 def checkopt(opt):
6701 6703 if opts.get(opt):
6702 6704 for i, allowable in allowables:
6703 6705 if opts[i] and opt not in allowable:
6704 6706 raise error.InputError(
6705 6707 _(
6706 6708 b"options '--%s' and '--%s' may not be "
6707 6709 b"used together"
6708 6710 )
6709 6711 % (opt, i)
6710 6712 )
6711 6713 return True
6712 6714
6713 6715 if checkopt(b'cleanup'):
6714 6716 if pats:
6715 6717 raise error.InputError(
6716 6718 _(b"cannot specify names when using '--cleanup'")
6717 6719 )
6718 6720 return shelvemod.cleanupcmd(ui, repo)
6719 6721 elif checkopt(b'delete'):
6720 6722 return shelvemod.deletecmd(ui, repo, pats)
6721 6723 elif checkopt(b'list'):
6722 6724 return shelvemod.listcmd(ui, repo, pats, opts)
6723 6725 elif checkopt(b'patch') or checkopt(b'stat'):
6724 6726 return shelvemod.patchcmds(ui, repo, pats, opts)
6725 6727 else:
6726 6728 return shelvemod.createcmd(ui, repo, pats, opts)
6727 6729
6728 6730
6729 6731 _NOTTERSE = b'nothing'
6730 6732
6731 6733
6732 6734 @command(
6733 6735 b'status|st',
6734 6736 [
6735 6737 (b'A', b'all', None, _(b'show status of all files')),
6736 6738 (b'm', b'modified', None, _(b'show only modified files')),
6737 6739 (b'a', b'added', None, _(b'show only added files')),
6738 6740 (b'r', b'removed', None, _(b'show only removed files')),
6739 6741 (b'd', b'deleted', None, _(b'show only missing files')),
6740 6742 (b'c', b'clean', None, _(b'show only files without changes')),
6741 6743 (b'u', b'unknown', None, _(b'show only unknown (not tracked) files')),
6742 6744 (b'i', b'ignored', None, _(b'show only ignored files')),
6743 6745 (b'n', b'no-status', None, _(b'hide status prefix')),
6744 6746 (b't', b'terse', _NOTTERSE, _(b'show the terse output (EXPERIMENTAL)')),
6745 6747 (
6746 6748 b'C',
6747 6749 b'copies',
6748 6750 None,
6749 6751 _(b'show source of copied files (DEFAULT: ui.statuscopies)'),
6750 6752 ),
6751 6753 (
6752 6754 b'0',
6753 6755 b'print0',
6754 6756 None,
6755 6757 _(b'end filenames with NUL, for use with xargs'),
6756 6758 ),
6757 6759 (b'', b'rev', [], _(b'show difference from revision'), _(b'REV')),
6758 6760 (
6759 6761 b'',
6760 6762 b'change',
6761 6763 b'',
6762 6764 _(b'list the changed files of a revision'),
6763 6765 _(b'REV'),
6764 6766 ),
6765 6767 ]
6766 6768 + walkopts
6767 6769 + subrepoopts
6768 6770 + formatteropts,
6769 6771 _(b'[OPTION]... [FILE]...'),
6770 6772 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
6771 6773 helpbasic=True,
6772 6774 inferrepo=True,
6773 6775 intents={INTENT_READONLY},
6774 6776 )
6775 6777 def status(ui, repo, *pats, **opts):
6776 6778 """show changed files in the working directory
6777 6779
6778 6780 Show status of files in the repository. If names are given, only
6779 6781 files that match are shown. Files that are clean or ignored or
6780 6782 the source of a copy/move operation, are not listed unless
6781 6783 -c/--clean, -i/--ignored, -C/--copies or -A/--all are given.
6782 6784 Unless options described with "show only ..." are given, the
6783 6785 options -mardu are used.
6784 6786
6785 6787 Option -q/--quiet hides untracked (unknown and ignored) files
6786 6788 unless explicitly requested with -u/--unknown or -i/--ignored.
6787 6789
6788 6790 .. note::
6789 6791
6790 6792 :hg:`status` may appear to disagree with diff if permissions have
6791 6793 changed or a merge has occurred. The standard diff format does
6792 6794 not report permission changes and diff only reports changes
6793 6795 relative to one merge parent.
6794 6796
6795 6797 If one revision is given, it is used as the base revision.
6796 6798 If two revisions are given, the differences between them are
6797 6799 shown. The --change option can also be used as a shortcut to list
6798 6800 the changed files of a revision from its first parent.
6799 6801
6800 6802 The codes used to show the status of files are::
6801 6803
6802 6804 M = modified
6803 6805 A = added
6804 6806 R = removed
6805 6807 C = clean
6806 6808 ! = missing (deleted by non-hg command, but still tracked)
6807 6809 ? = not tracked
6808 6810 I = ignored
6809 6811 = origin of the previous file (with --copies)
6810 6812
6811 6813 .. container:: verbose
6812 6814
6813 6815 The -t/--terse option abbreviates the output by showing only the directory
6814 6816 name if all the files in it share the same status. The option takes an
6815 6817 argument indicating the statuses to abbreviate: 'm' for 'modified', 'a'
6816 6818 for 'added', 'r' for 'removed', 'd' for 'deleted', 'u' for 'unknown', 'i'
6817 6819 for 'ignored' and 'c' for clean.
6818 6820
6819 6821 It abbreviates only those statuses which are passed. Note that clean and
6820 6822 ignored files are not displayed with '--terse ic' unless the -c/--clean
6821 6823 and -i/--ignored options are also used.
6822 6824
6823 6825 The -v/--verbose option shows information when the repository is in an
6824 6826 unfinished merge, shelve, rebase state etc. You can have this behavior
6825 6827 turned on by default by enabling the ``commands.status.verbose`` option.
6826 6828
6827 6829 You can skip displaying some of these states by setting
6828 6830 ``commands.status.skipstates`` to one or more of: 'bisect', 'graft',
6829 6831 'histedit', 'merge', 'rebase', or 'unshelve'.
6830 6832
6831 6833 Template:
6832 6834
6833 6835 The following keywords are supported in addition to the common template
6834 6836 keywords and functions. See also :hg:`help templates`.
6835 6837
6836 6838 :path: String. Repository-absolute path of the file.
6837 6839 :source: String. Repository-absolute path of the file originated from.
6838 6840 Available if ``--copies`` is specified.
6839 6841 :status: String. Character denoting file's status.
6840 6842
6841 6843 Examples:
6842 6844
6843 6845 - show changes in the working directory relative to a
6844 6846 changeset::
6845 6847
6846 6848 hg status --rev 9353
6847 6849
6848 6850 - show changes in the working directory relative to the
6849 6851 current directory (see :hg:`help patterns` for more information)::
6850 6852
6851 6853 hg status re:
6852 6854
6853 6855 - show all changes including copies in an existing changeset::
6854 6856
6855 6857 hg status --copies --change 9353
6856 6858
6857 6859 - get a NUL separated list of added files, suitable for xargs::
6858 6860
6859 6861 hg status -an0
6860 6862
6861 6863 - show more information about the repository status, abbreviating
6862 6864 added, removed, modified, deleted, and untracked paths::
6863 6865
6864 6866 hg status -v -t mardu
6865 6867
6866 6868 Returns 0 on success.
6867 6869
6868 6870 """
6869 6871
6870 6872 cmdutil.check_at_most_one_arg(opts, 'rev', 'change')
6871 6873 opts = pycompat.byteskwargs(opts)
6872 6874 revs = opts.get(b'rev', [])
6873 6875 change = opts.get(b'change', b'')
6874 6876 terse = opts.get(b'terse', _NOTTERSE)
6875 6877 if terse is _NOTTERSE:
6876 6878 if revs:
6877 6879 terse = b''
6878 6880 else:
6879 6881 terse = ui.config(b'commands', b'status.terse')
6880 6882
6881 6883 if revs and terse:
6882 6884 msg = _(b'cannot use --terse with --rev')
6883 6885 raise error.InputError(msg)
6884 6886 elif change:
6885 6887 repo = scmutil.unhidehashlikerevs(repo, [change], b'nowarn')
6886 6888 ctx2 = logcmdutil.revsingle(repo, change, None)
6887 6889 ctx1 = ctx2.p1()
6888 6890 else:
6889 6891 repo = scmutil.unhidehashlikerevs(repo, revs, b'nowarn')
6890 6892 ctx1, ctx2 = logcmdutil.revpair(repo, revs)
6891 6893
6892 6894 forcerelativevalue = None
6893 6895 if ui.hasconfig(b'commands', b'status.relative'):
6894 6896 forcerelativevalue = ui.configbool(b'commands', b'status.relative')
6895 6897 uipathfn = scmutil.getuipathfn(
6896 6898 repo,
6897 6899 legacyrelativevalue=bool(pats),
6898 6900 forcerelativevalue=forcerelativevalue,
6899 6901 )
6900 6902
6901 6903 if opts.get(b'print0'):
6902 6904 end = b'\0'
6903 6905 else:
6904 6906 end = b'\n'
6905 6907 states = b'modified added removed deleted unknown ignored clean'.split()
6906 6908 show = [k for k in states if opts.get(k)]
6907 6909 if opts.get(b'all'):
6908 6910 show += ui.quiet and (states[:4] + [b'clean']) or states
6909 6911
6910 6912 if not show:
6911 6913 if ui.quiet:
6912 6914 show = states[:4]
6913 6915 else:
6914 6916 show = states[:5]
6915 6917
6916 6918 m = scmutil.match(ctx2, pats, opts)
6917 6919 if terse:
6918 6920 # we need to compute clean and unknown to terse
6919 6921 stat = repo.status(
6920 6922 ctx1.node(),
6921 6923 ctx2.node(),
6922 6924 m,
6923 6925 b'ignored' in show or b'i' in terse,
6924 6926 clean=True,
6925 6927 unknown=True,
6926 6928 listsubrepos=opts.get(b'subrepos'),
6927 6929 )
6928 6930
6929 6931 stat = cmdutil.tersedir(stat, terse)
6930 6932 else:
6931 6933 stat = repo.status(
6932 6934 ctx1.node(),
6933 6935 ctx2.node(),
6934 6936 m,
6935 6937 b'ignored' in show,
6936 6938 b'clean' in show,
6937 6939 b'unknown' in show,
6938 6940 opts.get(b'subrepos'),
6939 6941 )
6940 6942
6941 6943 changestates = zip(
6942 6944 states,
6943 6945 pycompat.iterbytestr(b'MAR!?IC'),
6944 6946 [getattr(stat, s.decode('utf8')) for s in states],
6945 6947 )
6946 6948
6947 6949 copy = {}
6948 6950 if (
6949 6951 opts.get(b'all')
6950 6952 or opts.get(b'copies')
6951 6953 or ui.configbool(b'ui', b'statuscopies')
6952 6954 ) and not opts.get(b'no_status'):
6953 6955 copy = copies.pathcopies(ctx1, ctx2, m)
6954 6956
6955 6957 morestatus = None
6956 6958 if (
6957 6959 (ui.verbose or ui.configbool(b'commands', b'status.verbose'))
6958 6960 and not ui.plain()
6959 6961 and not opts.get(b'print0')
6960 6962 ):
6961 6963 morestatus = cmdutil.readmorestatus(repo)
6962 6964
6963 6965 ui.pager(b'status')
6964 6966 fm = ui.formatter(b'status', opts)
6965 6967 fmt = b'%s' + end
6966 6968 showchar = not opts.get(b'no_status')
6967 6969
6968 6970 for state, char, files in changestates:
6969 6971 if state in show:
6970 6972 label = b'status.' + state
6971 6973 for f in files:
6972 6974 fm.startitem()
6973 6975 fm.context(ctx=ctx2)
6974 6976 fm.data(itemtype=b'file', path=f)
6975 6977 fm.condwrite(showchar, b'status', b'%s ', char, label=label)
6976 6978 fm.plain(fmt % uipathfn(f), label=label)
6977 6979 if f in copy:
6978 6980 fm.data(source=copy[f])
6979 6981 fm.plain(
6980 6982 (b' %s' + end) % uipathfn(copy[f]),
6981 6983 label=b'status.copied',
6982 6984 )
6983 6985 if morestatus:
6984 6986 morestatus.formatfile(f, fm)
6985 6987
6986 6988 if morestatus:
6987 6989 morestatus.formatfooter(fm)
6988 6990 fm.end()
6989 6991
6990 6992
6991 6993 @command(
6992 6994 b'summary|sum',
6993 6995 [(b'', b'remote', None, _(b'check for push and pull'))],
6994 6996 b'[--remote]',
6995 6997 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
6996 6998 helpbasic=True,
6997 6999 intents={INTENT_READONLY},
6998 7000 )
6999 7001 def summary(ui, repo, **opts):
7000 7002 """summarize working directory state
7001 7003
7002 7004 This generates a brief summary of the working directory state,
7003 7005 including parents, branch, commit status, phase and available updates.
7004 7006
7005 7007 With the --remote option, this will check the default paths for
7006 7008 incoming and outgoing changes. This can be time-consuming.
7007 7009
7008 7010 Returns 0 on success.
7009 7011 """
7010 7012
7011 7013 opts = pycompat.byteskwargs(opts)
7012 7014 ui.pager(b'summary')
7013 7015 ctx = repo[None]
7014 7016 parents = ctx.parents()
7015 7017 pnode = parents[0].node()
7016 7018 marks = []
7017 7019
7018 7020 try:
7019 7021 ms = mergestatemod.mergestate.read(repo)
7020 7022 except error.UnsupportedMergeRecords as e:
7021 7023 s = b' '.join(e.recordtypes)
7022 7024 ui.warn(
7023 7025 _(b'warning: merge state has unsupported record types: %s\n') % s
7024 7026 )
7025 7027 unresolved = []
7026 7028 else:
7027 7029 unresolved = list(ms.unresolved())
7028 7030
7029 7031 for p in parents:
7030 7032 # label with log.changeset (instead of log.parent) since this
7031 7033 # shows a working directory parent *changeset*:
7032 7034 # i18n: column positioning for "hg summary"
7033 7035 ui.write(
7034 7036 _(b'parent: %d:%s ') % (p.rev(), p),
7035 7037 label=logcmdutil.changesetlabels(p),
7036 7038 )
7037 7039 ui.write(b' '.join(p.tags()), label=b'log.tag')
7038 7040 if p.bookmarks():
7039 7041 marks.extend(p.bookmarks())
7040 7042 if p.rev() == -1:
7041 7043 if not len(repo):
7042 7044 ui.write(_(b' (empty repository)'))
7043 7045 else:
7044 7046 ui.write(_(b' (no revision checked out)'))
7045 7047 if p.obsolete():
7046 7048 ui.write(_(b' (obsolete)'))
7047 7049 if p.isunstable():
7048 7050 instabilities = (
7049 7051 ui.label(instability, b'trouble.%s' % instability)
7050 7052 for instability in p.instabilities()
7051 7053 )
7052 7054 ui.write(b' (' + b', '.join(instabilities) + b')')
7053 7055 ui.write(b'\n')
7054 7056 if p.description():
7055 7057 ui.status(
7056 7058 b' ' + p.description().splitlines()[0].strip() + b'\n',
7057 7059 label=b'log.summary',
7058 7060 )
7059 7061
7060 7062 branch = ctx.branch()
7061 7063 bheads = repo.branchheads(branch)
7062 7064 # i18n: column positioning for "hg summary"
7063 7065 m = _(b'branch: %s\n') % branch
7064 7066 if branch != b'default':
7065 7067 ui.write(m, label=b'log.branch')
7066 7068 else:
7067 7069 ui.status(m, label=b'log.branch')
7068 7070
7069 7071 if marks:
7070 7072 active = repo._activebookmark
7071 7073 # i18n: column positioning for "hg summary"
7072 7074 ui.write(_(b'bookmarks:'), label=b'log.bookmark')
7073 7075 if active is not None:
7074 7076 if active in marks:
7075 7077 ui.write(b' *' + active, label=bookmarks.activebookmarklabel)
7076 7078 marks.remove(active)
7077 7079 else:
7078 7080 ui.write(b' [%s]' % active, label=bookmarks.activebookmarklabel)
7079 7081 for m in marks:
7080 7082 ui.write(b' ' + m, label=b'log.bookmark')
7081 7083 ui.write(b'\n', label=b'log.bookmark')
7082 7084
7083 7085 status = repo.status(unknown=True)
7084 7086
7085 7087 c = repo.dirstate.copies()
7086 7088 copied, renamed = [], []
7087 7089 for d, s in c.items():
7088 7090 if s in status.removed:
7089 7091 status.removed.remove(s)
7090 7092 renamed.append(d)
7091 7093 else:
7092 7094 copied.append(d)
7093 7095 if d in status.added:
7094 7096 status.added.remove(d)
7095 7097
7096 7098 subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
7097 7099
7098 7100 labels = [
7099 7101 (ui.label(_(b'%d modified'), b'status.modified'), status.modified),
7100 7102 (ui.label(_(b'%d added'), b'status.added'), status.added),
7101 7103 (ui.label(_(b'%d removed'), b'status.removed'), status.removed),
7102 7104 (ui.label(_(b'%d renamed'), b'status.copied'), renamed),
7103 7105 (ui.label(_(b'%d copied'), b'status.copied'), copied),
7104 7106 (ui.label(_(b'%d deleted'), b'status.deleted'), status.deleted),
7105 7107 (ui.label(_(b'%d unknown'), b'status.unknown'), status.unknown),
7106 7108 (ui.label(_(b'%d unresolved'), b'resolve.unresolved'), unresolved),
7107 7109 (ui.label(_(b'%d subrepos'), b'status.modified'), subs),
7108 7110 ]
7109 7111 t = []
7110 7112 for l, s in labels:
7111 7113 if s:
7112 7114 t.append(l % len(s))
7113 7115
7114 7116 t = b', '.join(t)
7115 7117 cleanworkdir = False
7116 7118
7117 7119 if repo.vfs.exists(b'graftstate'):
7118 7120 t += _(b' (graft in progress)')
7119 7121 if repo.vfs.exists(b'updatestate'):
7120 7122 t += _(b' (interrupted update)')
7121 7123 elif len(parents) > 1:
7122 7124 t += _(b' (merge)')
7123 7125 elif branch != parents[0].branch():
7124 7126 t += _(b' (new branch)')
7125 7127 elif parents[0].closesbranch() and pnode in repo.branchheads(
7126 7128 branch, closed=True
7127 7129 ):
7128 7130 t += _(b' (head closed)')
7129 7131 elif not (
7130 7132 status.modified
7131 7133 or status.added
7132 7134 or status.removed
7133 7135 or renamed
7134 7136 or copied
7135 7137 or subs
7136 7138 ):
7137 7139 t += _(b' (clean)')
7138 7140 cleanworkdir = True
7139 7141 elif pnode not in bheads:
7140 7142 t += _(b' (new branch head)')
7141 7143
7142 7144 if parents:
7143 7145 pendingphase = max(p.phase() for p in parents)
7144 7146 else:
7145 7147 pendingphase = phases.public
7146 7148
7147 7149 if pendingphase > phases.newcommitphase(ui):
7148 7150 t += b' (%s)' % phases.phasenames[pendingphase]
7149 7151
7150 7152 if cleanworkdir:
7151 7153 # i18n: column positioning for "hg summary"
7152 7154 ui.status(_(b'commit: %s\n') % t.strip())
7153 7155 else:
7154 7156 # i18n: column positioning for "hg summary"
7155 7157 ui.write(_(b'commit: %s\n') % t.strip())
7156 7158
7157 7159 # all ancestors of branch heads - all ancestors of parent = new csets
7158 7160 new = len(
7159 7161 repo.changelog.findmissing([pctx.node() for pctx in parents], bheads)
7160 7162 )
7161 7163
7162 7164 if new == 0:
7163 7165 # i18n: column positioning for "hg summary"
7164 7166 ui.status(_(b'update: (current)\n'))
7165 7167 elif pnode not in bheads:
7166 7168 # i18n: column positioning for "hg summary"
7167 7169 ui.write(_(b'update: %d new changesets (update)\n') % new)
7168 7170 else:
7169 7171 # i18n: column positioning for "hg summary"
7170 7172 ui.write(
7171 7173 _(b'update: %d new changesets, %d branch heads (merge)\n')
7172 7174 % (new, len(bheads))
7173 7175 )
7174 7176
7175 7177 t = []
7176 7178 draft = len(repo.revs(b'draft()'))
7177 7179 if draft:
7178 7180 t.append(_(b'%d draft') % draft)
7179 7181 secret = len(repo.revs(b'secret()'))
7180 7182 if secret:
7181 7183 t.append(_(b'%d secret') % secret)
7182 7184
7183 7185 if draft or secret:
7184 7186 ui.status(_(b'phases: %s\n') % b', '.join(t))
7185 7187
7186 7188 if obsolete.isenabled(repo, obsolete.createmarkersopt):
7187 7189 for trouble in (b"orphan", b"contentdivergent", b"phasedivergent"):
7188 7190 numtrouble = len(repo.revs(trouble + b"()"))
7189 7191 # We write all the possibilities to ease translation
7190 7192 troublemsg = {
7191 7193 b"orphan": _(b"orphan: %d changesets"),
7192 7194 b"contentdivergent": _(b"content-divergent: %d changesets"),
7193 7195 b"phasedivergent": _(b"phase-divergent: %d changesets"),
7194 7196 }
7195 7197 if numtrouble > 0:
7196 7198 ui.status(troublemsg[trouble] % numtrouble + b"\n")
7197 7199
7198 7200 cmdutil.summaryhooks(ui, repo)
7199 7201
7200 7202 if opts.get(b'remote'):
7201 7203 needsincoming, needsoutgoing = True, True
7202 7204 else:
7203 7205 needsincoming, needsoutgoing = False, False
7204 7206 for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None):
7205 7207 if i:
7206 7208 needsincoming = True
7207 7209 if o:
7208 7210 needsoutgoing = True
7209 7211 if not needsincoming and not needsoutgoing:
7210 7212 return
7211 7213
7212 7214 def getincoming():
7213 7215 # XXX We should actually skip this if no default is specified, instead
7214 7216 # of passing "default" which will resolve as "./default/" if no default
7215 7217 # path is defined.
7216 7218 source, branches = urlutil.get_unique_pull_path(
7217 7219 b'summary', repo, ui, b'default'
7218 7220 )
7219 7221 sbranch = branches[0]
7220 7222 try:
7221 7223 other = hg.peer(repo, {}, source)
7222 7224 except error.RepoError:
7223 7225 if opts.get(b'remote'):
7224 7226 raise
7225 7227 return source, sbranch, None, None, None
7226 7228 revs, checkout = hg.addbranchrevs(repo, other, branches, None)
7227 7229 if revs:
7228 7230 revs = [other.lookup(rev) for rev in revs]
7229 7231 ui.debug(b'comparing with %s\n' % urlutil.hidepassword(source))
7230 7232 with repo.ui.silent():
7231 7233 commoninc = discovery.findcommonincoming(repo, other, heads=revs)
7232 7234 return source, sbranch, other, commoninc, commoninc[1]
7233 7235
7234 7236 if needsincoming:
7235 7237 source, sbranch, sother, commoninc, incoming = getincoming()
7236 7238 else:
7237 7239 source = sbranch = sother = commoninc = incoming = None
7238 7240
7239 7241 def getoutgoing():
7240 7242 # XXX We should actually skip this if no default is specified, instead
7241 7243 # of passing "default" which will resolve as "./default/" if no default
7242 7244 # path is defined.
7243 7245 d = None
7244 7246 if b'default-push' in ui.paths:
7245 7247 d = b'default-push'
7246 7248 elif b'default' in ui.paths:
7247 7249 d = b'default'
7248 7250 if d is not None:
7249 7251 path = urlutil.get_unique_push_path(b'summary', repo, ui, d)
7250 7252 dest = path.pushloc or path.loc
7251 7253 dbranch = path.branch
7252 7254 else:
7253 7255 dest = b'default'
7254 7256 dbranch = None
7255 7257 revs, checkout = hg.addbranchrevs(repo, repo, (dbranch, []), None)
7256 7258 if source != dest:
7257 7259 try:
7258 7260 dother = hg.peer(repo, {}, dest)
7259 7261 except error.RepoError:
7260 7262 if opts.get(b'remote'):
7261 7263 raise
7262 7264 return dest, dbranch, None, None
7263 7265 ui.debug(b'comparing with %s\n' % urlutil.hidepassword(dest))
7264 7266 elif sother is None:
7265 7267 # there is no explicit destination peer, but source one is invalid
7266 7268 return dest, dbranch, None, None
7267 7269 else:
7268 7270 dother = sother
7269 7271 if source != dest or (sbranch is not None and sbranch != dbranch):
7270 7272 common = None
7271 7273 else:
7272 7274 common = commoninc
7273 7275 if revs:
7274 7276 revs = [repo.lookup(rev) for rev in revs]
7275 7277 with repo.ui.silent():
7276 7278 outgoing = discovery.findcommonoutgoing(
7277 7279 repo, dother, onlyheads=revs, commoninc=common
7278 7280 )
7279 7281 return dest, dbranch, dother, outgoing
7280 7282
7281 7283 if needsoutgoing:
7282 7284 dest, dbranch, dother, outgoing = getoutgoing()
7283 7285 else:
7284 7286 dest = dbranch = dother = outgoing = None
7285 7287
7286 7288 if opts.get(b'remote'):
7287 7289 # Help pytype. --remote sets both `needsincoming` and `needsoutgoing`.
7288 7290 # The former always sets `sother` (or raises an exception if it can't);
7289 7291 # the latter always sets `outgoing`.
7290 7292 assert sother is not None
7291 7293 assert outgoing is not None
7292 7294
7293 7295 t = []
7294 7296 if incoming:
7295 7297 t.append(_(b'1 or more incoming'))
7296 7298 o = outgoing.missing
7297 7299 if o:
7298 7300 t.append(_(b'%d outgoing') % len(o))
7299 7301 other = dother or sother
7300 7302 if b'bookmarks' in other.listkeys(b'namespaces'):
7301 7303 counts = bookmarks.summary(repo, other)
7302 7304 if counts[0] > 0:
7303 7305 t.append(_(b'%d incoming bookmarks') % counts[0])
7304 7306 if counts[1] > 0:
7305 7307 t.append(_(b'%d outgoing bookmarks') % counts[1])
7306 7308
7307 7309 if t:
7308 7310 # i18n: column positioning for "hg summary"
7309 7311 ui.write(_(b'remote: %s\n') % (b', '.join(t)))
7310 7312 else:
7311 7313 # i18n: column positioning for "hg summary"
7312 7314 ui.status(_(b'remote: (synced)\n'))
7313 7315
7314 7316 cmdutil.summaryremotehooks(
7315 7317 ui,
7316 7318 repo,
7317 7319 opts,
7318 7320 (
7319 7321 (source, sbranch, sother, commoninc),
7320 7322 (dest, dbranch, dother, outgoing),
7321 7323 ),
7322 7324 )
7323 7325
7324 7326
7325 7327 @command(
7326 7328 b'tag',
7327 7329 [
7328 7330 (b'f', b'force', None, _(b'force tag')),
7329 7331 (b'l', b'local', None, _(b'make the tag local')),
7330 7332 (b'r', b'rev', b'', _(b'revision to tag'), _(b'REV')),
7331 7333 (b'', b'remove', None, _(b'remove a tag')),
7332 7334 # -l/--local is already there, commitopts cannot be used
7333 7335 (b'e', b'edit', None, _(b'invoke editor on commit messages')),
7334 7336 (b'm', b'message', b'', _(b'use text as commit message'), _(b'TEXT')),
7335 7337 ]
7336 7338 + commitopts2,
7337 7339 _(b'[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...'),
7338 7340 helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
7339 7341 )
7340 7342 def tag(ui, repo, name1, *names, **opts):
7341 7343 """add one or more tags for the current or given revision
7342 7344
7343 7345 Name a particular revision using <name>.
7344 7346
7345 7347 Tags are used to name particular revisions of the repository and are
7346 7348 very useful to compare different revisions, to go back to significant
7347 7349 earlier versions or to mark branch points as releases, etc. Changing
7348 7350 an existing tag is normally disallowed; use -f/--force to override.
7349 7351
7350 7352 If no revision is given, the parent of the working directory is
7351 7353 used.
7352 7354
7353 7355 To facilitate version control, distribution, and merging of tags,
7354 7356 they are stored as a file named ".hgtags" which is managed similarly
7355 7357 to other project files and can be hand-edited if necessary. This
7356 7358 also means that tagging creates a new commit. The file
7357 7359 ".hg/localtags" is used for local tags (not shared among
7358 7360 repositories).
7359 7361
7360 7362 Tag commits are usually made at the head of a branch. If the parent
7361 7363 of the working directory is not a branch head, :hg:`tag` aborts; use
7362 7364 -f/--force to force the tag commit to be based on a non-head
7363 7365 changeset.
7364 7366
7365 7367 See :hg:`help dates` for a list of formats valid for -d/--date.
7366 7368
7367 7369 Since tag names have priority over branch names during revision
7368 7370 lookup, using an existing branch name as a tag name is discouraged.
7369 7371
7370 7372 Returns 0 on success.
7371 7373 """
7372 7374 cmdutil.check_incompatible_arguments(opts, 'remove', ['rev'])
7373 7375 opts = pycompat.byteskwargs(opts)
7374 7376 with repo.wlock(), repo.lock():
7375 7377 rev_ = b"."
7376 7378 names = [t.strip() for t in (name1,) + names]
7377 7379 if len(names) != len(set(names)):
7378 7380 raise error.InputError(_(b'tag names must be unique'))
7379 7381 for n in names:
7380 7382 scmutil.checknewlabel(repo, n, b'tag')
7381 7383 if not n:
7382 7384 raise error.InputError(
7383 7385 _(b'tag names cannot consist entirely of whitespace')
7384 7386 )
7385 7387 if opts.get(b'rev'):
7386 7388 rev_ = opts[b'rev']
7387 7389 message = opts.get(b'message')
7388 7390 if opts.get(b'remove'):
7389 7391 if opts.get(b'local'):
7390 7392 expectedtype = b'local'
7391 7393 else:
7392 7394 expectedtype = b'global'
7393 7395
7394 7396 for n in names:
7395 7397 if repo.tagtype(n) == b'global':
7396 7398 alltags = tagsmod.findglobaltags(ui, repo)
7397 7399 if alltags[n][0] == repo.nullid:
7398 7400 raise error.InputError(
7399 7401 _(b"tag '%s' is already removed") % n
7400 7402 )
7401 7403 if not repo.tagtype(n):
7402 7404 raise error.InputError(_(b"tag '%s' does not exist") % n)
7403 7405 if repo.tagtype(n) != expectedtype:
7404 7406 if expectedtype == b'global':
7405 7407 raise error.InputError(
7406 7408 _(b"tag '%s' is not a global tag") % n
7407 7409 )
7408 7410 else:
7409 7411 raise error.InputError(
7410 7412 _(b"tag '%s' is not a local tag") % n
7411 7413 )
7412 7414 rev_ = b'null'
7413 7415 if not message:
7414 7416 # we don't translate commit messages
7415 7417 message = b'Removed tag %s' % b', '.join(names)
7416 7418 elif not opts.get(b'force'):
7417 7419 for n in names:
7418 7420 if n in repo.tags():
7419 7421 raise error.InputError(
7420 7422 _(b"tag '%s' already exists (use -f to force)") % n
7421 7423 )
7422 7424 if not opts.get(b'local'):
7423 7425 p1, p2 = repo.dirstate.parents()
7424 7426 if p2 != repo.nullid:
7425 7427 raise error.StateError(_(b'uncommitted merge'))
7426 7428 bheads = repo.branchheads()
7427 7429 if not opts.get(b'force') and bheads and p1 not in bheads:
7428 7430 raise error.InputError(
7429 7431 _(
7430 7432 b'working directory is not at a branch head '
7431 7433 b'(use -f to force)'
7432 7434 )
7433 7435 )
7434 7436 node = logcmdutil.revsingle(repo, rev_).node()
7435 7437
7436 7438 if not message:
7437 7439 # we don't translate commit messages
7438 7440 message = b'Added tag %s for changeset %s' % (
7439 7441 b', '.join(names),
7440 7442 short(node),
7441 7443 )
7442 7444
7443 7445 date = opts.get(b'date')
7444 7446 if date:
7445 7447 date = dateutil.parsedate(date)
7446 7448
7447 7449 if opts.get(b'remove'):
7448 7450 editform = b'tag.remove'
7449 7451 else:
7450 7452 editform = b'tag.add'
7451 7453 editor = cmdutil.getcommiteditor(
7452 7454 editform=editform, **pycompat.strkwargs(opts)
7453 7455 )
7454 7456
7455 7457 # don't allow tagging the null rev
7456 7458 if (
7457 7459 not opts.get(b'remove')
7458 7460 and logcmdutil.revsingle(repo, rev_).rev() == nullrev
7459 7461 ):
7460 7462 raise error.InputError(_(b"cannot tag null revision"))
7461 7463
7462 7464 tagsmod.tag(
7463 7465 repo,
7464 7466 names,
7465 7467 node,
7466 7468 message,
7467 7469 opts.get(b'local'),
7468 7470 opts.get(b'user'),
7469 7471 date,
7470 7472 editor=editor,
7471 7473 )
7472 7474
7473 7475
7474 7476 @command(
7475 7477 b'tags',
7476 7478 formatteropts,
7477 7479 b'',
7478 7480 helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
7479 7481 intents={INTENT_READONLY},
7480 7482 )
7481 7483 def tags(ui, repo, **opts):
7482 7484 """list repository tags
7483 7485
7484 7486 This lists both regular and local tags. When the -v/--verbose
7485 7487 switch is used, a third column "local" is printed for local tags.
7486 7488 When the -q/--quiet switch is used, only the tag name is printed.
7487 7489
7488 7490 .. container:: verbose
7489 7491
7490 7492 Template:
7491 7493
7492 7494 The following keywords are supported in addition to the common template
7493 7495 keywords and functions such as ``{tag}``. See also
7494 7496 :hg:`help templates`.
7495 7497
7496 7498 :type: String. ``local`` for local tags.
7497 7499
7498 7500 Returns 0 on success.
7499 7501 """
7500 7502
7501 7503 opts = pycompat.byteskwargs(opts)
7502 7504 ui.pager(b'tags')
7503 7505 fm = ui.formatter(b'tags', opts)
7504 7506 hexfunc = fm.hexfunc
7505 7507
7506 7508 for t, n in reversed(repo.tagslist()):
7507 7509 hn = hexfunc(n)
7508 7510 label = b'tags.normal'
7509 7511 tagtype = repo.tagtype(t)
7510 7512 if not tagtype or tagtype == b'global':
7511 7513 tagtype = b''
7512 7514 else:
7513 7515 label = b'tags.' + tagtype
7514 7516
7515 7517 fm.startitem()
7516 7518 fm.context(repo=repo)
7517 7519 fm.write(b'tag', b'%s', t, label=label)
7518 7520 fmt = b" " * (30 - encoding.colwidth(t)) + b' %5d:%s'
7519 7521 fm.condwrite(
7520 7522 not ui.quiet,
7521 7523 b'rev node',
7522 7524 fmt,
7523 7525 repo.changelog.rev(n),
7524 7526 hn,
7525 7527 label=label,
7526 7528 )
7527 7529 fm.condwrite(
7528 7530 ui.verbose and tagtype, b'type', b' %s', tagtype, label=label
7529 7531 )
7530 7532 fm.plain(b'\n')
7531 7533 fm.end()
7532 7534
7533 7535
7534 7536 @command(
7535 7537 b'tip',
7536 7538 [
7537 7539 (b'p', b'patch', None, _(b'show patch')),
7538 7540 (b'g', b'git', None, _(b'use git extended diff format')),
7539 7541 ]
7540 7542 + templateopts,
7541 7543 _(b'[-p] [-g]'),
7542 7544 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
7543 7545 )
7544 7546 def tip(ui, repo, **opts):
7545 7547 """show the tip revision (DEPRECATED)
7546 7548
7547 7549 The tip revision (usually just called the tip) is the changeset
7548 7550 most recently added to the repository (and therefore the most
7549 7551 recently changed head).
7550 7552
7551 7553 If you have just made a commit, that commit will be the tip. If
7552 7554 you have just pulled changes from another repository, the tip of
7553 7555 that repository becomes the current tip. The "tip" tag is special
7554 7556 and cannot be renamed or assigned to a different changeset.
7555 7557
7556 7558 This command is deprecated, please use :hg:`heads` instead.
7557 7559
7558 7560 Returns 0 on success.
7559 7561 """
7560 7562 opts = pycompat.byteskwargs(opts)
7561 7563 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
7562 7564 displayer.show(repo[b'tip'])
7563 7565 displayer.close()
7564 7566
7565 7567
7566 7568 @command(
7567 7569 b'unbundle',
7568 7570 [
7569 7571 (
7570 7572 b'u',
7571 7573 b'update',
7572 7574 None,
7573 7575 _(b'update to new branch head if changesets were unbundled'),
7574 7576 )
7575 7577 ],
7576 7578 _(b'[-u] FILE...'),
7577 7579 helpcategory=command.CATEGORY_IMPORT_EXPORT,
7578 7580 )
7579 7581 def unbundle(ui, repo, fname1, *fnames, **opts):
7580 7582 """apply one or more bundle files
7581 7583
7582 7584 Apply one or more bundle files generated by :hg:`bundle`.
7583 7585
7584 7586 Returns 0 on success, 1 if an update has unresolved files.
7585 7587 """
7586 7588 fnames = (fname1,) + fnames
7587 7589
7588 7590 with repo.lock():
7589 7591 for fname in fnames:
7590 7592 f = hg.openpath(ui, fname)
7591 7593 gen = exchange.readbundle(ui, f, fname)
7592 7594 if isinstance(gen, streamclone.streamcloneapplier):
7593 7595 raise error.InputError(
7594 7596 _(
7595 7597 b'packed bundles cannot be applied with '
7596 7598 b'"hg unbundle"'
7597 7599 ),
7598 7600 hint=_(b'use "hg debugapplystreamclonebundle"'),
7599 7601 )
7600 7602 url = b'bundle:' + fname
7601 7603 try:
7602 7604 txnname = b'unbundle'
7603 7605 if not isinstance(gen, bundle2.unbundle20):
7604 7606 txnname = b'unbundle\n%s' % urlutil.hidepassword(url)
7605 7607 with repo.transaction(txnname) as tr:
7606 7608 op = bundle2.applybundle(
7607 7609 repo, gen, tr, source=b'unbundle', url=url
7608 7610 )
7609 7611 except error.BundleUnknownFeatureError as exc:
7610 7612 raise error.Abort(
7611 7613 _(b'%s: unknown bundle feature, %s') % (fname, exc),
7612 7614 hint=_(
7613 7615 b"see https://mercurial-scm.org/"
7614 7616 b"wiki/BundleFeature for more "
7615 7617 b"information"
7616 7618 ),
7617 7619 )
7618 7620 modheads = bundle2.combinechangegroupresults(op)
7619 7621
7620 7622 if postincoming(ui, repo, modheads, opts.get('update'), None, None):
7621 7623 return 1
7622 7624 else:
7623 7625 return 0
7624 7626
7625 7627
7626 7628 @command(
7627 7629 b'unshelve',
7628 7630 [
7629 7631 (b'a', b'abort', None, _(b'abort an incomplete unshelve operation')),
7630 7632 (
7631 7633 b'c',
7632 7634 b'continue',
7633 7635 None,
7634 7636 _(b'continue an incomplete unshelve operation'),
7635 7637 ),
7636 7638 (b'i', b'interactive', None, _(b'use interactive mode (EXPERIMENTAL)')),
7637 7639 (b'k', b'keep', None, _(b'keep shelve after unshelving')),
7638 7640 (
7639 7641 b'n',
7640 7642 b'name',
7641 7643 b'',
7642 7644 _(b'restore shelved change with given name'),
7643 7645 _(b'NAME'),
7644 7646 ),
7645 7647 (b't', b'tool', b'', _(b'specify merge tool')),
7646 7648 (
7647 7649 b'',
7648 7650 b'date',
7649 7651 b'',
7650 7652 _(b'set date for temporary commits (DEPRECATED)'),
7651 7653 _(b'DATE'),
7652 7654 ),
7653 7655 ],
7654 7656 _(b'hg unshelve [OPTION]... [[-n] SHELVED]'),
7655 7657 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
7656 7658 )
7657 7659 def unshelve(ui, repo, *shelved, **opts):
7658 7660 """restore a shelved change to the working directory
7659 7661
7660 7662 This command accepts an optional name of a shelved change to
7661 7663 restore. If none is given, the most recent shelved change is used.
7662 7664
7663 7665 If a shelved change is applied successfully, the bundle that
7664 7666 contains the shelved changes is moved to a backup location
7665 7667 (.hg/shelve-backup).
7666 7668
7667 7669 Since you can restore a shelved change on top of an arbitrary
7668 7670 commit, it is possible that unshelving will result in a conflict
7669 7671 between your changes and the commits you are unshelving onto. If
7670 7672 this occurs, you must resolve the conflict, then use
7671 7673 ``--continue`` to complete the unshelve operation. (The bundle
7672 7674 will not be moved until you successfully complete the unshelve.)
7673 7675
7674 7676 (Alternatively, you can use ``--abort`` to abandon an unshelve
7675 7677 that causes a conflict. This reverts the unshelved changes, and
7676 7678 leaves the bundle in place.)
7677 7679
7678 7680 If bare shelved change (without interactive, include and exclude
7679 7681 option) was done on newly created branch it would restore branch
7680 7682 information to the working directory.
7681 7683
7682 7684 After a successful unshelve, the shelved changes are stored in a
7683 7685 backup directory. Only the N most recent backups are kept. N
7684 7686 defaults to 10 but can be overridden using the ``shelve.maxbackups``
7685 7687 configuration option.
7686 7688
7687 7689 .. container:: verbose
7688 7690
7689 7691 Timestamp in seconds is used to decide order of backups. More
7690 7692 than ``maxbackups`` backups are kept, if same timestamp
7691 7693 prevents from deciding exact order of them, for safety.
7692 7694
7693 7695 Selected changes can be unshelved with ``--interactive`` flag.
7694 7696 The working directory is updated with the selected changes, and
7695 7697 only the unselected changes remain shelved.
7696 7698 Note: The whole shelve is applied to working directory first before
7697 7699 running interactively. So, this will bring up all the conflicts between
7698 7700 working directory and the shelve, irrespective of which changes will be
7699 7701 unshelved.
7700 7702 """
7701 7703 with repo.wlock():
7702 7704 return shelvemod.unshelvecmd(ui, repo, *shelved, **opts)
7703 7705
7704 7706
7705 7707 statemod.addunfinished(
7706 7708 b'unshelve',
7707 7709 fname=b'shelvedstate',
7708 7710 continueflag=True,
7709 7711 abortfunc=shelvemod.hgabortunshelve,
7710 7712 continuefunc=shelvemod.hgcontinueunshelve,
7711 7713 cmdmsg=_(b'unshelve already in progress'),
7712 7714 )
7713 7715
7714 7716
7715 7717 @command(
7716 7718 b'update|up|checkout|co',
7717 7719 [
7718 7720 (b'C', b'clean', None, _(b'discard uncommitted changes (no backup)')),
7719 7721 (b'c', b'check', None, _(b'require clean working directory')),
7720 7722 (b'm', b'merge', None, _(b'merge uncommitted changes')),
7721 7723 (b'd', b'date', b'', _(b'tipmost revision matching date'), _(b'DATE')),
7722 7724 (b'r', b'rev', b'', _(b'revision'), _(b'REV')),
7723 7725 ]
7724 7726 + mergetoolopts,
7725 7727 _(b'[-C|-c|-m] [-d DATE] [[-r] REV]'),
7726 7728 helpcategory=command.CATEGORY_WORKING_DIRECTORY,
7727 7729 helpbasic=True,
7728 7730 )
7729 7731 def update(ui, repo, node=None, **opts):
7730 7732 """update working directory (or switch revisions)
7731 7733
7732 7734 Update the repository's working directory to the specified
7733 7735 changeset. If no changeset is specified, update to the tip of the
7734 7736 current named branch and move the active bookmark (see :hg:`help
7735 7737 bookmarks`).
7736 7738
7737 7739 Update sets the working directory's parent revision to the specified
7738 7740 changeset (see :hg:`help parents`).
7739 7741
7740 7742 If the changeset is not a descendant or ancestor of the working
7741 7743 directory's parent and there are uncommitted changes, the update is
7742 7744 aborted. With the -c/--check option, the working directory is checked
7743 7745 for uncommitted changes; if none are found, the working directory is
7744 7746 updated to the specified changeset.
7745 7747
7746 7748 .. container:: verbose
7747 7749
7748 7750 The -C/--clean, -c/--check, and -m/--merge options control what
7749 7751 happens if the working directory contains uncommitted changes.
7750 7752 At most of one of them can be specified.
7751 7753
7752 7754 1. If no option is specified, and if
7753 7755 the requested changeset is an ancestor or descendant of
7754 7756 the working directory's parent, the uncommitted changes
7755 7757 are merged into the requested changeset and the merged
7756 7758 result is left uncommitted. If the requested changeset is
7757 7759 not an ancestor or descendant (that is, it is on another
7758 7760 branch), the update is aborted and the uncommitted changes
7759 7761 are preserved.
7760 7762
7761 7763 2. With the -m/--merge option, the update is allowed even if the
7762 7764 requested changeset is not an ancestor or descendant of
7763 7765 the working directory's parent.
7764 7766
7765 7767 3. With the -c/--check option, the update is aborted and the
7766 7768 uncommitted changes are preserved.
7767 7769
7768 7770 4. With the -C/--clean option, uncommitted changes are discarded and
7769 7771 the working directory is updated to the requested changeset.
7770 7772
7771 7773 To cancel an uncommitted merge (and lose your changes), use
7772 7774 :hg:`merge --abort`.
7773 7775
7774 7776 Use null as the changeset to remove the working directory (like
7775 7777 :hg:`clone -U`).
7776 7778
7777 7779 If you want to revert just one file to an older revision, use
7778 7780 :hg:`revert [-r REV] NAME`.
7779 7781
7780 7782 See :hg:`help dates` for a list of formats valid for -d/--date.
7781 7783
7782 7784 Returns 0 on success, 1 if there are unresolved files.
7783 7785 """
7784 7786 cmdutil.check_at_most_one_arg(opts, 'clean', 'check', 'merge')
7785 7787 rev = opts.get('rev')
7786 7788 date = opts.get('date')
7787 7789 clean = opts.get('clean')
7788 7790 check = opts.get('check')
7789 7791 merge = opts.get('merge')
7790 7792 if rev and node:
7791 7793 raise error.InputError(_(b"please specify just one revision"))
7792 7794
7793 7795 if ui.configbool(b'commands', b'update.requiredest'):
7794 7796 if not node and not rev and not date:
7795 7797 raise error.InputError(
7796 7798 _(b'you must specify a destination'),
7797 7799 hint=_(b'for example: hg update ".::"'),
7798 7800 )
7799 7801
7800 7802 if rev is None or rev == b'':
7801 7803 rev = node
7802 7804
7803 7805 if date and rev is not None:
7804 7806 raise error.InputError(_(b"you can't specify a revision and a date"))
7805 7807
7806 7808 updatecheck = None
7807 7809 if check or merge is not None and not merge:
7808 7810 updatecheck = b'abort'
7809 7811 elif merge or check is not None and not check:
7810 7812 updatecheck = b'none'
7811 7813
7812 7814 with repo.wlock():
7813 7815 cmdutil.clearunfinished(repo)
7814 7816 if date:
7815 7817 rev = cmdutil.finddate(ui, repo, date)
7816 7818
7817 7819 # if we defined a bookmark, we have to remember the original name
7818 7820 brev = rev
7819 7821 if rev:
7820 7822 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
7821 7823 ctx = logcmdutil.revsingle(repo, rev, default=None)
7822 7824 rev = ctx.rev()
7823 7825 hidden = ctx.hidden()
7824 7826 overrides = {(b'ui', b'forcemerge'): opts.get('tool', b'')}
7825 7827 with ui.configoverride(overrides, b'update'):
7826 7828 ret = hg.updatetotally(
7827 7829 ui, repo, rev, brev, clean=clean, updatecheck=updatecheck
7828 7830 )
7829 7831 if hidden:
7830 7832 ctxstr = ctx.hex()[:12]
7831 7833 ui.warn(_(b"updated to hidden changeset %s\n") % ctxstr)
7832 7834
7833 7835 if ctx.obsolete():
7834 7836 obsfatemsg = obsutil._getfilteredreason(repo, ctxstr, ctx)
7835 7837 ui.warn(b"(%s)\n" % obsfatemsg)
7836 7838 return ret
7837 7839
7838 7840
7839 7841 @command(
7840 7842 b'verify',
7841 7843 [(b'', b'full', False, b'perform more checks (EXPERIMENTAL)')],
7842 7844 helpcategory=command.CATEGORY_MAINTENANCE,
7843 7845 )
7844 7846 def verify(ui, repo, **opts):
7845 7847 """verify the integrity of the repository
7846 7848
7847 7849 Verify the integrity of the current repository.
7848 7850
7849 7851 This will perform an extensive check of the repository's
7850 7852 integrity, validating the hashes and checksums of each entry in
7851 7853 the changelog, manifest, and tracked files, as well as the
7852 7854 integrity of their crosslinks and indices.
7853 7855
7854 7856 Please see https://mercurial-scm.org/wiki/RepositoryCorruption
7855 7857 for more information about recovery from corruption of the
7856 7858 repository.
7857 7859
7858 7860 Returns 0 on success, 1 if errors are encountered.
7859 7861 """
7860 7862 opts = pycompat.byteskwargs(opts)
7861 7863
7862 7864 level = None
7863 7865 if opts[b'full']:
7864 7866 level = verifymod.VERIFY_FULL
7865 7867 return hg.verify(repo, level)
7866 7868
7867 7869
7868 7870 @command(
7869 7871 b'version',
7870 7872 [] + formatteropts,
7871 7873 helpcategory=command.CATEGORY_HELP,
7872 7874 norepo=True,
7873 7875 intents={INTENT_READONLY},
7874 7876 )
7875 7877 def version_(ui, **opts):
7876 7878 """output version and copyright information
7877 7879
7878 7880 .. container:: verbose
7879 7881
7880 7882 Template:
7881 7883
7882 7884 The following keywords are supported. See also :hg:`help templates`.
7883 7885
7884 7886 :extensions: List of extensions.
7885 7887 :ver: String. Version number.
7886 7888
7887 7889 And each entry of ``{extensions}`` provides the following sub-keywords
7888 7890 in addition to ``{ver}``.
7889 7891
7890 7892 :bundled: Boolean. True if included in the release.
7891 7893 :name: String. Extension name.
7892 7894 """
7893 7895 opts = pycompat.byteskwargs(opts)
7894 7896 if ui.verbose:
7895 7897 ui.pager(b'version')
7896 7898 fm = ui.formatter(b"version", opts)
7897 7899 fm.startitem()
7898 7900 fm.write(
7899 7901 b"ver", _(b"Mercurial Distributed SCM (version %s)\n"), util.version()
7900 7902 )
7901 7903 license = _(
7902 7904 b"(see https://mercurial-scm.org for more information)\n"
7903 7905 b"\nCopyright (C) 2005-2022 Olivia Mackall and others\n"
7904 7906 b"This is free software; see the source for copying conditions. "
7905 7907 b"There is NO\nwarranty; "
7906 7908 b"not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
7907 7909 )
7908 7910 if not ui.quiet:
7909 7911 fm.plain(license)
7910 7912
7911 7913 if ui.verbose:
7912 7914 fm.plain(_(b"\nEnabled extensions:\n\n"))
7913 7915 # format names and versions into columns
7914 7916 names = []
7915 7917 vers = []
7916 7918 isinternals = []
7917 7919 for name, module in sorted(extensions.extensions()):
7918 7920 names.append(name)
7919 7921 vers.append(extensions.moduleversion(module) or None)
7920 7922 isinternals.append(extensions.ismoduleinternal(module))
7921 7923 fn = fm.nested(b"extensions", tmpl=b'{name}\n')
7922 7924 if names:
7923 7925 namefmt = b" %%-%ds " % max(len(n) for n in names)
7924 7926 places = [_(b"external"), _(b"internal")]
7925 7927 for n, v, p in zip(names, vers, isinternals):
7926 7928 fn.startitem()
7927 7929 fn.condwrite(ui.verbose, b"name", namefmt, n)
7928 7930 if ui.verbose:
7929 7931 fn.plain(b"%s " % places[p])
7930 7932 fn.data(bundled=p)
7931 7933 fn.condwrite(ui.verbose and v, b"ver", b"%s", v)
7932 7934 if ui.verbose:
7933 7935 fn.plain(b"\n")
7934 7936 fn.end()
7935 7937 fm.end()
7936 7938
7937 7939
7938 7940 def loadcmdtable(ui, name, cmdtable):
7939 7941 """Load command functions from specified cmdtable"""
7940 7942 overrides = [cmd for cmd in cmdtable if cmd in table]
7941 7943 if overrides:
7942 7944 ui.warn(
7943 7945 _(b"extension '%s' overrides commands: %s\n")
7944 7946 % (name, b" ".join(overrides))
7945 7947 )
7946 7948 table.update(cmdtable)
@@ -1,1496 +1,1496 b''
1 1 ==================================================
2 2 Test obsmarkers interaction with bundle and strip
3 3 ==================================================
4 4
5 5 Setup a repository with various case
6 6 ====================================
7 7
8 8 Config setup
9 9 ------------
10 10
11 11 $ cat >> $HGRCPATH <<EOF
12 12 > [command-templates]
13 13 > # simpler log output
14 14 > log = "{node|short}: {desc}\n"
15 15 >
16 16 > [experimental]
17 17 > # enable evolution
18 18 > evolution=true
19 19 >
20 20 > # include obsmarkers in bundle
21 21 > evolution.bundle-obsmarker = yes
22 22 >
23 23 > [extensions]
24 24 > # needed for some tests
25 25 > strip =
26 26 > [defaults]
27 27 > # we'll query many hidden changeset
28 28 > debugobsolete = --hidden
29 29 > EOF
30 30
31 31 $ mkcommit() {
32 32 > echo "$1" > "$1"
33 33 > hg add "$1"
34 34 > hg ci -m "$1"
35 35 > }
36 36
37 37 $ getid() {
38 38 > hg log --hidden --template '{node}\n' --rev "$1"
39 39 > }
40 40
41 41 $ mktestrepo () {
42 42 > [ -n "$1" ] || exit 1
43 43 > cd $TESTTMP
44 44 > hg init $1
45 45 > cd $1
46 46 > mkcommit ROOT
47 47 > }
48 48
49 49 Function to compare the expected bundled obsmarkers with the actually bundled
50 50 obsmarkers. It also check the obsmarkers backed up during strip.
51 51
52 52 $ testrevs () {
53 53 > revs="$1"
54 54 > testname=`basename \`pwd\``
55 55 > revsname=`hg --hidden log -T '-{desc}' --rev "${revs}"`
56 56 > prefix="${TESTTMP}/${testname}${revsname}"
57 57 > markersfile="${prefix}-relevant-markers.txt"
58 58 > exclufile="${prefix}-exclusive-markers.txt"
59 59 > bundlefile="${prefix}-bundle.hg"
60 60 > contentfile="${prefix}-bundle-markers.hg"
61 61 > stripcontentfile="${prefix}-bundle-markers.hg"
62 62 > hg debugobsolete --hidden --rev "${revs}" | sed 's/^/ /' > "${markersfile}"
63 63 > hg debugobsolete --hidden --rev "${revs}" --exclusive | sed 's/^/ /' > "${exclufile}"
64 64 > echo '### Matched revisions###'
65 65 > hg log --hidden --rev "${revs}" | sort
66 66 > echo '### Relevant markers ###'
67 67 > cat "${markersfile}"
68 68 > printf "# bundling: "
69 69 > hg bundle --hidden --base "parents(roots(${revs}))" --rev "${revs}" "${bundlefile}"
70 70 > hg debugbundle --part-type obsmarkers "${bundlefile}" | sed 1,3d > "${contentfile}"
71 71 > echo '### Bundled markers ###'
72 72 > cat "${contentfile}"
73 73 > echo '### diff <relevant> <bundled> ###'
74 74 > cmp "${markersfile}" "${contentfile}" || diff -u "${markersfile}" "${contentfile}"
75 75 > echo '#################################'
76 76 > echo '### Exclusive markers ###'
77 77 > cat "${exclufile}"
78 78 > # if the matched revs do not have children, we also check the result of strip
79 79 > children=`hg log --hidden --rev "((${revs})::) - (${revs})"`
80 80 > if [ -z "$children" ];
81 81 > then
82 82 > printf "# stripping: "
83 83 > prestripfile="${prefix}-pre-strip.txt"
84 84 > poststripfile="${prefix}-post-strip.txt"
85 85 > strippedfile="${prefix}-stripped-markers.txt"
86 86 > hg debugobsolete --hidden | sort | sed 's/^/ /' > "${prestripfile}"
87 87 > hg strip --hidden --rev "${revs}"
88 88 > hg debugobsolete --hidden | sort | sed 's/^/ /' > "${poststripfile}"
89 89 > hg debugbundle --part-type obsmarkers .hg/strip-backup/* | sed 1,3d > "${stripcontentfile}"
90 90 > echo '### Backup markers ###'
91 91 > cat "${stripcontentfile}"
92 92 > echo '### diff <relevant> <backed-up> ###'
93 93 > cmp "${markersfile}" "${stripcontentfile}" || diff -u "${markersfile}" "${stripcontentfile}"
94 94 > echo '#################################'
95 95 > cat "${prestripfile}" "${poststripfile}" | sort | uniq -u > "${strippedfile}"
96 96 > echo '### Stripped markers ###'
97 97 > cat "${strippedfile}"
98 98 > echo '### diff <exclusive> <stripped> ###'
99 99 > cmp "${exclufile}" "${strippedfile}" || diff -u "${exclufile}" "${strippedfile}"
100 100 > echo '#################################'
101 101 > # restore and clean up repo for the next test
102 102 > hg unbundle .hg/strip-backup/* | sed 's/^/# unbundling: /'
103 103 > # clean up directory for the next test
104 104 > rm .hg/strip-backup/*
105 105 > fi
106 106 > }
107 107
108 108 root setup
109 109 -------------
110 110
111 111 simple chain
112 112 ============
113 113
114 114 . A0
115 115 . β‡ ΓΈβ‡ β—” A1
116 116 . |/
117 117 . ●
118 118
119 119 setup
120 120 -----
121 121
122 122 $ mktestrepo simple-chain
123 123 $ mkcommit 'C-A0'
124 124 $ hg up 'desc("ROOT")'
125 125 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
126 126 $ mkcommit 'C-A1'
127 127 created new head
128 128 $ hg debugobsolete a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 `getid 'desc("C-A0")'`
129 129 1 new obsolescence markers
130 130 $ hg debugobsolete `getid 'desc("C-A0")'` a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1
131 131 1 new obsolescence markers
132 132 obsoleted 1 changesets
133 133 $ hg debugobsolete a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 `getid 'desc("C-A1")'`
134 134 1 new obsolescence markers
135 135
136 136 $ hg up 'desc("ROOT")'
137 137 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
138 138 $ hg log --hidden -G
139 139 o cf2c22470d67: C-A1
140 140 |
141 141 | x 84fcb0dfe17b: C-A0
142 142 |/
143 143 @ ea207398892e: ROOT
144 144
145 145 $ hg debugobsolete
146 146 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
147 147 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
148 148 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
149 149
150 150 Actual testing
151 151 --------------
152 152
153 153 $ testrevs 'desc("C-A0")'
154 154 ### Matched revisions###
155 155 84fcb0dfe17b: C-A0
156 156 ### Relevant markers ###
157 157 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
158 158 # bundling: 1 changesets found
159 159 ### Bundled markers ###
160 160 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
161 161 ### diff <relevant> <bundled> ###
162 162 #################################
163 163 ### Exclusive markers ###
164 164 # stripping: saved backup bundle to $TESTTMP/simple-chain/.hg/strip-backup/84fcb0dfe17b-6454bbdc-backup.hg
165 165 ### Backup markers ###
166 166 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
167 167 ### diff <relevant> <backed-up> ###
168 168 #################################
169 169 ### Stripped markers ###
170 170 ### diff <exclusive> <stripped> ###
171 171 #################################
172 172 # unbundling: adding changesets
173 173 # unbundling: adding manifests
174 174 # unbundling: adding file changes
175 175 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
176 176 # unbundling: (1 other changesets obsolete on arrival)
177 177 # unbundling: (run 'hg heads' to see heads)
178 178
179 179 $ testrevs 'desc("C-A1")'
180 180 ### Matched revisions###
181 181 cf2c22470d67: C-A1
182 182 ### Relevant markers ###
183 183 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
184 184 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
185 185 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
186 186 # bundling: 1 changesets found
187 187 ### Bundled markers ###
188 188 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
189 189 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
190 190 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
191 191 ### diff <relevant> <bundled> ###
192 192 #################################
193 193 ### Exclusive markers ###
194 194 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
195 195 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
196 196 # stripping: saved backup bundle to $TESTTMP/simple-chain/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
197 197 ### Backup markers ###
198 198 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
199 199 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
200 200 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
201 201 ### diff <relevant> <backed-up> ###
202 202 #################################
203 203 ### Stripped markers ###
204 204 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
205 205 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
206 206 ### diff <exclusive> <stripped> ###
207 207 #################################
208 208 # unbundling: adding changesets
209 209 # unbundling: adding manifests
210 210 # unbundling: adding file changes
211 211 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
212 212 # unbundling: 2 new obsolescence markers
213 213 # unbundling: obsoleted 1 changesets
214 214 # unbundling: new changesets cf2c22470d67 (1 drafts)
215 215 # unbundling: (run 'hg heads' to see heads)
216 216
217 217 $ testrevs 'desc("C-A")'
218 218 ### Matched revisions###
219 219 84fcb0dfe17b: C-A0
220 220 cf2c22470d67: C-A1
221 221 ### Relevant markers ###
222 222 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
223 223 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
224 224 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
225 225 # bundling: 2 changesets found
226 226 ### Bundled markers ###
227 227 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
228 228 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
229 229 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
230 230 ### diff <relevant> <bundled> ###
231 231 #################################
232 232 ### Exclusive markers ###
233 233 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
234 234 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
235 235 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
236 236 # stripping: saved backup bundle to $TESTTMP/simple-chain/.hg/strip-backup/cf2c22470d67-fce4fc64-backup.hg
237 237 ### Backup markers ###
238 238 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
239 239 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
240 240 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
241 241 ### diff <relevant> <backed-up> ###
242 242 #################################
243 243 ### Stripped markers ###
244 244 84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
245 245 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
246 246 a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
247 247 ### diff <exclusive> <stripped> ###
248 248 #################################
249 249 # unbundling: adding changesets
250 250 # unbundling: adding manifests
251 251 # unbundling: adding file changes
252 252 # unbundling: added 2 changesets with 2 changes to 2 files (+1 heads)
253 253 # unbundling: 3 new obsolescence markers
254 254 # unbundling: new changesets cf2c22470d67 (1 drafts)
255 255 # unbundling: (1 other changesets obsolete on arrival)
256 256 # unbundling: (run 'hg heads' to see heads)
257 257
258 258 chain with prune children
259 259 =========================
260 260
261 261 . β‡ βŠ— B0
262 262 . |
263 263 . β‡ ΓΈβ‡ β—” A1
264 264 . |
265 265 . ●
266 266
267 267 setup
268 268 -----
269 269
270 270 $ mktestrepo prune
271 271 $ mkcommit 'C-A0'
272 272 $ mkcommit 'C-B0'
273 273 $ hg up 'desc("ROOT")'
274 274 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
275 275 $ mkcommit 'C-A1'
276 276 created new head
277 277 $ hg debugobsolete a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 `getid 'desc("C-A0")'`
278 278 1 new obsolescence markers
279 279 $ hg debugobsolete `getid 'desc("C-A0")'` `getid 'desc("C-A1")'`
280 280 1 new obsolescence markers
281 281 obsoleted 1 changesets
282 282 1 new orphan changesets
283 283 $ hg debugobsolete --record-parents `getid 'desc("C-B0")'`
284 284 1 new obsolescence markers
285 285 obsoleted 1 changesets
286 286 $ hg up 'desc("ROOT")'
287 287 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
288 288 $ hg log --hidden -G
289 289 o cf2c22470d67: C-A1
290 290 |
291 291 | x 29f93b1df87b: C-B0
292 292 | |
293 293 | x 84fcb0dfe17b: C-A0
294 294 |/
295 295 @ ea207398892e: ROOT
296 296
297 297 $ hg debugobsolete
298 298 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
299 299 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
300 300 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
301 301
302 302 Actual testing
303 303 --------------
304 304
305 305 $ testrevs 'desc("C-A0")'
306 306 ### Matched revisions###
307 307 84fcb0dfe17b: C-A0
308 308 ### Relevant markers ###
309 309 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
310 310 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
311 311 # bundling: 1 changesets found
312 312 ### Bundled markers ###
313 313 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
314 314 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
315 315 ### diff <relevant> <bundled> ###
316 316 #################################
317 317 ### Exclusive markers ###
318 318
319 319 (The strip markers is considered exclusive to the pruned changeset even if it
320 320 is also considered "relevant" to its parent. This allows to strip prune
321 321 markers. This avoid leaving prune markers from dead-end that could be
322 322 problematic)
323 323
324 324 $ testrevs 'desc("C-B0")'
325 325 ### Matched revisions###
326 326 29f93b1df87b: C-B0
327 327 ### Relevant markers ###
328 328 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
329 329 # bundling: 1 changesets found
330 330 ### Bundled markers ###
331 331 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
332 332 ### diff <relevant> <bundled> ###
333 333 #################################
334 334 ### Exclusive markers ###
335 335 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
336 336 # stripping: saved backup bundle to $TESTTMP/prune/.hg/strip-backup/29f93b1df87b-7fb32101-backup.hg
337 337 ### Backup markers ###
338 338 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
339 339 ### diff <relevant> <backed-up> ###
340 340 #################################
341 341 ### Stripped markers ###
342 342 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
343 343 ### diff <exclusive> <stripped> ###
344 344 #################################
345 345 # unbundling: adding changesets
346 346 # unbundling: adding manifests
347 347 # unbundling: adding file changes
348 348 # unbundling: added 1 changesets with 1 changes to 1 files
349 349 # unbundling: 1 new obsolescence markers
350 350 # unbundling: (1 other changesets obsolete on arrival)
351 351 # unbundling: (run 'hg update' to get a working copy)
352 352
353 353 $ testrevs 'desc("C-A1")'
354 354 ### Matched revisions###
355 355 cf2c22470d67: C-A1
356 356 ### Relevant markers ###
357 357 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
358 358 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
359 359 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
360 360 # bundling: 1 changesets found
361 361 ### Bundled markers ###
362 362 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
363 363 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
364 364 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
365 365 ### diff <relevant> <bundled> ###
366 366 #################################
367 367 ### Exclusive markers ###
368 368 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
369 369 # stripping: saved backup bundle to $TESTTMP/prune/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
370 370 ### Backup markers ###
371 371 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
372 372 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
373 373 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
374 374 ### diff <relevant> <backed-up> ###
375 375 #################################
376 376 ### Stripped markers ###
377 377 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
378 378 ### diff <exclusive> <stripped> ###
379 379 #################################
380 380 # unbundling: adding changesets
381 381 # unbundling: adding manifests
382 382 # unbundling: adding file changes
383 383 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
384 384 # unbundling: 1 new obsolescence markers
385 385 # unbundling: obsoleted 1 changesets
386 386 # unbundling: new changesets cf2c22470d67 (1 drafts)
387 387 # unbundling: (run 'hg heads' to see heads)
388 388
389 389 bundling multiple revisions
390 390
391 391 $ testrevs 'desc("C-A")'
392 392 ### Matched revisions###
393 393 84fcb0dfe17b: C-A0
394 394 cf2c22470d67: C-A1
395 395 ### Relevant markers ###
396 396 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
397 397 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
398 398 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
399 399 # bundling: 2 changesets found
400 400 ### Bundled markers ###
401 401 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
402 402 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
403 403 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
404 404 ### diff <relevant> <bundled> ###
405 405 #################################
406 406 ### Exclusive markers ###
407 407 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
408 408 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
409 409
410 410 $ testrevs 'desc("C-")'
411 411 ### Matched revisions###
412 412 29f93b1df87b: C-B0
413 413 84fcb0dfe17b: C-A0
414 414 cf2c22470d67: C-A1
415 415 ### Relevant markers ###
416 416 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
417 417 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
418 418 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
419 419 # bundling: 3 changesets found
420 420 ### Bundled markers ###
421 421 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
422 422 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
423 423 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
424 424 ### diff <relevant> <bundled> ###
425 425 #################################
426 426 ### Exclusive markers ###
427 427 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
428 428 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
429 429 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
430 430 # stripping: saved backup bundle to $TESTTMP/prune/.hg/strip-backup/cf2c22470d67-884c33b0-backup.hg
431 431 ### Backup markers ###
432 432 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
433 433 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
434 434 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
435 435 ### diff <relevant> <backed-up> ###
436 436 #################################
437 437 ### Stripped markers ###
438 438 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
439 439 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
440 440 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
441 441 ### diff <exclusive> <stripped> ###
442 442 #################################
443 443 # unbundling: adding changesets
444 444 # unbundling: adding manifests
445 445 # unbundling: adding file changes
446 446 # unbundling: added 3 changesets with 3 changes to 3 files (+1 heads)
447 447 # unbundling: 3 new obsolescence markers
448 448 # unbundling: new changesets cf2c22470d67 (1 drafts)
449 449 # unbundling: (2 other changesets obsolete on arrival)
450 450 # unbundling: (run 'hg heads' to see heads)
451 451
452 452 chain with precursors also pruned
453 453 =================================
454 454
455 455 . A0 (also pruned)
456 456 . β‡ ΓΈβ‡ β—” A1
457 457 . |
458 458 . ●
459 459
460 460 setup
461 461 -----
462 462
463 463 $ mktestrepo prune-inline
464 464 $ mkcommit 'C-A0'
465 465 $ hg up 'desc("ROOT")'
466 466 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
467 467 $ mkcommit 'C-A1'
468 468 created new head
469 469 $ hg debugobsolete a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 `getid 'desc("C-A0")'`
470 470 1 new obsolescence markers
471 471 $ hg debugobsolete --record-parents `getid 'desc("C-A0")'`
472 472 1 new obsolescence markers
473 473 obsoleted 1 changesets
474 474 $ hg debugobsolete `getid 'desc("C-A0")'` `getid 'desc("C-A1")'`
475 475 1 new obsolescence markers
476 476 $ hg up 'desc("ROOT")'
477 477 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
478 478 $ hg log --hidden -G
479 479 o cf2c22470d67: C-A1
480 480 |
481 481 | x 84fcb0dfe17b: C-A0
482 482 |/
483 483 @ ea207398892e: ROOT
484 484
485 485 $ hg debugobsolete
486 486 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
487 487 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
488 488 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
489 489
490 490 Actual testing
491 491 --------------
492 492
493 493 $ testrevs 'desc("C-A0")'
494 494 ### Matched revisions###
495 495 84fcb0dfe17b: C-A0
496 496 ### Relevant markers ###
497 497 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
498 498 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
499 499 # bundling: 1 changesets found
500 500 ### Bundled markers ###
501 501 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
502 502 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
503 503 ### diff <relevant> <bundled> ###
504 504 #################################
505 505 ### Exclusive markers ###
506 506 # stripping: saved backup bundle to $TESTTMP/prune-inline/.hg/strip-backup/84fcb0dfe17b-6454bbdc-backup.hg
507 507 ### Backup markers ###
508 508 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
509 509 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
510 510 ### diff <relevant> <backed-up> ###
511 511 #################################
512 512 ### Stripped markers ###
513 513 ### diff <exclusive> <stripped> ###
514 514 #################################
515 515 # unbundling: adding changesets
516 516 # unbundling: adding manifests
517 517 # unbundling: adding file changes
518 518 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
519 519 # unbundling: (1 other changesets obsolete on arrival)
520 520 # unbundling: (run 'hg heads' to see heads)
521 521
522 522 $ testrevs 'desc("C-A1")'
523 523 ### Matched revisions###
524 524 cf2c22470d67: C-A1
525 525 ### Relevant markers ###
526 526 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
527 527 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
528 528 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
529 529 # bundling: 1 changesets found
530 530 ### Bundled markers ###
531 531 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
532 532 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
533 533 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
534 534 ### diff <relevant> <bundled> ###
535 535 #################################
536 536 ### Exclusive markers ###
537 537 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
538 538 # stripping: saved backup bundle to $TESTTMP/prune-inline/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
539 539 ### Backup markers ###
540 540 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
541 541 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
542 542 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
543 543 ### diff <relevant> <backed-up> ###
544 544 #################################
545 545 ### Stripped markers ###
546 546 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
547 547 ### diff <exclusive> <stripped> ###
548 548 #################################
549 549 # unbundling: adding changesets
550 550 # unbundling: adding manifests
551 551 # unbundling: adding file changes
552 552 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
553 553 # unbundling: 1 new obsolescence markers
554 554 # unbundling: new changesets cf2c22470d67 (1 drafts)
555 555 # unbundling: (run 'hg heads' to see heads)
556 556
557 557 $ testrevs 'desc("C-A")'
558 558 ### Matched revisions###
559 559 84fcb0dfe17b: C-A0
560 560 cf2c22470d67: C-A1
561 561 ### Relevant markers ###
562 562 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
563 563 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
564 564 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
565 565 # bundling: 2 changesets found
566 566 ### Bundled markers ###
567 567 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
568 568 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
569 569 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
570 570 ### diff <relevant> <bundled> ###
571 571 #################################
572 572 ### Exclusive markers ###
573 573 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
574 574 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
575 575 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
576 576 # stripping: saved backup bundle to $TESTTMP/prune-inline/.hg/strip-backup/cf2c22470d67-fce4fc64-backup.hg
577 577 ### Backup markers ###
578 578 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
579 579 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
580 580 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
581 581 ### diff <relevant> <backed-up> ###
582 582 #################################
583 583 ### Stripped markers ###
584 584 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
585 585 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
586 586 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
587 587 ### diff <exclusive> <stripped> ###
588 588 #################################
589 589 # unbundling: adding changesets
590 590 # unbundling: adding manifests
591 591 # unbundling: adding file changes
592 592 # unbundling: added 2 changesets with 2 changes to 2 files (+1 heads)
593 593 # unbundling: 3 new obsolescence markers
594 594 # unbundling: new changesets cf2c22470d67 (1 drafts)
595 595 # unbundling: (1 other changesets obsolete on arrival)
596 596 # unbundling: (run 'hg heads' to see heads)
597 597
598 598 chain with missing prune
599 599 ========================
600 600
601 601 . βŠ— B
602 602 . |
603 603 . β‡ β—Œβ‡ β—” A1
604 604 . |
605 605 . ●
606 606
607 607 setup
608 608 -----
609 609
610 610 $ mktestrepo missing-prune
611 611 $ mkcommit 'C-A0'
612 612 $ mkcommit 'C-B0'
613 613 $ hg up 'desc("ROOT")'
614 614 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
615 615 $ mkcommit 'C-A1'
616 616 created new head
617 617 $ hg debugobsolete a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 `getid 'desc("C-A0")'`
618 618 1 new obsolescence markers
619 619 $ hg debugobsolete `getid 'desc("C-A0")'` `getid 'desc("C-A1")'`
620 620 1 new obsolescence markers
621 621 obsoleted 1 changesets
622 622 1 new orphan changesets
623 623 $ hg debugobsolete --record-parents `getid 'desc("C-B0")'`
624 624 1 new obsolescence markers
625 625 obsoleted 1 changesets
626 626
627 627 (it is annoying to create prune with parent data without the changeset, so we strip it after the fact)
628 628
629 629 $ hg strip --hidden --rev 'desc("C-A0")::' --no-backup --config devel.strip-obsmarkers=no
630 630
631 631 $ hg up 'desc("ROOT")'
632 632 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
633 633 $ hg log --hidden -G
634 634 o cf2c22470d67: C-A1
635 635 |
636 636 @ ea207398892e: ROOT
637 637
638 638 $ hg debugobsolete
639 639 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
640 640 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
641 641 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
642 642
643 643 Actual testing
644 644 --------------
645 645
646 646 $ testrevs 'desc("C-A1")'
647 647 ### Matched revisions###
648 648 cf2c22470d67: C-A1
649 649 ### Relevant markers ###
650 650 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
651 651 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
652 652 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
653 653 # bundling: 1 changesets found
654 654 ### Bundled markers ###
655 655 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
656 656 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
657 657 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
658 658 ### diff <relevant> <bundled> ###
659 659 #################################
660 660 ### Exclusive markers ###
661 661 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
662 662 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
663 663 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
664 664 # stripping: saved backup bundle to $TESTTMP/missing-prune/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
665 665 ### Backup markers ###
666 666 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
667 667 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
668 668 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
669 669 ### diff <relevant> <backed-up> ###
670 670 #################################
671 671 ### Stripped markers ###
672 672 29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
673 673 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
674 674 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
675 675 ### diff <exclusive> <stripped> ###
676 676 #################################
677 677 # unbundling: adding changesets
678 678 # unbundling: adding manifests
679 679 # unbundling: adding file changes
680 680 # unbundling: added 1 changesets with 1 changes to 1 files
681 681 # unbundling: 3 new obsolescence markers
682 682 # unbundling: new changesets cf2c22470d67 (1 drafts)
683 683 # unbundling: (run 'hg update' to get a working copy)
684 684
685 685 chain with precursors also pruned
686 686 =================================
687 687
688 688 . A0 (also pruned)
689 689 . β‡ β—Œβ‡ β—” A1
690 690 . |
691 691 . ●
692 692
693 693 setup
694 694 -----
695 695
696 696 $ mktestrepo prune-inline-missing
697 697 $ mkcommit 'C-A0'
698 698 $ hg up 'desc("ROOT")'
699 699 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
700 700 $ mkcommit 'C-A1'
701 701 created new head
702 702 $ hg debugobsolete a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 `getid 'desc("C-A0")'`
703 703 1 new obsolescence markers
704 704 $ hg debugobsolete --record-parents `getid 'desc("C-A0")'`
705 705 1 new obsolescence markers
706 706 obsoleted 1 changesets
707 707 $ hg debugobsolete `getid 'desc("C-A0")'` `getid 'desc("C-A1")'`
708 708 1 new obsolescence markers
709 709
710 710 (it is annoying to create prune with parent data without the changeset, so we strip it after the fact)
711 711
712 712 $ hg strip --hidden --rev 'desc("C-A0")::' --no-backup --config devel.strip-obsmarkers=no
713 713
714 714 $ hg up 'desc("ROOT")'
715 715 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
716 716 $ hg log --hidden -G
717 717 o cf2c22470d67: C-A1
718 718 |
719 719 @ ea207398892e: ROOT
720 720
721 721 $ hg debugobsolete
722 722 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
723 723 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
724 724 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
725 725
726 726 Actual testing
727 727 --------------
728 728
729 729 $ testrevs 'desc("C-A1")'
730 730 ### Matched revisions###
731 731 cf2c22470d67: C-A1
732 732 ### Relevant markers ###
733 733 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
734 734 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
735 735 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
736 736 # bundling: 1 changesets found
737 737 ### Bundled markers ###
738 738 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
739 739 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
740 740 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
741 741 ### diff <relevant> <bundled> ###
742 742 #################################
743 743 ### Exclusive markers ###
744 744 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
745 745 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
746 746 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
747 747 # stripping: saved backup bundle to $TESTTMP/prune-inline-missing/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
748 748 ### Backup markers ###
749 749 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
750 750 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
751 751 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
752 752 ### diff <relevant> <backed-up> ###
753 753 #################################
754 754 ### Stripped markers ###
755 755 84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
756 756 84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
757 757 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
758 758 ### diff <exclusive> <stripped> ###
759 759 #################################
760 760 # unbundling: adding changesets
761 761 # unbundling: adding manifests
762 762 # unbundling: adding file changes
763 763 # unbundling: added 1 changesets with 1 changes to 1 files
764 764 # unbundling: 3 new obsolescence markers
765 765 # unbundling: new changesets cf2c22470d67 (1 drafts)
766 766 # unbundling: (run 'hg update' to get a working copy)
767 767
768 768 Chain with fold and split
769 769 =========================
770 770
771 771 setup
772 772 -----
773 773
774 774 $ mktestrepo split-fold
775 775 $ mkcommit 'C-A'
776 776 $ hg up 'desc("ROOT")'
777 777 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
778 778 $ mkcommit 'C-B'
779 779 created new head
780 780 $ hg up 'desc("ROOT")'
781 781 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
782 782 $ mkcommit 'C-C'
783 783 created new head
784 784 $ hg up 'desc("ROOT")'
785 785 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
786 786 $ mkcommit 'C-D'
787 787 created new head
788 788 $ hg up 'desc("ROOT")'
789 789 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
790 790 $ mkcommit 'C-E'
791 791 created new head
792 792 $ hg debugobsolete a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 `getid 'desc("C-A")'`
793 793 1 new obsolescence markers
794 794 $ hg debugobsolete `getid 'desc("C-A")'` `getid 'desc("C-B")'` `getid 'desc("C-C")'` # record split
795 795 1 new obsolescence markers
796 796 obsoleted 1 changesets
797 797 $ hg debugobsolete `getid 'desc("C-A")'` `getid 'desc("C-D")'` # other divergent
798 798 1 new obsolescence markers
799 799 3 new content-divergent changesets
800 800 $ hg debugobsolete `getid 'desc("C-A")'` b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0
801 801 1 new obsolescence markers
802 802 $ hg debugobsolete b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 `getid 'desc("C-E")'`
803 803 1 new obsolescence markers
804 804 1 new content-divergent changesets
805 805 $ hg debugobsolete `getid 'desc("C-B")'` `getid 'desc("C-E")'`
806 806 1 new obsolescence markers
807 807 obsoleted 1 changesets
808 808 $ hg debugobsolete `getid 'desc("C-C")'` `getid 'desc("C-E")'`
809 809 1 new obsolescence markers
810 810 obsoleted 1 changesets
811 811 $ hg debugobsolete `getid 'desc("C-D")'` `getid 'desc("C-E")'`
812 812 1 new obsolescence markers
813 813 obsoleted 1 changesets
814 814 $ hg debugobsolete c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 `getid 'desc("C-E")'`
815 815 1 new obsolescence markers
816 816
817 817 $ hg up 'desc("ROOT")'
818 818 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
819 819 $ hg log --hidden -G
820 820 o 2f20ff6509f0: C-E
821 821 |
822 822 | x 06dc9da25ef0: C-D
823 823 |/
824 824 | x 27ec657ca21d: C-C
825 825 |/
826 826 | x a9b9da38ed96: C-B
827 827 |/
828 828 | x 9ac430e15fca: C-A
829 829 |/
830 830 @ ea207398892e: ROOT
831 831
832 832 $ hg debugobsolete
833 833 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
834 834 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
835 835 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
836 836 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
837 837 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
838 838 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
839 839 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
840 840 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
841 841 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
842 842
843 843 Actual testing
844 844 --------------
845 845
846 846 $ testrevs 'desc("C-A")'
847 847 ### Matched revisions###
848 848 9ac430e15fca: C-A
849 849 ### Relevant markers ###
850 850 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
851 851 # bundling: 1 changesets found
852 852 ### Bundled markers ###
853 853 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
854 854 ### diff <relevant> <bundled> ###
855 855 #################################
856 856 ### Exclusive markers ###
857 857 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/9ac430e15fca-81204eba-backup.hg
858 858 ### Backup markers ###
859 859 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
860 860 ### diff <relevant> <backed-up> ###
861 861 #################################
862 862 ### Stripped markers ###
863 863 ### diff <exclusive> <stripped> ###
864 864 #################################
865 865 # unbundling: adding changesets
866 866 # unbundling: adding manifests
867 867 # unbundling: adding file changes
868 868 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
869 869 # unbundling: (1 other changesets obsolete on arrival)
870 870 # unbundling: (run 'hg heads' to see heads)
871 871
872 872 $ testrevs 'desc("C-B")'
873 873 ### Matched revisions###
874 874 a9b9da38ed96: C-B
875 875 ### Relevant markers ###
876 876 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
877 877 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
878 878 # bundling: 1 changesets found
879 879 ### Bundled markers ###
880 880 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
881 881 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
882 882 ### diff <relevant> <bundled> ###
883 883 #################################
884 884 ### Exclusive markers ###
885 885 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/a9b9da38ed96-7465d6e9-backup.hg
886 886 ### Backup markers ###
887 887 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
888 888 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
889 889 ### diff <relevant> <backed-up> ###
890 890 #################################
891 891 ### Stripped markers ###
892 892 ### diff <exclusive> <stripped> ###
893 893 #################################
894 894 # unbundling: adding changesets
895 895 # unbundling: adding manifests
896 896 # unbundling: adding file changes
897 897 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
898 898 # unbundling: (1 other changesets obsolete on arrival)
899 899 # unbundling: (run 'hg heads' to see heads)
900 900
901 901 $ testrevs 'desc("C-C")'
902 902 ### Matched revisions###
903 903 27ec657ca21d: C-C
904 904 ### Relevant markers ###
905 905 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
906 906 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
907 907 # bundling: 1 changesets found
908 908 ### Bundled markers ###
909 909 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
910 910 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
911 911 ### diff <relevant> <bundled> ###
912 912 #################################
913 913 ### Exclusive markers ###
914 914 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/27ec657ca21d-d5dd1c7c-backup.hg
915 915 ### Backup markers ###
916 916 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
917 917 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
918 918 ### diff <relevant> <backed-up> ###
919 919 #################################
920 920 ### Stripped markers ###
921 921 ### diff <exclusive> <stripped> ###
922 922 #################################
923 923 # unbundling: adding changesets
924 924 # unbundling: adding manifests
925 925 # unbundling: adding file changes
926 926 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
927 927 # unbundling: (1 other changesets obsolete on arrival)
928 928 # unbundling: (run 'hg heads' to see heads)
929 929
930 930 $ testrevs 'desc("C-D")'
931 931 ### Matched revisions###
932 932 06dc9da25ef0: C-D
933 933 ### Relevant markers ###
934 934 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
935 935 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
936 936 # bundling: 1 changesets found
937 937 ### Bundled markers ###
938 938 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
939 939 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
940 940 ### diff <relevant> <bundled> ###
941 941 #################################
942 942 ### Exclusive markers ###
943 943 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/06dc9da25ef0-9b1c0a91-backup.hg
944 944 ### Backup markers ###
945 945 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
946 946 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
947 947 ### diff <relevant> <backed-up> ###
948 948 #################################
949 949 ### Stripped markers ###
950 950 ### diff <exclusive> <stripped> ###
951 951 #################################
952 952 # unbundling: adding changesets
953 953 # unbundling: adding manifests
954 954 # unbundling: adding file changes
955 955 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
956 956 # unbundling: (1 other changesets obsolete on arrival)
957 957 # unbundling: (run 'hg heads' to see heads)
958 958
959 959 $ testrevs 'desc("C-E")'
960 960 ### Matched revisions###
961 961 2f20ff6509f0: C-E
962 962 ### Relevant markers ###
963 963 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
964 964 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
965 965 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
966 966 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
967 967 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
968 968 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
969 969 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
970 970 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
971 971 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
972 972 # bundling: 1 changesets found
973 973 ### Bundled markers ###
974 974 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
975 975 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
976 976 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
977 977 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
978 978 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
979 979 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
980 980 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
981 981 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
982 982 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
983 983 ### diff <relevant> <bundled> ###
984 984 #################################
985 985 ### Exclusive markers ###
986 986 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
987 987 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
988 988 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
989 989 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
990 990 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
991 991 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
992 992 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/2f20ff6509f0-8adeb22d-backup.hg
993 993 3 new content-divergent changesets
994 994 ### Backup markers ###
995 995 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
996 996 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
997 997 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
998 998 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
999 999 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1000 1000 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1001 1001 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1002 1002 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1003 1003 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1004 1004 ### diff <relevant> <backed-up> ###
1005 1005 #################################
1006 1006 ### Stripped markers ###
1007 1007 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1008 1008 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1009 1009 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1010 1010 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1011 1011 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1012 1012 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1013 1013 ### diff <exclusive> <stripped> ###
1014 1014 #################################
1015 1015 # unbundling: adding changesets
1016 1016 # unbundling: adding manifests
1017 1017 # unbundling: adding file changes
1018 1018 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
1019 1019 # unbundling: 6 new obsolescence markers
1020 1020 # unbundling: obsoleted 3 changesets
1021 1021 # unbundling: new changesets 2f20ff6509f0 (1 drafts)
1022 1022 # unbundling: (run 'hg heads' to see heads)
1023 1023
1024 1024 Bundle multiple revisions
1025 1025
1026 1026 * each part of the split
1027 1027
1028 1028 $ testrevs 'desc("C-B") + desc("C-C")'
1029 1029 ### Matched revisions###
1030 1030 27ec657ca21d: C-C
1031 1031 a9b9da38ed96: C-B
1032 1032 ### Relevant markers ###
1033 1033 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1034 1034 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1035 1035 # bundling: 2 changesets found
1036 1036 ### Bundled markers ###
1037 1037 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1038 1038 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1039 1039 ### diff <relevant> <bundled> ###
1040 1040 #################################
1041 1041 ### Exclusive markers ###
1042 1042 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/a9b9da38ed96-0daf625a-backup.hg
1043 1043 ### Backup markers ###
1044 1044 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1045 1045 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1046 1046 ### diff <relevant> <backed-up> ###
1047 1047 #################################
1048 1048 ### Stripped markers ###
1049 1049 ### diff <exclusive> <stripped> ###
1050 1050 #################################
1051 1051 # unbundling: adding changesets
1052 1052 # unbundling: adding manifests
1053 1053 # unbundling: adding file changes
1054 1054 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1055 1055 # unbundling: (2 other changesets obsolete on arrival)
1056 1056 # unbundling: (run 'hg heads' to see heads)
1057 1057
1058 1058 * top one and other divergent
1059 1059
1060 1060 $ testrevs 'desc("C-E") + desc("C-D")'
1061 1061 ### Matched revisions###
1062 1062 06dc9da25ef0: C-D
1063 1063 2f20ff6509f0: C-E
1064 1064 ### Relevant markers ###
1065 1065 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1066 1066 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1067 1067 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1068 1068 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1069 1069 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1070 1070 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1071 1071 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1072 1072 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1073 1073 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1074 1074 # bundling: 2 changesets found
1075 1075 ### Bundled markers ###
1076 1076 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1077 1077 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1078 1078 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1079 1079 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1080 1080 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1081 1081 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1082 1082 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1083 1083 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1084 1084 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1085 1085 ### diff <relevant> <bundled> ###
1086 1086 #################################
1087 1087 ### Exclusive markers ###
1088 1088 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1089 1089 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1090 1090 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1091 1091 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1092 1092 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1093 1093 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1094 1094 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1095 1095 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/2f20ff6509f0-bf1b80f4-backup.hg
1096 1096 ### Backup markers ###
1097 1097 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1098 1098 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1099 1099 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1100 1100 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1101 1101 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1102 1102 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1103 1103 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1104 1104 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1105 1105 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1106 1106 ### diff <relevant> <backed-up> ###
1107 1107 #################################
1108 1108 ### Stripped markers ###
1109 1109 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1110 1110 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1111 1111 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1112 1112 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1113 1113 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1114 1114 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1115 1115 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1116 1116 ### diff <exclusive> <stripped> ###
1117 1117 #################################
1118 1118 # unbundling: adding changesets
1119 1119 # unbundling: adding manifests
1120 1120 # unbundling: adding file changes
1121 1121 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1122 1122 # unbundling: 7 new obsolescence markers
1123 1123 # unbundling: obsoleted 2 changesets
1124 1124 # unbundling: new changesets 2f20ff6509f0 (1 drafts)
1125 1125 # unbundling: (1 other changesets obsolete on arrival)
1126 1126 # unbundling: (run 'hg heads' to see heads)
1127 1127
1128 1128 * top one and initial precursors
1129 1129
1130 1130 $ testrevs 'desc("C-E") + desc("C-A")'
1131 1131 ### Matched revisions###
1132 1132 2f20ff6509f0: C-E
1133 1133 9ac430e15fca: C-A
1134 1134 ### Relevant markers ###
1135 1135 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1136 1136 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1137 1137 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1138 1138 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1139 1139 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1140 1140 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1141 1141 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1142 1142 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1143 1143 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1144 1144 # bundling: 2 changesets found
1145 1145 ### Bundled markers ###
1146 1146 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1147 1147 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1148 1148 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1149 1149 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1150 1150 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1151 1151 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1152 1152 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1153 1153 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1154 1154 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1155 1155 ### diff <relevant> <bundled> ###
1156 1156 #################################
1157 1157 ### Exclusive markers ###
1158 1158 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1159 1159 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1160 1160 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1161 1161 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1162 1162 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1163 1163 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1164 1164 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/9ac430e15fca-36b6476a-backup.hg
1165 1165 3 new content-divergent changesets
1166 1166 ### Backup markers ###
1167 1167 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1168 1168 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1169 1169 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1170 1170 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1171 1171 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1172 1172 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1173 1173 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1174 1174 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1175 1175 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1176 1176 ### diff <relevant> <backed-up> ###
1177 1177 #################################
1178 1178 ### Stripped markers ###
1179 1179 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1180 1180 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1181 1181 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1182 1182 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1183 1183 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1184 1184 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1185 1185 ### diff <exclusive> <stripped> ###
1186 1186 #################################
1187 1187 # unbundling: adding changesets
1188 1188 # unbundling: adding manifests
1189 1189 # unbundling: adding file changes
1190 1190 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1191 1191 # unbundling: 6 new obsolescence markers
1192 1192 # unbundling: obsoleted 3 changesets
1193 1193 # unbundling: new changesets 2f20ff6509f0 (1 drafts)
1194 1194 # unbundling: (1 other changesets obsolete on arrival)
1195 1195 # unbundling: (run 'hg heads' to see heads)
1196 1196
1197 1197 * top one and one of the split
1198 1198
1199 1199 $ testrevs 'desc("C-E") + desc("C-C")'
1200 1200 ### Matched revisions###
1201 1201 27ec657ca21d: C-C
1202 1202 2f20ff6509f0: C-E
1203 1203 ### Relevant markers ###
1204 1204 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1205 1205 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1206 1206 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1207 1207 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1208 1208 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1209 1209 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1210 1210 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1211 1211 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1212 1212 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1213 1213 # bundling: 2 changesets found
1214 1214 ### Bundled markers ###
1215 1215 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1216 1216 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1217 1217 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1218 1218 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1219 1219 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1220 1220 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1221 1221 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1222 1222 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1223 1223 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1224 1224 ### diff <relevant> <bundled> ###
1225 1225 #################################
1226 1226 ### Exclusive markers ###
1227 1227 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1228 1228 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1229 1229 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1230 1230 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1231 1231 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1232 1232 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1233 1233 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1234 1234 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/2f20ff6509f0-5fdfcd7d-backup.hg
1235 1235 ### Backup markers ###
1236 1236 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1237 1237 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1238 1238 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1239 1239 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1240 1240 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1241 1241 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1242 1242 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1243 1243 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1244 1244 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1245 1245 ### diff <relevant> <backed-up> ###
1246 1246 #################################
1247 1247 ### Stripped markers ###
1248 1248 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1249 1249 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1250 1250 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1251 1251 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1252 1252 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1253 1253 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1254 1254 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1255 1255 ### diff <exclusive> <stripped> ###
1256 1256 #################################
1257 1257 # unbundling: adding changesets
1258 1258 # unbundling: adding manifests
1259 1259 # unbundling: adding file changes
1260 1260 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1261 1261 # unbundling: 7 new obsolescence markers
1262 1262 # unbundling: obsoleted 2 changesets
1263 1263 # unbundling: new changesets 2f20ff6509f0 (1 drafts)
1264 1264 # unbundling: (1 other changesets obsolete on arrival)
1265 1265 # unbundling: (run 'hg heads' to see heads)
1266 1266
1267 1267 * all
1268 1268
1269 1269 $ testrevs 'desc("C-")'
1270 1270 ### Matched revisions###
1271 1271 06dc9da25ef0: C-D
1272 1272 27ec657ca21d: C-C
1273 1273 2f20ff6509f0: C-E
1274 1274 9ac430e15fca: C-A
1275 1275 a9b9da38ed96: C-B
1276 1276 ### Relevant markers ###
1277 1277 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1278 1278 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1279 1279 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1280 1280 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1281 1281 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1282 1282 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1283 1283 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1284 1284 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1285 1285 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1286 1286 # bundling: 5 changesets found
1287 1287 ### Bundled markers ###
1288 1288 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1289 1289 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1290 1290 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1291 1291 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1292 1292 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1293 1293 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1294 1294 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1295 1295 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1296 1296 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1297 1297 ### diff <relevant> <bundled> ###
1298 1298 #################################
1299 1299 ### Exclusive markers ###
1300 1300 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1301 1301 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1302 1302 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1303 1303 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1304 1304 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1305 1305 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1306 1306 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1307 1307 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1308 1308 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1309 1309 # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/a9b9da38ed96-eeb4258f-backup.hg
1310 1310 ### Backup markers ###
1311 1311 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1312 1312 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1313 1313 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1314 1314 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1315 1315 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1316 1316 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1317 1317 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1318 1318 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1319 1319 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1320 1320 ### diff <relevant> <backed-up> ###
1321 1321 #################################
1322 1322 ### Stripped markers ###
1323 1323 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1324 1324 27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1325 1325 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1326 1326 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1327 1327 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1328 1328 a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1329 1329 a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1330 1330 b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1331 1331 c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1332 1332 ### diff <exclusive> <stripped> ###
1333 1333 #################################
1334 1334 # unbundling: adding changesets
1335 1335 # unbundling: adding manifests
1336 1336 # unbundling: adding file changes
1337 1337 # unbundling: added 5 changesets with 5 changes to 5 files (+4 heads)
1338 1338 # unbundling: 9 new obsolescence markers
1339 1339 # unbundling: new changesets 2f20ff6509f0 (1 drafts)
1340 1340 # unbundling: (4 other changesets obsolete on arrival)
1341 1341 # unbundling: (run 'hg heads' to see heads)
1342 1342
1343 1343 changeset pruned on its own
1344 1344 ===========================
1345 1345
1346 1346 . βŠ— B
1347 1347 . |
1348 1348 . β—• A
1349 1349 . |
1350 1350 . ●
1351 1351
1352 1352 setup
1353 1353 -----
1354 1354
1355 1355 $ mktestrepo lonely-prune
1356 1356 $ hg up 'desc("ROOT")'
1357 1357 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1358 1358 $ mkcommit 'C-A'
1359 1359 $ mkcommit 'C-B'
1360 1360 $ hg debugobsolete --record-parent `getid 'desc("C-B")'`
1361 1361 1 new obsolescence markers
1362 1362 obsoleted 1 changesets
1363 1363
1364 1364 $ hg up 'desc("ROOT")'
1365 1365 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1366 1366 $ hg log --hidden -G
1367 1367 x cefb651fc2fd: C-B
1368 1368 |
1369 1369 o 9ac430e15fca: C-A
1370 1370 |
1371 1371 @ ea207398892e: ROOT
1372 1372
1373 1373 $ hg debugobsolete
1374 1374 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1375 1375
1376 1376 Actual testing
1377 1377 --------------
1378 1378 $ testrevs 'desc("C-A")'
1379 1379 ### Matched revisions###
1380 1380 9ac430e15fca: C-A
1381 1381 ### Relevant markers ###
1382 1382 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1383 1383 # bundling: 1 changesets found
1384 1384 ### Bundled markers ###
1385 1385 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1386 1386 ### diff <relevant> <bundled> ###
1387 1387 #################################
1388 1388 ### Exclusive markers ###
1389 1389 $ testrevs 'desc("C-B")'
1390 1390 ### Matched revisions###
1391 1391 cefb651fc2fd: C-B
1392 1392 ### Relevant markers ###
1393 1393 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1394 1394 # bundling: 1 changesets found
1395 1395 ### Bundled markers ###
1396 1396 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1397 1397 ### diff <relevant> <bundled> ###
1398 1398 #################################
1399 1399 ### Exclusive markers ###
1400 1400 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1401 1401 # stripping: saved backup bundle to $TESTTMP/lonely-prune/.hg/strip-backup/cefb651fc2fd-345c8dfa-backup.hg
1402 1402 ### Backup markers ###
1403 1403 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1404 1404 ### diff <relevant> <backed-up> ###
1405 1405 #################################
1406 1406 ### Stripped markers ###
1407 1407 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1408 1408 ### diff <exclusive> <stripped> ###
1409 1409 #################################
1410 1410 # unbundling: adding changesets
1411 1411 # unbundling: adding manifests
1412 1412 # unbundling: adding file changes
1413 1413 # unbundling: added 1 changesets with 1 changes to 1 files
1414 1414 # unbundling: 1 new obsolescence markers
1415 1415 # unbundling: (1 other changesets obsolete on arrival)
1416 1416 # unbundling: (run 'hg update' to get a working copy)
1417 1417 $ testrevs 'desc("C-")'
1418 1418 ### Matched revisions###
1419 1419 9ac430e15fca: C-A
1420 1420 cefb651fc2fd: C-B
1421 1421 ### Relevant markers ###
1422 1422 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1423 1423 # bundling: 2 changesets found
1424 1424 ### Bundled markers ###
1425 1425 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1426 1426 ### diff <relevant> <bundled> ###
1427 1427 #################################
1428 1428 ### Exclusive markers ###
1429 1429 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1430 1430 # stripping: saved backup bundle to $TESTTMP/lonely-prune/.hg/strip-backup/9ac430e15fca-b9855b02-backup.hg
1431 1431 ### Backup markers ###
1432 1432 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1433 1433 ### diff <relevant> <backed-up> ###
1434 1434 #################################
1435 1435 ### Stripped markers ###
1436 1436 cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1437 1437 ### diff <exclusive> <stripped> ###
1438 1438 #################################
1439 1439 # unbundling: adding changesets
1440 1440 # unbundling: adding manifests
1441 1441 # unbundling: adding file changes
1442 1442 # unbundling: added 2 changesets with 2 changes to 2 files
1443 1443 # unbundling: 1 new obsolescence markers
1444 1444 # unbundling: new changesets 9ac430e15fca (1 drafts)
1445 1445 # unbundling: (1 other changesets obsolete on arrival)
1446 1446 # unbundling: (run 'hg update' to get a working copy)
1447 1447
1448 1448 Test that advisory obsolescence markers in bundles are ignored if unsupported
1449 1449 -----------------------------------------------------------------------------
1450 1450
1451 1451 $ hg init repo-with-obs
1452 1452 $ cd repo-with-obs
1453 1453 $ hg debugbuilddag +1
1454 1454 $ hg debugobsolete `getid 0`
1455 1455 1 new obsolescence markers
1456 1456 obsoleted 1 changesets
1457 1457 $ hg bundle --config experimental.evolution.bundle-obsmarker=true --config experimental.evolution.bundle-obsmarker:mandatory=false --all --hidden bundle-with-obs
1458 1458 1 changesets found
1459 1459 $ cd ..
1460 1460 $ hg init repo-without-obs
1461 1461 $ cd repo-without-obs
1462 1462 $ hg --config experimental.evolution=False unbundle ../repo-with-obs/bundle-with-obs --debug
1463 1463 bundle2-input-bundle: 1 params with-transaction
1464 1464 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
1465 1465 adding changesets
1466 1466 add changeset 1ea73414a91b
1467 1467 adding manifests
1468 1468 adding file changes
1469 1469 bundle2-input-part: total payload size 190
1470 1470 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
1471 1471 bundle2-input-part: total payload size 39
1472 1472 bundle2-input-part: "obsmarkers" (advisory) supported
1473 1473 bundle2-input-part: total payload size 50
1474 1474 ignoring obsolescence markers, feature not enabled
1475 1475 bundle2-input-bundle: 3 parts total
1476 1476 updating the branch cache
1477 1477 added 1 changesets with 0 changes to 0 files
1478 1478 new changesets 1ea73414a91b (1 drafts)
1479 1479 (run 'hg update' to get a working copy)
1480 1480 $ cd ..
1481 1481
1482 1482 Test bundlespec overwrite default
1483 1483 ---------------------------------
1484 1484
1485 1485 # move back to the default
1486 1486
1487 1487 $ grep -v evolution.bundle-obsmarker $HGRCPATH > a
1488 1488 $ mv a $HGRCPATH
1489 1489
1490 1490 $ hg bundle -R repo-with-obs --type 'v2;obsolescence=yes' --all --hidden bundle-type-with-obs
1491 1491 1 changesets found
1492 1492 $ hg debugbundle bundle-type-with-obs --part-type obsmarkers
1493 1493 Stream params: {Compression: BZ}
1494 obsmarkers -- {} (mandatory: True) (missing-correct-output !)
1495 version: 1 (50 bytes) (missing-correct-output !)
1496 1ea73414a91b0920940797d8fc6a11e447f8ea1e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} (missing-correct-output !)
1494 obsmarkers -- {} (mandatory: True)
1495 version: 1 (50 bytes)
1496 1ea73414a91b0920940797d8fc6a11e447f8ea1e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
General Comments 0
You need to be logged in to leave comments. Login now