1HG(1) Mercurial Manual HG(1)
2
3
4
6 hg - Mercurial source code management system
7
9 hg command [option]... [argument]...
10
12 The hg command provides a command line interface to the Mercurial sys‐
13 tem.
14
16 files...
17 indicates one or more filename or relative path filenames; see
18 File Name Patterns for information on pattern matching
19
20 path indicates a path on the local machine
21
22 revision
23 indicates a changeset which can be specified as a changeset re‐
24 vision number, a tag, or a unique substring of the changeset
25 hash value
26
27 repository path
28 either the pathname of a local repository or the URI of a remote
29 repository.
30
32 -R,--repository <REPO>
33 repository root directory or name of overlay bundle file
34
35 --cwd <DIR>
36 change working directory
37
38 -y, --noninteractive
39 do not prompt, automatically pick the first choice for all
40 prompts
41
42 -q, --quiet
43 suppress output
44
45 -v, --verbose
46 enable additional output
47
48 --color <TYPE>
49 when to colorize (boolean, always, auto, never, or debug)
50
51 --config <CONFIG[+]>
52 set/override config option (use 'section.name=value')
53
54 --debug
55 enable debugging output
56
57 --debugger
58 start debugger
59
60 --encoding <ENCODE>
61 set the charset encoding (default: UTF-8)
62
63 --encodingmode <MODE>
64 set the charset encoding mode (default: strict)
65
66 --traceback
67 always print a traceback on exception
68
69 --time time how long the command takes
70
71 --profile
72 print command execution profile
73
74 --version
75 output version information and exit
76
77 -h, --help
78 display help and exit
79
80 --hidden
81 consider hidden changesets
82
83 --pager <TYPE>
84 when to paginate (boolean, always, auto, or never) (default:
85 auto)
86
87 [+] marked option can be specified multiple times
88
90 Repository creation
91 clone
92 make a copy of an existing repository:
93
94 hg clone [OPTION]... SOURCE [DEST]
95
96 Create a copy of an existing repository in a new directory.
97
98 If no destination directory name is specified, it defaults to the base‐
99 name of the source.
100
101 The location of the source is added to the new repository's .hg/hgrc
102 file, as the default to be used for future pulls.
103
104 Only local paths and ssh:// URLs are supported as destinations. For
105 ssh:// destinations, no working directory or .hg/hgrc will be created
106 on the remote side.
107
108 If the source repository has a bookmark called '@' set, that revision
109 will be checked out in the new repository by default.
110
111 To check out a particular version, use -u/--update, or -U/--noupdate to
112 create a clone with no working directory.
113
114 To pull only a subset of changesets, specify one or more revisions
115 identifiers with -r/--rev or branches with -b/--branch. The resulting
116 clone will contain only the specified changesets and their ancestors.
117 These options (or 'clone src#rev dest') imply --pull, even for local
118 source repositories.
119
120 In normal clone mode, the remote normalizes repository data into a com‐
121 mon exchange format and the receiving end translates this data into its
122 local storage format. --stream activates a different clone mode that
123 essentially copies repository files from the remote with minimal data
124 processing. This significantly reduces the CPU cost of a clone both re‐
125 motely and locally. However, it often increases the transferred data
126 size by 30-40%. This can result in substantially faster clones where
127 I/O throughput is plentiful, especially for larger repositories. A
128 side-effect of --stream clones is that storage settings and require‐
129 ments on the remote are applied locally: a modern client may inherit
130 legacy or inefficient storage used by the remote or a legacy Mercurial
131 client may not be able to clone from a modern Mercurial remote.
132
133 Note Specifying a tag will include the tagged changeset but not the
134 changeset containing the tag.
135
136 For efficiency, hardlinks are used for cloning whenever the source and
137 destination are on the same filesystem (note this applies only to the
138 repository data, not to the working directory). Some filesystems, such
139 as AFS, implement hardlinking incorrectly, but do not report errors. In
140 these cases, use the --pull option to avoid hardlinking.
141
142 Mercurial will update the working directory to the first applicable re‐
143 vision from this list:
144
145 a. null if -U or the source repository has no changesets
146
147 b. if -u . and the source repository is local, the first parent of the
148 source repository's working directory
149
150 c. the changeset specified with -u (if a branch name, this means the
151 latest head of that branch)
152
153 d. the changeset specified with -r
154
155 e. the tipmost head specified with -b
156
157 f. the tipmost head specified with the url#branch source syntax
158
159 g. the revision marked with the '@' bookmark, if present
160
161 h. the tipmost head of the default branch
162
163 i. tip
164
165 When cloning from servers that support it, Mercurial may fetch pre-gen‐
166 erated data from a server-advertised URL or inline from the same
167 stream. When this is done, hooks operating on incoming changesets and
168 changegroups may fire more than once, once for each pre-generated bun‐
169 dle and as well as for any additional remaining data. In addition, if
170 an error occurs, the repository may be rolled back to a partial clone.
171 This behavior may change in future releases. See hg help -e cloneb‐
172 undles for more.
173
174 Examples:
175
176 • clone a remote repository to a new directory named hg/:
177
178 hg clone https://www.mercurial-scm.org/repo/hg/
179
180 • create a lightweight local clone:
181
182 hg clone project/ project-feature/
183
184 • clone from an absolute path on an ssh server (note double-slash):
185
186 hg clone ssh://user@server//home/projects/alpha/
187
188 • do a streaming clone while checking out a specified version:
189
190 hg clone --stream http://server/repo -u 1.5
191
192 • create a repository without changesets after a particular revision:
193
194 hg clone -r 04e544 experimental/ good/
195
196 • clone (and track) a particular named branch:
197
198 hg clone https://www.mercurial-scm.org/repo/hg/#stable
199
200 See hg help urls for details on specifying URLs.
201
202 Returns 0 on success.
203
204 Options:
205
206 -U, --noupdate
207 the clone will include an empty working directory (only a repos‐
208 itory)
209
210 -u,--updaterev <REV>
211 revision, tag, or branch to check out
212
213 -r,--rev <REV[+]>
214 do not clone everything, but include this changeset and its an‐
215 cestors
216
217 -b,--branch <BRANCH[+]>
218 do not clone everything, but include this branch's changesets
219 and their ancestors
220
221 --pull use pull protocol to copy metadata
222
223 --uncompressed
224 an alias to --stream (DEPRECATED)
225
226 --stream
227 clone with minimal data processing
228
229 -e,--ssh <CMD>
230 specify ssh command to use
231
232 --remotecmd <CMD>
233 specify hg command to run on the remote side
234
235 --insecure
236 do not verify server certificate (ignoring web.cacerts config)
237
238 [+] marked option can be specified multiple times
239
240 init
241 create a new repository in the given directory:
242
243 hg init [-e CMD] [--remotecmd CMD] [DEST]
244
245 Initialize a new repository in the given directory. If the given direc‐
246 tory does not exist, it will be created.
247
248 If no directory is given, the current directory is used.
249
250 It is possible to specify an ssh:// URL as the destination. See hg
251 help urls for more information.
252
253 Returns 0 on success.
254
255 Options:
256
257 -e,--ssh <CMD>
258 specify ssh command to use
259
260 --remotecmd <CMD>
261 specify hg command to run on the remote side
262
263 --insecure
264 do not verify server certificate (ignoring web.cacerts config)
265
266 Remote repository management
267 incoming
268 show new changesets found in source:
269
270 hg incoming [-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]
271
272 Show new changesets found in the specified path/URL or the default pull
273 location. These are the changesets that would have been pulled by hg
274 pull at the time you issued this command.
275
276 See pull for valid source format details.
277
278 With -B/--bookmarks, the result of bookmark comparison between local
279 and remote repositories is displayed. With -v/--verbose, status is also
280 displayed for each bookmark like below:
281
282 BM1 01234567890a added
283 BM2 1234567890ab advanced
284 BM3 234567890abc diverged
285 BM4 34567890abcd changed
286
287 The action taken locally when pulling depends on the status of each
288 bookmark:
289
290 added
291
292 pull will create it
293
294 advanced
295
296 pull will update it
297
298 diverged
299
300 pull will create a divergent bookmark
301
302 changed
303
304 result depends on remote changesets
305
306 From the point of view of pulling behavior, bookmark existing only in
307 the remote repository are treated as added, even if it is in fact lo‐
308 cally deleted.
309
310 For remote repository, using --bundle avoids downloading the changesets
311 twice if the incoming is followed by a pull.
312
313 Examples:
314
315 • show incoming changes with patches and full description:
316
317 hg incoming -vp
318
319 • show incoming changes excluding merges, store a bundle:
320
321 hg in -vpM --bundle incoming.hg
322 hg pull incoming.hg
323
324 • briefly list changes inside a bundle:
325
326 hg in changes.hg -T "{desc|firstline}\n"
327
328 Returns 0 if there are incoming changes, 1 otherwise.
329
330 Options:
331
332 -f, --force
333 run even if remote repository is unrelated
334
335 -n, --newest-first
336 show newest record first
337
338 --bundle <FILE>
339 file to store the bundles into
340
341 -r,--rev <REV[+]>
342 a remote changeset intended to be added
343
344 -B, --bookmarks
345 compare bookmarks
346
347 -b,--branch <BRANCH[+]>
348 a specific branch you would like to pull
349
350 -p, --patch
351 show patch
352
353 -g, --git
354 use git extended diff format
355
356 -l,--limit <NUM>
357 limit number of changes displayed
358
359 -M, --no-merges
360 do not show merges
361
362 --stat output diffstat-style summary of changes
363
364 -G, --graph
365 show the revision DAG
366
367 --style <STYLE>
368 display using template map file (DEPRECATED)
369
370 -T,--template <TEMPLATE>
371 display with template
372
373 -e,--ssh <CMD>
374 specify ssh command to use
375
376 --remotecmd <CMD>
377 specify hg command to run on the remote side
378
379 --insecure
380 do not verify server certificate (ignoring web.cacerts config)
381
382 -S, --subrepos
383 recurse into subrepositories
384
385 [+] marked option can be specified multiple times
386
387 aliases: in
388
389 outgoing
390 show changesets not found in the destination:
391
392 hg outgoing [-M] [-p] [-n] [-f] [-r REV]... [DEST]...
393
394 Show changesets not found in the specified destination repository or
395 the default push location. These are the changesets that would be
396 pushed if a push was requested.
397
398 See pull for details of valid destination formats.
399
400 With -B/--bookmarks, the result of bookmark comparison between local
401 and remote repositories is displayed. With -v/--verbose, status is also
402 displayed for each bookmark like below:
403
404 BM1 01234567890a added
405 BM2 deleted
406 BM3 234567890abc advanced
407 BM4 34567890abcd diverged
408 BM5 4567890abcde changed
409
410 The action taken when pushing depends on the status of each bookmark:
411
412 added
413
414 push with -B will create it
415
416 deleted
417
418 push with -B will delete it
419
420 advanced
421
422 push will update it
423
424 diverged
425
426 push with -B will update it
427
428 changed
429
430 push with -B will update it
431
432 From the point of view of pushing behavior, bookmarks existing only in
433 the remote repository are treated as deleted, even if it is in fact
434 added remotely.
435
436 Returns 0 if there are outgoing changes, 1 otherwise.
437
438 Options:
439
440 -f, --force
441 run even when the destination is unrelated
442
443 -r,--rev <REV[+]>
444 a changeset intended to be included in the destination
445
446 -n, --newest-first
447 show newest record first
448
449 -B, --bookmarks
450 compare bookmarks
451
452 -b,--branch <BRANCH[+]>
453 a specific branch you would like to push
454
455 -p, --patch
456 show patch
457
458 -g, --git
459 use git extended diff format
460
461 -l,--limit <NUM>
462 limit number of changes displayed
463
464 -M, --no-merges
465 do not show merges
466
467 --stat output diffstat-style summary of changes
468
469 -G, --graph
470 show the revision DAG
471
472 --style <STYLE>
473 display using template map file (DEPRECATED)
474
475 -T,--template <TEMPLATE>
476 display with template
477
478 -e,--ssh <CMD>
479 specify ssh command to use
480
481 --remotecmd <CMD>
482 specify hg command to run on the remote side
483
484 --insecure
485 do not verify server certificate (ignoring web.cacerts config)
486
487 -S, --subrepos
488 recurse into subrepositories
489
490 [+] marked option can be specified multiple times
491
492 aliases: out
493
494 paths
495 show aliases for remote repositories:
496
497 hg paths [NAME]
498
499 Show definition of symbolic path name NAME. If no name is given, show
500 definition of all available names.
501
502 Option -q/--quiet suppresses all output when searching for NAME and
503 shows only the path names when listing all definitions.
504
505 Path names are defined in the [paths] section of your configuration
506 file and in /etc/mercurial/hgrc. If run inside a repository, .hg/hgrc
507 is used, too.
508
509 The path names default and default-push have a special meaning. When
510 performing a push or pull operation, they are used as fallbacks if no
511 location is specified on the command-line. When default-push is set,
512 it will be used for push and default will be used for pull; otherwise
513 default is used as the fallback for both. When cloning a repository,
514 the clone source is written as default in .hg/hgrc.
515
516 Note default and default-push apply to all inbound (e.g. hg incoming
517 ) and outbound (e.g. hg outgoing, hg email and hg bundle) opera‐
518 tions.
519
520 See hg help urls for more information.
521
522 Template:
523
524 The following keywords are supported. See also hg help templates.
525
526 name String. Symbolic name of the path alias.
527
528 pushurl
529 String. URL for push operations.
530
531 url String. URL or directory path for the other operations.
532
533 Returns 0 on success.
534
535 Options:
536
537 -T,--template <TEMPLATE>
538 display with template
539
540 pull
541 pull changes from the specified source:
542
543 hg pull [-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]...
544
545 Pull changes from a remote repository to a local one.
546
547 This finds all changes from the repository at the specified path or URL
548 and adds them to a local repository (the current one unless -R is spec‐
549 ified). By default, this does not update the copy of the project in the
550 working directory.
551
552 When cloning from servers that support it, Mercurial may fetch pre-gen‐
553 erated data. When this is done, hooks operating on incoming changesets
554 and changegroups may fire more than once, once for each pre-generated
555 bundle and as well as for any additional remaining data. See hg help -e
556 clonebundles for more.
557
558 Use hg incoming if you want to see what would have been added by a pull
559 at the time you issued this command. If you then decide to add those
560 changes to the repository, you should use hg pull -r X where X is the
561 last changeset listed by hg incoming.
562
563 If SOURCE is omitted, the 'default' path will be used. See hg help
564 urls for more information.
565
566 If multiple sources are specified, they will be pulled sequentially as
567 if the command was run multiple time. If --update is specify and the
568 command will stop at the first failed --update.
569
570 Specifying bookmark as . is equivalent to specifying the active book‐
571 mark's name.
572
573 Returns 0 on success, 1 if an update had unresolved files.
574
575 Options:
576
577 -u, --update
578 update to new branch head if new descendants were pulled
579
580 -f, --force
581 run even when remote repository is unrelated
582
583 --confirm
584 confirm pull before applying changes
585
586 -r,--rev <REV[+]>
587 a remote changeset intended to be added
588
589 -B,--bookmark <BOOKMARK[+]>
590 bookmark to pull
591
592 -b,--branch <BRANCH[+]>
593 a specific branch you would like to pull
594
595 -e,--ssh <CMD>
596 specify ssh command to use
597
598 --remotecmd <CMD>
599 specify hg command to run on the remote side
600
601 --insecure
602 do not verify server certificate (ignoring web.cacerts config)
603
604 [+] marked option can be specified multiple times
605
606 push
607 push changes to the specified destination:
608
609 hg push [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]...
610
611 Push changesets from the local repository to the specified destination.
612
613 This operation is symmetrical to pull: it is identical to a pull in the
614 destination repository from the current one.
615
616 By default, push will not allow creation of new heads at the destina‐
617 tion, since multiple heads would make it unclear which head to use. In
618 this situation, it is recommended to pull and merge before pushing.
619
620 Use --new-branch if you want to allow push to create a new named branch
621 that is not present at the destination. This allows you to only create
622 a new branch without forcing other changes.
623
624 Note Extra care should be taken with the -f/--force option, which
625 will push all new heads on all branches, an action which will
626 almost always cause confusion for collaborators.
627
628 If -r/--rev is used, the specified revision and all its ancestors will
629 be pushed to the remote repository.
630
631 If -B/--bookmark is used, the specified bookmarked revision, its ances‐
632 tors, and the bookmark will be pushed to the remote repository. Speci‐
633 fying . is equivalent to specifying the active bookmark's name. Use the
634 --all-bookmarks option for pushing all current bookmarks.
635
636 Please see hg help urls for important details about ssh:// URLs. If
637 DESTINATION is omitted, a default path will be used.
638
639 When passed multiple destinations, push will process them one after the
640 other, but stop should an error occur.
641
642 The --pushvars option sends strings to the server that become environ‐
643 ment variables prepended with HG_USERVAR_. For example, --pushvars EN‐
644 ABLE_FEATURE=true, provides the server side hooks with HG_USERVAR_EN‐
645 ABLE_FEATURE=true as part of their environment.
646
647 pushvars can provide for user-overridable hooks as well as set debug
648 levels. One example is having a hook that blocks commits containing
649 conflict markers, but enables the user to override the hook if the file
650 is using conflict markers for testing purposes or the file format has
651 strings that look like conflict markers.
652
653 By default, servers will ignore --pushvars. To enable it add the fol‐
654 lowing to your configuration file:
655
656 [push]
657 pushvars.server = true
658
659 Returns 0 if push was successful, 1 if nothing to push.
660
661 Options:
662
663 -f, --force
664 force push
665
666 -r,--rev <REV[+]>
667 a changeset intended to be included in the destination
668
669 -B,--bookmark <BOOKMARK[+]>
670 bookmark to push
671
672 --all-bookmarks
673 push all bookmarks (EXPERIMENTAL)
674
675 -b,--branch <BRANCH[+]>
676 a specific branch you would like to push
677
678 --new-branch
679 allow pushing a new branch
680
681 --pushvars <VALUE[+]>
682 variables that can be sent to server (ADVANCED)
683
684 --publish
685 push the changeset as public (EXPERIMENTAL)
686
687 -e,--ssh <CMD>
688 specify ssh command to use
689
690 --remotecmd <CMD>
691 specify hg command to run on the remote side
692
693 --insecure
694 do not verify server certificate (ignoring web.cacerts config)
695
696 [+] marked option can be specified multiple times
697
698 serve
699 start stand-alone webserver:
700
701 hg serve [OPTION]...
702
703 Start a local HTTP repository browser and pull server. You can use this
704 for ad-hoc sharing and browsing of repositories. It is recommended to
705 use a real web server to serve a repository for longer periods of time.
706
707 Please note that the server does not implement access control. This
708 means that, by default, anybody can read from the server and nobody can
709 write to it by default. Set the web.allow-push option to * to allow ev‐
710 erybody to push to the server. You should use a real web server if you
711 need to authenticate users.
712
713 By default, the server logs accesses to stdout and errors to stderr.
714 Use the -A/--accesslog and -E/--errorlog options to log to files.
715
716 To have the server choose a free port number to listen on, specify a
717 port number of 0; in this case, the server will print the port number
718 it uses.
719
720 Returns 0 on success.
721
722 Options:
723
724 -A,--accesslog <FILE>
725 name of access log file to write to
726
727 -d, --daemon
728 run server in background
729
730 --daemon-postexec <VALUE[+]>
731 used internally by daemon mode
732
733 -E,--errorlog <FILE>
734 name of error log file to write to
735
736 -p,--port <PORT>
737 port to listen on (default: 8000)
738
739 -a,--address <ADDR>
740 address to listen on (default: all interfaces)
741
742 --prefix <PREFIX>
743 prefix path to serve from (default: server root)
744
745 -n,--name <NAME>
746 name to show in web pages (default: working directory)
747
748 --web-conf <FILE>
749 name of the hgweb config file (see 'hg help hgweb')
750
751 --webdir-conf <FILE>
752 name of the hgweb config file (DEPRECATED)
753
754 --pid-file <FILE>
755 name of file to write process ID to
756
757 --stdio
758 for remote clients (ADVANCED)
759
760 --cmdserver <MODE>
761 for remote clients (ADVANCED)
762
763 -t,--templates <TEMPLATE>
764 web templates to use
765
766 --style <STYLE>
767 template style to use
768
769 -6, --ipv6
770 use IPv6 in addition to IPv4
771
772 --certificate <FILE>
773 SSL certificate file
774
775 --print-url
776 start and print only the URL
777
778 -S, --subrepos
779 recurse into subrepositories
780
781 [+] marked option can be specified multiple times
782
783 Change creation
784 commit
785 commit the specified files or all outstanding changes:
786
787 hg commit [OPTION]... [FILE]...
788
789 Commit changes to the given files into the repository. Unlike a cen‐
790 tralized SCM, this operation is a local operation. See hg push for a
791 way to actively distribute your changes.
792
793 If a list of files is omitted, all changes reported by hg status will
794 be committed.
795
796 If you are committing the result of a merge, do not provide any file‐
797 names or -I/-X filters.
798
799 If no commit message is specified, Mercurial starts your configured ed‐
800 itor where you can enter a message. In case your commit fails, you will
801 find a backup of your message in .hg/last-message.txt.
802
803 The --close-branch flag can be used to mark the current branch head
804 closed. When all heads of a branch are closed, the branch will be con‐
805 sidered closed and no longer listed.
806
807 The --amend flag can be used to amend the parent of the working direc‐
808 tory with a new commit that contains the changes in the parent in addi‐
809 tion to those currently reported by hg status, if there are any. The
810 old commit is stored in a backup bundle in .hg/strip-backup (see hg
811 help bundle and hg help unbundle on how to restore it).
812
813 Message, user and date are taken from the amended commit unless speci‐
814 fied. When a message isn't specified on the command line, the editor
815 will open with the message of the amended commit.
816
817 It is not possible to amend public changesets (see hg help phases) or
818 changesets that have children.
819
820 See hg help dates for a list of formats valid for -d/--date.
821
822 Returns 0 on success, 1 if nothing changed.
823
824 Examples:
825
826 • commit all files ending in .py:
827
828 hg commit --include "set:**.py"
829
830 • commit all non-binary files:
831
832 hg commit --exclude "set:binary()"
833
834 • amend the current commit and set the date to now:
835
836 hg commit --amend --date now
837
838 Options:
839
840 -A, --addremove
841 mark new/missing files as added/removed before committing
842
843 --close-branch
844 mark a branch head as closed
845
846 --amend
847 amend the parent of the working directory
848
849 -s, --secret
850 use the secret phase for committing
851
852 -e, --edit
853 invoke editor on commit messages
854
855 --force-close-branch
856 forcibly close branch from a non-head changeset (ADVANCED)
857
858 -i, --interactive
859 use interactive mode
860
861 -I,--include <PATTERN[+]>
862 include names matching the given patterns
863
864 -X,--exclude <PATTERN[+]>
865 exclude names matching the given patterns
866
867 -m,--message <TEXT>
868 use text as commit message
869
870 -l,--logfile <FILE>
871 read commit message from file
872
873 -d,--date <DATE>
874 record the specified date as commit date
875
876 -u,--user <USER>
877 record the specified user as committer
878
879 -S, --subrepos
880 recurse into subrepositories
881
882 [+] marked option can be specified multiple times
883
884 aliases: ci
885
886 Change manipulation
887 abort
888 abort an unfinished operation (EXPERIMENTAL):
889
890 hg abort
891
892 Aborts a multistep operation like graft, histedit, rebase, merge, and
893 unshelve if they are in an unfinished state.
894
895 use --dry-run/-n to dry run the command.
896
897 Options:
898
899 -n, --dry-run
900 do not perform actions, just print output
901
902 backout
903 reverse effect of earlier changeset:
904
905 hg backout [OPTION]... [-r] REV
906
907 Prepare a new changeset with the effect of REV undone in the current
908 working directory. If no conflicts were encountered, it will be commit‐
909 ted immediately.
910
911 If REV is the parent of the working directory, then this new changeset
912 is committed automatically (unless --no-commit is specified).
913
914 Note hg backout cannot be used to fix either an unwanted or incorrect
915 merge.
916
917 Examples:
918
919 • Reverse the effect of the parent of the working directory. This
920 backout will be committed immediately:
921
922 hg backout -r .
923
924 • Reverse the effect of previous bad revision 23:
925
926 hg backout -r 23
927
928 • Reverse the effect of previous bad revision 23 and leave changes un‐
929 committed:
930
931 hg backout -r 23 --no-commit
932 hg commit -m "Backout revision 23"
933
934 By default, the pending changeset will have one parent, maintaining a
935 linear history. With --merge, the pending changeset will instead have
936 two parents: the old parent of the working directory and a new child of
937 REV that simply undoes REV.
938
939 Before version 1.7, the behavior without --merge was equivalent to
940 specifying --merge followed by hg update --clean . to cancel the merge
941 and leave the child of REV as a head to be merged separately.
942
943 See hg help dates for a list of formats valid for -d/--date.
944
945 See hg help revert for a way to restore files to the state of another
946 revision.
947
948 Returns 0 on success, 1 if nothing to backout or there are unresolved
949 files.
950
951 Options:
952
953 --merge
954 merge with old dirstate parent after backout
955
956 --commit
957 commit if no conflicts were encountered (DEPRECATED)
958
959 --no-commit
960 do not commit
961
962 --parent <REV>
963 parent to choose when backing out merge (DEPRECATED)
964
965 -r,--rev <REV>
966 revision to backout
967
968 -e, --edit
969 invoke editor on commit messages
970
971 -t,--tool <TOOL>
972 specify merge tool
973
974 -I,--include <PATTERN[+]>
975 include names matching the given patterns
976
977 -X,--exclude <PATTERN[+]>
978 exclude names matching the given patterns
979
980 -m,--message <TEXT>
981 use text as commit message
982
983 -l,--logfile <FILE>
984 read commit message from file
985
986 -d,--date <DATE>
987 record the specified date as commit date
988
989 -u,--user <USER>
990 record the specified user as committer
991
992 [+] marked option can be specified multiple times
993
994 continue
995 resumes an interrupted operation (EXPERIMENTAL):
996
997 hg continue
998
999 Finishes a multistep operation like graft, histedit, rebase, merge, and
1000 unshelve if they are in an interrupted state.
1001
1002 use --dry-run/-n to dry run the command.
1003
1004 Options:
1005
1006 -n, --dry-run
1007 do not perform actions, just print output
1008
1009 graft
1010 copy changes from other branches onto the current branch:
1011
1012 hg graft [OPTION]... [-r REV]... REV...
1013
1014 This command uses Mercurial's merge logic to copy individual changes
1015 from other branches without merging branches in the history graph. This
1016 is sometimes known as 'backporting' or 'cherry-picking'. By default,
1017 graft will copy user, date, and description from the source changesets.
1018
1019 Changesets that are ancestors of the current revision, that have al‐
1020 ready been grafted, or that are merges will be skipped.
1021
1022 If --log is specified, log messages will have a comment appended of the
1023 form:
1024
1025 (grafted from CHANGESETHASH)
1026
1027 If --force is specified, revisions will be grafted even if they are al‐
1028 ready ancestors of, or have been grafted to, the destination. This is
1029 useful when the revisions have since been backed out.
1030
1031 If a graft merge results in conflicts, the graft process is interrupted
1032 so that the current merge can be manually resolved. Once all conflicts
1033 are addressed, the graft process can be continued with the -c/--con‐
1034 tinue option.
1035
1036 The -c/--continue option reapplies all the earlier options.
1037
1038 The --base option exposes more of how graft internally uses merge with
1039 a custom base revision. --base can be used to specify another ancestor
1040 than the first and only parent.
1041
1042 The command:
1043
1044 hg graft -r 345 --base 234
1045
1046 is thus pretty much the same as:
1047
1048 hg diff --from 234 --to 345 | hg import
1049
1050 but using merge to resolve conflicts and track moved files.
1051
1052 The result of a merge can thus be backported as a single commit by
1053 specifying one of the merge parents as base, and thus effectively
1054 grafting the changes from the other side.
1055
1056 It is also possible to collapse multiple changesets and clean up his‐
1057 tory by specifying another ancestor as base, much like rebase --col‐
1058 lapse --keep.
1059
1060 The commit message can be tweaked after the fact using commit --amend .
1061
1062 For using non-ancestors as the base to backout changes, see the backout
1063 command and the hidden --parent option.
1064
1065 Examples:
1066
1067 • copy a single change to the stable branch and edit its description:
1068
1069 hg update stable
1070 hg graft --edit 9393
1071
1072 • graft a range of changesets with one exception, updating dates:
1073
1074 hg graft -D "2085::2093 and not 2091"
1075
1076 • continue a graft after resolving conflicts:
1077
1078 hg graft -c
1079
1080 • show the source of a grafted changeset:
1081
1082 hg log --debug -r .
1083
1084 • show revisions sorted by date:
1085
1086 hg log -r "sort(all(), date)"
1087
1088 • backport the result of a merge as a single commit:
1089
1090 hg graft -r 123 --base 123^
1091
1092 • land a feature branch as one changeset:
1093
1094 hg up -cr default
1095 hg graft -r featureX --base "ancestor('featureX', 'default')"
1096
1097 See hg help revisions for more about specifying revisions.
1098
1099 Returns 0 on successful completion, 1 if there are unresolved files.
1100
1101 Options:
1102
1103 -r,--rev <REV[+]>
1104 revisions to graft
1105
1106 --base <REV>
1107 base revision when doing the graft merge (ADVANCED)
1108
1109 -c, --continue
1110 resume interrupted graft
1111
1112 --stop stop interrupted graft
1113
1114 --abort
1115 abort interrupted graft
1116
1117 -e, --edit
1118 invoke editor on commit messages
1119
1120 --log append graft info to log message
1121
1122 --no-commit
1123 don't commit, just apply the changes in working directory
1124
1125 -f, --force
1126 force graft
1127
1128 -D, --currentdate
1129 record the current date as commit date
1130
1131 -U, --currentuser
1132 record the current user as committer
1133
1134 -d,--date <DATE>
1135 record the specified date as commit date
1136
1137 -u,--user <USER>
1138 record the specified user as committer
1139
1140 -t,--tool <TOOL>
1141 specify merge tool
1142
1143 -n, --dry-run
1144 do not perform actions, just print output
1145
1146 [+] marked option can be specified multiple times
1147
1148 merge
1149 merge another revision into working directory:
1150
1151 hg merge [-P] [[-r] REV]
1152
1153 The current working directory is updated with all changes made in the
1154 requested revision since the last common predecessor revision.
1155
1156 Files that changed between either parent are marked as changed for the
1157 next commit and a commit must be performed before any further updates
1158 to the repository are allowed. The next commit will have two parents.
1159
1160 --tool can be used to specify the merge tool used for file merges. It
1161 overrides the HGMERGE environment variable and your configuration
1162 files. See hg help merge-tools for options.
1163
1164 If no revision is specified, the working directory's parent is a head
1165 revision, and the current branch contains exactly one other head, the
1166 other head is merged with by default. Otherwise, an explicit revision
1167 with which to merge must be provided.
1168
1169 See hg help resolve for information on handling file conflicts.
1170
1171 To undo an uncommitted merge, use hg merge --abort which will check out
1172 a clean copy of the original merge parent, losing all changes.
1173
1174 Returns 0 on success, 1 if there are unresolved files.
1175
1176 Options:
1177
1178 -f, --force
1179 force a merge including outstanding changes (DEPRECATED)
1180
1181 -r,--rev <REV>
1182 revision to merge
1183
1184 -P, --preview
1185 review revisions to merge (no merge is performed)
1186
1187 --abort
1188 abort the ongoing merge
1189
1190 -t,--tool <TOOL>
1191 specify merge tool
1192
1193 Change organization
1194 bookmarks
1195 create a new bookmark or list existing bookmarks:
1196
1197 hg bookmarks [OPTIONS]... [NAME]...
1198
1199 Bookmarks are labels on changesets to help track lines of development.
1200 Bookmarks are unversioned and can be moved, renamed and deleted.
1201 Deleting or moving a bookmark has no effect on the associated change‐
1202 sets.
1203
1204 Creating or updating to a bookmark causes it to be marked as 'active'.
1205 The active bookmark is indicated with a '*'. When a commit is made,
1206 the active bookmark will advance to the new commit. A plain hg update
1207 will also advance an active bookmark, if possible. Updating away from
1208 a bookmark will cause it to be deactivated.
1209
1210 Bookmarks can be pushed and pulled between repositories (see hg help
1211 push and hg help pull). If a shared bookmark has diverged, a new 'di‐
1212 vergent bookmark' of the form 'name@path' will be created. Using hg
1213 merge will resolve the divergence.
1214
1215 Specifying bookmark as '.' to -m/-d/-l options is equivalent to speci‐
1216 fying the active bookmark's name.
1217
1218 A bookmark named '@' has the special property that hg clone will check
1219 it out by default if it exists.
1220
1221 Template:
1222
1223 The following keywords are supported in addition to the common template
1224 keywords and functions such as {bookmark}. See also hg help templates.
1225
1226 active Boolean. True if the bookmark is active.
1227
1228 Examples:
1229
1230 • create an active bookmark for a new line of development:
1231
1232 hg book new-feature
1233
1234 • create an inactive bookmark as a place marker:
1235
1236 hg book -i reviewed
1237
1238 • create an inactive bookmark on another changeset:
1239
1240 hg book -r .^ tested
1241
1242 • rename bookmark turkey to dinner:
1243
1244 hg book -m turkey dinner
1245
1246 • move the '@' bookmark from another branch:
1247
1248 hg book -f @
1249
1250 • print only the active bookmark name:
1251
1252 hg book -ql .
1253
1254 Options:
1255
1256 -f, --force
1257 force
1258
1259 -r,--rev <REV>
1260 revision for bookmark action
1261
1262 -d, --delete
1263 delete a given bookmark
1264
1265 -m,--rename <OLD>
1266 rename a given bookmark
1267
1268 -i, --inactive
1269 mark a bookmark inactive
1270
1271 -l, --list
1272 list existing bookmarks
1273
1274 -T,--template <TEMPLATE>
1275 display with template
1276
1277 aliases: bookmark
1278
1279 branch
1280 set or show the current branch name:
1281
1282 hg branch [-fC] [NAME]
1283
1284 Note Branch names are permanent and global. Use hg bookmark to create
1285 a light-weight bookmark instead. See hg help glossary for more
1286 information about named branches and bookmarks.
1287
1288 With no argument, show the current branch name. With one argument, set
1289 the working directory branch name (the branch will not exist in the
1290 repository until the next commit). Standard practice recommends that
1291 primary development take place on the 'default' branch.
1292
1293 Unless -f/--force is specified, branch will not let you set a branch
1294 name that already exists.
1295
1296 Use -C/--clean to reset the working directory branch to that of the
1297 parent of the working directory, negating a previous branch change.
1298
1299 Use the command hg update to switch to an existing branch. Use hg com‐
1300 mit --close-branch to mark this branch head as closed. When all heads
1301 of a branch are closed, the branch will be considered closed.
1302
1303 Returns 0 on success.
1304
1305 Options:
1306
1307 -f, --force
1308 set branch name even if it shadows an existing branch
1309
1310 -C, --clean
1311 reset branch name to parent branch name
1312
1313 -r,--rev <VALUE[+]>
1314 change branches of the given revs (EXPERIMENTAL)
1315
1316 [+] marked option can be specified multiple times
1317
1318 branches
1319 list repository named branches:
1320
1321 hg branches [-c]
1322
1323 List the repository's named branches, indicating which ones are inac‐
1324 tive. If -c/--closed is specified, also list branches which have been
1325 marked closed (see hg commit --close-branch).
1326
1327 Use the command hg update to switch to an existing branch.
1328
1329 Template:
1330
1331 The following keywords are supported in addition to the common template
1332 keywords and functions such as {branch}. See also hg help templates.
1333
1334 active Boolean. True if the branch is active.
1335
1336 closed Boolean. True if the branch is closed.
1337
1338 current
1339 Boolean. True if it is the current branch.
1340
1341 Returns 0.
1342
1343 Options:
1344
1345 -a, --active
1346 show only branches that have unmerged heads (DEPRECATED)
1347
1348 -c, --closed
1349 show normal and closed branches
1350
1351 -r,--rev <VALUE[+]>
1352 show branch name(s) of the given rev
1353
1354 -T,--template <TEMPLATE>
1355 display with template
1356
1357 [+] marked option can be specified multiple times
1358
1359 phase
1360 set or show the current phase name:
1361
1362 hg phase [-p|-d|-s] [-f] [-r] [REV...]
1363
1364 With no argument, show the phase name of the current revision(s).
1365
1366 With one of -p/--public, -d/--draft or -s/--secret, change the phase
1367 value of the specified revisions.
1368
1369 Unless -f/--force is specified, hg phase won't move changesets from a
1370 lower phase to a higher phase. Phases are ordered as follows:
1371
1372 public < draft < secret
1373
1374 Returns 0 on success, 1 if some phases could not be changed.
1375
1376 (For more information about the phases concept, see hg help phases.)
1377
1378 Options:
1379
1380 -p, --public
1381 set changeset phase to public
1382
1383 -d, --draft
1384 set changeset phase to draft
1385
1386 -s, --secret
1387 set changeset phase to secret
1388
1389 -f, --force
1390 allow to move boundary backward
1391
1392 -r,--rev <REV[+]>
1393 target revision
1394
1395 [+] marked option can be specified multiple times
1396
1397 tag
1398 add one or more tags for the current or given revision:
1399
1400 hg tag [-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...
1401
1402 Name a particular revision using <name>.
1403
1404 Tags are used to name particular revisions of the repository and are
1405 very useful to compare different revisions, to go back to significant
1406 earlier versions or to mark branch points as releases, etc. Changing an
1407 existing tag is normally disallowed; use -f/--force to override.
1408
1409 If no revision is given, the parent of the working directory is used.
1410
1411 To facilitate version control, distribution, and merging of tags, they
1412 are stored as a file named ".hgtags" which is managed similarly to
1413 other project files and can be hand-edited if necessary. This also
1414 means that tagging creates a new commit. The file ".hg/localtags" is
1415 used for local tags (not shared among repositories).
1416
1417 Tag commits are usually made at the head of a branch. If the parent of
1418 the working directory is not a branch head, hg tag aborts; use
1419 -f/--force to force the tag commit to be based on a non-head changeset.
1420
1421 See hg help dates for a list of formats valid for -d/--date.
1422
1423 Since tag names have priority over branch names during revision lookup,
1424 using an existing branch name as a tag name is discouraged.
1425
1426 Returns 0 on success.
1427
1428 Options:
1429
1430 -f, --force
1431 force tag
1432
1433 -l, --local
1434 make the tag local
1435
1436 -r,--rev <REV>
1437 revision to tag
1438
1439 --remove
1440 remove a tag
1441
1442 -e, --edit
1443 invoke editor on commit messages
1444
1445 -m,--message <TEXT>
1446 use text as commit message
1447
1448 -d,--date <DATE>
1449 record the specified date as commit date
1450
1451 -u,--user <USER>
1452 record the specified user as committer
1453
1454 tags
1455 list repository tags:
1456
1457 hg tags
1458
1459 This lists both regular and local tags. When the -v/--verbose switch is
1460 used, a third column "local" is printed for local tags. When the
1461 -q/--quiet switch is used, only the tag name is printed.
1462
1463 Template:
1464
1465 The following keywords are supported in addition to the common template
1466 keywords and functions such as {tag}. See also hg help templates.
1467
1468 type String. local for local tags.
1469
1470 Returns 0 on success.
1471
1472 Options:
1473
1474 -T,--template <TEMPLATE>
1475 display with template
1476
1477 File content management
1478 annotate
1479 show changeset information by line for each file:
1480
1481 hg annotate [-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...
1482
1483 List changes in files, showing the revision id responsible for each
1484 line.
1485
1486 This command is useful for discovering when a change was made and by
1487 whom.
1488
1489 If you include --file, --user, or --date, the revision number is sup‐
1490 pressed unless you also include --number.
1491
1492 Without the -a/--text option, annotate will avoid processing files it
1493 detects as binary. With -a, annotate will annotate the file anyway, al‐
1494 though the results will probably be neither useful nor desirable.
1495
1496 Template:
1497
1498 The following keywords are supported in addition to the common template
1499 keywords and functions. See also hg help templates.
1500
1501 lines List of lines with annotation data.
1502
1503 path String. Repository-absolute path of the specified file.
1504
1505 And each entry of {lines} provides the following sub-keywords in addi‐
1506 tion to {date}, {node}, {rev}, {user}, etc.
1507
1508 line String. Line content.
1509
1510 lineno Integer. Line number at that revision.
1511
1512 path String. Repository-absolute path of the file at that revision.
1513
1514 See hg help templates.operators for the list expansion syntax.
1515
1516 Returns 0 on success.
1517
1518 Options:
1519
1520 -r,--rev <REV>
1521 annotate the specified revision
1522
1523 --follow
1524 follow copies/renames and list the filename (DEPRECATED)
1525
1526 --no-follow
1527 don't follow copies and renames
1528
1529 -a, --text
1530 treat all files as text
1531
1532 -u, --user
1533 list the author (long with -v)
1534
1535 -f, --file
1536 list the filename
1537
1538 -d, --date
1539 list the date (short with -q)
1540
1541 -n, --number
1542 list the revision number (default)
1543
1544 -c, --changeset
1545 list the changeset
1546
1547 -l, --line-number
1548 show line number at the first appearance
1549
1550 --skip <REV[+]>
1551 revset to not display (EXPERIMENTAL)
1552
1553 -w, --ignore-all-space
1554 ignore white space when comparing lines
1555
1556 -b, --ignore-space-change
1557 ignore changes in the amount of white space
1558
1559 -B, --ignore-blank-lines
1560 ignore changes whose lines are all blank
1561
1562 -Z, --ignore-space-at-eol
1563 ignore changes in whitespace at EOL
1564
1565 -I,--include <PATTERN[+]>
1566 include names matching the given patterns
1567
1568 -X,--exclude <PATTERN[+]>
1569 exclude names matching the given patterns
1570
1571 -T,--template <TEMPLATE>
1572 display with template
1573
1574 [+] marked option can be specified multiple times
1575
1576 aliases: blame
1577
1578 cat
1579 output the current or given revision of files:
1580
1581 hg cat [OPTION]... FILE...
1582
1583 Print the specified files as they were at the given revision. If no re‐
1584 vision is given, the parent of the working directory is used.
1585
1586 Output may be to a file, in which case the name of the file is given
1587 using a template string. See hg help templates. In addition to the com‐
1588 mon template keywords, the following formatting rules are supported:
1589
1590 %%
1591
1592 literal "%" character
1593
1594 %s
1595
1596 basename of file being printed
1597
1598 %d
1599
1600 dirname of file being printed, or '.' if in repository root
1601
1602 %p
1603
1604 root-relative path name of file being printed
1605
1606 %H
1607
1608 changeset hash (40 hexadecimal digits)
1609
1610 %R
1611
1612 changeset revision number
1613
1614 %h
1615
1616 short-form changeset hash (12 hexadecimal digits)
1617
1618 %r
1619
1620 zero-padded changeset revision number
1621
1622 %b
1623
1624 basename of the exporting repository
1625
1626 \
1627
1628 literal "" character
1629
1630 Template:
1631
1632 The following keywords are supported in addition to the common template
1633 keywords and functions. See also hg help templates.
1634
1635 data String. File content.
1636
1637 path String. Repository-absolute path of the file.
1638
1639 Returns 0 on success.
1640
1641 Options:
1642
1643 -o,--output <FORMAT>
1644 print output to file with formatted name
1645
1646 -r,--rev <REV>
1647 print the given revision
1648
1649 --decode
1650 apply any matching decode filter
1651
1652 -I,--include <PATTERN[+]>
1653 include names matching the given patterns
1654
1655 -X,--exclude <PATTERN[+]>
1656 exclude names matching the given patterns
1657
1658 -T,--template <TEMPLATE>
1659 display with template
1660
1661 [+] marked option can be specified multiple times
1662
1663 copy
1664 mark files as copied for the next commit:
1665
1666 hg copy [OPTION]... (SOURCE... DEST | --forget DEST...)
1667
1668 Mark dest as having copies of source files. If dest is a directory,
1669 copies are put in that directory. If dest is a file, the source must be
1670 a single file.
1671
1672 By default, this command copies the contents of files as they exist in
1673 the working directory. If invoked with -A/--after, the operation is
1674 recorded, but no copying is performed.
1675
1676 To undo marking a destination file as copied, use --forget. With that
1677 option, all given (positional) arguments are unmarked as copies. The
1678 destination file(s) will be left in place (still tracked). Note that hg
1679 copy --forget behaves the same way as hg rename --forget.
1680
1681 This command takes effect with the next commit by default.
1682
1683 Returns 0 on success, 1 if errors are encountered.
1684
1685 Options:
1686
1687 --forget
1688 unmark a destination file as copied
1689
1690 -A, --after
1691 record a copy that has already occurred
1692
1693 --at-rev <REV>
1694 (un)mark copies in the given revision (EXPERIMENTAL)
1695
1696 -f, --force
1697 forcibly copy over an existing managed file
1698
1699 -I,--include <PATTERN[+]>
1700 include names matching the given patterns
1701
1702 -X,--exclude <PATTERN[+]>
1703 exclude names matching the given patterns
1704
1705 -n, --dry-run
1706 do not perform actions, just print output
1707
1708 [+] marked option can be specified multiple times
1709
1710 aliases: cp
1711
1712 diff
1713 diff repository (or selected files):
1714
1715 hg diff [OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]...
1716
1717 Show differences between revisions for the specified files.
1718
1719 Differences between files are shown using the unified diff format.
1720
1721 Note hg diff may generate unexpected results for merges, as it will
1722 default to comparing against the working directory's first par‐
1723 ent changeset if no revisions are specified.
1724
1725 By default, the working directory files are compared to its first par‐
1726 ent. To see the differences from another revision, use --from. To see
1727 the difference to another revision, use --to. For example, hg diff
1728 --from .^ will show the differences from the working copy's grandparent
1729 to the working copy, hg diff --to . will show the diff from the working
1730 copy to its parent (i.e. the reverse of the default), and hg diff
1731 --from 1.0 --to 1.2 will show the diff between those two revisions.
1732
1733 Alternatively you can specify -c/--change with a revision to see the
1734 changes in that changeset relative to its first parent (i.e. hg diff -c
1735 42 is equivalent to hg diff --from 42^ --to 42)
1736
1737 Without the -a/--text option, diff will avoid generating diffs of files
1738 it detects as binary. With -a, diff will generate a diff anyway, proba‐
1739 bly with undesirable results.
1740
1741 Use the -g/--git option to generate diffs in the git extended diff for‐
1742 mat. For more information, read hg help diffs.
1743
1744 Examples:
1745
1746 • compare a file in the current working directory to its parent:
1747
1748 hg diff foo.c
1749
1750 • compare two historical versions of a directory, with rename info:
1751
1752 hg diff --git --from 1.0 --to 1.2 lib/
1753
1754 • get change stats relative to the last change on some date:
1755
1756 hg diff --stat --from "date('may 2')"
1757
1758 • diff all newly-added files that contain a keyword:
1759
1760 hg diff "set:added() and grep(GNU)"
1761
1762 • compare a revision and its parents:
1763
1764 hg diff -c 9353 # compare against first parent
1765 hg diff --from 9353^ --to 9353 # same using revset syntax
1766 hg diff --from 9353^2 --to 9353 # compare against the second parent
1767
1768 Returns 0 on success.
1769
1770 Options:
1771
1772 -r,--rev <REV[+]>
1773 revision (DEPRECATED)
1774
1775 --from <REV1>
1776 revision to diff from
1777
1778 --to <REV2>
1779 revision to diff to
1780
1781 -c,--change <REV>
1782 change made by revision
1783
1784 -a, --text
1785 treat all files as text
1786
1787 -g, --git
1788 use git extended diff format (DEFAULT: diff.git)
1789
1790 --binary
1791 generate binary diffs in git mode (default)
1792
1793 --nodates
1794 omit dates from diff headers
1795
1796 --noprefix
1797 omit a/ and b/ prefixes from filenames
1798
1799 -p, --show-function
1800 show which function each change is in (DEFAULT: diff.showfunc)
1801
1802 --reverse
1803 produce a diff that undoes the changes
1804
1805 -w, --ignore-all-space
1806 ignore white space when comparing lines
1807
1808 -b, --ignore-space-change
1809 ignore changes in the amount of white space
1810
1811 -B, --ignore-blank-lines
1812 ignore changes whose lines are all blank
1813
1814 -Z, --ignore-space-at-eol
1815 ignore changes in whitespace at EOL
1816
1817 -U,--unified <NUM>
1818 number of lines of context to show
1819
1820 --stat output diffstat-style summary of changes
1821
1822 --root <DIR>
1823 produce diffs relative to subdirectory
1824
1825 -I,--include <PATTERN[+]>
1826 include names matching the given patterns
1827
1828 -X,--exclude <PATTERN[+]>
1829 exclude names matching the given patterns
1830
1831 -S, --subrepos
1832 recurse into subrepositories
1833
1834 [+] marked option can be specified multiple times
1835
1836 grep
1837 search for a pattern in specified files:
1838
1839 hg grep [--diff] [OPTION]... PATTERN [FILE]...
1840
1841 Search the working directory or revision history for a regular expres‐
1842 sion in the specified files for the entire repository.
1843
1844 By default, grep searches the repository files in the working directory
1845 and prints the files where it finds a match. To specify historical re‐
1846 visions instead of the working directory, use the --rev flag.
1847
1848 To search instead historical revision differences that contains a
1849 change in match status ("-" for a match that becomes a non-match, or
1850 "+" for a non-match that becomes a match), use the --diff flag.
1851
1852 PATTERN can be any Python (roughly Perl-compatible) regular expression.
1853
1854 If no FILEs are specified and the --rev flag isn't supplied, all files
1855 in the working directory are searched. When using the --rev flag and
1856 specifying FILEs, use the --follow argument to also follow the speci‐
1857 fied FILEs across renames and copies.
1858
1859 Template:
1860
1861 The following keywords are supported in addition to the common template
1862 keywords and functions. See also hg help templates.
1863
1864 change String. Character denoting insertion + or removal -. Available
1865 if --diff is specified.
1866
1867 lineno Integer. Line number of the match.
1868
1869 path String. Repository-absolute path of the file.
1870
1871 texts List of text chunks.
1872
1873 And each entry of {texts} provides the following sub-keywords.
1874
1875 matched
1876 Boolean. True if the chunk matches the specified pattern.
1877
1878 text String. Chunk content.
1879
1880 See hg help templates.operators for the list expansion syntax.
1881
1882 Returns 0 if a match is found, 1 otherwise.
1883
1884 Options:
1885
1886 -0, --print0
1887 end fields with NUL
1888
1889 --all an alias to --diff (DEPRECATED)
1890
1891 --diff search revision differences for when the pattern was added or
1892 removed
1893
1894 -a, --text
1895 treat all files as text
1896
1897 -f, --follow
1898 follow changeset history, or file history across copies and re‐
1899 names
1900
1901 -i, --ignore-case
1902 ignore case when matching
1903
1904 -l, --files-with-matches
1905 print only filenames and revisions that match
1906
1907 -n, --line-number
1908 print matching line numbers
1909
1910 -r,--rev <REV[+]>
1911 search files changed within revision range
1912
1913 --all-files
1914 include all files in the changeset while grepping (DEPRECATED)
1915
1916 -u, --user
1917 list the author (long with -v)
1918
1919 -d, --date
1920 list the date (short with -q)
1921
1922 -T,--template <TEMPLATE>
1923 display with template
1924
1925 -I,--include <PATTERN[+]>
1926 include names matching the given patterns
1927
1928 -X,--exclude <PATTERN[+]>
1929 exclude names matching the given patterns
1930
1931 [+] marked option can be specified multiple times
1932
1933 Change navigation
1934 bisect
1935 subdivision search of changesets:
1936
1937 hg bisect [-gbsr] [-U] [-c CMD] [REV]
1938
1939 This command helps to find changesets which introduce problems. To use,
1940 mark the earliest changeset you know exhibits the problem as bad, then
1941 mark the latest changeset which is free from the problem as good. Bi‐
1942 sect will update your working directory to a revision for testing (un‐
1943 less the -U/--noupdate option is specified). Once you have performed
1944 tests, mark the working directory as good or bad, and bisect will ei‐
1945 ther update to another candidate changeset or announce that it has
1946 found the bad revision.
1947
1948 As a shortcut, you can also use the revision argument to mark a revi‐
1949 sion as good or bad without checking it out first.
1950
1951 If you supply a command, it will be used for automatic bisection. The
1952 environment variable HG_NODE will contain the ID of the changeset being
1953 tested. The exit status of the command will be used to mark revisions
1954 as good or bad: status 0 means good, 125 means to skip the revision,
1955 127 (command not found) will abort the bisection, and any other
1956 non-zero exit status means the revision is bad.
1957
1958 Some examples:
1959
1960 • start a bisection with known bad revision 34, and good revision 12:
1961
1962 hg bisect --bad 34
1963 hg bisect --good 12
1964
1965 • advance the current bisection by marking current revision as good or
1966 bad:
1967
1968 hg bisect --good
1969 hg bisect --bad
1970
1971 • mark the current revision, or a known revision, to be skipped (e.g.
1972 if that revision is not usable because of another issue):
1973
1974 hg bisect --skip
1975 hg bisect --skip 23
1976
1977 • skip all revisions that do not touch directories foo or bar:
1978
1979 hg bisect --skip "!( file('path:foo') & file('path:bar') )"
1980
1981 • forget the current bisection:
1982
1983 hg bisect --reset
1984
1985 • use 'make && make tests' to automatically find the first broken revi‐
1986 sion:
1987
1988 hg bisect --reset
1989 hg bisect --bad 34
1990 hg bisect --good 12
1991 hg bisect --command "make && make tests"
1992
1993 • see all changesets whose states are already known in the current bi‐
1994 section:
1995
1996 hg log -r "bisect(pruned)"
1997
1998 • see the changeset currently being bisected (especially useful if run‐
1999 ning with -U/--noupdate):
2000
2001 hg log -r "bisect(current)"
2002
2003 • see all changesets that took part in the current bisection:
2004
2005 hg log -r "bisect(range)"
2006
2007 • you can even get a nice graph:
2008
2009 hg log --graph -r "bisect(range)"
2010
2011 See hg help revisions.bisect for more about the bisect() predicate.
2012
2013 Returns 0 on success.
2014
2015 Options:
2016
2017 -r, --reset
2018 reset bisect state
2019
2020 -g, --good
2021 mark changeset good
2022
2023 -b, --bad
2024 mark changeset bad
2025
2026 -s, --skip
2027 skip testing changeset
2028
2029 -e, --extend
2030 extend the bisect range
2031
2032 -c,--command <CMD>
2033 use command to check changeset state
2034
2035 -U, --noupdate
2036 do not update to target
2037
2038 heads
2039 show branch heads:
2040
2041 hg heads [-ct] [-r STARTREV] [REV]...
2042
2043 With no arguments, show all open branch heads in the repository.
2044 Branch heads are changesets that have no descendants on the same
2045 branch. They are where development generally takes place and are the
2046 usual targets for update and merge operations.
2047
2048 If one or more REVs are given, only open branch heads on the branches
2049 associated with the specified changesets are shown. This means that you
2050 can use hg heads . to see the heads on the currently checked-out
2051 branch.
2052
2053 If -c/--closed is specified, also show branch heads marked closed (see
2054 hg commit --close-branch).
2055
2056 If STARTREV is specified, only those heads that are descendants of
2057 STARTREV will be displayed.
2058
2059 If -t/--topo is specified, named branch mechanics will be ignored and
2060 only topological heads (changesets with no children) will be shown.
2061
2062 Returns 0 if matching heads are found, 1 if not.
2063
2064 Options:
2065
2066 -r,--rev <STARTREV>
2067 show only heads which are descendants of STARTREV
2068
2069 -t, --topo
2070 show topological heads only
2071
2072 -a, --active
2073 show active branchheads only (DEPRECATED)
2074
2075 -c, --closed
2076 show normal and closed branch heads
2077
2078 --style <STYLE>
2079 display using template map file (DEPRECATED)
2080
2081 -T,--template <TEMPLATE>
2082 display with template
2083
2084 identify
2085 identify the working directory or specified revision:
2086
2087 hg identify [-nibtB] [-r REV] [SOURCE]
2088
2089 Print a summary identifying the repository state at REV using one or
2090 two parent hash identifiers, followed by a "+" if the working directory
2091 has uncommitted changes, the branch name (if not default), a list of
2092 tags, and a list of bookmarks.
2093
2094 When REV is not given, print a summary of the current state of the
2095 repository including the working directory. Specify -r. to get informa‐
2096 tion of the working directory parent without scanning uncommitted
2097 changes.
2098
2099 Specifying a path to a repository root or Mercurial bundle will cause
2100 lookup to operate on that repository/bundle.
2101
2102 Template:
2103
2104 The following keywords are supported in addition to the common template
2105 keywords and functions. See also hg help templates.
2106
2107 dirty String. Character + denoting if the working directory has uncom‐
2108 mitted changes.
2109
2110 id String. One or two nodes, optionally followed by +.
2111
2112 parents
2113 List of strings. Parent nodes of the changeset.
2114
2115 Examples:
2116
2117 • generate a build identifier for the working directory:
2118
2119 hg id --id > build-id.dat
2120
2121 • find the revision corresponding to a tag:
2122
2123 hg id -n -r 1.3
2124
2125 • check the most recent revision of a remote repository:
2126
2127 hg id -r tip https://www.mercurial-scm.org/repo/hg/
2128
2129 See hg log for generating more information about specific revisions,
2130 including full hash identifiers.
2131
2132 Returns 0 if successful.
2133
2134 Options:
2135
2136 -r,--rev <REV>
2137 identify the specified revision
2138
2139 -n, --num
2140 show local revision number
2141
2142 -i, --id
2143 show global revision id
2144
2145 -b, --branch
2146 show branch
2147
2148 -t, --tags
2149 show tags
2150
2151 -B, --bookmarks
2152 show bookmarks
2153
2154 -e,--ssh <CMD>
2155 specify ssh command to use
2156
2157 --remotecmd <CMD>
2158 specify hg command to run on the remote side
2159
2160 --insecure
2161 do not verify server certificate (ignoring web.cacerts config)
2162
2163 -T,--template <TEMPLATE>
2164 display with template
2165
2166 aliases: id
2167
2168 log
2169 show revision history of entire repository or files:
2170
2171 hg log [OPTION]... [FILE]
2172
2173 Print the revision history of the specified files or the entire
2174 project.
2175
2176 If no revision range is specified, the default is tip:0 unless --follow
2177 is set.
2178
2179 File history is shown without following rename or copy history of
2180 files. Use -f/--follow with a filename to follow history across renames
2181 and copies. --follow without a filename will only show ancestors of the
2182 starting revisions. The starting revisions can be specified by
2183 -r/--rev, which default to the working directory parent.
2184
2185 By default this command prints revision number and changeset id, tags,
2186 non-trivial parents, user, date and time, and a summary for each com‐
2187 mit. When the -v/--verbose switch is used, the list of changed files
2188 and full commit message are shown.
2189
2190 With --graph the revisions are shown as an ASCII art DAG with the most
2191 recent changeset at the top. 'o' is a changeset, '@' is a working di‐
2192 rectory parent, '%' is a changeset involved in an unresolved merge con‐
2193 flict, '_' closes a branch, 'x' is obsolete, '*' is unstable, and '+'
2194 represents a fork where the changeset from the lines below is a parent
2195 of the 'o' merge on the same line. Paths in the DAG are represented
2196 with '|', '/' and so forth. ':' in place of a '|' indicates one or more
2197 revisions in a path are omitted.
2198
2199 Use -L/--line-range FILE,M:N options to follow the history of lines
2200 from M to N in FILE. With -p/--patch only diff hunks affecting speci‐
2201 fied line range will be shown. This option requires --follow; it can be
2202 specified multiple times. Currently, this option is not compatible with
2203 --graph. This option is experimental.
2204
2205 Note hg log --patch may generate unexpected diff output for merge
2206 changesets, as it will only compare the merge changeset against
2207 its first parent. Also, only files different from BOTH parents
2208 will appear in files:.
2209
2210 Note For performance reasons, hg log FILE may omit duplicate changes
2211 made on branches and will not show removals or mode changes. To
2212 see all such changes, use the --removed switch.
2213
2214 Note The history resulting from -L/--line-range options depends on
2215 diff options; for instance if white-spaces are ignored, respec‐
2216 tive changes with only white-spaces in specified line range will
2217 not be listed.
2218
2219 Some examples:
2220
2221 • changesets with full descriptions and file lists:
2222
2223 hg log -v
2224
2225 • changesets ancestral to the working directory:
2226
2227 hg log -f
2228
2229 • last 10 commits on the current branch:
2230
2231 hg log -l 10 -b .
2232
2233 • changesets showing all modifications of a file, including removals:
2234
2235 hg log --removed file.c
2236
2237 • all changesets that touch a directory, with diffs, excluding merges:
2238
2239 hg log -Mp lib/
2240
2241 • all revision numbers that match a keyword:
2242
2243 hg log -k bug --template "{rev}\n"
2244
2245 • the full hash identifier of the working directory parent:
2246
2247 hg log -r . --template "{node}\n"
2248
2249 • list available log templates:
2250
2251 hg log -T list
2252
2253 • check if a given changeset is included in a tagged release:
2254
2255 hg log -r "a21ccf and ancestor(1.9)"
2256
2257 • find all changesets by some user in a date range:
2258
2259 hg log -k alice -d "may 2008 to jul 2008"
2260
2261 • summary of all changesets after the last tag:
2262
2263 hg log -r "last(tagged())::" --template "{desc|firstline}\n"
2264
2265 • changesets touching lines 13 to 23 for file.c:
2266
2267 hg log -L file.c,13:23
2268
2269 • changesets touching lines 13 to 23 for file.c and lines 2 to 6 of
2270 main.c with patch:
2271
2272 hg log -L file.c,13:23 -L main.c,2:6 -p
2273
2274 See hg help dates for a list of formats valid for -d/--date.
2275
2276 See hg help revisions for more about specifying and ordering revisions.
2277
2278 See hg help templates for more about pre-packaged styles and specifying
2279 custom templates. The default template used by the log command can be
2280 customized via the command-templates.log configuration setting.
2281
2282 Returns 0 on success.
2283
2284 Options:
2285
2286 -f, --follow
2287 follow changeset history, or file history across copies and re‐
2288 names
2289
2290 --follow-first
2291 only follow the first parent of merge changesets (DEPRECATED)
2292
2293 -d,--date <DATE>
2294 show revisions matching date spec
2295
2296 -C, --copies
2297 show copied files
2298
2299 -k,--keyword <TEXT[+]>
2300 do case-insensitive search for a given text
2301
2302 -r,--rev <REV[+]>
2303 revisions to select or follow from
2304
2305 -L,--line-range <FILE,RANGE[+]>
2306 follow line range of specified file (EXPERIMENTAL)
2307
2308 --removed
2309 include revisions where files were removed
2310
2311 -m, --only-merges
2312 show only merges (DEPRECATED) (use -r "merge()" instead)
2313
2314 -u,--user <USER[+]>
2315 revisions committed by user
2316
2317 --only-branch <BRANCH[+]>
2318 show only changesets within the given named branch (DEPRECATED)
2319
2320 -b,--branch <BRANCH[+]>
2321 show changesets within the given named branch
2322
2323 -B,--bookmark <BOOKMARK[+]>
2324 show changesets within the given bookmark
2325
2326 -P,--prune <REV[+]>
2327 do not display revision or any of its ancestors
2328
2329 -p, --patch
2330 show patch
2331
2332 -g, --git
2333 use git extended diff format
2334
2335 -l,--limit <NUM>
2336 limit number of changes displayed
2337
2338 -M, --no-merges
2339 do not show merges
2340
2341 --stat output diffstat-style summary of changes
2342
2343 -G, --graph
2344 show the revision DAG
2345
2346 --style <STYLE>
2347 display using template map file (DEPRECATED)
2348
2349 -T,--template <TEMPLATE>
2350 display with template
2351
2352 -I,--include <PATTERN[+]>
2353 include names matching the given patterns
2354
2355 -X,--exclude <PATTERN[+]>
2356 exclude names matching the given patterns
2357
2358 [+] marked option can be specified multiple times
2359
2360 aliases: history
2361
2362 parents
2363 show the parents of the working directory or revision (DEPRECATED):
2364
2365 hg parents [-r REV] [FILE]
2366
2367 Print the working directory's parent revisions. If a revision is given
2368 via -r/--rev, the parent of that revision will be printed. If a file
2369 argument is given, the revision in which the file was last changed (be‐
2370 fore the working directory revision or the argument to --rev if given)
2371 is printed.
2372
2373 This command is equivalent to:
2374
2375 hg log -r "p1()+p2()" or
2376 hg log -r "p1(REV)+p2(REV)" or
2377 hg log -r "max(::p1() and file(FILE))+max(::p2() and file(FILE))" or
2378 hg log -r "max(::p1(REV) and file(FILE))+max(::p2(REV) and file(FILE))"
2379
2380 See hg summary and hg help revsets for related information.
2381
2382 Returns 0 on success.
2383
2384 Options:
2385
2386 -r,--rev <REV>
2387 show parents of the specified revision
2388
2389 --style <STYLE>
2390 display using template map file (DEPRECATED)
2391
2392 -T,--template <TEMPLATE>
2393 display with template
2394
2395 tip
2396 show the tip revision (DEPRECATED):
2397
2398 hg tip [-p] [-g]
2399
2400 The tip revision (usually just called the tip) is the changeset most
2401 recently added to the repository (and therefore the most recently
2402 changed head).
2403
2404 If you have just made a commit, that commit will be the tip. If you
2405 have just pulled changes from another repository, the tip of that
2406 repository becomes the current tip. The "tip" tag is special and cannot
2407 be renamed or assigned to a different changeset.
2408
2409 This command is deprecated, please use hg heads instead.
2410
2411 Returns 0 on success.
2412
2413 Options:
2414
2415 -p, --patch
2416 show patch
2417
2418 -g, --git
2419 use git extended diff format
2420
2421 --style <STYLE>
2422 display using template map file (DEPRECATED)
2423
2424 -T,--template <TEMPLATE>
2425 display with template
2426
2427 Working directory management
2428 add
2429 add the specified files on the next commit:
2430
2431 hg add [OPTION]... [FILE]...
2432
2433 Schedule files to be version controlled and added to the repository.
2434
2435 The files will be added to the repository at the next commit. To undo
2436 an add before that, see hg forget.
2437
2438 If no names are given, add all files to the repository (except files
2439 matching .hgignore).
2440
2441 Examples:
2442
2443 • New (unknown) files are added automatically by hg add:
2444
2445 $ ls
2446 foo.c
2447 $ hg status
2448 ? foo.c
2449 $ hg add
2450 adding foo.c
2451 $ hg status
2452 A foo.c
2453
2454 • Specific files to be added can be specified:
2455
2456 $ ls
2457 bar.c foo.c
2458 $ hg status
2459 ? bar.c
2460 ? foo.c
2461 $ hg add bar.c
2462 $ hg status
2463 A bar.c
2464 ? foo.c
2465
2466 Returns 0 if all files are successfully added.
2467
2468 Options:
2469
2470 -I,--include <PATTERN[+]>
2471 include names matching the given patterns
2472
2473 -X,--exclude <PATTERN[+]>
2474 exclude names matching the given patterns
2475
2476 -S, --subrepos
2477 recurse into subrepositories
2478
2479 -n, --dry-run
2480 do not perform actions, just print output
2481
2482 [+] marked option can be specified multiple times
2483
2484 addremove
2485 add all new files, delete all missing files:
2486
2487 hg addremove [OPTION]... [FILE]...
2488
2489 Add all new files and remove all missing files from the repository.
2490
2491 Unless names are given, new files are ignored if they match any of the
2492 patterns in .hgignore. As with add, these changes take effect at the
2493 next commit.
2494
2495 Use the -s/--similarity option to detect renamed files. This option
2496 takes a percentage between 0 (disabled) and 100 (files must be identi‐
2497 cal) as its parameter. With a parameter greater than 0, this compares
2498 every removed file with every added file and records those similar
2499 enough as renames. Detecting renamed files this way can be expensive.
2500 After using this option, hg status -C can be used to check which files
2501 were identified as moved or renamed. If not specified, -s/--similarity
2502 defaults to 100 and only renames of identical files are detected.
2503
2504 Examples:
2505
2506 • A number of files (bar.c and foo.c) are new, while foobar.c has
2507 been removed (without using hg remove) from the repository:
2508
2509 $ ls
2510 bar.c foo.c
2511 $ hg status
2512 ! foobar.c
2513 ? bar.c
2514 ? foo.c
2515 $ hg addremove
2516 adding bar.c
2517 adding foo.c
2518 removing foobar.c
2519 $ hg status
2520 A bar.c
2521 A foo.c
2522 R foobar.c
2523
2524 • A file foobar.c was moved to foo.c without using hg rename. Af‐
2525 terwards, it was edited slightly:
2526
2527 $ ls
2528 foo.c
2529 $ hg status
2530 ! foobar.c
2531 ? foo.c
2532 $ hg addremove --similarity 90
2533 removing foobar.c
2534 adding foo.c
2535 recording removal of foobar.c as rename to foo.c (94% similar)
2536 $ hg status -C
2537 A foo.c
2538 foobar.c
2539 R foobar.c
2540
2541 Returns 0 if all files are successfully added.
2542
2543 Options:
2544
2545 -s,--similarity <SIMILARITY>
2546 guess renamed files by similarity (0<=s<=100)
2547
2548 -S, --subrepos
2549 recurse into subrepositories
2550
2551 -I,--include <PATTERN[+]>
2552 include names matching the given patterns
2553
2554 -X,--exclude <PATTERN[+]>
2555 exclude names matching the given patterns
2556
2557 -n, --dry-run
2558 do not perform actions, just print output
2559
2560 [+] marked option can be specified multiple times
2561
2562 files
2563 list tracked files:
2564
2565 hg files [OPTION]... [FILE]...
2566
2567 Print files under Mercurial control in the working directory or speci‐
2568 fied revision for given files (excluding removed files). Files can be
2569 specified as filenames or filesets.
2570
2571 If no files are given to match, this command prints the names of all
2572 files under Mercurial control.
2573
2574 Template:
2575
2576 The following keywords are supported in addition to the common template
2577 keywords and functions. See also hg help templates.
2578
2579 flags String. Character denoting file's symlink and executable bits.
2580
2581 path String. Repository-absolute path of the file.
2582
2583 size Integer. Size of the file in bytes.
2584
2585 Examples:
2586
2587 • list all files under the current directory:
2588
2589 hg files .
2590
2591 • shows sizes and flags for current revision:
2592
2593 hg files -vr .
2594
2595 • list all files named README:
2596
2597 hg files -I "**/README"
2598
2599 • list all binary files:
2600
2601 hg files "set:binary()"
2602
2603 • find files containing a regular expression:
2604
2605 hg files "set:grep('bob')"
2606
2607 • search tracked file contents with xargs and grep:
2608
2609 hg files -0 | xargs -0 grep foo
2610
2611 See hg help patterns and hg help filesets for more information on spec‐
2612 ifying file patterns.
2613
2614 Returns 0 if a match is found, 1 otherwise.
2615
2616 Options:
2617
2618 -r,--rev <REV>
2619 search the repository as it is in REV
2620
2621 -0, --print0
2622 end filenames with NUL, for use with xargs
2623
2624 -I,--include <PATTERN[+]>
2625 include names matching the given patterns
2626
2627 -X,--exclude <PATTERN[+]>
2628 exclude names matching the given patterns
2629
2630 -T,--template <TEMPLATE>
2631 display with template
2632
2633 -S, --subrepos
2634 recurse into subrepositories
2635
2636 [+] marked option can be specified multiple times
2637
2638 forget
2639 forget the specified files on the next commit:
2640
2641 hg forget [OPTION]... FILE...
2642
2643 Mark the specified files so they will no longer be tracked after the
2644 next commit.
2645
2646 This only removes files from the current branch, not from the entire
2647 project history, and it does not delete them from the working direc‐
2648 tory.
2649
2650 To delete the file from the working directory, see hg remove.
2651
2652 To undo a forget before the next commit, see hg add.
2653
2654 Examples:
2655
2656 • forget newly-added binary files:
2657
2658 hg forget "set:added() and binary()"
2659
2660 • forget files that would be excluded by .hgignore:
2661
2662 hg forget "set:hgignore()"
2663
2664 Returns 0 on success.
2665
2666 Options:
2667
2668 -i, --interactive
2669 use interactive mode
2670
2671 -I,--include <PATTERN[+]>
2672 include names matching the given patterns
2673
2674 -X,--exclude <PATTERN[+]>
2675 exclude names matching the given patterns
2676
2677 -n, --dry-run
2678 do not perform actions, just print output
2679
2680 [+] marked option can be specified multiple times
2681
2682 locate
2683 locate files matching specific patterns (DEPRECATED):
2684
2685 hg locate [OPTION]... [PATTERN]...
2686
2687 Print files under Mercurial control in the working directory whose
2688 names match the given patterns.
2689
2690 By default, this command searches all directories in the working direc‐
2691 tory. To search just the current directory and its subdirectories, use
2692 "--include .".
2693
2694 If no patterns are given to match, this command prints the names of all
2695 files under Mercurial control in the working directory.
2696
2697 If you want to feed the output of this command into the "xargs" com‐
2698 mand, use the -0 option to both this command and "xargs". This will
2699 avoid the problem of "xargs" treating single filenames that contain
2700 whitespace as multiple filenames.
2701
2702 See hg help files for a more versatile command.
2703
2704 Returns 0 if a match is found, 1 otherwise.
2705
2706 Options:
2707
2708 -r,--rev <REV>
2709 search the repository as it is in REV
2710
2711 -0, --print0
2712 end filenames with NUL, for use with xargs
2713
2714 -f, --fullpath
2715 print complete paths from the filesystem root
2716
2717 -I,--include <PATTERN[+]>
2718 include names matching the given patterns
2719
2720 -X,--exclude <PATTERN[+]>
2721 exclude names matching the given patterns
2722
2723 [+] marked option can be specified multiple times
2724
2725 purge
2726 removes files not tracked by Mercurial:
2727
2728 hg purge [OPTION]... [DIR]...
2729
2730 Delete files not known to Mercurial. This is useful to test local and
2731 uncommitted changes in an otherwise-clean source tree.
2732
2733 This means that purge will delete the following by default:
2734
2735 • Unknown files: files marked with "?" by hg status
2736
2737 • Empty directories: in fact Mercurial ignores directories unless they
2738 contain files under source control management
2739
2740 But it will leave untouched:
2741
2742 • Modified and unmodified tracked files
2743
2744 • Ignored files (unless -i or --all is specified)
2745
2746 • New files added to the repository (with hg add)
2747
2748 The --files and --dirs options can be used to direct purge to delete
2749 only files, only directories, or both. If neither option is given, both
2750 will be deleted.
2751
2752 If directories are given on the command line, only files in these di‐
2753 rectories are considered.
2754
2755 Be careful with purge, as you could irreversibly delete some files you
2756 forgot to add to the repository. If you only want to print the list of
2757 files that this program would delete, use the --print option.
2758
2759 Options:
2760
2761 -a, --abort-on-err
2762 abort if an error occurs
2763
2764 --all purge ignored files too
2765
2766 -i, --ignored
2767 purge only ignored files
2768
2769 --dirs purge empty directories
2770
2771 --files
2772 purge files
2773
2774 -p, --print
2775 print filenames instead of deleting them
2776
2777 -0, --print0
2778 end filenames with NUL, for use with xargs (implies -p/--print)
2779
2780 --confirm
2781 ask before permanently deleting files
2782
2783 -I,--include <PATTERN[+]>
2784 include names matching the given patterns
2785
2786 -X,--exclude <PATTERN[+]>
2787 exclude names matching the given patterns
2788
2789 [+] marked option can be specified multiple times
2790
2791 aliases: clean
2792
2793 remove
2794 remove the specified files on the next commit:
2795
2796 hg remove [OPTION]... FILE...
2797
2798 Schedule the indicated files for removal from the current branch.
2799
2800 This command schedules the files to be removed at the next commit. To
2801 undo a remove before that, see hg revert. To undo added files, see hg
2802 forget.
2803
2804 -A/--after can be used to remove only files that have already been
2805 deleted, -f/--force can be used to force deletion, and -Af can be used
2806 to remove files from the next revision without deleting them from the
2807 working directory.
2808
2809 The following table details the behavior of remove for different file
2810 states (columns) and option combinations (rows). The file states are
2811 Added [A], Clean [C], Modified [M] and Missing [!] (as reported by hg
2812 status). The actions are Warn, Remove (from branch) and Delete (from
2813 disk):
2814
2815 ┌──────────┬───┬────┬────┬───┐
2816 │opt/state │ A │ C │ M │ ! │
2817 ├──────────┼───┼────┼────┼───┤
2818 │none │ W │ RD │ W │ R │
2819 ├──────────┼───┼────┼────┼───┤
2820 │-f │ R │ RD │ RD │ R │
2821 ├──────────┼───┼────┼────┼───┤
2822 │-A │ W │ W │ W │ R │
2823 ├──────────┼───┼────┼────┼───┤
2824 │-Af │ R │ R │ R │ R │
2825 └──────────┴───┴────┴────┴───┘
2826
2827 Note hg remove never deletes files in Added [A] state from the work‐
2828 ing directory, not even if --force is specified.
2829
2830 Returns 0 on success, 1 if any warnings encountered.
2831
2832 Options:
2833
2834 -A, --after
2835 record delete for missing files
2836
2837 -f, --force
2838 forget added files, delete modified files
2839
2840 -S, --subrepos
2841 recurse into subrepositories
2842
2843 -I,--include <PATTERN[+]>
2844 include names matching the given patterns
2845
2846 -X,--exclude <PATTERN[+]>
2847 exclude names matching the given patterns
2848
2849 -n, --dry-run
2850 do not perform actions, just print output
2851
2852 [+] marked option can be specified multiple times
2853
2854 aliases: rm
2855
2856 rename
2857 rename files; equivalent of copy + remove:
2858
2859 hg rename [OPTION]... SOURCE... DEST
2860
2861 Mark dest as copies of sources; mark sources for deletion. If dest is a
2862 directory, copies are put in that directory. If dest is a file, there
2863 can only be one source.
2864
2865 By default, this command copies the contents of files as they exist in
2866 the working directory. If invoked with -A/--after, the operation is
2867 recorded, but no copying is performed.
2868
2869 To undo marking a destination file as renamed, use --forget. With that
2870 option, all given (positional) arguments are unmarked as renames. The
2871 destination file(s) will be left in place (still tracked). The source
2872 file(s) will not be restored. Note that hg rename --forget behaves the
2873 same way as hg copy --forget.
2874
2875 This command takes effect with the next commit by default.
2876
2877 Returns 0 on success, 1 if errors are encountered.
2878
2879 Options:
2880
2881 --forget
2882 unmark a destination file as renamed
2883
2884 -A, --after
2885 record a rename that has already occurred
2886
2887 --at-rev <REV>
2888 (un)mark renames in the given revision (EXPERIMENTAL)
2889
2890 -f, --force
2891 forcibly move over an existing managed file
2892
2893 -I,--include <PATTERN[+]>
2894 include names matching the given patterns
2895
2896 -X,--exclude <PATTERN[+]>
2897 exclude names matching the given patterns
2898
2899 -n, --dry-run
2900 do not perform actions, just print output
2901
2902 [+] marked option can be specified multiple times
2903
2904 aliases: move mv
2905
2906 resolve
2907 redo merges or set/view the merge status of files:
2908
2909 hg resolve [OPTION]... [FILE]...
2910
2911 Merges with unresolved conflicts are often the result of non-interac‐
2912 tive merging using the internal:merge configuration setting, or a com‐
2913 mand-line merge tool like diff3. The resolve command is used to manage
2914 the files involved in a merge, after hg merge has been run, and before
2915 hg commit is run (i.e. the working directory must have two parents).
2916 See hg help merge-tools for information on configuring merge tools.
2917
2918 The resolve command can be used in the following ways:
2919
2920 • hg resolve [--re-merge] [--tool TOOL] FILE...: attempt to re-merge
2921 the specified files, discarding any previous merge attempts. Re-merg‐
2922 ing is not performed for files already marked as resolved. Use
2923 --all/-a to select all unresolved files. --tool can be used to spec‐
2924 ify the merge tool used for the given files. It overrides the HGMERGE
2925 environment variable and your configuration files. Previous file
2926 contents are saved with a .orig suffix.
2927
2928 • hg resolve -m [FILE]: mark a file as having been resolved (e.g. after
2929 having manually fixed-up the files). The default is to mark all unre‐
2930 solved files.
2931
2932 • hg resolve -u [FILE]...: mark a file as unresolved. The default is to
2933 mark all resolved files.
2934
2935 • hg resolve -l: list files which had or still have conflicts. In the
2936 printed list, U = unresolved and R = resolved. You can use set:unre‐
2937 solved() or set:resolved() to filter the list. See hg help filesets
2938 for details.
2939
2940 Note Mercurial will not let you commit files with unresolved merge
2941 conflicts. You must use hg resolve -m ... before you can commit
2942 after a conflicting merge.
2943
2944 Template:
2945
2946 The following keywords are supported in addition to the common template
2947 keywords and functions. See also hg help templates.
2948
2949 mergestatus
2950 String. Character denoting merge conflicts, U or R.
2951
2952 path String. Repository-absolute path of the file.
2953
2954 Returns 0 on success, 1 if any files fail a resolve attempt.
2955
2956 Options:
2957
2958 -a, --all
2959 select all unresolved files
2960
2961 -l, --list
2962 list state of files needing merge
2963
2964 -m, --mark
2965 mark files as resolved
2966
2967 -u, --unmark
2968 mark files as unresolved
2969
2970 -n, --no-status
2971 hide status prefix
2972
2973 --re-merge
2974 re-merge files
2975
2976 -t,--tool <TOOL>
2977 specify merge tool
2978
2979 -I,--include <PATTERN[+]>
2980 include names matching the given patterns
2981
2982 -X,--exclude <PATTERN[+]>
2983 exclude names matching the given patterns
2984
2985 -T,--template <TEMPLATE>
2986 display with template
2987
2988 [+] marked option can be specified multiple times
2989
2990 revert
2991 restore files to their checkout state:
2992
2993 hg revert [OPTION]... [-r REV] [NAME]...
2994
2995 Note To check out earlier revisions, you should use hg update REV.
2996 To cancel an uncommitted merge (and lose your changes), use hg
2997 merge --abort.
2998
2999 With no revision specified, revert the specified files or directories
3000 to the contents they had in the parent of the working directory. This
3001 restores the contents of files to an unmodified state and unschedules
3002 adds, removes, copies, and renames. If the working directory has two
3003 parents, you must explicitly specify a revision.
3004
3005 Using the -r/--rev or -d/--date options, revert the given files or di‐
3006 rectories to their states as of a specific revision. Because revert
3007 does not change the working directory parents, this will cause these
3008 files to appear modified. This can be helpful to "back out" some or all
3009 of an earlier change. See hg backout for a related method.
3010
3011 Modified files are saved with a .orig suffix before reverting. To dis‐
3012 able these backups, use --no-backup. It is possible to store the backup
3013 files in a custom directory relative to the root of the repository by
3014 setting the ui.origbackuppath configuration option.
3015
3016 See hg help dates for a list of formats valid for -d/--date.
3017
3018 See hg help backout for a way to reverse the effect of an earlier
3019 changeset.
3020
3021 Returns 0 on success.
3022
3023 Options:
3024
3025 -a, --all
3026 revert all changes when no arguments given
3027
3028 -d,--date <DATE>
3029 tipmost revision matching date
3030
3031 -r,--rev <REV>
3032 revert to the specified revision
3033
3034 -C, --no-backup
3035 do not save backup copies of files
3036
3037 -i, --interactive
3038 interactively select the changes
3039
3040 -I,--include <PATTERN[+]>
3041 include names matching the given patterns
3042
3043 -X,--exclude <PATTERN[+]>
3044 exclude names matching the given patterns
3045
3046 -n, --dry-run
3047 do not perform actions, just print output
3048
3049 [+] marked option can be specified multiple times
3050
3051 root
3052 print the root (top) of the current working directory:
3053
3054 hg root
3055
3056 Print the root directory of the current repository.
3057
3058 Template:
3059
3060 The following keywords are supported in addition to the common template
3061 keywords and functions. See also hg help templates.
3062
3063 hgpath String. Path to the .hg directory.
3064
3065 storepath
3066 String. Path to the directory holding versioned data.
3067
3068 Returns 0 on success.
3069
3070 Options:
3071
3072 -T,--template <TEMPLATE>
3073 display with template
3074
3075 shelve
3076 save and set aside changes from the working directory:
3077
3078 hg shelve [OPTION]... [FILE]...
3079
3080 Shelving takes files that "hg status" reports as not clean, saves the
3081 modifications to a bundle (a shelved change), and reverts the files so
3082 that their state in the working directory becomes clean.
3083
3084 To restore these changes to the working directory, using "hg unshelve";
3085 this will work even if you switch to a different commit.
3086
3087 When no files are specified, "hg shelve" saves all not-clean files. If
3088 specific files or directories are named, only changes to those files
3089 are shelved.
3090
3091 In bare shelve (when no files are specified, without interactive, in‐
3092 clude and exclude option), shelving remembers information if the work‐
3093 ing directory was on newly created branch, in other words working di‐
3094 rectory was on different branch than its first parent. In this situa‐
3095 tion unshelving restores branch information to the working directory.
3096
3097 Each shelved change has a name that makes it easier to find later. The
3098 name of a shelved change defaults to being based on the active book‐
3099 mark, or if there is no active bookmark, the current named branch. To
3100 specify a different name, use --name.
3101
3102 To see a list of existing shelved changes, use the --list option. For
3103 each shelved change, this will print its name, age, and description;
3104 use --patch or --stat for more details.
3105
3106 To delete specific shelved changes, use --delete. To delete all shelved
3107 changes, use --cleanup.
3108
3109 Options:
3110
3111 -A, --addremove
3112 mark new/missing files as added/removed before shelving
3113
3114 -u, --unknown
3115 store unknown files in the shelve
3116
3117 --cleanup
3118 delete all shelved changes
3119
3120 --date <DATE>
3121 shelve with the specified commit date
3122
3123 -d, --delete
3124 delete the named shelved change(s)
3125
3126 -e, --edit
3127 invoke editor on commit messages
3128
3129 -k, --keep
3130 shelve, but keep changes in the working directory
3131
3132 -l, --list
3133 list current shelves
3134
3135 -m,--message <TEXT>
3136 use text as shelve message
3137
3138 -n,--name <NAME>
3139 use the given name for the shelved commit
3140
3141 -p, --patch
3142 output patches for changes (provide the names of the shelved
3143 changes as positional arguments)
3144
3145 -i, --interactive
3146 interactive mode
3147
3148 --stat output diffstat-style summary of changes (provide the names of
3149 the shelved changes as positional arguments)
3150
3151 -I,--include <PATTERN[+]>
3152 include names matching the given patterns
3153
3154 -X,--exclude <PATTERN[+]>
3155 exclude names matching the given patterns
3156
3157 [+] marked option can be specified multiple times
3158
3159 status
3160 show changed files in the working directory:
3161
3162 hg status [OPTION]... [FILE]...
3163
3164 Show status of files in the repository. If names are given, only files
3165 that match are shown. Files that are clean or ignored or the source of
3166 a copy/move operation, are not listed unless -c/--clean, -i/--ignored,
3167 -C/--copies or -A/--all are given. Unless options described with "show
3168 only ..." are given, the options -mardu are used.
3169
3170 Option -q/--quiet hides untracked (unknown and ignored) files unless
3171 explicitly requested with -u/--unknown or -i/--ignored.
3172
3173 Note hg status may appear to disagree with diff if permissions have
3174 changed or a merge has occurred. The standard diff format does
3175 not report permission changes and diff only reports changes rel‐
3176 ative to one merge parent.
3177
3178 If one revision is given, it is used as the base revision. If two re‐
3179 visions are given, the differences between them are shown. The --change
3180 option can also be used as a shortcut to list the changed files of a
3181 revision from its first parent.
3182
3183 The codes used to show the status of files are:
3184
3185 M = modified
3186 A = added
3187 R = removed
3188 C = clean
3189 ! = missing (deleted by non-hg command, but still tracked)
3190 ? = not tracked
3191 I = ignored
3192 = origin of the previous file (with --copies)
3193
3194 The -t/--terse option abbreviates the output by showing only the direc‐
3195 tory name if all the files in it share the same status. The option
3196 takes an argument indicating the statuses to abbreviate: 'm' for 'modi‐
3197 fied', 'a' for 'added', 'r' for 'removed', 'd' for 'deleted', 'u' for
3198 'unknown', 'i' for 'ignored' and 'c' for clean.
3199
3200 It abbreviates only those statuses which are passed. Note that clean
3201 and ignored files are not displayed with '--terse ic' unless the
3202 -c/--clean and -i/--ignored options are also used.
3203
3204 The -v/--verbose option shows information when the repository is in an
3205 unfinished merge, shelve, rebase state etc. You can have this behavior
3206 turned on by default by enabling the commands.status.verbose option.
3207
3208 You can skip displaying some of these states by setting commands.sta‐
3209 tus.skipstates to one or more of: 'bisect', 'graft', 'histedit',
3210 'merge', 'rebase', or 'unshelve'.
3211
3212 Template:
3213
3214 The following keywords are supported in addition to the common template
3215 keywords and functions. See also hg help templates.
3216
3217 path String. Repository-absolute path of the file.
3218
3219 source String. Repository-absolute path of the file originated from.
3220 Available if --copies is specified.
3221
3222 status String. Character denoting file's status.
3223
3224 Examples:
3225
3226 • show changes in the working directory relative to a changeset:
3227
3228 hg status --rev 9353
3229
3230 • show changes in the working directory relative to the current direc‐
3231 tory (see hg help patterns for more information):
3232
3233 hg status re:
3234
3235 • show all changes including copies in an existing changeset:
3236
3237 hg status --copies --change 9353
3238
3239 • get a NUL separated list of added files, suitable for xargs:
3240
3241 hg status -an0
3242
3243 • show more information about the repository status, abbreviating
3244 added, removed, modified, deleted, and untracked paths:
3245
3246 hg status -v -t mardu
3247
3248 Returns 0 on success.
3249
3250 Options:
3251
3252 -A, --all
3253 show status of all files
3254
3255 -m, --modified
3256 show only modified files
3257
3258 -a, --added
3259 show only added files
3260
3261 -r, --removed
3262 show only removed files
3263
3264 -d, --deleted
3265 show only missing files
3266
3267 -c, --clean
3268 show only files without changes
3269
3270 -u, --unknown
3271 show only unknown (not tracked) files
3272
3273 -i, --ignored
3274 show only ignored files
3275
3276 -n, --no-status
3277 hide status prefix
3278
3279 -t,--terse <VALUE>
3280 show the terse output (EXPERIMENTAL) (default: nothing)
3281
3282 -C, --copies
3283 show source of copied files (DEFAULT: ui.statuscopies)
3284
3285 -0, --print0
3286 end filenames with NUL, for use with xargs
3287
3288 --rev <REV[+]>
3289 show difference from revision
3290
3291 --change <REV>
3292 list the changed files of a revision
3293
3294 -I,--include <PATTERN[+]>
3295 include names matching the given patterns
3296
3297 -X,--exclude <PATTERN[+]>
3298 exclude names matching the given patterns
3299
3300 -S, --subrepos
3301 recurse into subrepositories
3302
3303 -T,--template <TEMPLATE>
3304 display with template
3305
3306 [+] marked option can be specified multiple times
3307
3308 aliases: st
3309
3310 summary
3311 summarize working directory state:
3312
3313 hg summary [--remote]
3314
3315 This generates a brief summary of the working directory state, includ‐
3316 ing parents, branch, commit status, phase and available updates.
3317
3318 With the --remote option, this will check the default paths for incom‐
3319 ing and outgoing changes. This can be time-consuming.
3320
3321 Returns 0 on success.
3322
3323 Options:
3324
3325 --remote
3326 check for push and pull
3327
3328 aliases: sum
3329
3330 unshelve
3331 restore a shelved change to the working directory:
3332
3333 hg unshelve [OPTION]... [[-n] SHELVED]
3334
3335 This command accepts an optional name of a shelved change to restore.
3336 If none is given, the most recent shelved change is used.
3337
3338 If a shelved change is applied successfully, the bundle that contains
3339 the shelved changes is moved to a backup location (.hg/shelve-backup).
3340
3341 Since you can restore a shelved change on top of an arbitrary commit,
3342 it is possible that unshelving will result in a conflict between your
3343 changes and the commits you are unshelving onto. If this occurs, you
3344 must resolve the conflict, then use --continue to complete the unshelve
3345 operation. (The bundle will not be moved until you successfully com‐
3346 plete the unshelve.)
3347
3348 (Alternatively, you can use --abort to abandon an unshelve that causes
3349 a conflict. This reverts the unshelved changes, and leaves the bundle
3350 in place.)
3351
3352 If bare shelved change (without interactive, include and exclude op‐
3353 tion) was done on newly created branch it would restore branch informa‐
3354 tion to the working directory.
3355
3356 After a successful unshelve, the shelved changes are stored in a backup
3357 directory. Only the N most recent backups are kept. N defaults to 10
3358 but can be overridden using the shelve.maxbackups configuration option.
3359
3360 Timestamp in seconds is used to decide order of backups. More than
3361 maxbackups backups are kept, if same timestamp prevents from deciding
3362 exact order of them, for safety.
3363
3364 Selected changes can be unshelved with --interactive flag. The working
3365 directory is updated with the selected changes, and only the unselected
3366 changes remain shelved. Note: The whole shelve is applied to working
3367 directory first before running interactively. So, this will bring up
3368 all the conflicts between working directory and the shelve, irrespec‐
3369 tive of which changes will be unshelved.
3370
3371 Options:
3372
3373 -a, --abort
3374 abort an incomplete unshelve operation
3375
3376 -c, --continue
3377 continue an incomplete unshelve operation
3378
3379 -i, --interactive
3380 use interactive mode (EXPERIMENTAL)
3381
3382 -k, --keep
3383 keep shelve after unshelving
3384
3385 -n,--name <NAME>
3386 restore shelved change with given name
3387
3388 -t,--tool <VALUE>
3389 specify merge tool
3390
3391 --date <DATE>
3392 set date for temporary commits (DEPRECATED)
3393
3394 update
3395 update working directory (or switch revisions):
3396
3397 hg update [-C|-c|-m] [-d DATE] [[-r] REV]
3398
3399 Update the repository's working directory to the specified changeset.
3400 If no changeset is specified, update to the tip of the current named
3401 branch and move the active bookmark (see hg help bookmarks).
3402
3403 Update sets the working directory's parent revision to the specified
3404 changeset (see hg help parents).
3405
3406 If the changeset is not a descendant or ancestor of the working direc‐
3407 tory's parent and there are uncommitted changes, the update is aborted.
3408 With the -c/--check option, the working directory is checked for uncom‐
3409 mitted changes; if none are found, the working directory is updated to
3410 the specified changeset.
3411
3412 The -C/--clean, -c/--check, and -m/--merge options control what happens
3413 if the working directory contains uncommitted changes. At most of one
3414 of them can be specified.
3415
3416 1. If no option is specified, and if the requested changeset is an an‐
3417 cestor or descendant of the working directory's parent, the uncom‐
3418 mitted changes are merged into the requested changeset and the
3419 merged result is left uncommitted. If the requested changeset is not
3420 an ancestor or descendant (that is, it is on another branch), the
3421 update is aborted and the uncommitted changes are preserved.
3422
3423 2. With the -m/--merge option, the update is allowed even if the re‐
3424 quested changeset is not an ancestor or descendant of the working
3425 directory's parent.
3426
3427 3. With the -c/--check option, the update is aborted and the uncommit‐
3428 ted changes are preserved.
3429
3430 4. With the -C/--clean option, uncommitted changes are discarded and
3431 the working directory is updated to the requested changeset.
3432
3433 To cancel an uncommitted merge (and lose your changes), use hg merge
3434 --abort.
3435
3436 Use null as the changeset to remove the working directory (like hg
3437 clone -U).
3438
3439 If you want to revert just one file to an older revision, use hg revert
3440 [-r REV] NAME.
3441
3442 See hg help dates for a list of formats valid for -d/--date.
3443
3444 Returns 0 on success, 1 if there are unresolved files.
3445
3446 Options:
3447
3448 -C, --clean
3449 discard uncommitted changes (no backup)
3450
3451 -c, --check
3452 require clean working directory
3453
3454 -m, --merge
3455 merge uncommitted changes
3456
3457 -d,--date <DATE>
3458 tipmost revision matching date
3459
3460 -r,--rev <REV>
3461 revision
3462
3463 -t,--tool <TOOL>
3464 specify merge tool
3465
3466 aliases: up checkout co
3467
3468 Change import/export
3469 archive
3470 create an unversioned archive of a repository revision:
3471
3472 hg archive [OPTION]... DEST
3473
3474 By default, the revision used is the parent of the working directory;
3475 use -r/--rev to specify a different revision.
3476
3477 The archive type is automatically detected based on file extension (to
3478 override, use -t/--type).
3479
3480 Examples:
3481
3482 • create a zip file containing the 1.0 release:
3483
3484 hg archive -r 1.0 project-1.0.zip
3485
3486 • create a tarball excluding .hg files:
3487
3488 hg archive project.tar.gz -X ".hg*"
3489
3490 Valid types are:
3491
3492 files
3493
3494 a directory full of files (default)
3495
3496 tar
3497
3498 tar archive, uncompressed
3499
3500 tbz2
3501
3502 tar archive, compressed using bzip2
3503
3504 tgz
3505
3506 tar archive, compressed using gzip
3507
3508 txz
3509
3510 tar archive, compressed using lzma (only in Python 3)
3511
3512 uzip
3513
3514 zip archive, uncompressed
3515
3516 zip
3517
3518 zip archive, compressed using deflate
3519
3520 The exact name of the destination archive or directory is given using a
3521 format string; see hg help export for details.
3522
3523 Each member added to an archive file has a directory prefix prepended.
3524 Use -p/--prefix to specify a format string for the prefix. The default
3525 is the basename of the archive, with suffixes removed.
3526
3527 Returns 0 on success.
3528
3529 Options:
3530
3531 --no-decode
3532 do not pass files through decoders
3533
3534 -p,--prefix <PREFIX>
3535 directory prefix for files in archive
3536
3537 -r,--rev <REV>
3538 revision to distribute
3539
3540 -t,--type <TYPE>
3541 type of distribution to create
3542
3543 -S, --subrepos
3544 recurse into subrepositories
3545
3546 -I,--include <PATTERN[+]>
3547 include names matching the given patterns
3548
3549 -X,--exclude <PATTERN[+]>
3550 exclude names matching the given patterns
3551
3552 [+] marked option can be specified multiple times
3553
3554 bundle
3555 create a bundle file:
3556
3557 hg bundle [-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]...
3558
3559 Generate a bundle file containing data to be transferred to another
3560 repository.
3561
3562 To create a bundle containing all changesets, use -a/--all (or --base
3563 null). Otherwise, hg assumes the destination will have all the nodes
3564 you specify with --base parameters. Otherwise, hg will assume the
3565 repository has all the nodes in destination, or default-push/default if
3566 no destination is specified, where destination is the repositories you
3567 provide through DEST option.
3568
3569 You can change bundle format with the -t/--type option. See hg help
3570 bundlespec for documentation on this format. By default, the most ap‐
3571 propriate format is used and compression defaults to bzip2.
3572
3573 The bundle file can then be transferred using conventional means and
3574 applied to another repository with the unbundle or pull command. This
3575 is useful when direct push and pull are not available or when exporting
3576 an entire repository is undesirable.
3577
3578 Applying bundles preserves all changeset contents including permis‐
3579 sions, copy/rename information, and revision history.
3580
3581 Returns 0 on success, 1 if no changes found.
3582
3583 Options:
3584
3585 -f, --force
3586 run even when the destination is unrelated
3587
3588 -r,--rev <REV[+]>
3589 a changeset intended to be added to the destination
3590
3591 -b,--branch <BRANCH[+]>
3592 a specific branch you would like to bundle
3593
3594 --base <REV[+]>
3595 a base changeset assumed to be available at the destination
3596
3597 -a, --all
3598 bundle all changesets in the repository
3599
3600 -t,--type <TYPE>
3601 bundle compression type to use (default: bzip2)
3602
3603 -e,--ssh <CMD>
3604 specify ssh command to use
3605
3606 --remotecmd <CMD>
3607 specify hg command to run on the remote side
3608
3609 --insecure
3610 do not verify server certificate (ignoring web.cacerts config)
3611
3612 [+] marked option can be specified multiple times
3613
3614 export
3615 dump the header and diffs for one or more changesets:
3616
3617 hg export [OPTION]... [-o OUTFILESPEC] [-r] [REV]...
3618
3619 Print the changeset header and diffs for one or more revisions. If no
3620 revision is given, the parent of the working directory is used.
3621
3622 The information shown in the changeset header is: author, date, branch
3623 name (if non-default), changeset hash, parent(s) and commit comment.
3624
3625 Note hg export may generate unexpected diff output for merge change‐
3626 sets, as it will compare the merge changeset against its first
3627 parent only.
3628
3629 Output may be to a file, in which case the name of the file is given
3630 using a template string. See hg help templates. In addition to the com‐
3631 mon template keywords, the following formatting rules are supported:
3632
3633 %%
3634
3635 literal "%" character
3636
3637 %H
3638
3639 changeset hash (40 hexadecimal digits)
3640
3641 %N
3642
3643 number of patches being generated
3644
3645 %R
3646
3647 changeset revision number
3648
3649 %b
3650
3651 basename of the exporting repository
3652
3653 %h
3654
3655 short-form changeset hash (12 hexadecimal digits)
3656
3657 %m
3658
3659 first line of the commit message (only alphanumeric characters)
3660
3661 %n
3662
3663 zero-padded sequence number, starting at 1
3664
3665 %r
3666
3667 zero-padded changeset revision number
3668
3669 \
3670
3671 literal "" character
3672
3673 Without the -a/--text option, export will avoid generating diffs of
3674 files it detects as binary. With -a, export will generate a diff any‐
3675 way, probably with undesirable results.
3676
3677 With -B/--bookmark changesets reachable by the given bookmark are se‐
3678 lected.
3679
3680 Use the -g/--git option to generate diffs in the git extended diff for‐
3681 mat. See hg help diffs for more information.
3682
3683 With the --switch-parent option, the diff will be against the second
3684 parent. It can be useful to review a merge.
3685
3686 Template:
3687
3688 The following keywords are supported in addition to the common template
3689 keywords and functions. See also hg help templates.
3690
3691 diff String. Diff content.
3692
3693 parents
3694 List of strings. Parent nodes of the changeset.
3695
3696 Examples:
3697
3698 • use export and import to transplant a bugfix to the current branch:
3699
3700 hg export -r 9353 | hg import -
3701
3702 • export all the changesets between two revisions to a file with rename
3703 information:
3704
3705 hg export --git -r 123:150 > changes.txt
3706
3707 • split outgoing changes into a series of patches with descriptive
3708 names:
3709
3710 hg export -r "outgoing()" -o "%n-%m.patch"
3711
3712 Returns 0 on success.
3713
3714 Options:
3715
3716 -B,--bookmark <BOOKMARK>
3717 export changes only reachable by given bookmark
3718
3719 -o,--output <FORMAT>
3720 print output to file with formatted name
3721
3722 --switch-parent
3723 diff against the second parent
3724
3725 -r,--rev <REV[+]>
3726 revisions to export
3727
3728 -a, --text
3729 treat all files as text
3730
3731 -g, --git
3732 use git extended diff format (DEFAULT: diff.git)
3733
3734 --binary
3735 generate binary diffs in git mode (default)
3736
3737 --nodates
3738 omit dates from diff headers
3739
3740 -T,--template <TEMPLATE>
3741 display with template
3742
3743 [+] marked option can be specified multiple times
3744
3745 import
3746 import an ordered set of patches:
3747
3748 hg import [OPTION]... PATCH...
3749
3750 Import a list of patches and commit them individually (unless --no-com‐
3751 mit is specified).
3752
3753 To read a patch from standard input (stdin), use "-" as the patch name.
3754 If a URL is specified, the patch will be downloaded from there.
3755
3756 Import first applies changes to the working directory (unless --bypass
3757 is specified), import will abort if there are outstanding changes.
3758
3759 Use --bypass to apply and commit patches directly to the repository,
3760 without affecting the working directory. Without --exact, patches will
3761 be applied on top of the working directory parent revision.
3762
3763 You can import a patch straight from a mail message. Even patches as
3764 attachments work (to use the body part, it must have type text/plain or
3765 text/x-patch). From and Subject headers of email message are used as
3766 default committer and commit message. All text/plain body parts before
3767 first diff are added to the commit message.
3768
3769 If the imported patch was generated by hg export, user and description
3770 from patch override values from message headers and body. Values given
3771 on command line with -m/--message and -u/--user override these.
3772
3773 If --exact is specified, import will set the working directory to the
3774 parent of each patch before applying it, and will abort if the result‐
3775 ing changeset has a different ID than the one recorded in the patch.
3776 This will guard against various ways that portable patch formats and
3777 mail systems might fail to transfer Mercurial data or metadata. See hg
3778 bundle for lossless transmission.
3779
3780 Use --partial to ensure a changeset will be created from the patch even
3781 if some hunks fail to apply. Hunks that fail to apply will be written
3782 to a <target-file>.rej file. Conflicts can then be resolved by hand be‐
3783 fore hg commit --amend is run to update the created changeset. This
3784 flag exists to let people import patches that partially apply without
3785 losing the associated metadata (author, date, description, ...).
3786
3787 Note When no hunks apply cleanly, hg import --partial will create an
3788 empty changeset, importing only the patch metadata.
3789
3790 With -s/--similarity, hg will attempt to discover renames and copies in
3791 the patch in the same way as hg addremove.
3792
3793 It is possible to use external patch programs to perform the patch by
3794 setting the ui.patch configuration option. For the default internal
3795 tool, the fuzz can also be configured via patch.fuzz. See hg help con‐
3796 fig for more information about configuration files and how to use these
3797 options.
3798
3799 See hg help dates for a list of formats valid for -d/--date.
3800
3801 Examples:
3802
3803 • import a traditional patch from a website and detect renames:
3804
3805 hg import -s 80 http://example.com/bugfix.patch
3806
3807 • import a changeset from an hgweb server:
3808
3809 hg import https://www.mercurial-scm.org/repo/hg/rev/5ca8c111e9aa
3810
3811 • import all the patches in an Unix-style mbox:
3812
3813 hg import incoming-patches.mbox
3814
3815 • import patches from stdin:
3816
3817 hg import -
3818
3819 • attempt to exactly restore an exported changeset (not always possi‐
3820 ble):
3821
3822 hg import --exact proposed-fix.patch
3823
3824 • use an external tool to apply a patch which is too fuzzy for the de‐
3825 fault internal tool.
3826
3827 hg import --config ui.patch="patch --merge" fuzzy.patch
3828
3829 • change the default fuzzing from 2 to a less strict 7
3830
3831 hg import --config ui.fuzz=7 fuzz.patch
3832
3833 Returns 0 on success, 1 on partial success (see --partial).
3834
3835 Options:
3836
3837 -p,--strip <NUM>
3838 directory strip option for patch. This has the same meaning as
3839 the corresponding patch option (default: 1)
3840
3841 -b,--base <PATH>
3842 base path (DEPRECATED)
3843
3844 --secret
3845 use the secret phase for committing
3846
3847 -e, --edit
3848 invoke editor on commit messages
3849
3850 -f, --force
3851 skip check for outstanding uncommitted changes (DEPRECATED)
3852
3853 --no-commit
3854 don't commit, just update the working directory
3855
3856 --bypass
3857 apply patch without touching the working directory
3858
3859 --partial
3860 commit even if some hunks fail
3861
3862 --exact
3863 abort if patch would apply lossily
3864
3865 --prefix <DIR>
3866 apply patch to subdirectory
3867
3868 --import-branch
3869 use any branch information in patch (implied by --exact)
3870
3871 -m,--message <TEXT>
3872 use text as commit message
3873
3874 -l,--logfile <FILE>
3875 read commit message from file
3876
3877 -d,--date <DATE>
3878 record the specified date as commit date
3879
3880 -u,--user <USER>
3881 record the specified user as committer
3882
3883 -s,--similarity <SIMILARITY>
3884 guess renamed files by similarity (0<=s<=100)
3885
3886 aliases: patch
3887
3888 unbundle
3889 apply one or more bundle files:
3890
3891 hg unbundle [-u] FILE...
3892
3893 Apply one or more bundle files generated by hg bundle.
3894
3895 Returns 0 on success, 1 if an update has unresolved files.
3896
3897 Options:
3898
3899 -u, --update
3900 update to new branch head if changesets were unbundled
3901
3902 Repository maintenance
3903 manifest
3904 output the current or given revision of the project manifest:
3905
3906 hg manifest [-r REV]
3907
3908 Print a list of version controlled files for the given revision. If no
3909 revision is given, the first parent of the working directory is used,
3910 or the null revision if no revision is checked out.
3911
3912 With -v, print file permissions, symlink and executable bits. With
3913 --debug, print file revision hashes.
3914
3915 If option --all is specified, the list of all files from all revisions
3916 is printed. This includes deleted and renamed files.
3917
3918 Returns 0 on success.
3919
3920 Options:
3921
3922 -r,--rev <REV>
3923 revision to display
3924
3925 --all list files from all revisions
3926
3927 -T,--template <TEMPLATE>
3928 display with template
3929
3930 recover
3931 roll back an interrupted transaction:
3932
3933 hg recover
3934
3935 Recover from an interrupted commit or pull.
3936
3937 This command tries to fix the repository status after an interrupted
3938 operation. It should only be necessary when Mercurial suggests it.
3939
3940 Returns 0 if successful, 1 if nothing to recover or verify fails.
3941
3942 Options:
3943
3944 --verify
3945 run hg verify after successful recover
3946
3947 rollback
3948 roll back the last transaction (DANGEROUS) (DEPRECATED):
3949
3950 hg rollback
3951
3952 Please use hg commit --amend instead of rollback to correct mistakes in
3953 the last commit.
3954
3955 This command should be used with care. There is only one level of roll‐
3956 back, and there is no way to undo a rollback. It will also restore the
3957 dirstate at the time of the last transaction, losing any dirstate
3958 changes since that time. This command does not alter the working direc‐
3959 tory.
3960
3961 Transactions are used to encapsulate the effects of all commands that
3962 create new changesets or propagate existing changesets into a reposi‐
3963 tory.
3964
3965 For example, the following commands are transactional, and their ef‐
3966 fects can be rolled back:
3967
3968 • commit
3969
3970 • import
3971
3972 • pull
3973
3974 • push (with this repository as the destination)
3975
3976 • unbundle
3977
3978 To avoid permanent data loss, rollback will refuse to rollback a commit
3979 transaction if it isn't checked out. Use --force to override this pro‐
3980 tection.
3981
3982 The rollback command can be entirely disabled by setting the ui.roll‐
3983 back configuration setting to false. If you're here because you want to
3984 use rollback and it's disabled, you can re-enable the command by set‐
3985 ting ui.rollback to true.
3986
3987 This command is not intended for use on public repositories. Once
3988 changes are visible for pull by other users, rolling a transaction back
3989 locally is ineffective (someone else may already have pulled the
3990 changes). Furthermore, a race is possible with readers of the reposi‐
3991 tory; for example an in-progress pull from the repository may fail if a
3992 rollback is performed.
3993
3994 Returns 0 on success, 1 if no rollback data is available.
3995
3996 Options:
3997
3998 -n, --dry-run
3999 do not perform actions, just print output
4000
4001 -f, --force
4002 ignore safety measures
4003
4004 verify
4005 verify the integrity of the repository:
4006
4007 hg verify
4008
4009 Verify the integrity of the current repository.
4010
4011 This will perform an extensive check of the repository's integrity,
4012 validating the hashes and checksums of each entry in the changelog,
4013 manifest, and tracked files, as well as the integrity of their
4014 crosslinks and indices.
4015
4016 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
4017 information about recovery from corruption of the repository.
4018
4019 Returns 0 on success, 1 if errors are encountered.
4020
4021 Options:
4022
4023 --full perform more checks (EXPERIMENTAL)
4024
4025 Help
4026 config
4027 show combined config settings from all hgrc files:
4028
4029 hg config [-u] [NAME]...
4030
4031 With no arguments, print names and values of all config items.
4032
4033 With one argument of the form section.name, print just the value of
4034 that config item.
4035
4036 With multiple arguments, print names and values of all config items
4037 with matching section names or section.names.
4038
4039 With --edit, start an editor on the user-level config file. With
4040 --global, edit the system-wide config file. With --local, edit the
4041 repository-level config file.
4042
4043 With --source, the source (filename and line number) is printed for
4044 each config item.
4045
4046 See hg help config for more information about config files.
4047
4048 --non-shared flag is used to edit .hg/hgrc-not-shared config file.
4049 This file is not shared across shares when in share-safe mode.
4050
4051 Template:
4052
4053 The following keywords are supported. See also hg help templates.
4054
4055 name String. Config name.
4056
4057 source String. Filename and line number where the item is defined.
4058
4059 value String. Config value.
4060
4061 The --shared flag can be used to edit the config file of shared source
4062 repository. It only works when you have shared using the experimental
4063 share safe feature.
4064
4065 Returns 0 on success, 1 if NAME does not exist.
4066
4067 Options:
4068
4069 -u, --untrusted
4070 show untrusted configuration options
4071
4072 --exp-all-known
4073 show all known config option (EXPERIMENTAL)
4074
4075 -e, --edit
4076 edit user config
4077
4078 -l, --local
4079 edit repository config
4080
4081 --source
4082 show source of configuration value
4083
4084 --shared
4085 edit shared source repository config (EXPERIMENTAL)
4086
4087 --non-shared
4088 edit non shared config (EXPERIMENTAL)
4089
4090 -g, --global
4091 edit global config
4092
4093 -T,--template <TEMPLATE>
4094 display with template
4095
4096 aliases: showconfig debugconfig
4097
4098 help
4099 show help for a given topic or a help overview:
4100
4101 hg help [-eck] [-s PLATFORM] [TOPIC]
4102
4103 With no arguments, print a list of commands with short help messages.
4104
4105 Given a topic, extension, or command name, print help for that topic.
4106
4107 Returns 0 if successful.
4108
4109 Options:
4110
4111 -e, --extension
4112 show only help for extensions
4113
4114 -c, --command
4115 show only help for commands
4116
4117 -k, --keyword
4118 show topics matching keyword
4119
4120 -s,--system <PLATFORM[+]>
4121 show help for specific platform(s)
4122
4123 [+] marked option can be specified multiple times
4124
4125 version
4126 output version and copyright information:
4127
4128 hg version
4129
4130 Template:
4131
4132 The following keywords are supported. See also hg help templates.
4133
4134 extensions
4135 List of extensions.
4136
4137 ver String. Version number.
4138
4139 And each entry of {extensions} provides the following sub-keywords in
4140 addition to {ver}.
4141
4142 bundled
4143 Boolean. True if included in the release.
4144
4145 name String. Extension name.
4146
4147 Options:
4148
4149 -T,--template <TEMPLATE>
4150 display with template
4151
4152 Uncategorized commands
4154 Mercurial supports generating standalone "bundle" files that hold
4155 repository data. These "bundles" are typically saved locally and used
4156 later or exchanged between different repositories, possibly on differ‐
4157 ent machines. Example commands using bundles are hg bundle and hg un‐
4158 bundle.
4159
4160 Generation of bundle files is controlled by a "bundle specification"
4161 ("bundlespec") string. This string tells the bundle generation process
4162 how to create the bundle.
4163
4164 A "bundlespec" string is composed of the following elements:
4165
4166 type A string denoting the bundle format to use.
4167
4168 compression
4169 Denotes the compression engine to use compressing the raw bundle
4170 data.
4171
4172 parameters
4173 Arbitrary key-value parameters to further control bundle genera‐
4174 tion.
4175
4176 A "bundlespec" string has the following formats:
4177
4178 <type> The literal bundle format string is used.
4179
4180 <compression>-<type>
4181 The compression engine and format are delimited by a hyphen (-).
4182
4183 Optional parameters follow the <type>. Parameters are URI escaped
4184 key=value pairs. Each pair is delimited by a semicolon (;). The first
4185 parameter begins after a ; immediately following the <type> value.
4186
4187 Available Types
4188 The following bundle <type> strings are available:
4189
4190 v1 Produces a legacy "changegroup" version 1 bundle.
4191
4192 This format is compatible with nearly all Mercurial clients be‐
4193 cause it is the oldest. However, it has some limitations, which
4194 is why it is no longer the default for new repositories.
4195
4196 v1 bundles can be used with modern repositories using the "gen‐
4197 eraldelta" storage format. However, it may take longer to pro‐
4198 duce the bundle and the resulting bundle may be significantly
4199 larger than a v2 bundle.
4200
4201 v1 bundles can only use the gzip, bzip2, and none compression
4202 formats.
4203
4204 v2 Produces a version 2 bundle.
4205
4206 Version 2 bundles are an extensible format that can store addi‐
4207 tional repository data (such as bookmarks and phases informa‐
4208 tion) and they can store data more efficiently, resulting in
4209 smaller bundles.
4210
4211 Version 2 bundles can also use modern compression engines, such
4212 as zstd, making them faster to compress and often smaller.
4213
4214 Available Compression Engines
4215 The following bundle <compression> engines can be used:
4216
4217 bzip2
4218
4219 An algorithm that produces smaller bundles than gzip.
4220
4221 All Mercurial clients should support this format.
4222
4223 This engine will likely produce smaller bundles than gzip but
4224 will be significantly slower, both during compression and decom‐
4225 pression.
4226
4227 If available, the zstd engine can yield similar or better com‐
4228 pression at much higher speeds.
4229
4230 gzip
4231
4232 zlib compression using the DEFLATE algorithm.
4233
4234 All Mercurial clients should support this format. The compres‐
4235 sion algorithm strikes a reasonable balance between compression
4236 ratio and size.
4237
4238 none
4239
4240 No compression is performed.
4241
4242 Use this compression engine to explicitly disable compression.
4243
4244 Examples
4245 v2
4246
4247 Produce a v2 bundle using default options, including compres‐
4248 sion.
4249
4250 none-v1
4251
4252 Produce a v1 bundle with no compression.
4253
4254 zstd-v2
4255
4256 Produce a v2 bundle with zstandard compression using default
4257 settings.
4258
4259 zstd-v1
4260
4261 This errors because zstd is not supported for v1 types.
4262
4264 Mercurial colorizes output from several commands.
4265
4266 For example, the diff command shows additions in green and deletions in
4267 red, while the status command shows modified files in magenta. Many
4268 other commands have analogous colors. It is possible to customize these
4269 colors.
4270
4271 To enable color (default) whenever possible use:
4272
4273 [ui]
4274 color = yes
4275
4276 To disable color use:
4277
4278 [ui]
4279 color = no
4280
4281 See hg help config.ui.color for details.
4282
4283 The default pager on Windows does not support color, so enabling the
4284 pager will effectively disable color. See hg help config.ui.paginate
4285 to disable the pager. Alternately, MSYS and Cygwin shells provide less
4286 as a pager, which can be configured to support ANSI color mode. Win‐
4287 dows 10 natively supports ANSI color mode.
4288
4289 Mode
4290 Mercurial can use various systems to display color. The supported modes
4291 are ansi, win32, and terminfo. See hg help config.color for details
4292 about how to control the mode.
4293
4294 Effects
4295 Other effects in addition to color, like bold and underlined text, are
4296 also available. By default, the terminfo database is used to find the
4297 terminal codes used to change color and effect. If terminfo is not
4298 available, then effects are rendered with the ECMA-48 SGR control func‐
4299 tion (aka ANSI escape codes).
4300
4301 The available effects in terminfo mode are 'blink', 'bold', 'dim', 'in‐
4302 verse', 'invisible', 'italic', 'standout', and 'underline'; in ECMA-48
4303 mode, the options are 'bold', 'inverse', 'italic', and 'underline'.
4304 How each is rendered depends on the terminal emulator. Some may not be
4305 available for a given terminal type, and will be silently ignored.
4306
4307 If the terminfo entry for your terminal is missing codes for an effect
4308 or has the wrong codes, you can add or override those codes in your
4309 configuration:
4310
4311 [color]
4312 terminfo.dim = \E[2m
4313
4314 where 'E' is substituted with an escape character.
4315
4316 Labels
4317 Text receives color effects depending on the labels that it has. Many
4318 default Mercurial commands emit labelled text. You can also define your
4319 own labels in templates using the label function, see hg help templates
4320 . A single portion of text may have more than one label. In that case,
4321 effects given to the last label will override any other effects. This
4322 includes the special "none" effect, which nullifies other effects.
4323
4324 Labels are normally invisible. In order to see these labels and their
4325 position in the text, use the global --color=debug option. The same an‐
4326 chor text may be associated to multiple labels, e.g.
4327
4328 [log.changeset changeset.secret|changeset: 22611:6f0a53c8f587]
4329
4330 The following are the default effects for some default labels. Default
4331 effects may be overridden from your configuration file:
4332
4333 [color]
4334 status.modified = blue bold underline red_background
4335 status.added = green bold
4336 status.removed = red bold blue_background
4337 status.deleted = cyan bold underline
4338 status.unknown = magenta bold underline
4339 status.ignored = black bold
4340
4341 # 'none' turns off all effects
4342 status.clean = none
4343 status.copied = none
4344
4345 qseries.applied = blue bold underline
4346 qseries.unapplied = black bold
4347 qseries.missing = red bold
4348
4349 diff.diffline = bold
4350 diff.extended = cyan bold
4351 diff.file_a = red bold
4352 diff.file_b = green bold
4353 diff.hunk = magenta
4354 diff.deleted = red
4355 diff.inserted = green
4356 diff.changed = white
4357 diff.tab =
4358 diff.trailingwhitespace = bold red_background
4359
4360 # Blank so it inherits the style of the surrounding label
4361 changeset.public =
4362 changeset.draft =
4363 changeset.secret =
4364
4365 resolve.unresolved = red bold
4366 resolve.resolved = green bold
4367
4368 bookmarks.active = green
4369
4370 branches.active = none
4371 branches.closed = black bold
4372 branches.current = green
4373 branches.inactive = none
4374
4375 tags.normal = green
4376 tags.local = black bold
4377
4378 rebase.rebased = blue
4379 rebase.remaining = red bold
4380
4381 shelve.age = cyan
4382 shelve.newest = green bold
4383 shelve.name = blue bold
4384
4385 histedit.remaining = red bold
4386
4387 Custom colors
4388 Because there are only eight standard colors, Mercurial allows you to
4389 define color names for other color slots which might be available for
4390 your terminal type, assuming terminfo mode. For instance:
4391
4392 color.brightblue = 12
4393 color.pink = 207
4394 color.orange = 202
4395
4396 to set 'brightblue' to color slot 12 (useful for 16 color terminals
4397 that have brighter colors defined in the upper eight) and, 'pink' and
4398 'orange' to colors in 256-color xterm's default color cube. These de‐
4399 fined colors may then be used as any of the pre-defined eight, includ‐
4400 ing appending '_background' to set the background to that color.
4401
4403 Some commands allow the user to specify a date, e.g.:
4404
4405 • backout, commit, import, tag: Specify the commit date.
4406
4407 • log, revert, update: Select revision(s) by date.
4408
4409 Many date formats are valid. Here are some examples:
4410
4411 • Wed Dec 6 13:18:29 2006 (local timezone assumed)
4412
4413 • Dec 6 13:18 -0600 (year assumed, time offset provided)
4414
4415 • Dec 6 13:18 UTC (UTC and GMT are aliases for +0000)
4416
4417 • Dec 6 (midnight)
4418
4419 • 13:18 (today assumed)
4420
4421 • 3:39 (3:39AM assumed)
4422
4423 • 3:39pm (15:39)
4424
4425 • 2006-12-06 13:18:29 (ISO 8601 format)
4426
4427 • 2006-12-6 13:18
4428
4429 • 2006-12-6
4430
4431 • 12-6
4432
4433 • 12/6
4434
4435 • 12/6/6 (Dec 6 2006)
4436
4437 • today (midnight)
4438
4439 • yesterday (midnight)
4440
4441 • now - right now
4442
4443 Lastly, there is Mercurial's internal format:
4444
4445 • 1165411109 0 (Wed Dec 6 13:18:29 2006 UTC)
4446
4447 This is the internal representation format for dates. The first number
4448 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
4449 second is the offset of the local timezone, in seconds west of UTC
4450 (negative if the timezone is east of UTC).
4451
4452 The log command also accepts date ranges:
4453
4454 • <DATE - at or before a given date/time
4455
4456 • >DATE - on or after a given date/time
4457
4458 • DATE to DATE - a date range, inclusive
4459
4460 • -DAYS - within a given number of days from today
4461
4463 Mercurial evolves over time, some features, options, commands may be
4464 replaced by better and more secure alternatives. This topic will help
4465 you migrating your existing usage and/or configuration to newer fea‐
4466 tures.
4467
4468 Commands
4469 The following commands are still available but their use are not recom‐
4470 mended:
4471
4472 locate
4473
4474 This command has been replaced by hg files.
4475
4476 parents
4477
4478 This command can be replaced by hg summary or hg log with appropriate
4479 revsets. See hg help revsets for more information.
4480
4481 tip
4482
4483 The recommended alternative is hg heads.
4484
4485 Options
4486 web.allowpull
4487
4488 Renamed to allow-pull.
4489
4490 web.allow_push
4491
4492 Renamed to allow-push.
4493
4495 Mercurial's default format for showing changes between two versions of
4496 a file is compatible with the unified format of GNU diff, which can be
4497 used by GNU patch and many other standard tools.
4498
4499 While this standard format is often enough, it does not encode the fol‐
4500 lowing information:
4501
4502 • executable status and other permission bits
4503
4504 • copy or rename information
4505
4506 • changes in binary files
4507
4508 • creation or deletion of empty files
4509
4510 Mercurial also supports the extended diff format from the git VCS which
4511 addresses these limitations. The git diff format is not produced by de‐
4512 fault because a few widespread tools still do not understand this for‐
4513 mat.
4514
4515 This means that when generating diffs from a Mercurial repository (e.g.
4516 with hg export), you should be careful about things like file copies
4517 and renames or other things mentioned above, because when applying a
4518 standard diff to a different repository, this extra information is
4519 lost. Mercurial's internal operations (like push and pull) are not af‐
4520 fected by this, because they use an internal binary format for communi‐
4521 cating changes.
4522
4523 To make Mercurial produce the git extended diff format, use the --git
4524 option available for many commands, or set 'git = True' in the [diff]
4525 section of your configuration file. You do not need to set this option
4526 when importing diffs in this format or using them in the mq extension.
4527
4529 HG Path to the 'hg' executable, automatically passed when running
4530 hooks, extensions or external tools. If unset or empty, this is
4531 the hg executable's name if it's frozen, or an executable named
4532 'hg' (with %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions
4533 on Windows) is searched.
4534
4535 HGEDITOR
4536 This is the name of the editor to run when committing. See EDI‐
4537 TOR.
4538
4539 (deprecated, see hg help config.ui.editor)
4540
4541 HGENCODING
4542 This overrides the default locale setting detected by Mercurial.
4543 This setting is used to convert data including usernames,
4544 changeset descriptions, tag names, and branches. This setting
4545 can be overridden with the --encoding command-line option.
4546
4547 HGENCODINGMODE
4548 This sets Mercurial's behavior for handling unknown characters
4549 while transcoding user input. The default is "strict", which
4550 causes Mercurial to abort if it can't map a character. Other
4551 settings include "replace", which replaces unknown characters,
4552 and "ignore", which drops them. This setting can be overridden
4553 with the --encodingmode command-line option.
4554
4555 HGENCODINGAMBIGUOUS
4556 This sets Mercurial's behavior for handling characters with "am‐
4557 biguous" widths like accented Latin characters with East Asian
4558 fonts. By default, Mercurial assumes ambiguous characters are
4559 narrow, set this variable to "wide" if such characters cause
4560 formatting problems.
4561
4562 HGMERGE
4563 An executable to use for resolving merge conflicts. The program
4564 will be executed with three arguments: local file, remote file,
4565 ancestor file.
4566
4567 (deprecated, see hg help config.ui.merge)
4568
4569 HGRCPATH
4570 A list of files or directories to search for configuration
4571 files. Item separator is ":" on Unix, ";" on Windows. If HGRC‐
4572 PATH is not set, platform default search path is used. If empty,
4573 only the .hg/hgrc from the current repository is read.
4574
4575 For each element in HGRCPATH:
4576
4577 • if it's a directory, all files ending with .rc are added
4578
4579 • otherwise, the file itself will be added
4580
4581 HGRCSKIPREPO
4582 When set, the .hg/hgrc from repositories are not read.
4583
4584 HGPLAIN
4585 When set, this disables any configuration settings that might
4586 change Mercurial's default output. This includes encoding, de‐
4587 faults, verbose mode, debug mode, quiet mode, tracebacks, and
4588 localization. This can be useful when scripting against Mercu‐
4589 rial in the face of existing user configuration.
4590
4591 In addition to the features disabled by HGPLAIN=, the following
4592 values can be specified to adjust behavior:
4593
4594 +strictflags
4595
4596 Restrict parsing of command line flags.
4597
4598 Equivalent options set via command line flags or environment
4599 variables are not overridden.
4600
4601 See hg help scripting for details.
4602
4603 HGPLAINEXCEPT
4604 This is a comma-separated list of features to preserve when HG‐
4605 PLAIN is enabled. Currently the following values are supported:
4606
4607 alias
4608
4609 Don't remove aliases.
4610
4611 color
4612
4613 Don't disable colored output.
4614
4615 i18n
4616
4617 Preserve internationalization.
4618
4619 revsetalias
4620
4621 Don't remove revset aliases.
4622
4623 templatealias
4624
4625 Don't remove template aliases.
4626
4627 progress
4628
4629 Don't hide progress output.
4630
4631 Setting HGPLAINEXCEPT to anything (even an empty string) will
4632 enable plain mode.
4633
4634 HGUSER This is the string used as the author of a commit. If not set,
4635 available values will be considered in this order:
4636
4637 • HGUSER (deprecated)
4638
4639 • configuration files from the HGRCPATH
4640
4641 • EMAIL
4642
4643 • interactive prompt
4644
4645 • LOGNAME (with @hostname appended)
4646
4647 (deprecated, see hg help config.ui.username)
4648
4649 EMAIL May be used as the author of a commit; see HGUSER.
4650
4651 LOGNAME
4652 May be used as the author of a commit; see HGUSER.
4653
4654 VISUAL This is the name of the editor to use when committing. See EDI‐
4655 TOR.
4656
4657 EDITOR Sometimes Mercurial needs to open a text file in an editor for a
4658 user to modify, for example when writing commit messages. The
4659 editor it uses is determined by looking at the environment vari‐
4660 ables HGEDITOR, VISUAL and EDITOR, in that order. The first
4661 non-empty one is chosen. If all of them are empty, the editor
4662 defaults to 'vi'.
4663
4664 PYTHONPATH
4665 This is used by Python to find imported modules and may need to
4666 be set appropriately if this Mercurial is not installed sys‐
4667 tem-wide.
4668
4670 Obsolescence markers make it possible to mark changesets that have been
4671 deleted or superseded in a new version of the changeset.
4672
4673 Unlike the previous way of handling such changes, by stripping the old
4674 changesets from the repository, obsolescence markers can be propagated
4675 between repositories. This allows for a safe and simple way of exchang‐
4676 ing mutable history and altering it after the fact. Changeset phases
4677 are respected, such that only draft and secret changesets can be al‐
4678 tered (see hg help phases for details).
4679
4680 Obsolescence is tracked using "obsolescence markers", a piece of meta‐
4681 data tracking which changesets have been made obsolete, potential suc‐
4682 cessors for a given changeset, the moment the changeset was marked as
4683 obsolete, and the user who performed the rewriting operation. The mark‐
4684 ers are stored separately from standard changeset data can be exchanged
4685 without any of the precursor changesets, preventing unnecessary ex‐
4686 change of obsolescence data.
4687
4688 The complete set of obsolescence markers describes a history of change‐
4689 set modifications that is orthogonal to the repository history of file
4690 modifications. This changeset history allows for detection and auto‐
4691 matic resolution of edge cases arising from multiple users rewriting
4692 the same part of history concurrently.
4693
4694 Current feature status
4695 This feature is still in development.
4696
4697 Instability
4698 Rewriting changesets might introduce instability.
4699
4700 There are two main kinds of instability: orphaning and diverging.
4701
4702 Orphans are changesets left behind when their ancestors are rewritten.
4703 Divergence has two variants:
4704
4705 • Content-divergence occurs when independent rewrites of the same
4706 changesets lead to different results.
4707
4708 • Phase-divergence occurs when the old (obsolete) version of a change‐
4709 set becomes public.
4710
4711 It is possible to prevent local creation of orphans by using the fol‐
4712 lowing config:
4713
4714 [experimental]
4715 evolution.createmarkers = true
4716 evolution.exchange = true
4717
4718 You can also enable that option explicitly:
4719
4720 [experimental]
4721 evolution.createmarkers = true
4722 evolution.exchange = true
4723 evolution.allowunstable = true
4724
4726 Mercurial has the ability to add new features through the use of exten‐
4727 sions. Extensions may add new commands, add options to existing com‐
4728 mands, change the default behavior of commands, or implement hooks.
4729
4730 To enable the "foo" extension, either shipped with Mercurial or in the
4731 Python search path, create an entry for it in your configuration file,
4732 like this:
4733
4734 [extensions]
4735 foo =
4736
4737 You may also specify the full path to an extension:
4738
4739 [extensions]
4740 myfeature = ~/.hgext/myfeature.py
4741
4742 See hg help config for more information on configuration files.
4743
4744 Extensions are not loaded by default for a variety of reasons: they can
4745 increase startup overhead; they may be meant for advanced usage only;
4746 they may provide potentially dangerous abilities (such as letting you
4747 destroy or modify history); they might not be ready for prime time; or
4748 they may alter some usual behaviors of stock Mercurial. It is thus up
4749 to the user to activate extensions as needed.
4750
4751 To explicitly disable an extension enabled in a configuration file of
4752 broader scope, prepend its path with !:
4753
4754 [extensions]
4755 # disabling extension bar residing in /path/to/extension/bar.py
4756 bar = !/path/to/extension/bar.py
4757 # ditto, but no path was supplied for extension baz
4758 baz = !
4759
4760 disabled extensions:
4761
4762 acl hooks for controlling repository access
4763
4764 blackbox
4765 log repository events to a blackbox for debugging
4766
4767 bugzilla
4768 hooks for integrating with the Bugzilla bug tracker
4769
4770 censor erase file content at a given revision
4771
4772 churn command to display statistics about repository history
4773
4774 clonebundles
4775 advertise pre-generated bundles to seed clones
4776
4777 closehead
4778 close arbitrary heads without checking them out first
4779
4780 convert
4781 import revisions from foreign VCS repositories into Mercurial
4782
4783 eol automatically manage newlines in repository files
4784
4785 extdiff
4786 command to allow external programs to compare revisions
4787
4788 factotum
4789 http authentication with factotum
4790
4791 fastexport
4792 export repositories as git fast-import stream
4793
4794 githelp
4795 try mapping git commands to Mercurial commands
4796
4797 gpg commands to sign and verify changesets
4798
4799 hgk browse the repository in a graphical way
4800
4801 highlight
4802 syntax highlighting for hgweb (requires Pygments)
4803
4804 histedit
4805 interactive history editing
4806
4807 keyword
4808 expand keywords in tracked files
4809
4810 largefiles
4811 track large binary files
4812
4813 mq manage a stack of patches
4814
4815 notify hooks for sending email push notifications
4816
4817 patchbomb
4818 command to send changesets as (a series of) patch emails
4819
4820 rebase command to move sets of revisions to a different ancestor
4821
4822 relink recreates hardlinks between repository clones
4823
4824 schemes
4825 extend schemes with shortcuts to repository swarms
4826
4827 share share a common history between several working directories
4828
4829 transplant
4830 command to transplant changesets from another branch
4831
4832 win32mbcs
4833 allow the use of MBCS paths with problematic encodings
4834
4835 zeroconf
4836 discover and advertise repositories on the local network
4837
4839 Mercurial supports a functional language for selecting a set of files.
4840
4841 Like other file patterns, this pattern type is indicated by a prefix,
4842 'set:'. The language supports a number of predicates which are joined
4843 by infix operators. Parenthesis can be used for grouping.
4844
4845 Identifiers such as filenames or patterns must be quoted with single or
4846 double quotes if they contain characters outside of
4847 [.*{}[]?/\_a-zA-Z0-9\x80-\xff] or if they match one of the predefined
4848 predicates. This generally applies to file patterns other than globs
4849 and arguments for predicates. Pattern prefixes such as path: may be
4850 specified without quoting.
4851
4852 Special characters can be used in quoted identifiers by escaping them,
4853 e.g., \n is interpreted as a newline. To prevent them from being inter‐
4854 preted, strings can be prefixed with r, e.g. r'...'.
4855
4856 See also hg help patterns.
4857
4858 Operators
4859 There is a single prefix operator:
4860
4861 not x
4862
4863 Files not in x. Short form is ! x.
4864
4865 These are the supported infix operators:
4866
4867 x and y
4868
4869 The intersection of files in x and y. Short form is x & y.
4870
4871 x or y
4872
4873 The union of files in x and y. There are two alternative short
4874 forms: x | y and x + y.
4875
4876 x - y
4877
4878 Files in x but not in y.
4879
4880 Predicates
4881 The following predicates are supported:
4882
4883 added()
4884
4885 File that is added according to hg status.
4886
4887 binary()
4888
4889 File that appears to be binary (contains NUL bytes).
4890
4891 clean()
4892
4893 File that is clean according to hg status.
4894
4895 copied()
4896
4897 File that is recorded as being copied.
4898
4899 deleted()
4900
4901 Alias for missing().
4902
4903 encoding(name)
4904
4905 File can be successfully decoded with the given character encod‐
4906 ing. May not be useful for encodings other than ASCII and UTF-8.
4907
4908 eol(style)
4909
4910 File contains newlines of the given style (dos, unix, mac). Bi‐
4911 nary files are excluded, files with mixed line endings match
4912 multiple styles.
4913
4914 exec()
4915
4916 File that is marked as executable.
4917
4918 grep(regex)
4919
4920 File contains the given regular expression.
4921
4922 hgignore()
4923
4924 File that matches the active .hgignore pattern.
4925
4926 ignored()
4927
4928 File that is ignored according to hg status.
4929
4930 missing()
4931
4932 File that is missing according to hg status.
4933
4934 modified()
4935
4936 File that is modified according to hg status.
4937
4938 portable()
4939
4940 File that has a portable name. (This doesn't include filenames
4941 with case collisions.)
4942
4943 removed()
4944
4945 File that is removed according to hg status.
4946
4947 resolved()
4948
4949 File that is marked resolved according to hg resolve -l.
4950
4951 revs(revs, pattern)
4952
4953 Evaluate set in the specified revisions. If the revset match
4954 multiple revs, this will return file matching pattern in any of
4955 the revision.
4956
4957 size(expression)
4958
4959 File size matches the given expression. Examples:
4960
4961 • size('1k') - files from 1024 to 2047 bytes
4962
4963 • size('< 20k') - files less than 20480 bytes
4964
4965 • size('>= .5MB') - files at least 524288 bytes
4966
4967 • size('4k - 1MB') - files from 4096 bytes to 1048576 bytes
4968
4969 status(base, rev, pattern)
4970
4971 Evaluate predicate using status change between base and rev. Ex‐
4972 amples:
4973
4974 • status(3, 7, added()) - matches files added from "3" to "7"
4975
4976 subrepo([pattern])
4977
4978 Subrepositories whose paths match the given pattern.
4979
4980 symlink()
4981
4982 File that is marked as a symlink.
4983
4984 tracked()
4985
4986 File that is under Mercurial control.
4987
4988 unknown()
4989
4990 File that is unknown according to hg status.
4991
4992 unresolved()
4993
4994 File that is marked unresolved according to hg resolve -l.
4995
4996 Examples
4997 Some sample queries:
4998
4999 • Show status of files that appear to be binary in the working direc‐
5000 tory:
5001
5002 hg status -A "set:binary()"
5003
5004 • Forget files that are in .hgignore but are already tracked:
5005
5006 hg forget "set:hgignore() and not ignored()"
5007
5008 • Find text files that contain a string:
5009
5010 hg files "set:grep(magic) and not binary()"
5011
5012 • Find C files in a non-standard encoding:
5013
5014 hg files "set:**.c and not encoding('UTF-8')"
5015
5016 • Revert copies of large binary files:
5017
5018 hg revert "set:copied() and binary() and size('>1M')"
5019
5020 • Revert files that were added to the working directory:
5021
5022 hg revert "set:revs('wdir()', added())"
5023
5024 • Remove files listed in foo.lst that contain the letter a or b:
5025
5026 hg remove "set: listfile:foo.lst and (**a* or **b*)"
5027
5029 Most Mercurial commands accept various flags.
5030
5031 Flag names
5032 Flags for each command are listed in hg help for that command. Addi‐
5033 tionally, some flags, such as --repository, are global and can be used
5034 with any command - those are seen in hg help -v, and can be specified
5035 before or after the command.
5036
5037 Every flag has at least a long name, such as --repository. Some flags
5038 may also have a short one-letter name, such as the equivalent -R. Using
5039 the short or long name is equivalent and has the same effect. The long
5040 name may be abbreviated to any unambiguous prefix. For example, hg com‐
5041 mit --amend can be abbreviated to hg commit --am.
5042
5043 Flags that have a short name can also be bundled together - for in‐
5044 stance, to specify both --edit (short -e) and --interactive (short -i),
5045 one could use:
5046
5047 hg commit -ei
5048
5049 If any of the bundled flags takes a value (i.e. is not a boolean), it
5050 must be last, followed by the value:
5051
5052 hg commit -im 'Message'
5053
5054 Flag types
5055 Mercurial command-line flags can be strings, numbers, booleans, or
5056 lists of strings.
5057
5058 Specifying flag values
5059 The following syntaxes are allowed, assuming a flag 'flagname' with
5060 short name 'f':
5061
5062 --flagname=foo
5063 --flagname foo
5064 -f foo
5065 -ffoo
5066
5067 This syntax applies to all non-boolean flags (strings, numbers or
5068 lists).
5069
5070 Specifying boolean flags
5071 Boolean flags do not take a value parameter. To specify a boolean, use
5072 the flag name to set it to true, or the same name prefixed with 'no-'
5073 to set it to false:
5074
5075 hg commit --interactive
5076 hg commit --no-interactive
5077
5078 Specifying list flags
5079 List flags take multiple values. To specify them, pass the flag multi‐
5080 ple times:
5081
5082 hg files --include mercurial --include tests
5083
5084 Setting flag defaults
5085 In order to set a default value for a flag in an hgrc file, it is rec‐
5086 ommended to use aliases:
5087
5088 [alias]
5089 commit = commit --interactive
5090
5091 For more information on hgrc files, see hg help config.
5092
5093 Overriding flags on the command line
5094 If the same non-list flag is specified multiple times on the command
5095 line, the latest specification is used:
5096
5097 hg commit -m "Ignored value" -m "Used value"
5098
5099 This includes the use of aliases - e.g., if one has:
5100
5101 [alias]
5102 committemp = commit -m "Ignored value"
5103
5104 then the following command will override that -m:
5105
5106 hg committemp -m "Used value"
5107
5108 Overriding flag defaults
5109 Every flag has a default value, and you may also set your own defaults
5110 in hgrc as described above. Except for list flags, defaults can be
5111 overridden on the command line simply by specifying the flag in that
5112 location.
5113
5114 Hidden flags
5115 Some flags are not shown in a command's help by default - specifically,
5116 those that are deemed to be experimental, deprecated or advanced. To
5117 show all flags, add the --verbose flag for the help command:
5118
5119 hg help --verbose commit
5120
5122 Ancestor
5123 Any changeset that can be reached by an unbroken chain of parent
5124 changesets from a given changeset. More precisely, the ancestors
5125 of a changeset can be defined by two properties: a parent of a
5126 changeset is an ancestor, and a parent of an ancestor is an an‐
5127 cestor. See also: 'Descendant'.
5128
5129 Bookmark
5130 Bookmarks are pointers to certain commits that move when commit‐
5131 ting. They are similar to tags in that it is possible to use
5132 bookmark names in all places where Mercurial expects a changeset
5133 ID, e.g., with hg update. Unlike tags, bookmarks move along when
5134 you make a commit.
5135
5136 Bookmarks can be renamed, copied and deleted. Bookmarks are lo‐
5137 cal, unless they are explicitly pushed or pulled between reposi‐
5138 tories. Pushing and pulling bookmarks allow you to collaborate
5139 with others on a branch without creating a named branch.
5140
5141 Branch (Noun) A child changeset that has been created from a parent
5142 that is not a head. These are known as topological branches, see
5143 'Branch, topological'. If a topological branch is named, it be‐
5144 comes a named branch. If a topological branch is not named, it
5145 becomes an anonymous branch. See 'Branch, anonymous' and
5146 'Branch, named'.
5147
5148 Branches may be created when changes are pulled from or pushed
5149 to a remote repository, since new heads may be created by these
5150 operations. Note that the term branch can also be used infor‐
5151 mally to describe a development process in which certain devel‐
5152 opment is done independently of other development. This is some‐
5153 times done explicitly with a named branch, but it can also be
5154 done locally, using bookmarks or clones and anonymous branches.
5155
5156 Example: "The experimental branch."
5157
5158 (Verb) The action of creating a child changeset which results in
5159 its parent having more than one child.
5160
5161 Example: "I'm going to branch at X."
5162
5163 Branch, anonymous
5164 Every time a new child changeset is created from a parent that
5165 is not a head and the name of the branch is not changed, a new
5166 anonymous branch is created.
5167
5168 Branch, closed
5169 A named branch whose branch heads have all been closed.
5170
5171 Branch, default
5172 The branch assigned to a changeset when no name has previously
5173 been assigned.
5174
5175 Branch head
5176 See 'Head, branch'.
5177
5178 Branch, inactive
5179 If a named branch has no topological heads, it is considered to
5180 be inactive. As an example, a feature branch becomes inactive
5181 when it is merged into the default branch. The hg branches com‐
5182 mand shows inactive branches by default, though they can be hid‐
5183 den with hg branches --active.
5184
5185 NOTE: this concept is deprecated because it is too implicit.
5186 Branches should now be explicitly closed using hg commit
5187 --close-branch when they are no longer needed.
5188
5189 Branch, named
5190 A collection of changesets which have the same branch name. By
5191 default, children of a changeset in a named branch belong to the
5192 same named branch. A child can be explicitly assigned to a dif‐
5193 ferent branch. See hg help branch, hg help branches and hg com‐
5194 mit --close-branch for more information on managing branches.
5195
5196 Named branches can be thought of as a kind of namespace, divid‐
5197 ing the collection of changesets that comprise the repository
5198 into a collection of disjoint subsets. A named branch is not
5199 necessarily a topological branch. If a new named branch is cre‐
5200 ated from the head of another named branch, or the default
5201 branch, but no further changesets are added to that previous
5202 branch, then that previous branch will be a branch in name only.
5203
5204 Branch tip
5205 See 'Tip, branch'.
5206
5207 Branch, topological
5208 Every time a new child changeset is created from a parent that
5209 is not a head, a new topological branch is created. If a topo‐
5210 logical branch is named, it becomes a named branch. If a topo‐
5211 logical branch is not named, it becomes an anonymous branch of
5212 the current, possibly default, branch.
5213
5214 Changelog
5215 A record of the changesets in the order in which they were added
5216 to the repository. This includes details such as changeset id,
5217 author, commit message, date, and list of changed files.
5218
5219 Changeset
5220 A snapshot of the state of the repository used to record a
5221 change.
5222
5223 Changeset, child
5224 The converse of parent changeset: if P is a parent of C, then C
5225 is a child of P. There is no limit to the number of children
5226 that a changeset may have.
5227
5228 Changeset id
5229 A SHA-1 hash that uniquely identifies a changeset. It may be
5230 represented as either a "long" 40 hexadecimal digit string, or a
5231 "short" 12 hexadecimal digit string.
5232
5233 Changeset, merge
5234 A changeset with two parents. This occurs when a merge is com‐
5235 mitted.
5236
5237 Changeset, parent
5238 A revision upon which a child changeset is based. Specifically,
5239 a parent changeset of a changeset C is a changeset whose node
5240 immediately precedes C in the DAG. Changesets have at most two
5241 parents.
5242
5243 Checkout
5244 (Noun) The working directory being updated to a specific revi‐
5245 sion. This use should probably be avoided where possible, as
5246 changeset is much more appropriate than checkout in this con‐
5247 text.
5248
5249 Example: "I'm using checkout X."
5250
5251 (Verb) Updating the working directory to a specific changeset.
5252 See hg help update.
5253
5254 Example: "I'm going to check out changeset X."
5255
5256 Child changeset
5257 See 'Changeset, child'.
5258
5259 Close changeset
5260 See 'Head, closed branch'.
5261
5262 Closed branch
5263 See 'Branch, closed'.
5264
5265 Clone (Noun) An entire or partial copy of a repository. The partial
5266 clone must be in the form of a revision and its ancestors.
5267
5268 Example: "Is your clone up to date?"
5269
5270 (Verb) The process of creating a clone, using hg clone.
5271
5272 Example: "I'm going to clone the repository."
5273
5274 Closed branch head
5275 See 'Head, closed branch'.
5276
5277 Commit (Noun) A synonym for changeset.
5278
5279 Example: "Is the bug fixed in your recent commit?"
5280
5281 (Verb) The act of recording changes to a repository. When files
5282 are committed in a working directory, Mercurial finds the dif‐
5283 ferences between the committed files and their parent changeset,
5284 creating a new changeset in the repository.
5285
5286 Example: "You should commit those changes now."
5287
5288 Cset A common abbreviation of the term changeset.
5289
5290 DAG The repository of changesets of a distributed version control
5291 system (DVCS) can be described as a directed acyclic graph
5292 (DAG), consisting of nodes and edges, where nodes correspond to
5293 changesets and edges imply a parent -> child relation. This
5294 graph can be visualized by graphical tools such as hg log
5295 --graph. In Mercurial, the DAG is limited by the requirement for
5296 children to have at most two parents.
5297
5298 Deprecated
5299 Feature removed from documentation, but not scheduled for re‐
5300 moval.
5301
5302 Default branch
5303 See 'Branch, default'.
5304
5305 Descendant
5306 Any changeset that can be reached by a chain of child changesets
5307 from a given changeset. More precisely, the descendants of a
5308 changeset can be defined by two properties: the child of a
5309 changeset is a descendant, and the child of a descendant is a
5310 descendant. See also: 'Ancestor'.
5311
5312 Diff (Noun) The difference between the contents and attributes of
5313 files in two changesets or a changeset and the current working
5314 directory. The difference is usually represented in a standard
5315 form called a "diff" or "patch". The "git diff" format is used
5316 when the changes include copies, renames, or changes to file at‐
5317 tributes, none of which can be represented/handled by classic
5318 "diff" and "patch".
5319
5320 Example: "Did you see my correction in the diff?"
5321
5322 (Verb) Diffing two changesets is the action of creating a diff
5323 or patch.
5324
5325 Example: "If you diff with changeset X, you will see what I
5326 mean."
5327
5328 Directory, working
5329 The working directory represents the state of the files tracked
5330 by Mercurial, that will be recorded in the next commit. The
5331 working directory initially corresponds to the snapshot at an
5332 existing changeset, known as the parent of the working direc‐
5333 tory. See 'Parent, working directory'. The state may be modified
5334 by changes to the files introduced manually or by a merge. The
5335 repository metadata exists in the .hg directory inside the work‐
5336 ing directory.
5337
5338 Draft Changesets in the draft phase have not been shared with publish‐
5339 ing repositories and may thus be safely changed by history-modi‐
5340 fying extensions. See hg help phases.
5341
5342 Experimental
5343 Feature that may change or be removed at a later date.
5344
5345 Graph See DAG and hg log --graph.
5346
5347 Head The term 'head' may be used to refer to both a branch head or a
5348 repository head, depending on the context. See 'Head, branch'
5349 and 'Head, repository' for specific definitions.
5350
5351 Heads are where development generally takes place and are the
5352 usual targets for update and merge operations.
5353
5354 Head, branch
5355 A changeset with no descendants on the same named branch.
5356
5357 Head, closed branch
5358 A changeset that marks a head as no longer interesting. The
5359 closed head is no longer listed by hg heads. A branch is consid‐
5360 ered closed when all its heads are closed and consequently is
5361 not listed by hg branches.
5362
5363 Closed heads can be re-opened by committing new changeset as the
5364 child of the changeset that marks a head as closed.
5365
5366 Head, repository
5367 A topological head which has not been closed.
5368
5369 Head, topological
5370 A changeset with no children in the repository.
5371
5372 History, immutable
5373 Once committed, changesets cannot be altered. Extensions which
5374 appear to change history actually create new changesets that re‐
5375 place existing ones, and then destroy the old changesets. Doing
5376 so in public repositories can result in old changesets being
5377 reintroduced to the repository.
5378
5379 History, rewriting
5380 The changesets in a repository are immutable. However, exten‐
5381 sions to Mercurial can be used to alter the repository, usually
5382 in such a way as to preserve changeset contents.
5383
5384 Immutable history
5385 See 'History, immutable'.
5386
5387 Merge changeset
5388 See 'Changeset, merge'.
5389
5390 Manifest
5391 Each changeset has a manifest, which is the list of files that
5392 are tracked by the changeset.
5393
5394 Merge Used to bring together divergent branches of work. When you up‐
5395 date to a changeset and then merge another changeset, you bring
5396 the history of the latter changeset into your working directory.
5397 Once conflicts are resolved (and marked), this merge may be com‐
5398 mitted as a merge changeset, bringing two branches together in
5399 the DAG.
5400
5401 Named branch
5402 See 'Branch, named'.
5403
5404 Null changeset
5405 The empty changeset. It is the parent state of newly-initialized
5406 repositories and repositories with no checked out revision. It
5407 is thus the parent of root changesets and the effective ancestor
5408 when merging unrelated changesets. Can be specified by the alias
5409 'null' or by the changeset ID '000000000000'.
5410
5411 Parent See 'Changeset, parent'.
5412
5413 Parent changeset
5414 See 'Changeset, parent'.
5415
5416 Parent, working directory
5417 The working directory parent reflects a virtual revision which
5418 is the child of the changeset (or two changesets with an uncom‐
5419 mitted merge) shown by hg parents. This is changed with hg up‐
5420 date. Other commands to see the working directory parent are hg
5421 summary and hg id. Can be specified by the alias ".".
5422
5423 Patch (Noun) The product of a diff operation.
5424
5425 Example: "I've sent you my patch."
5426
5427 (Verb) The process of using a patch file to transform one
5428 changeset into another.
5429
5430 Example: "You will need to patch that revision."
5431
5432 Phase A per-changeset state tracking how the changeset has been or
5433 should be shared. See hg help phases.
5434
5435 Public Changesets in the public phase have been shared with publishing
5436 repositories and are therefore considered immutable. See hg help
5437 phases.
5438
5439 Pull An operation in which changesets in a remote repository which
5440 are not in the local repository are brought into the local
5441 repository. Note that this operation without special arguments
5442 only updates the repository, it does not update the files in the
5443 working directory. See hg help pull.
5444
5445 Push An operation in which changesets in a local repository which are
5446 not in a remote repository are sent to the remote repository.
5447 Note that this operation only adds changesets which have been
5448 committed locally to the remote repository. Uncommitted changes
5449 are not sent. See hg help push.
5450
5451 Repository
5452 The metadata describing all recorded states of a collection of
5453 files. Each recorded state is represented by a changeset. A
5454 repository is usually (but not always) found in the .hg subdi‐
5455 rectory of a working directory. Any recorded state can be recre‐
5456 ated by "updating" a working directory to a specific changeset.
5457
5458 Repository head
5459 See 'Head, repository'.
5460
5461 Revision
5462 A state of the repository at some point in time. Earlier revi‐
5463 sions can be updated to by using hg update. See also 'Revision
5464 number'; See also 'Changeset'.
5465
5466 Revision number
5467 This integer uniquely identifies a changeset in a specific
5468 repository. It represents the order in which changesets were
5469 added to a repository, starting with revision number 0. Note
5470 that the revision number may be different in each clone of a
5471 repository. To identify changesets uniquely between different
5472 clones, see 'Changeset id'.
5473
5474 Revlog History storage mechanism used by Mercurial. It is a form of
5475 delta encoding, with occasional full revision of data followed
5476 by delta of each successive revision. It includes data and an
5477 index pointing to the data.
5478
5479 Rewriting history
5480 See 'History, rewriting'.
5481
5482 Root A changeset that has only the null changeset as its parent. Most
5483 repositories have only a single root changeset.
5484
5485 Secret Changesets in the secret phase may not be shared via push, pull,
5486 or clone. See hg help phases.
5487
5488 Tag An alternative name given to a changeset. Tags can be used in
5489 all places where Mercurial expects a changeset ID, e.g., with hg
5490 update. The creation of a tag is stored in the history and will
5491 thus automatically be shared with other using push and pull.
5492
5493 Tip The changeset with the highest revision number. It is the
5494 changeset most recently added in a repository.
5495
5496 Tip, branch
5497 The head of a given branch with the highest revision number.
5498 When a branch name is used as a revision identifier, it refers
5499 to the branch tip. See also 'Branch, head'. Note that because
5500 revision numbers may be different in different repository
5501 clones, the branch tip may be different in different cloned
5502 repositories.
5503
5504 Update (Noun) Another synonym of changeset.
5505
5506 Example: "I've pushed an update."
5507
5508 (Verb) This term is usually used to describe updating the state
5509 of the working directory to that of a specific changeset. See hg
5510 help update.
5511
5512 Example: "You should update."
5513
5514 Working directory
5515 See 'Directory, working'.
5516
5517 Working directory parent
5518 See 'Parent, working directory'.
5519
5521 Synopsis
5522 The Mercurial system uses a file called .hgignore in the root directory
5523 of a repository to control its behavior when it searches for files that
5524 it is not currently tracking.
5525
5526 Description
5527 The working directory of a Mercurial repository will often contain
5528 files that should not be tracked by Mercurial. These include backup
5529 files created by editors and build products created by compilers.
5530 These files can be ignored by listing them in a .hgignore file in the
5531 root of the working directory. The .hgignore file must be created manu‐
5532 ally. It is typically put under version control, so that the settings
5533 will propagate to other repositories with push and pull.
5534
5535 An untracked file is ignored if its path relative to the repository
5536 root directory, or any prefix path of that path, is matched against any
5537 pattern in .hgignore.
5538
5539 For example, say we have an untracked file, file.c, at a/b/file.c in‐
5540 side our repository. Mercurial will ignore file.c if any pattern in
5541 .hgignore matches a/b/file.c, a/b or a.
5542
5543 In addition, a Mercurial configuration file can reference a set of
5544 per-user or global ignore files. See the ignore configuration key on
5545 the [ui] section of hg help config for details of how to configure
5546 these files.
5547
5548 To control Mercurial's handling of files that it manages, many commands
5549 support the -I and -X options; see hg help <command> and hg help pat‐
5550 terns for details.
5551
5552 Files that are already tracked are not affected by .hgignore, even if
5553 they appear in .hgignore. An untracked file X can be explicitly added
5554 with hg add X, even if X would be excluded by a pattern in .hgignore.
5555
5556 Syntax
5557 An ignore file is a plain text file consisting of a list of patterns,
5558 with one pattern per line. Empty lines are skipped. The # character is
5559 treated as a comment character, and the \ character is treated as an
5560 escape character.
5561
5562 Mercurial supports several pattern syntaxes. The default syntax used is
5563 Python/Perl-style regular expressions.
5564
5565 To change the syntax used, use a line of the following form:
5566
5567 syntax: NAME
5568
5569 where NAME is one of the following:
5570
5571 regexp
5572
5573 Regular expression, Python/Perl syntax.
5574
5575 glob
5576
5577 Shell-style glob.
5578
5579 rootglob
5580
5581 A variant of glob that is rooted (see below).
5582
5583 The chosen syntax stays in effect when parsing all patterns that fol‐
5584 low, until another syntax is selected.
5585
5586 Neither glob nor regexp patterns are rooted. A glob-syntax pattern of
5587 the form *.c will match a file ending in .c in any directory, and a
5588 regexp pattern of the form \.c$ will do the same. To root a regexp pat‐
5589 tern, start it with ^. To get the same effect with glob-syntax, you
5590 have to use rootglob.
5591
5592 Subdirectories can have their own .hgignore settings by adding subin‐
5593 clude:path/to/subdir/.hgignore to the root .hgignore. See hg help pat‐
5594 terns for details on subinclude: and include:.
5595
5596 Note Patterns specified in other than .hgignore are always rooted.
5597 Please see hg help patterns for details.
5598
5599 Example
5600 Here is an example ignore file.
5601
5602 # use glob syntax.
5603 syntax: glob
5604
5605 *.elc
5606 *.pyc
5607 *~
5608
5609 # switch to regexp syntax.
5610 syntax: regexp
5611 ^\.pc/
5612
5613 Debugging
5614 Use the debugignore command to see if and why a file is ignored, or to
5615 see the combined ignore pattern. See hg help debugignore for details.
5616
5618 Mercurial's internal web server, hgweb, can serve either a single
5619 repository, or a tree of repositories. In the second case, repository
5620 paths and global options can be defined using a dedicated configuration
5621 file common to hg serve, hgweb.wsgi, hgweb.cgi and hgweb.fcgi.
5622
5623 This file uses the same syntax as other Mercurial configuration files
5624 but recognizes only the following sections:
5625
5626 • web
5627
5628 • paths
5629
5630 • collections
5631
5632 The web options are thoroughly described in hg help config.
5633
5634 The paths section maps URL paths to paths of repositories in the
5635 filesystem. hgweb will not expose the filesystem directly - only Mercu‐
5636 rial repositories can be published and only according to the configura‐
5637 tion.
5638
5639 The left hand side is the path in the URL. Note that hgweb reserves
5640 subpaths like rev or file, try using different names for nested reposi‐
5641 tories to avoid confusing effects.
5642
5643 The right hand side is the path in the filesystem. If the specified
5644 path ends with * or ** the filesystem will be searched recursively for
5645 repositories below that point. With * it will not recurse into the
5646 repositories it finds (except for .hg/patches). With ** it will also
5647 search inside repository working directories and possibly find sub‐
5648 repositories.
5649
5650 In this example:
5651
5652 [paths]
5653 /projects/a = /srv/tmprepos/a
5654 /projects/b = c:/repos/b
5655 / = /srv/repos/*
5656 /user/bob = /home/bob/repos/**
5657
5658 • The first two entries make two repositories in different directories
5659 appear under the same directory in the web interface
5660
5661 • The third entry will publish every Mercurial repository found in
5662 /srv/repos/, for instance the repository /srv/repos/quux/ will appear
5663 as http://server/quux/
5664
5665 • The fourth entry will publish both http://server/user/bob/quux/ and
5666 http://server/user/bob/quux/testsubrepo/
5667
5668 The collections section is deprecated and has been superseded by paths.
5669
5670 URLs and Common Arguments
5671 URLs under each repository have the form /{command}[/{arguments}] where
5672 {command} represents the name of a command or handler and {arguments}
5673 represents any number of additional URL parameters to that command.
5674
5675 The web server has a default style associated with it. Styles map to a
5676 collection of named templates. Each template is used to render a spe‐
5677 cific piece of data, such as a changeset or diff.
5678
5679 The style for the current request can be overridden two ways. First, if
5680 {command} contains a hyphen (-), the text before the hyphen defines the
5681 style. For example, /atom-log will render the log command handler with
5682 the atom style. The second way to set the style is with the style query
5683 string argument. For example, /log?style=atom. The hyphenated URL pa‐
5684 rameter is preferred.
5685
5686 Not all templates are available for all styles. Attempting to use a
5687 style that doesn't have all templates defined may result in an error
5688 rendering the page.
5689
5690 Many commands take a {revision} URL parameter. This defines the change‐
5691 set to operate on. This is commonly specified as the short, 12 digit
5692 hexadecimal abbreviation for the full 40 character unique revision
5693 identifier. However, any value described by hg help revisions typically
5694 works.
5695
5696 Commands and URLs
5697 The following web commands and their URLs are available:
5698
5699 /annotate/{revision}/{path}
5700 Show changeset information for each line in a file.
5701
5702 The ignorews, ignorewsamount, ignorewseol, and ignoreblanklines query
5703 string arguments have the same meaning as their [annotate] config
5704 equivalents. It uses the hgrc boolean parsing logic to interpret the
5705 value. e.g. 0 and false are false and 1 and true are true. If not de‐
5706 fined, the server default settings are used.
5707
5708 The fileannotate template is rendered.
5709
5710 /archive/{revision}.{format}[/{path}]
5711 Obtain an archive of repository content.
5712
5713 The content and type of the archive is defined by a URL path parameter.
5714 format is the file extension of the archive type to be generated. e.g.
5715 zip or tar.bz2. Not all archive types may be allowed by your server
5716 configuration.
5717
5718 The optional path URL parameter controls content to include in the ar‐
5719 chive. If omitted, every file in the specified revision is present in
5720 the archive. If included, only the specified file or contents of the
5721 specified directory will be included in the archive.
5722
5723 No template is used for this handler. Raw, binary content is generated.
5724
5725 /bookmarks
5726 Show information about bookmarks.
5727
5728 No arguments are accepted.
5729
5730 The bookmarks template is rendered.
5731
5732 /branches
5733 Show information about branches.
5734
5735 All known branches are contained in the output, even closed branches.
5736
5737 No arguments are accepted.
5738
5739 The branches template is rendered.
5740
5741 /changelog[/{revision}]
5742 Show information about multiple changesets.
5743
5744 If the optional revision URL argument is absent, information about all
5745 changesets starting at tip will be rendered. If the revision argument
5746 is present, changesets will be shown starting from the specified revi‐
5747 sion.
5748
5749 If revision is absent, the rev query string argument may be defined.
5750 This will perform a search for changesets.
5751
5752 The argument for rev can be a single revision, a revision set, or a
5753 literal keyword to search for in changeset data (equivalent to hg log
5754 -k).
5755
5756 The revcount query string argument defines the maximum numbers of
5757 changesets to render.
5758
5759 For non-searches, the changelog template will be rendered.
5760
5761 /changeset[/{revision}]
5762 Show information about a single changeset.
5763
5764 A URL path argument is the changeset identifier to show. See hg help
5765 revisions for possible values. If not defined, the tip changeset will
5766 be shown.
5767
5768 The changeset template is rendered. Contents of the changesettag,
5769 changesetbookmark, filenodelink, filenolink, and the many templates re‐
5770 lated to diffs may all be used to produce the output.
5771
5772 /comparison/{revision}/{path}
5773 Show a comparison between the old and new versions of a file from
5774 changes made on a particular revision.
5775
5776 This is similar to the diff handler. However, this form features a
5777 split or side-by-side diff rather than a unified diff.
5778
5779 The context query string argument can be used to control the lines of
5780 context in the diff.
5781
5782 The filecomparison template is rendered.
5783
5784 /diff/{revision}/{path}
5785 Show how a file changed in a particular commit.
5786
5787 The filediff template is rendered.
5788
5789 This handler is registered under both the /diff and /filediff paths.
5790 /diff is used in modern code.
5791
5792 /file/{revision}[/{path}]
5793 Show information about a directory or file in the repository.
5794
5795 Info about the path given as a URL parameter will be rendered.
5796
5797 If path is a directory, information about the entries in that directory
5798 will be rendered. This form is equivalent to the manifest handler.
5799
5800 If path is a file, information about that file will be shown via the
5801 filerevision template.
5802
5803 If path is not defined, information about the root directory will be
5804 rendered.
5805
5806 /diff/{revision}/{path}
5807 Show how a file changed in a particular commit.
5808
5809 The filediff template is rendered.
5810
5811 This handler is registered under both the /diff and /filediff paths.
5812 /diff is used in modern code.
5813
5814 /filelog/{revision}/{path}
5815 Show information about the history of a file in the repository.
5816
5817 The revcount query string argument can be defined to control the maxi‐
5818 mum number of entries to show.
5819
5820 The filelog template will be rendered.
5821
5822 /graph[/{revision}]
5823 Show information about the graphical topology of the repository.
5824
5825 Information rendered by this handler can be used to create visual rep‐
5826 resentations of repository topology.
5827
5828 The revision URL parameter controls the starting changeset. If it's ab‐
5829 sent, the default is tip.
5830
5831 The revcount query string argument can define the number of changesets
5832 to show information for.
5833
5834 The graphtop query string argument can specify the starting changeset
5835 for producing jsdata variable that is used for rendering graph in Java‐
5836 Script. By default it has the same value as revision.
5837
5838 This handler will render the graph template.
5839
5840 /help[/{topic}]
5841 Render help documentation.
5842
5843 This web command is roughly equivalent to hg help. If a topic is de‐
5844 fined, that help topic will be rendered. If not, an index of available
5845 help topics will be rendered.
5846
5847 The help template will be rendered when requesting help for a topic.
5848 helptopics will be rendered for the index of help topics.
5849
5850 /log[/{revision}[/{path}]]
5851 Show repository or file history.
5852
5853 For URLs of the form /log/{revision}, a list of changesets starting at
5854 the specified changeset identifier is shown. If {revision} is not de‐
5855 fined, the default is tip. This form is equivalent to the changelog
5856 handler.
5857
5858 For URLs of the form /log/{revision}/{file}, the history for a specific
5859 file will be shown. This form is equivalent to the filelog handler.
5860
5861 /manifest[/{revision}[/{path}]]
5862 Show information about a directory.
5863
5864 If the URL path arguments are omitted, information about the root di‐
5865 rectory for the tip changeset will be shown.
5866
5867 Because this handler can only show information for directories, it is
5868 recommended to use the file handler instead, as it can handle both di‐
5869 rectories and files.
5870
5871 The manifest template will be rendered for this handler.
5872
5873 /changeset[/{revision}]
5874 Show information about a single changeset.
5875
5876 A URL path argument is the changeset identifier to show. See hg help
5877 revisions for possible values. If not defined, the tip changeset will
5878 be shown.
5879
5880 The changeset template is rendered. Contents of the changesettag,
5881 changesetbookmark, filenodelink, filenolink, and the many templates re‐
5882 lated to diffs may all be used to produce the output.
5883
5884 /shortlog
5885 Show basic information about a set of changesets.
5886
5887 This accepts the same parameters as the changelog handler. The only
5888 difference is the shortlog template will be rendered instead of the
5889 changelog template.
5890
5891 /summary
5892 Show a summary of repository state.
5893
5894 Information about the latest changesets, bookmarks, tags, and branches
5895 is captured by this handler.
5896
5897 The summary template is rendered.
5898
5899 /tags
5900 Show information about tags.
5901
5902 No arguments are accepted.
5903
5904 The tags template is rendered.
5905
5907 To access a subtopic, use "hg help internals.{subtopic-name}"
5908
5909 bid-merge
5910 Bid Merge Algorithm
5911
5912 bundle2
5913 Bundle2
5914
5915 bundles
5916 Bundles
5917
5918 cbor CBOR
5919
5920 censor Censor
5921
5922 changegroups
5923 Changegroups
5924
5925 config Config Registrar
5926
5927 extensions
5928 Extension API
5929
5930 mergestate
5931 Mergestate
5932
5933 requirements
5934 Repository Requirements
5935
5936 revlogs
5937 Revision Logs
5938
5939 wireprotocol
5940 Wire Protocol
5941
5942 wireprotocolrpc
5943 Wire Protocol RPC
5944
5945 wireprotocolv2
5946 Wire Protocol Version 2
5947
5949 To merge files Mercurial uses merge tools.
5950
5951 A merge tool combines two different versions of a file into a merged
5952 file. Merge tools are given the two files and the greatest common an‐
5953 cestor of the two file versions, so they can determine the changes made
5954 on both branches.
5955
5956 Merge tools are used both for hg resolve, hg merge, hg update, hg back‐
5957 out and in several extensions.
5958
5959 Usually, the merge tool tries to automatically reconcile the files by
5960 combining all non-overlapping changes that occurred separately in the
5961 two different evolutions of the same initial base file. Furthermore,
5962 some interactive merge programs make it easier to manually resolve con‐
5963 flicting merges, either in a graphical way, or by inserting some con‐
5964 flict markers. Mercurial does not include any interactive merge pro‐
5965 grams but relies on external tools for that.
5966
5967 Available merge tools
5968 External merge tools and their properties are configured in the
5969 merge-tools configuration section - see hgrc(5) - but they can often
5970 just be named by their executable.
5971
5972 A merge tool is generally usable if its executable can be found on the
5973 system and if it can handle the merge. The executable is found if it is
5974 an absolute or relative executable path or the name of an application
5975 in the executable search path. The tool is assumed to be able to handle
5976 the merge if it can handle symlinks if the file is a symlink, if it can
5977 handle binary files if the file is binary, and if a GUI is available if
5978 the tool requires a GUI.
5979
5980 There are some internal merge tools which can be used. The internal
5981 merge tools are:
5982
5983 :dump
5984
5985 Creates three versions of the files to merge, containing the
5986 contents of local, other and base. These files can then be used
5987 to perform a merge manually. If the file to be merged is named
5988 a.txt, these files will accordingly be named a.txt.local,
5989 a.txt.other and a.txt.base and they will be placed in the same
5990 directory as a.txt.
5991
5992 This implies premerge. Therefore, files aren't dumped, if pre‐
5993 merge runs successfully. Use :forcedump to forcibly write files
5994 out.
5995
5996 (actual capabilities: binary, symlink)
5997
5998 :fail
5999
6000 Rather than attempting to merge files that were modified on both
6001 branches, it marks them as unresolved. The resolve command must
6002 be used to resolve these conflicts.
6003
6004 (actual capabilities: binary, symlink)
6005
6006 :forcedump
6007
6008 Creates three versions of the files as same as :dump, but omits
6009 premerge.
6010
6011 (actual capabilities: binary, symlink)
6012
6013 :local
6014
6015 Uses the local p1() version of files as the merged version.
6016
6017 (actual capabilities: binary, symlink)
6018
6019 :merge
6020
6021 Uses the internal non-interactive simple merge algorithm for
6022 merging files. It will fail if there are any conflicts and leave
6023 markers in the partially merged file. Markers will have two sec‐
6024 tions, one for each side of merge.
6025
6026 :merge-local
6027
6028 Like :merge, but resolve all conflicts non-interactively in fa‐
6029 vor of the local p1() changes.
6030
6031 :merge-other
6032
6033 Like :merge, but resolve all conflicts non-interactively in fa‐
6034 vor of the other p2() changes.
6035
6036 :merge3
6037
6038 Uses the internal non-interactive simple merge algorithm for
6039 merging files. It will fail if there are any conflicts and leave
6040 markers in the partially merged file. Marker will have three
6041 sections, one from each side of the merge and one for the base
6042 content.
6043
6044 :mergediff
6045
6046 Uses the internal non-interactive simple merge algorithm for
6047 merging files. It will fail if there are any conflicts and leave
6048 markers in the partially merged file. The marker will have two
6049 sections, one with the content from one side of the merge, and
6050 one with a diff from the base content to the content on the
6051 other side. (experimental)
6052
6053 :other
6054
6055 Uses the other p2() version of files as the merged version.
6056
6057 (actual capabilities: binary, symlink)
6058
6059 :prompt
6060
6061 Asks the user which of the local p1() or the other p2() version
6062 to keep as the merged version.
6063
6064 (actual capabilities: binary, symlink)
6065
6066 :tagmerge
6067
6068 Uses the internal tag merge algorithm (experimental).
6069
6070 :union
6071
6072 Uses the internal non-interactive simple merge algorithm for
6073 merging files. It will use both left and right sides for con‐
6074 flict regions. No markers are inserted.
6075
6076 Internal tools are always available and do not require a GUI but will
6077 by default not handle symlinks or binary files. See next section for
6078 detail about "actual capabilities" described above.
6079
6080 Choosing a merge tool
6081 Mercurial uses these rules when deciding which merge tool to use:
6082
6083 1. If a tool has been specified with the --tool option to merge or re‐
6084 solve, it is used. If it is the name of a tool in the merge-tools
6085 configuration, its configuration is used. Otherwise the specified
6086 tool must be executable by the shell.
6087
6088 2. If the HGMERGE environment variable is present, its value is used
6089 and must be executable by the shell.
6090
6091 3. If the filename of the file to be merged matches any of the patterns
6092 in the merge-patterns configuration section, the first usable merge
6093 tool corresponding to a matching pattern is used.
6094
6095 4. If ui.merge is set it will be considered next. If the value is not
6096 the name of a configured tool, the specified value is used and must
6097 be executable by the shell. Otherwise the named tool is used if it
6098 is usable.
6099
6100 5. If any usable merge tools are present in the merge-tools configura‐
6101 tion section, the one with the highest priority is used.
6102
6103 6. If a program named hgmerge can be found on the system, it is used -
6104 but it will by default not be used for symlinks and binary files.
6105
6106 7. If the file to be merged is not binary and is not a symlink, then
6107 internal :merge is used.
6108
6109 8. Otherwise, :prompt is used.
6110
6111 For historical reason, Mercurial treats merge tools as below while ex‐
6112 amining rules above.
6113
6114 ┌───────────┬────────────────┬────────┬─────────┐
6115 │step │ specified via │ binary │ symlink │
6116 ├───────────┼────────────────┼────────┼─────────┤
6117 │ │ --tool │ o/o │ o/o │
6118 │ 1. │ │ │ │
6119 ├───────────┼────────────────┼────────┼─────────┤
6120 │ │ HGMERGE │ o/o │ o/o │
6121 │ 2. │ │ │ │
6122 ├───────────┼────────────────┼────────┼─────────┤
6123 │ │ merge-patterns │ o/o(*) │ x/?(*) │
6124 │ 3. │ │ │ │
6125 ├───────────┼────────────────┼────────┼─────────┤
6126 │ │ ui.merge │ x/?(*) │ x/?(*) │
6127 │ 4. │ │ │ │
6128 └───────────┴────────────────┴────────┴─────────┘
6129
6130 Each capability column indicates Mercurial behavior for internal/exter‐
6131 nal merge tools at examining each rule.
6132
6133 • "o": "assume that a tool has capability"
6134
6135 • "x": "assume that a tool does not have capability"
6136
6137 • "?": "check actual capability of a tool"
6138
6139 If merge.strict-capability-check configuration is true, Mercurial
6140 checks capabilities of merge tools strictly in (*) cases above (= each
6141 capability column becomes "?/?"). It is false by default for backward
6142 compatibility.
6143
6144 Note After selecting a merge program, Mercurial will by default at‐
6145 tempt to merge the files using a simple merge algorithm first.
6146 Only if it doesn't succeed because of conflicting changes will
6147 Mercurial actually execute the merge program. Whether to use the
6148 simple merge algorithm first can be controlled by the premerge
6149 setting of the merge tool. Premerge is enabled by default unless
6150 the file is binary or a symlink.
6151
6152 See the merge-tools and ui sections of hgrc(5) for details on the con‐
6153 figuration of merge tools.
6154
6156 Some Mercurial commands can produce a lot of output, and Mercurial will
6157 attempt to use a pager to make those commands more pleasant.
6158
6159 To set the pager that should be used, set the application variable:
6160
6161 [pager]
6162 pager = less -FRX
6163
6164 If no pager is set in the user or repository configuration, Mercurial
6165 uses the environment variable $PAGER. If $PAGER is not set, pager.pager
6166 from the default or system configuration is used. If none of these are
6167 set, a default pager will be used, typically less on Unix and more on
6168 Windows.
6169
6170 On Windows, more is not color aware, so using it effectively disables
6171 color. MSYS and Cygwin shells provide less as a pager, which can be
6172 configured to support ANSI color codes. See hg help con‐
6173 fig.color.pagermode to configure the color mode when invoking a pager.
6174
6175 You can disable the pager for certain commands by adding them to the
6176 pager.ignore list:
6177
6178 [pager]
6179 ignore = version, help, update
6180
6181 To ignore global commands like hg version or hg help, you have to spec‐
6182 ify them in your user configuration file.
6183
6184 To control whether the pager is used at all for an individual command,
6185 you can use --pager=<value>:
6186
6187 • use as needed: auto.
6188
6189 • require the pager: yes or on.
6190
6191 • suppress the pager: no or off (any unrecognized value will also
6192 work).
6193
6194 To globally turn off all attempts to use a pager, set:
6195
6196 [ui]
6197 paginate = never
6198
6199 which will prevent the pager from running.
6200
6202 Mercurial accepts several notations for identifying one or more files
6203 at a time.
6204
6205 By default, Mercurial treats filenames as shell-style extended glob
6206 patterns.
6207
6208 Alternate pattern notations must be specified explicitly.
6209
6210 Note Patterns specified in .hgignore are not rooted. Please see hg
6211 help hgignore for details.
6212
6213 To use a plain path name without any pattern matching, start it with
6214 path:. These path names must completely match starting at the current
6215 repository root, and when the path points to a directory, it is matched
6216 recursively. To match all files in a directory non-recursively (not in‐
6217 cluding any files in subdirectories), rootfilesin: can be used, speci‐
6218 fying an absolute path (relative to the repository root).
6219
6220 To use an extended glob, start a name with glob:. Globs are rooted at
6221 the current directory; a glob such as *.c will only match files in the
6222 current directory ending with .c. rootglob: can be used instead of
6223 glob: for a glob that is rooted at the root of the repository.
6224
6225 The supported glob syntax extensions are ** to match any string across
6226 path separators and {a,b} to mean "a or b".
6227
6228 To use a Perl/Python regular expression, start a name with re:. Regexp
6229 pattern matching is anchored at the root of the repository.
6230
6231 To read name patterns from a file, use listfile: or listfile0:. The
6232 latter expects null delimited patterns while the former expects line
6233 feeds. Each string read from the file is itself treated as a file pat‐
6234 tern.
6235
6236 To read a set of patterns from a file, use include: or subinclude:.
6237 include: will use all the patterns from the given file and treat them
6238 as if they had been passed in manually. subinclude: will only apply
6239 the patterns against files that are under the subinclude file's direc‐
6240 tory. See hg help hgignore for details on the format of these files.
6241
6242 All patterns, except for glob: specified in command line (not for -I or
6243 -X options), can match also against directories: files under matched
6244 directories are treated as matched. For -I and -X options, glob: will
6245 match directories recursively.
6246
6247 Plain examples:
6248
6249 path:foo/bar a name bar in a directory named foo in the root
6250 of the repository
6251 path:path:name a file or directory named "path:name"
6252 rootfilesin:foo/bar the files in a directory called foo/bar, but not any files
6253 in its subdirectories and not a file bar in directory foo
6254
6255 Glob examples:
6256
6257 glob:*.c any name ending in ".c" in the current directory
6258 *.c any name ending in ".c" in the current directory
6259 **.c any name ending in ".c" in any subdirectory of the
6260 current directory including itself.
6261 foo/* any file in directory foo
6262 foo/** any file in directory foo plus all its subdirectories,
6263 recursively
6264 foo/*.c any name ending in ".c" in the directory foo
6265 foo/**.c any name ending in ".c" in any subdirectory of foo
6266 including itself.
6267 rootglob:*.c any name ending in ".c" in the root of the repository
6268
6269 Regexp examples:
6270
6271 re:.*\.c$ any name ending in ".c", anywhere in the repository
6272
6273 File examples:
6274
6275 listfile:list.txt read list from list.txt with one file pattern per line
6276 listfile0:list.txt read list from list.txt with null byte delimiters
6277
6278 See also hg help filesets.
6279
6280 Include examples:
6281
6282 include:path/to/mypatternfile reads patterns to be applied to all paths
6283 subinclude:path/to/subignorefile reads patterns specifically for paths in the
6284 subdirectory
6285
6287 What are phases?
6288 Phases are a system for tracking which changesets have been or should
6289 be shared. This helps prevent common mistakes when modifying history
6290 (for instance, with the mq or rebase extensions).
6291
6292 Each changeset in a repository is in one of the following phases:
6293
6294 • public : changeset is visible on a public server
6295
6296 • draft : changeset is not yet published
6297
6298 • secret : changeset should not be pushed, pulled, or cloned
6299
6300 These phases are ordered (public < draft < secret) and no changeset can
6301 be in a lower phase than its ancestors. For instance, if a changeset is
6302 public, all its ancestors are also public. Lastly, changeset phases
6303 should only be changed towards the public phase.
6304
6305 How are phases managed?
6306 For the most part, phases should work transparently. By default, a
6307 changeset is created in the draft phase and is moved into the public
6308 phase when it is pushed to another repository.
6309
6310 Once changesets become public, extensions like mq and rebase will
6311 refuse to operate on them to prevent creating duplicate changesets.
6312 Phases can also be manually manipulated with the hg phase command if
6313 needed. See hg help -v phase for examples.
6314
6315 To make your commits secret by default, put this in your configuration
6316 file:
6317
6318 [phases]
6319 new-commit = secret
6320
6321 Phases and servers
6322 Normally, all servers are publishing by default. This means:
6323
6324 - all draft changesets that are pulled or cloned appear in phase
6325 public on the client
6326
6327 - all draft changesets that are pushed appear as public on both
6328 client and server
6329
6330 - secret changesets are neither pushed, pulled, or cloned
6331
6332 Note Pulling a draft changeset from a publishing server does not mark
6333 it as public on the server side due to the read-only nature of
6334 pull.
6335
6336 Sometimes it may be desirable to push and pull changesets in the draft
6337 phase to share unfinished work. This can be done by setting a reposi‐
6338 tory to disable publishing in its configuration file:
6339
6340 [phases]
6341 publish = False
6342
6343 See hg help config for more information on configuration files.
6344
6345 Note Servers running older versions of Mercurial are treated as pub‐
6346 lishing.
6347
6348 Note Changesets in secret phase are not exchanged with the server.
6349 This applies to their content: file names, file contents, and
6350 changeset metadata. For technical reasons, the identifier (e.g.
6351 d825e4025e39) of the secret changeset may be communicated to the
6352 server.
6353
6354 Examples
6355 • list changesets in draft or secret phase:
6356
6357 hg log -r "not public()"
6358
6359 • change all secret changesets to draft:
6360
6361 hg phase --draft "secret()"
6362
6363 • forcibly move the current changeset and descendants from public to
6364 draft:
6365
6366 hg phase --force --draft .
6367
6368 • show a list of changeset revisions and each corresponding phase:
6369
6370 hg log --template "{rev} {phase}\n"
6371
6372 • resynchronize draft changesets relative to a remote repository:
6373
6374 hg phase -fd "outgoing(URL)"
6375
6376 See hg help phase for more information on manually manipulating phases.
6377
6379 Mercurial supports several ways to specify revisions.
6380
6381 Specifying single revisions
6382 A plain integer is treated as a revision number. Negative integers are
6383 treated as sequential offsets from the tip, with -1 denoting the tip,
6384 -2 denoting the revision prior to the tip, and so forth.
6385
6386 A 40-digit hexadecimal string is treated as a unique revision identi‐
6387 fier. A hexadecimal string less than 40 characters long is treated as
6388 a unique revision identifier and is referred to as a short-form identi‐
6389 fier. A short-form identifier is only valid if it is the prefix of ex‐
6390 actly one full-length identifier.
6391
6392 Any other string is treated as a bookmark, tag, or branch name. A book‐
6393 mark is a movable pointer to a revision. A tag is a permanent name as‐
6394 sociated with a revision. A branch name denotes the tipmost open branch
6395 head of that branch - or if they are all closed, the tipmost closed
6396 head of the branch. Bookmark, tag, and branch names must not contain
6397 the ":" character.
6398
6399 The reserved name "tip" always identifies the most recent revision.
6400
6401 The reserved name "null" indicates the null revision. This is the revi‐
6402 sion of an empty repository, and the parent of revision 0.
6403
6404 The reserved name "." indicates the working directory parent. If no
6405 working directory is checked out, it is equivalent to null. If an un‐
6406 committed merge is in progress, "." is the revision of the first par‐
6407 ent.
6408
6409 Finally, commands that expect a single revision (like hg update) also
6410 accept revsets (see below for details). When given a revset, they use
6411 the last revision of the revset. A few commands accept two single revi‐
6412 sions (like hg diff). When given a revset, they use the first and the
6413 last revisions of the revset.
6414
6415 Specifying multiple revisions
6416 Mercurial supports a functional language for selecting a set of revi‐
6417 sions. Expressions in this language are called revsets.
6418
6419 The language supports a number of predicates which are joined by infix
6420 operators. Parenthesis can be used for grouping.
6421
6422 Identifiers such as branch names may need quoting with single or double
6423 quotes if they contain characters like - or if they match one of the
6424 predefined predicates.
6425
6426 Special characters can be used in quoted identifiers by escaping them,
6427 e.g., \n is interpreted as a newline. To prevent them from being inter‐
6428 preted, strings can be prefixed with r, e.g. r'...'.
6429
6430 Operators
6431 There is a single prefix operator:
6432
6433 not x
6434
6435 Changesets not in x. Short form is ! x.
6436
6437 These are the supported infix operators:
6438
6439 x::y
6440
6441 A DAG range, meaning all changesets that are descendants of x
6442 and ancestors of y, including x and y themselves. If the first
6443 endpoint is left out, this is equivalent to ancestors(y), if the
6444 second is left out it is equivalent to descendants(x).
6445
6446 An alternative syntax is x..y.
6447
6448 x:y
6449
6450 All changesets with revision numbers between x and y, both in‐
6451 clusive. Either endpoint can be left out, they default to 0 and
6452 tip.
6453
6454 x and y
6455
6456 The intersection of changesets in x and y. Short form is x & y.
6457
6458 x or y
6459
6460 The union of changesets in x and y. There are two alternative
6461 short forms: x | y and x + y.
6462
6463 x - y
6464
6465 Changesets in x but not in y.
6466
6467 x % y
6468
6469 Changesets that are ancestors of x but not ancestors of y (i.e.
6470 ::x - ::y). This is shorthand notation for only(x, y) (see be‐
6471 low). The second argument is optional and, if left out, is
6472 equivalent to only(x).
6473
6474 x^n
6475
6476 The nth parent of x, n == 0, 1, or 2. For n == 0, x; for n ==
6477 1, the first parent of each changeset in x; for n == 2, the sec‐
6478 ond parent of changeset in x.
6479
6480 x~n
6481
6482 The nth first ancestor of x; x~0 is x; x~3 is x^^^. For n < 0,
6483 the nth unambiguous descendent of x.
6484
6485 x ## y
6486
6487 Concatenate strings and identifiers into one string.
6488
6489 All other prefix, infix and postfix operators have lower prior‐
6490 ity than ##. For example, a1 ## a2~2 is equivalent to (a1 ##
6491 a2)~2.
6492
6493 For example:
6494
6495 [revsetalias]
6496 issue(a1) = grep(r'\bissue[ :]?' ## a1 ## r'\b|\bbug\(' ## a1 ## r'\)')
6497
6498 issue(1234) is equivalent to grep(r'\bissue[
6499 :]?1234\b|\bbug\(1234\)') in this case. This matches against all
6500 of "issue 1234", "issue:1234", "issue1234" and "bug(1234)".
6501
6502 There is a single postfix operator:
6503
6504 x^
6505
6506 Equivalent to x^1, the first parent of each changeset in x.
6507
6508 Patterns
6509 Where noted, predicates that perform string matching can accept a pat‐
6510 tern string. The pattern may be either a literal, or a regular expres‐
6511 sion. If the pattern starts with re:, the remainder of the pattern is
6512 treated as a regular expression. Otherwise, it is treated as a literal.
6513 To match a pattern that actually starts with re:, use the prefix lit‐
6514 eral:.
6515
6516 Matching is case-sensitive, unless otherwise noted. To perform a case-
6517 insensitive match on a case-sensitive predicate, use a regular expres‐
6518 sion, prefixed with (?i).
6519
6520 For example, tag(r're:(?i)release') matches "release" or "RELEASE" or
6521 "Release", etc.
6522
6523 Predicates
6524 The following predicates are supported:
6525
6526 adds(pattern)
6527
6528 Changesets that add a file matching pattern.
6529
6530 The pattern without explicit kind like glob: is expected to be
6531 relative to the current directory and match against a file or a
6532 directory.
6533
6534 all()
6535
6536 All changesets, the same as 0:tip.
6537
6538 ancestor(*changeset)
6539
6540 A greatest common ancestor of the changesets.
6541
6542 Accepts 0 or more changesets. Will return empty list when
6543 passed no args. Greatest common ancestor of a single changeset
6544 is that changeset.
6545
6546 ancestors(set[, depth])
6547
6548 Changesets that are ancestors of changesets in set, including
6549 the given changesets themselves.
6550
6551 If depth is specified, the result only includes changesets up to
6552 the specified generation.
6553
6554 author(string)
6555
6556 Alias for user(string).
6557
6558 bisect(string)
6559
6560 Changesets marked in the specified bisect status:
6561
6562 • good, bad, skip: csets explicitly marked as good/bad/skip
6563
6564 • goods, bads : csets topologically good/bad
6565
6566 • range : csets taking part in the bisection
6567
6568 • pruned : csets that are goods, bads or skipped
6569
6570 • untested : csets whose fate is yet unknown
6571
6572 • ignored : csets ignored due to DAG topology
6573
6574 • current : the cset currently being bisected
6575
6576 bookmark([name])
6577
6578 The named bookmark or all bookmarks.
6579
6580 Pattern matching is supported for name. See hg help revi‐
6581 sions.patterns.
6582
6583 branch(string or set)
6584
6585 All changesets belonging to the given branch or the branches of
6586 the given changesets.
6587
6588 Pattern matching is supported for string. See hg help revi‐
6589 sions.patterns.
6590
6591 branchpoint()
6592
6593 Changesets with more than one child.
6594
6595 bundle()
6596
6597 Changesets in the bundle.
6598
6599 Bundle must be specified by the -R option.
6600
6601 children(set)
6602
6603 Child changesets of changesets in set.
6604
6605 closed()
6606
6607 Changeset is closed.
6608
6609 commonancestors(set)
6610
6611 Changesets that are ancestors of every changeset in set.
6612
6613 conflictlocal()
6614
6615 The local side of the merge, if currently in an unresolved
6616 merge.
6617
6618 "merge" here includes merge conflicts from e.g. 'hg rebase' or
6619 'hg graft'.
6620
6621 conflictother()
6622
6623 The other side of the merge, if currently in an unresolved
6624 merge.
6625
6626 "merge" here includes merge conflicts from e.g. 'hg rebase' or
6627 'hg graft'.
6628
6629 contains(pattern)
6630
6631 The revision's manifest contains a file matching pattern (but
6632 might not modify it). See hg help patterns for information about
6633 file patterns.
6634
6635 The pattern without explicit kind like glob: is expected to be
6636 relative to the current directory and match against a file ex‐
6637 actly for efficiency.
6638
6639 converted([id])
6640
6641 Changesets converted from the given identifier in the old repos‐
6642 itory if present, or all converted changesets if no identifier
6643 is specified.
6644
6645 date(interval)
6646
6647 Changesets within the interval, see hg help dates.
6648
6649 desc(string)
6650
6651 Search commit message for string. The match is case-insensitive.
6652
6653 Pattern matching is supported for string. See hg help revi‐
6654 sions.patterns.
6655
6656 descendants(set[, depth])
6657
6658 Changesets which are descendants of changesets in set, including
6659 the given changesets themselves.
6660
6661 If depth is specified, the result only includes changesets up to
6662 the specified generation.
6663
6664 destination([set])
6665
6666 Changesets that were created by a graft, transplant or rebase
6667 operation, with the given revisions specified as the source.
6668 Omitting the optional set is the same as passing all().
6669
6670 diffcontains(pattern)
6671
6672 Search revision differences for when the pattern was added or
6673 removed.
6674
6675 The pattern may be a substring literal or a regular expression.
6676 See hg help revisions.patterns.
6677
6678 draft()
6679
6680 Changeset in draft phase.
6681
6682 expectsize(set[, size])
6683
6684 Return the given revset if size matches the revset size. Abort
6685 if the revset doesn't expect given size. size can either be an
6686 integer range or an integer.
6687
6688 For example, expectsize(0:1, 3:5) will abort as revset size is 2
6689 and 2 is not between 3 and 5 inclusive.
6690
6691 extra(label, [value])
6692
6693 Changesets with the given label in the extra metadata, with the
6694 given optional value.
6695
6696 Pattern matching is supported for value. See hg help revi‐
6697 sions.patterns.
6698
6699 file(pattern)
6700
6701 Changesets affecting files matched by pattern.
6702
6703 For a faster but less accurate result, consider using filelog()
6704 instead.
6705
6706 This predicate uses glob: as the default kind of pattern.
6707
6708 filelog(pattern)
6709
6710 Changesets connected to the specified filelog.
6711
6712 For performance reasons, visits only revisions mentioned in the
6713 file-level filelog, rather than filtering through all changesets
6714 (much faster, but doesn't include deletes or duplicate changes).
6715 For a slower, more accurate result, use file().
6716
6717 The pattern without explicit kind like glob: is expected to be
6718 relative to the current directory and match against a file ex‐
6719 actly for efficiency.
6720
6721 first(set, [n])
6722
6723 An alias for limit().
6724
6725 follow([file[, startrev]])
6726
6727 An alias for ::. (ancestors of the working directory's first
6728 parent). If file pattern is specified, the histories of files
6729 matching given pattern in the revision given by startrev are
6730 followed, including copies.
6731
6732 followlines(file, fromline:toline[, startrev=., descend=False])
6733
6734 Changesets modifying file in line range ('fromline', 'toline').
6735
6736 Line range corresponds to 'file' content at 'startrev' and
6737 should hence be consistent with file size. If startrev is not
6738 specified, working directory's parent is used.
6739
6740 By default, ancestors of 'startrev' are returned. If 'descend'
6741 is True, descendants of 'startrev' are returned though renames
6742 are (currently) not followed in this direction.
6743
6744 grep(regex)
6745
6746 Like keyword(string) but accepts a regex. Use grep(r'...') to
6747 ensure special escape characters are handled correctly. Unlike
6748 keyword(string), the match is case-sensitive.
6749
6750 head()
6751
6752 Changeset is a named branch head.
6753
6754 heads(set)
6755
6756 Members of set with no children in set.
6757
6758 hidden()
6759
6760 Hidden changesets.
6761
6762 id(string)
6763
6764 Revision non-ambiguously specified by the given hex string pre‐
6765 fix.
6766
6767 keyword(string)
6768
6769 Search commit message, user name, and names of changed files for
6770 string. The match is case-insensitive.
6771
6772 For a regular expression or case sensitive search of these
6773 fields, use grep(regex).
6774
6775 last(set, [n])
6776
6777 Last n members of set, defaulting to 1.
6778
6779 limit(set[, n[, offset]])
6780
6781 First n members of set, defaulting to 1, starting from offset.
6782
6783 matching(revision [, field])
6784
6785 Changesets in which a given set of fields match the set of
6786 fields in the selected revision or set.
6787
6788 To match more than one field pass the list of fields to match
6789 separated by spaces (e.g. author description).
6790
6791 Valid fields are most regular revision fields and some special
6792 fields.
6793
6794 Regular revision fields are description, author, branch, date,
6795 files, phase, parents, substate, user and diff. Note that au‐
6796 thor and user are synonyms. diff refers to the contents of the
6797 revision. Two revisions matching their diff will also match
6798 their files.
6799
6800 Special fields are summary and metadata: summary matches the
6801 first line of the description. metadata is equivalent to match‐
6802 ing description user date (i.e. it matches the main metadata
6803 fields).
6804
6805 metadata is the default field which is used when no fields are
6806 specified. You can match more than one field at a time.
6807
6808 max(set)
6809
6810 Changeset with highest revision number in set.
6811
6812 merge()
6813
6814 Changeset is a merge changeset.
6815
6816 min(set)
6817
6818 Changeset with lowest revision number in set.
6819
6820 modifies(pattern)
6821
6822 Changesets modifying files matched by pattern.
6823
6824 The pattern without explicit kind like glob: is expected to be
6825 relative to the current directory and match against a file or a
6826 directory.
6827
6828 named(namespace)
6829
6830 The changesets in a given namespace.
6831
6832 Pattern matching is supported for namespace. See hg help revi‐
6833 sions.patterns.
6834
6835 nodefromfile(path)
6836
6837 An alias for ::. (ancestors of the working directory's first
6838 parent). If file pattern is specified, the histories of files
6839 matching given pattern in the revision given by startrev are
6840 followed, including copies.
6841
6842 none()
6843
6844 No changesets.
6845
6846 only(set, [set])
6847
6848 Changesets that are ancestors of the first set that are not an‐
6849 cestors of any other head in the repo. If a second set is speci‐
6850 fied, the result is ancestors of the first set that are not an‐
6851 cestors of the second set (i.e. ::<set1> - ::<set2>).
6852
6853 origin([set])
6854
6855 Changesets that were specified as a source for the grafts,
6856 transplants or rebases that created the given revisions. Omit‐
6857 ting the optional set is the same as passing all(). If a
6858 changeset created by these operations is itself specified as a
6859 source for one of these operations, only the source changeset
6860 for the first operation is selected.
6861
6862 outgoing([path])
6863
6864 Changesets not found in the specified destination repository, or
6865 the default push location.
6866
6867 If the location resolve to multiple repositories, the union of
6868 all outgoing changeset will be used.
6869
6870 p1([set])
6871
6872 First parent of changesets in set, or the working directory.
6873
6874 p2([set])
6875
6876 Second parent of changesets in set, or the working directory.
6877
6878 parents([set])
6879
6880 The set of all parents for all changesets in set, or the working
6881 directory.
6882
6883 present(set)
6884
6885 An empty set, if any revision in set isn't found; otherwise, all
6886 revisions in set.
6887
6888 If any of specified revisions is not present in the local repos‐
6889 itory, the query is normally aborted. But this predicate allows
6890 the query to continue even in such cases.
6891
6892 public()
6893
6894 Changeset in public phase.
6895
6896 remote([id [,path]])
6897
6898 Local revision that corresponds to the given identifier in a re‐
6899 mote repository, if present. Here, the '.' identifier is a syn‐
6900 onym for the current local branch.
6901
6902 removes(pattern)
6903
6904 Changesets which remove files matching pattern.
6905
6906 The pattern without explicit kind like glob: is expected to be
6907 relative to the current directory and match against a file or a
6908 directory.
6909
6910 rev(number)
6911
6912 Revision with the given numeric identifier.
6913
6914 reverse(set)
6915
6916 Reverse order of set.
6917
6918 revset(set)
6919
6920 Strictly interpret the content as a revset.
6921
6922 The content of this special predicate will be strictly inter‐
6923 preted as a revset. For example, revset(id(0)) will be inter‐
6924 preted as "id(0)" without possible ambiguity with a "id(0)"
6925 bookmark or tag.
6926
6927 roots(set)
6928
6929 Changesets in set with no parent changeset in set.
6930
6931 secret()
6932
6933 Changeset in secret phase.
6934
6935 sort(set[, [-]key... [, ...]])
6936
6937 Sort set by keys. The default sort order is ascending, specify a
6938 key as -key to sort in descending order.
6939
6940 The keys can be:
6941
6942 • rev for the revision number,
6943
6944 • branch for the branch name,
6945
6946 • desc for the commit message (description),
6947
6948 • user for user name (author can be used as an alias),
6949
6950 • date for the commit date
6951
6952 • topo for a reverse topographical sort
6953
6954 • node the nodeid of the revision
6955
6956 The topo sort order cannot be combined with other sort keys.
6957 This sort takes one optional argument, topo.firstbranch, which
6958 takes a revset that specifies what topographical branches to
6959 prioritize in the sort.
6960
6961 subrepo([pattern])
6962
6963 Changesets that add, modify or remove the given subrepo. If no
6964 subrepo pattern is named, any subrepo changes are returned.
6965
6966 tag([name])
6967
6968 The specified tag by name, or all tagged revisions if no name is
6969 given.
6970
6971 Pattern matching is supported for name. See hg help revi‐
6972 sions.patterns.
6973
6974 user(string)
6975
6976 User name contains string. The match is case-insensitive.
6977
6978 Pattern matching is supported for string. See hg help revi‐
6979 sions.patterns.
6980
6981 Aliases
6982 New predicates (known as "aliases") can be defined, using any combina‐
6983 tion of existing predicates or other aliases. An alias definition looks
6984 like:
6985
6986 <alias> = <definition>
6987
6988 in the revsetalias section of a Mercurial configuration file. Arguments
6989 of the form a1, a2, etc. are substituted from the alias into the defi‐
6990 nition.
6991
6992 For example,
6993
6994 [revsetalias]
6995 h = heads()
6996 d(s) = sort(s, date)
6997 rs(s, k) = reverse(sort(s, k))
6998
6999 defines three aliases, h, d, and rs. rs(0:tip, author) is exactly
7000 equivalent to reverse(sort(0:tip, author)).
7001
7002 Equivalents
7003 Command line equivalents for hg log:
7004
7005 -f -> ::.
7006 -d x -> date(x)
7007 -k x -> keyword(x)
7008 -m -> merge()
7009 -u x -> user(x)
7010 -b x -> branch(x)
7011 -P x -> !::x
7012 -l x -> limit(expr, x)
7013
7014 Examples
7015 Some sample queries:
7016
7017 • Changesets on the default branch:
7018
7019 hg log -r "branch(default)"
7020
7021 • Changesets on the default branch since tag 1.5 (excluding merges):
7022
7023 hg log -r "branch(default) and 1.5:: and not merge()"
7024
7025 • Open branch heads:
7026
7027 hg log -r "head() and not closed()"
7028
7029 • Changesets between tags 1.3 and 1.5 mentioning "bug" that affect
7030 hgext/*:
7031
7032 hg log -r "1.3::1.5 and keyword(bug) and file('hgext/*')"
7033
7034 • Changesets committed in May 2008, sorted by user:
7035
7036 hg log -r "sort(date('May 2008'), user)"
7037
7038 • Changesets mentioning "bug" or "issue" that are not in a tagged re‐
7039 lease:
7040
7041 hg log -r "(keyword(bug) or keyword(issue)) and not ancestors(tag())"
7042
7043 • Update to the commit that bookmark @ is pointing to, without activat‐
7044 ing the bookmark (this works because the last revision of the revset
7045 is used):
7046
7047 hg update :@
7048
7049 • Show diff between tags 1.3 and 1.5 (this works because the first and
7050 the last revisions of the revset are used):
7051
7052 hg diff -r 1.3::1.5
7053
7055 It is common for machines (as opposed to humans) to consume Mercurial.
7056 This help topic describes some of the considerations for interfacing
7057 machines with Mercurial.
7058
7059 Choosing an Interface
7060 Machines have a choice of several methods to interface with Mercurial.
7061 These include:
7062
7063 • Executing the hg process
7064
7065 • Querying a HTTP server
7066
7067 • Calling out to a command server
7068
7069 Executing hg processes is very similar to how humans interact with Mer‐
7070 curial in the shell. It should already be familiar to you.
7071
7072 hg serve can be used to start a server. By default, this will start a
7073 "hgweb" HTTP server. This HTTP server has support for machine-readable
7074 output, such as JSON. For more, see hg help hgweb.
7075
7076 hg serve can also start a "command server." Clients can connect to this
7077 server and issue Mercurial commands over a special protocol. For more
7078 details on the command server, including links to client libraries, see
7079 https://www.mercurial-scm.org/wiki/CommandServer.
7080
7081 hg serve based interfaces (the hgweb and command servers) have the ad‐
7082 vantage over simple hg process invocations in that they are likely more
7083 efficient. This is because there is significant overhead to spawn new
7084 Python processes.
7085
7086 Tip If you need to invoke several hg processes in short order and/or
7087 performance is important to you, use of a server-based interface
7088 is highly recommended.
7089
7090 Environment Variables
7091 As documented in hg help environment, various environment variables in‐
7092 fluence the operation of Mercurial. The following are particularly rel‐
7093 evant for machines consuming Mercurial:
7094
7095 HGPLAIN
7096 If not set, Mercurial's output could be influenced by configura‐
7097 tion settings that impact its encoding, verbose mode, localiza‐
7098 tion, etc.
7099
7100 It is highly recommended for machines to set this variable when
7101 invoking hg processes.
7102
7103 HGENCODING
7104 If not set, the locale used by Mercurial will be detected from
7105 the environment. If the determined locale does not support dis‐
7106 play of certain characters, Mercurial may render these character
7107 sequences incorrectly (often by using "?" as a placeholder for
7108 invalid characters in the current locale).
7109
7110 Explicitly setting this environment variable is a good practice
7111 to guarantee consistent results. "utf-8" is a good choice on
7112 UNIX-like environments.
7113
7114 HGRCPATH
7115 If not set, Mercurial will inherit config options from config
7116 files using the process described in hg help config. This in‐
7117 cludes inheriting user or system-wide config files.
7118
7119 When utmost control over the Mercurial configuration is desired,
7120 the value of HGRCPATH can be set to an explicit file with known
7121 good configs. In rare cases, the value can be set to an empty
7122 file or the null device (often /dev/null) to bypass loading of
7123 any user or system config files. Note that these approaches can
7124 have unintended consequences, as the user and system config
7125 files often define things like the username and extensions that
7126 may be required to interface with a repository.
7127
7128 HGRCSKIPREPO
7129 When set, the .hg/hgrc from repositories are not read.
7130
7131 Note that not reading the repository's configuration can have
7132 unintended consequences, as the repository config files can de‐
7133 fine things like extensions that are required for access to the
7134 repository.
7135
7136 Command-line Flags
7137 Mercurial's default command-line parser is designed for humans, and is
7138 not robust against malicious input. For instance, you can start a de‐
7139 bugger by passing --debugger as an option value:
7140
7141 $ REV=--debugger sh -c 'hg log -r "$REV"'
7142
7143 This happens because several command-line flags need to be scanned
7144 without using a concrete command table, which may be modified while
7145 loading repository settings and extensions.
7146
7147 Since Mercurial 4.4.2, the parsing of such flags may be restricted by
7148 setting HGPLAIN=+strictflags. When this feature is enabled, all early
7149 options (e.g. -R/--repository, --cwd, --config) must be specified first
7150 amongst the other global options, and cannot be injected to an arbi‐
7151 trary location:
7152
7153 $ HGPLAIN=+strictflags hg -R "$REPO" log -r "$REV"
7154
7155 In earlier Mercurial versions where +strictflags isn't available, you
7156 can mitigate the issue by concatenating an option value with its flag:
7157
7158 $ hg log -r"$REV" --keyword="$KEYWORD"
7159
7160 Consuming Command Output
7161 It is common for machines to need to parse the output of Mercurial com‐
7162 mands for relevant data. This section describes the various techniques
7163 for doing so.
7164
7165 Parsing Raw Command Output
7166 Likely the simplest and most effective solution for consuming command
7167 output is to simply invoke hg commands as you would as a user and parse
7168 their output.
7169
7170 The output of many commands can easily be parsed with tools like grep,
7171 sed, and awk.
7172
7173 A potential downside with parsing command output is that the output of
7174 commands can change when Mercurial is upgraded. While Mercurial does
7175 generally strive for strong backwards compatibility, command output
7176 does occasionally change. Having tests for your automated interactions
7177 with hg commands is generally recommended, but is even more important
7178 when raw command output parsing is involved.
7179
7180 Using Templates to Control Output
7181 Many hg commands support templatized output via the -T/--template argu‐
7182 ment. For more, see hg help templates.
7183
7184 Templates are useful for explicitly controlling output so that you get
7185 exactly the data you want formatted how you want it. For example, log
7186 -T {node}\n can be used to print a newline delimited list of changeset
7187 nodes instead of a human-tailored output containing authors, dates, de‐
7188 scriptions, etc.
7189
7190 Tip If parsing raw command output is too complicated, consider using
7191 templates to make your life easier.
7192
7193 The -T/--template argument allows specifying pre-defined styles. Mer‐
7194 curial ships with the machine-readable styles cbor, json, and xml,
7195 which provide CBOR, JSON, and XML output, respectively. These are use‐
7196 ful for producing output that is machine readable as-is.
7197
7198 (Mercurial 5.0 is required for CBOR style.)
7199
7200 Important
7201 The json and xml styles are considered experimental. While they
7202 may be attractive to use for easily obtaining machine-readable
7203 output, their behavior may change in subsequent versions.
7204
7205 These styles may also exhibit unexpected results when dealing
7206 with certain encodings. Mercurial treats things like filenames
7207 as a series of bytes and normalizing certain byte sequences to
7208 JSON or XML with certain encoding settings can lead to sur‐
7209 prises.
7210
7211 Command Server Output
7212 If using the command server to interact with Mercurial, you are likely
7213 using an existing library/API that abstracts implementation details of
7214 the command server. If so, this interface layer may perform parsing for
7215 you, saving you the work of implementing it yourself.
7216
7217 Output Verbosity
7218 Commands often have varying output verbosity, even when machine read‐
7219 able styles are being used (e.g. -T json). Adding -v/--verbose and
7220 --debug to the command's arguments can increase the amount of data ex‐
7221 posed by Mercurial.
7222
7223 An alternate way to get the data you need is by explicitly specifying a
7224 template.
7225
7226 Other Topics
7227 revsets
7228 Revisions sets is a functional query language for selecting a
7229 set of revisions. Think of it as SQL for Mercurial repositories.
7230 Revsets are useful for querying repositories for specific data.
7231
7232 See hg help revsets for more.
7233
7234 share extension
7235 The share extension provides functionality for sharing reposi‐
7236 tory data across several working copies. It can even automati‐
7237 cally "pool" storage for logically related repositories when
7238 cloning.
7239
7240 Configuring the share extension can lead to significant resource
7241 utilization reduction, particularly around disk space and the
7242 network. This is especially true for continuous integration (CI)
7243 environments.
7244
7245 See hg help -e share for more.
7246
7248 Subrepositories let you nest external repositories or projects into a
7249 parent Mercurial repository, and make commands operate on them as a
7250 group.
7251
7252 Mercurial currently supports Mercurial, Git, and Subversion subreposi‐
7253 tories.
7254
7255 Subrepositories are made of three components:
7256
7257 1. Nested repository checkouts. They can appear anywhere in the parent
7258 working directory.
7259
7260 2. Nested repository references. They are defined in .hgsub, which
7261 should be placed in the root of working directory, and tell where
7262 the subrepository checkouts come from. Mercurial subrepositories are
7263 referenced like:
7264
7265 path/to/nested = https://example.com/nested/repo/path
7266
7267 Git and Subversion subrepos are also supported:
7268
7269 path/to/nested = [git]git://example.com/nested/repo/path
7270 path/to/nested = [svn]https://example.com/nested/trunk/path
7271
7272 where path/to/nested is the checkout location relatively to the par‐
7273 ent Mercurial root, and https://example.com/nested/repo/path is the
7274 source repository path. The source can also reference a filesystem
7275 path.
7276
7277 Note that .hgsub does not exist by default in Mercurial reposito‐
7278 ries, you have to create and add it to the parent repository before
7279 using subrepositories.
7280
7281 3. Nested repository states. They are defined in .hgsubstate, which is
7282 placed in the root of working directory, and capture whatever infor‐
7283 mation is required to restore the subrepositories to the state they
7284 were committed in a parent repository changeset. Mercurial automati‐
7285 cally record the nested repositories states when committing in the
7286 parent repository.
7287
7288 Note
7289 The .hgsubstate file should not be edited manually.
7290
7291 Adding a Subrepository
7292 If .hgsub does not exist, create it and add it to the parent reposi‐
7293 tory. Clone or checkout the external projects where you want it to live
7294 in the parent repository. Edit .hgsub and add the subrepository entry
7295 as described above. At this point, the subrepository is tracked and the
7296 next commit will record its state in .hgsubstate and bind it to the
7297 committed changeset.
7298
7299 Synchronizing a Subrepository
7300 Subrepos do not automatically track the latest changeset of their
7301 sources. Instead, they are updated to the changeset that corresponds
7302 with the changeset checked out in the top-level changeset. This is so
7303 developers always get a consistent set of compatible code and libraries
7304 when they update.
7305
7306 Thus, updating subrepos is a manual process. Simply check out target
7307 subrepo at the desired revision, test in the top-level repo, then com‐
7308 mit in the parent repository to record the new combination.
7309
7310 Deleting a Subrepository
7311 To remove a subrepository from the parent repository, delete its refer‐
7312 ence from .hgsub, then remove its files.
7313
7314 Interaction with Mercurial Commands
7315 add add does not recurse in subrepos unless -S/--subrepos is speci‐
7316 fied. However, if you specify the full path of a file in a sub‐
7317 repo, it will be added even without -S/--subrepos specified.
7318 Subversion subrepositories are currently silently ignored.
7319
7320 addremove
7321 addremove does not recurse into subrepos unless -S/--subrepos is
7322 specified. However, if you specify the full path of a directory
7323 in a subrepo, addremove will be performed on it even without
7324 -S/--subrepos being specified. Git and Subversion subreposito‐
7325 ries will print a warning and continue.
7326
7327 archive
7328 archive does not recurse in subrepositories unless -S/--subrepos
7329 is specified.
7330
7331 cat Git subrepositories only support exact file matches. Subversion
7332 subrepositories are currently ignored.
7333
7334 commit commit creates a consistent snapshot of the state of the entire
7335 project and its subrepositories. If any subrepositories have
7336 been modified, Mercurial will abort. Mercurial can be made to
7337 instead commit all modified subrepositories by specifying
7338 -S/--subrepos, or setting "ui.commitsubrepos=True" in a configu‐
7339 ration file (see hg help config). After there are no longer any
7340 modified subrepositories, it records their state and finally
7341 commits it in the parent repository. The --addremove option
7342 also honors the -S/--subrepos option. However, Git and Subver‐
7343 sion subrepositories will print a warning and abort.
7344
7345 diff diff does not recurse in subrepos unless -S/--subrepos is speci‐
7346 fied. However, if you specify the full path of a file or direc‐
7347 tory in a subrepo, it will be diffed even without -S/--subrepos
7348 being specified. Subversion subrepositories are currently
7349 silently ignored.
7350
7351 files files does not recurse into subrepos unless -S/--subrepos is
7352 specified. However, if you specify the full path of a file or
7353 directory in a subrepo, it will be displayed even without
7354 -S/--subrepos being specified. Git and Subversion subreposito‐
7355 ries are currently silently ignored.
7356
7357 forget forget currently only handles exact file matches in subrepos.
7358 Git and Subversion subrepositories are currently silently ig‐
7359 nored.
7360
7361 incoming
7362 incoming does not recurse in subrepos unless -S/--subrepos is
7363 specified. Git and Subversion subrepositories are currently
7364 silently ignored.
7365
7366 outgoing
7367 outgoing does not recurse in subrepos unless -S/--subrepos is
7368 specified. Git and Subversion subrepositories are currently
7369 silently ignored.
7370
7371 pull pull is not recursive since it is not clear what to pull prior
7372 to running hg update. Listing and retrieving all subrepositories
7373 changes referenced by the parent repository pulled changesets is
7374 expensive at best, impossible in the Subversion case.
7375
7376 push Mercurial will automatically push all subrepositories first when
7377 the parent repository is being pushed. This ensures new sub‐
7378 repository changes are available when referenced by top-level
7379 repositories. Push is a no-op for Subversion subrepositories.
7380
7381 serve serve does not recurse into subrepositories unless -S/--subrepos
7382 is specified. Git and Subversion subrepositories are currently
7383 silently ignored.
7384
7385 status status does not recurse into subrepositories unless -S/--subre‐
7386 pos is specified. Subrepository changes are displayed as regular
7387 Mercurial changes on the subrepository elements. Subversion sub‐
7388 repositories are currently silently ignored.
7389
7390 remove remove does not recurse into subrepositories unless -S/--subre‐
7391 pos is specified. However, if you specify a file or directory
7392 path in a subrepo, it will be removed even without -S/--subre‐
7393 pos. Git and Subversion subrepositories are currently silently
7394 ignored.
7395
7396 update update restores the subrepos in the state they were originally
7397 committed in target changeset. If the recorded changeset is not
7398 available in the current subrepository, Mercurial will pull it
7399 in first before updating. This means that updating can require
7400 network access when using subrepositories.
7401
7402 Remapping Subrepositories Sources
7403 A subrepository source location may change during a project life, in‐
7404 validating references stored in the parent repository history. To fix
7405 this, rewriting rules can be defined in parent repository hgrc file or
7406 in Mercurial configuration. See the [subpaths] section in hgrc(5) for
7407 more details.
7408
7410 Mercurial allows you to customize output of commands through templates.
7411 You can either pass in a template or select an existing template-style
7412 from the command line, via the --template option.
7413
7414 You can customize output for any "log-like" command: log, outgoing, in‐
7415 coming, tip, parents, and heads.
7416
7417 Some built-in styles are packaged with Mercurial. These can be listed
7418 with hg log --template list. Example usage:
7419
7420 $ hg log -r1.0::1.1 --template changelog
7421
7422 A template is a piece of text, with markup to invoke variable expan‐
7423 sion:
7424
7425 $ hg log -r1 --template "{node}\n"
7426 b56ce7b07c52de7d5fd79fb89701ea538af65746
7427
7428 Keywords
7429 Strings in curly braces are called keywords. The availability of key‐
7430 words depends on the exact context of the templater. These keywords are
7431 usually available for templating a log-like command:
7432
7433 activebookmark
7434 String. The active bookmark, if it is associated with the
7435 changeset.
7436
7437 author Alias for {user}
7438
7439 bisect String. The changeset bisection status.
7440
7441 bookmarks
7442 List of strings. Any bookmarks associated with the changeset.
7443 Also sets 'active', the name of the active bookmark.
7444
7445 branch String. The name of the branch on which the changeset was com‐
7446 mitted.
7447
7448 changessincelatesttag
7449 Integer. All ancestors not in the latest tag.
7450
7451 children
7452 List of strings. The children of the changeset.
7453
7454 date Date information. The date when the changeset was committed.
7455
7456 desc String. The text of the changeset description.
7457
7458 diffstat
7459 String. Statistics of changes with the following format: "modi‐
7460 fied files: +added/-removed lines"
7461
7462 extras List of dicts with key, value entries of the 'extras' field of
7463 this changeset.
7464
7465 file_adds
7466 List of strings. Files added by this changeset.
7467
7468 file_copies
7469 List of strings. Files copied in this changeset with their
7470 sources.
7471
7472 file_copies_switch
7473 List of strings. Like "file_copies" but displayed only if the
7474 --copied switch is set.
7475
7476 file_dels
7477 List of strings. Files removed by this changeset.
7478
7479 file_mods
7480 List of strings. Files modified by this changeset.
7481
7482 files List of strings. All files modified, added, or removed by this
7483 changeset.
7484
7485 graphnode
7486 String. The character representing the changeset node in an
7487 ASCII revision graph.
7488
7489 graphwidth
7490 Integer. The width of the graph drawn by 'log --graph' or zero.
7491
7492 index Integer. The current iteration of the loop. (0 indexed)
7493
7494 latesttag
7495 List of strings. The global tags on the most recent globally
7496 tagged ancestor of this changeset. If no such tags exist, the
7497 list consists of the single string "null".
7498
7499 latesttagdistance
7500 Integer. Longest path to the latest tag.
7501
7502 namespaces
7503 Dict of lists. Names attached to this changeset per namespace.
7504
7505 negrev Integer. The repository-local changeset negative revision num‐
7506 ber, which counts in the opposite direction.
7507
7508 node String. The changeset identification hash, as a 40 hexadecimal
7509 digit string.
7510
7511 onelinesummary
7512 String. A one-line summary for the ctx (not including trailing
7513 newline). The default template be overridden in command-tem‐
7514 plates.oneline-summary.
7515
7516 p1 Changeset. The changeset's first parent. {p1.rev} for the revi‐
7517 sion number, and {p1.node} for the identification hash.
7518
7519 p2 Changeset. The changeset's second parent. {p2.rev} for the revi‐
7520 sion number, and {p2.node} for the identification hash.
7521
7522 parents
7523 List of strings. The parents of the changeset in "rev:node" for‐
7524 mat. If the changeset has only one "natural" parent (the prede‐
7525 cessor revision) nothing is shown.
7526
7527 peerurls
7528 A dictionary of repository locations defined in the [paths] sec‐
7529 tion of your configuration file.
7530
7531 phase String. The changeset phase name.
7532
7533 reporoot
7534 String. The root directory of the current repository.
7535
7536 rev Integer. The repository-local changeset revision number.
7537
7538 subrepos
7539 List of strings. Updated subrepositories in the changeset.
7540
7541 tags List of strings. Any tags associated with the changeset.
7542
7543 termwidth
7544 Integer. The width of the current terminal.
7545
7546 user String. The unmodified author of the changeset.
7547
7548 verbosity
7549 String. The current output verbosity in 'debug', 'quiet', 'ver‐
7550 bose', or ''.
7551
7552 The "date" keyword does not produce human-readable output. If you want
7553 to use a date in your output, you can use a filter to process it. Fil‐
7554 ters are functions which return a string based on the input variable.
7555 Be sure to use the stringify filter first when you're applying a
7556 string-input filter to a list-like input variable. You can also use a
7557 chain of filters to get the desired output:
7558
7559 $ hg tip --template "{date|isodate}\n"
7560 2008-08-21 18:22 +0000
7561
7562 Filters
7563 List of filters:
7564
7565 addbreaks
7566 Any text. Add an XHTML "<br />" tag before the end of every line
7567 except the last.
7568
7569 age Date. Returns a human-readable date/time difference between the
7570 given date/time and the current date/time.
7571
7572 basename
7573 Any text. Treats the text as a path, and returns the last compo‐
7574 nent of the path after splitting by the path separator. For ex‐
7575 ample, "foo/bar/baz" becomes "baz" and "foo/bar//" becomes "".
7576
7577 cbor Any object. Serializes the object to CBOR bytes.
7578
7579 commondir
7580 List of text. Treats each list item as file name with / as path
7581 separator and returns the longest common directory prefix shared
7582 by all list items. Returns the empty string if no common prefix
7583 exists.
7584
7585 The list items are not normalized, i.e. "foo/../bar" is handled
7586 as file "bar" in the directory "foo/..". Leading slashes are ig‐
7587 nored.
7588
7589 For example, ["foo/bar/baz", "foo/baz/bar"] becomes "foo" and
7590 ["foo/bar", "baz"] becomes "".
7591
7592 count List or text. Returns the length as an integer.
7593
7594 dirname
7595 Any text. Treats the text as a path, and strips the last compo‐
7596 nent of the path after splitting by the path separator.
7597
7598 domain Any text. Finds the first string that looks like an email ad‐
7599 dress, and extracts just the domain component. Example: User
7600 <user@example.com> becomes example.com.
7601
7602 email Any text. Extracts the first string that looks like an email ad‐
7603 dress. Example: User <user@example.com> becomes user@exam‐
7604 ple.com.
7605
7606 emailuser
7607 Any text. Returns the user portion of an email address.
7608
7609 escape Any text. Replaces the special XML/XHTML characters "&", "<" and
7610 ">" with XML entities, and filters out NUL characters.
7611
7612 fill68 Any text. Wraps the text to fit in 68 columns.
7613
7614 fill76 Any text. Wraps the text to fit in 76 columns.
7615
7616 firstline
7617 Any text. Returns the first line of text.
7618
7619 hex Any text. Convert a binary Mercurial node identifier into its
7620 long hexadecimal representation.
7621
7622 hgdate Date. Returns the date as a pair of numbers: "1157407993 25200"
7623 (Unix timestamp, timezone offset).
7624
7625 isodate
7626 Date. Returns the date in ISO 8601 format: "2009-08-18 13:00
7627 +0200".
7628
7629 isodatesec
7630 Date. Returns the date in ISO 8601 format, including seconds:
7631 "2009-08-18 13:00:13 +0200". See also the rfc3339date filter.
7632
7633 json Any object. Serializes the object to a JSON formatted text.
7634
7635 lower Any text. Converts the text to lowercase.
7636
7637 nonempty
7638 Any text. Returns '(none)' if the string is empty.
7639
7640 obfuscate
7641 Any text. Returns the input text rendered as a sequence of XML
7642 entities.
7643
7644 person Any text. Returns the name before an email address, interpreting
7645 it as per RFC 5322.
7646
7647 revescape
7648 Any text. Escapes all "special" characters, except @. Forward
7649 slashes are escaped twice to prevent web servers from prema‐
7650 turely unescaping them. For example, "@foo bar/baz" becomes
7651 "@foo%20bar%252Fbaz".
7652
7653 rfc3339date
7654 Date. Returns a date using the Internet date format specified in
7655 RFC 3339: "2009-08-18T13:00:13+02:00".
7656
7657 rfc822date
7658 Date. Returns a date using the same format used in email head‐
7659 ers: "Tue, 18 Aug 2009 13:00:13 +0200".
7660
7661 short Changeset hash. Returns the short form of a changeset hash, i.e.
7662 a 12 hexadecimal digit string.
7663
7664 shortbisect
7665 Any text. Treats label as a bisection status, and returns a sin‐
7666 gle-character representing the status (G: good, B: bad, S:
7667 skipped, U: untested, I: ignored). Returns single space if text
7668 is not a valid bisection status.
7669
7670 shortdate
7671 Date. Returns a date like "2006-09-18".
7672
7673 slashpath
7674 Any text. Replaces the native path separator with slash.
7675
7676 splitlines
7677 Any text. Split text into a list of lines.
7678
7679 stringify
7680 Any type. Turns the value into text by converting values into
7681 text and concatenating them.
7682
7683 stripdir
7684 Treat the text as path and strip a directory level, if possible.
7685 For example, "foo" and "foo/bar" becomes "foo".
7686
7687 tabindent
7688 Any text. Returns the text, with every non-empty line except the
7689 first starting with a tab character.
7690
7691 upper Any text. Converts the text to uppercase.
7692
7693 urlescape
7694 Any text. Escapes all "special" characters. For example, "foo
7695 bar" becomes "foo%20bar".
7696
7697 user Any text. Returns a short representation of a user name or email
7698 address.
7699
7700 utf8 Any text. Converts from the local character encoding to UTF-8.
7701
7702 Note that a filter is nothing more than a function call, i.e.
7703 expr|filter is equivalent to filter(expr).
7704
7705 Functions
7706 In addition to filters, there are some basic built-in functions:
7707
7708 config(section, name[, default])
7709 Returns the requested hgrc config option as a string.
7710
7711 configbool(section, name[, default])
7712 Returns the requested hgrc config option as a boolean.
7713
7714 configint(section, name[, default])
7715 Returns the requested hgrc config option as an integer.
7716
7717 date(date[, fmt])
7718 Format a date. See hg help dates for formatting strings. The de‐
7719 fault is a Unix date format, including the timezone: "Mon Sep 04
7720 15:13:13 2006 0700".
7721
7722 dict([[key=]value...])
7723 Construct a dict from key-value pairs. A key may be omitted if a
7724 value expression can provide an unambiguous name.
7725
7726 diff([includepattern [, excludepattern]])
7727 Show a diff, optionally specifying files to include or exclude.
7728
7729 files(pattern)
7730 All files of the current changeset matching the pattern. See hg
7731 help patterns.
7732
7733 fill(text[, width[, initialident[, hangindent]]])
7734 Fill many paragraphs with optional indentation. See the "fill"
7735 filter.
7736
7737 filter(iterable[, expr])
7738 Remove empty elements from a list or a dict. If expr specified,
7739 it's applied to each element to test emptiness.
7740
7741 get(dict, key)
7742 Get an attribute/key from an object. Some keywords are complex
7743 types. This function allows you to obtain the value of an attri‐
7744 bute on these types.
7745
7746 if(expr, then[, else])
7747 Conditionally execute based on the result of an expression.
7748
7749 ifcontains(needle, haystack, then[, else])
7750 Conditionally execute based on whether the item "needle" is in
7751 "haystack".
7752
7753 ifeq(expr1, expr2, then[, else])
7754 Conditionally execute based on whether 2 items are equivalent.
7755
7756 indent(text, indentchars[, firstline])
7757 Indents all non-empty lines with the characters given in the in‐
7758 dentchars string. An optional third parameter will override the
7759 indent for the first line only if present.
7760
7761 join(list, sep)
7762 Join items in a list with a delimiter.
7763
7764 label(label, expr)
7765 Apply a label to generated content. Content with a label applied
7766 can result in additional post-processing, such as automatic col‐
7767 orization.
7768
7769 latesttag([pattern])
7770 The global tags matching the given pattern on the most recent
7771 globally tagged ancestor of this changeset. If no such tags ex‐
7772 ist, the "{tag}" template resolves to the string "null". See hg
7773 help revisions.patterns for the pattern syntax.
7774
7775 localdate(date[, tz])
7776 Converts a date to the specified timezone. The default is local
7777 date.
7778
7779 mailmap(author)
7780 Return the author, updated according to the value set in the
7781 .mailmap file
7782
7783 max(iterable)
7784 Return the max of an iterable
7785
7786 min(iterable)
7787 Return the min of an iterable
7788
7789 mod(a, b)
7790 Calculate a mod b such that a / b + a mod b == a
7791
7792 pad(text, width[, fillchar=' '[, left=False[, truncate=False]]])
7793 Pad text with a fill character.
7794
7795 relpath(path)
7796 Convert a repository-absolute path into a filesystem path rela‐
7797 tive to the current working directory.
7798
7799 revset(query[, formatargs...])
7800 Execute a revision set query. See hg help revset.
7801
7802 rstdoc(text, style)
7803 Format reStructuredText.
7804
7805 search(pattern, text)
7806 Look for the first text matching the regular expression pattern.
7807 Groups are accessible as {1}, {2}, ... in %-mapped template.
7808
7809 separate(sep, args...)
7810 Add a separator between non-empty arguments.
7811
7812 shortest(node, minlength=4)
7813 Obtain the shortest representation of a node.
7814
7815 startswith(pattern, text)
7816 Returns the value from the "text" argument if it begins with the
7817 content from the "pattern" argument.
7818
7819 strip(text[, chars])
7820 Strip characters from a string. By default, strips all leading
7821 and trailing whitespace.
7822
7823 sub(pattern, replacement, expression)
7824 Perform text substitution using regular expressions.
7825
7826 subsetparents(rev, revset)
7827 Look up parents of the rev in the sub graph given by the revset.
7828
7829 word(number, text[, separator])
7830 Return the nth word from a string.
7831
7832 Operators
7833 We provide a limited set of infix arithmetic operations on integers:
7834
7835 + for addition
7836 - for subtraction
7837 * for multiplication
7838 / for floor division (division rounded to integer nearest -infinity)
7839
7840 Division fulfills the law x = x / y + mod(x, y).
7841
7842 Also, for any expression that returns a list, there is a list operator:
7843
7844 expr % "{template}"
7845
7846 As seen in the above example, {template} is interpreted as a template.
7847 To prevent it from being interpreted, you can use an escape character
7848 \{ or a raw string prefix, r'...'.
7849
7850 The dot operator can be used as a shorthand for accessing a sub item:
7851
7852 • expr.member is roughly equivalent to expr % '{member}' if expr re‐
7853 turns a non-list/dict. The returned value is not stringified.
7854
7855 • dict.key is identical to get(dict, 'key').
7856
7857 Aliases
7858 New keywords and functions can be defined in the templatealias section
7859 of a Mercurial configuration file:
7860
7861 <alias> = <definition>
7862
7863 Arguments of the form a1, a2, etc. are substituted from the alias into
7864 the definition.
7865
7866 For example,
7867
7868 [templatealias]
7869 r = rev
7870 rn = "{r}:{node|short}"
7871 leftpad(s, w) = pad(s, w, ' ', True)
7872
7873 defines two symbol aliases, r and rn, and a function alias leftpad().
7874
7875 It's also possible to specify complete template strings, using the tem‐
7876 plates section. The syntax used is the general template string syntax.
7877
7878 For example,
7879
7880 [templates]
7881 nodedate = "{node|short}: {date(date, "%Y-%m-%d")}\n"
7882
7883 defines a template, nodedate, which can be called like:
7884
7885 $ hg log -r . -Tnodedate
7886
7887 A template defined in templates section can also be referenced from an‐
7888 other template:
7889
7890 $ hg log -r . -T "{rev} {nodedate}"
7891
7892 but be aware that the keywords cannot be overridden by templates. For
7893 example, a template defined as templates.rev cannot be referenced as
7894 {rev}.
7895
7896 A template defined in templates section may have sub templates which
7897 are inserted before/after/between items:
7898
7899 [templates]
7900 myjson = ' {dict(rev, node|short)|json}'
7901 myjson:docheader = '\{\n'
7902 myjson:docfooter = '\n}\n'
7903 myjson:separator = ',\n'
7904
7905 Examples
7906 Some sample command line templates:
7907
7908 • Format lists, e.g. files:
7909
7910 $ hg log -r 0 --template "files:\n{files % ' {file}\n'}"
7911
7912 • Join the list of files with a ", ":
7913
7914 $ hg log -r 0 --template "files: {join(files, ', ')}\n"
7915
7916 • Join the list of files ending with ".py" with a ", ":
7917
7918 $ hg log -r 0 --template "pythonfiles: {join(files('**.py'), ', ')}\n"
7919
7920 • Separate non-empty arguments by a " ":
7921
7922 $ hg log -r 0 --template "{separate(' ', node, bookmarks, tags}\n"
7923
7924 • Modify each line of a commit description:
7925
7926 $ hg log --template "{splitlines(desc) % '**** {line}\n'}"
7927
7928 • Format date:
7929
7930 $ hg log -r 0 --template "{date(date, '%Y')}\n"
7931
7932 • Display date in UTC:
7933
7934 $ hg log -r 0 --template "{localdate(date, 'UTC')|date}\n"
7935
7936 • Output the description set to a fill-width of 30:
7937
7938 $ hg log -r 0 --template "{fill(desc, 30)}"
7939
7940 • Use a conditional to test for the default branch:
7941
7942 $ hg log -r 0 --template "{ifeq(branch, 'default', 'on the main branch',
7943 'on branch {branch}')}\n"
7944
7945 • Append a newline if not empty:
7946
7947 $ hg tip --template "{if(author, '{author}\n')}"
7948
7949 • Label the output for use with the color extension:
7950
7951 $ hg log -r 0 --template "{label('changeset.{phase}', node|short)}\n"
7952
7953 • Invert the firstline filter, i.e. everything but the first line:
7954
7955 $ hg log -r 0 --template "{sub(r'^.*\n?\n?', '', desc)}\n"
7956
7957 • Display the contents of the 'extra' field, one per line:
7958
7959 $ hg log -r 0 --template "{join(extras, '\n')}\n"
7960
7961 • Mark the active bookmark with '*':
7962
7963 $ hg log --template "{bookmarks % '{bookmark}{ifeq(bookmark, active, '*')} '}\n"
7964
7965 • Find the previous release candidate tag, the distance and changes
7966 since the tag:
7967
7968 $ hg log -r . --template "{latesttag('re:^.*-rc$') % '{tag}, {changes}, {distance}'}\n"
7969
7970 • Mark the working copy parent with '@':
7971
7972 $ hg log --template "{ifcontains(rev, revset('.'), '@')}\n"
7973
7974 • Show details of parent revisions:
7975
7976 $ hg log --template "{revset('parents(%d)', rev) % '{desc|firstline}\n'}"
7977
7978 • Show only commit descriptions that start with "template":
7979
7980 $ hg log --template "{startswith('template', firstline(desc))}\n"
7981
7982 • Print the first word of each line of a commit message:
7983
7984 $ hg log --template "{word(0, desc)}\n"
7985
7987 Valid URLs are of the form:
7988
7989 local/filesystem/path[#revision]
7990 file://local/filesystem/path[#revision]
7991 http://[user[:pass]@]host[:port]/[path][#revision]
7992 https://[user[:pass]@]host[:port]/[path][#revision]
7993 ssh://[user@]host[:port]/[path][#revision]
7994 path://pathname
7995
7996 Paths in the local filesystem can either point to Mercurial reposito‐
7997 ries or to bundle files (as created by hg bundle or hg incoming --bun‐
7998 dle). See also hg help paths.
7999
8000 An optional identifier after # indicates a particular branch, tag, or
8001 changeset to use from the remote repository. See also hg help revisions
8002 .
8003
8004 Some features, such as pushing to http:// and https:// URLs are only
8005 possible if the feature is explicitly enabled on the remote Mercurial
8006 server.
8007
8008 Note that the security of HTTPS URLs depends on proper configuration of
8009 web.cacerts.
8010
8011 Some notes about using SSH with Mercurial:
8012
8013 • SSH requires an accessible shell account on the destination machine
8014 and a copy of hg in the remote path or specified with remotecmd.
8015
8016 • path is relative to the remote user's home directory by default. Use
8017 an extra slash at the start of a path to specify an absolute path:
8018
8019 ssh://example.com//tmp/repository
8020
8021 • Mercurial doesn't use its own compression via SSH; the right thing to
8022 do is to configure it in your ~/.ssh/config, e.g.:
8023
8024 Host *.mylocalnetwork.example.com
8025 Compression no
8026 Host *
8027 Compression yes
8028
8029 Alternatively specify "ssh -C" as your ssh command in your configura‐
8030 tion file or with the --ssh command line option.
8031
8032 These URLs can all be stored in your configuration file with path
8033 aliases under the [paths] section like so:
8034
8035 [paths]
8036 alias1 = URL1
8037 alias2 = URL2
8038 ...
8039
8040 You can then use the alias for any command that uses a URL (for example
8041 hg pull alias1 will be treated as hg pull URL1).
8042
8043 Two path aliases are special because they are used as defaults when you
8044 do not provide the URL to a command:
8045
8046 default:
8047 When you create a repository with hg clone, the clone command
8048 saves the location of the source repository as the new reposi‐
8049 tory's 'default' path. This is then used when you omit path from
8050 push- and pull-like commands (including incoming and outgoing).
8051
8052 default-push:
8053 The push command will look for a path named 'default-push', and
8054 prefer it over 'default' if both are defined.
8055
8056 These alias can also be use in the path:// scheme:
8057
8058 [paths]
8059 alias1 = URL1
8060 alias2 = path://alias1
8061 ...
8062
8063 check hg help config.paths for details about the behavior of such
8064 "sub-path".
8065
8067 This section contains help for extensions that are distributed together
8068 with Mercurial. Help for other extensions is available in the help sys‐
8069 tem.
8070
8071 absorb
8072 apply working directory changes to changesets (EXPERIMENTAL)
8073
8074 The absorb extension provides a command to use annotate information to
8075 amend modified chunks into the corresponding non-public changesets.
8076
8077 [absorb]
8078 # only check 50 recent non-public changesets at most
8079 max-stack-size = 50
8080 # whether to add noise to new commits to avoid obsolescence cycle
8081 add-noise = 1
8082 # make `amend --correlated` a shortcut to the main command
8083 amend-flag = correlated
8084
8085 [color]
8086 absorb.description = yellow
8087 absorb.node = blue bold
8088 absorb.path = bold
8089
8090 Commands
8091 Change creation
8092 absorb
8093 incorporate corrections into the stack of draft changesets:
8094
8095 hg absorb [OPTION] [FILE]...
8096
8097 absorb analyzes each change in your working directory and attempts to
8098 amend the changed lines into the changesets in your stack that first
8099 introduced those lines.
8100
8101 If absorb cannot find an unambiguous changeset to amend for a change,
8102 that change will be left in the working directory, untouched. They can
8103 be observed by hg status or hg diff afterwards. In other words, absorb
8104 does not write to the working directory.
8105
8106 Changesets outside the revset ::. and not public() and not merge() will
8107 not be changed.
8108
8109 Changesets that become empty after applying the changes will be
8110 deleted.
8111
8112 By default, absorb will show what it plans to do and prompt for confir‐
8113 mation. If you are confident that the changes will be absorbed to the
8114 correct place, run hg absorb -a to apply the changes immediately.
8115
8116 Returns 0 on success, 1 if all chunks were ignored and nothing amended.
8117
8118 Options:
8119
8120 -a, --apply-changes
8121 apply changes without prompting for confirmation
8122
8123 -p, --print-changes
8124 always print which changesets are modified by which changes
8125
8126 -i, --interactive
8127 interactively select which chunks to apply
8128
8129 -e, --edit-lines
8130 edit what lines belong to which changesets before commit (EXPER‐
8131 IMENTAL)
8132
8133 -n, --dry-run
8134 do not perform actions, just print output
8135
8136 --style <STYLE>
8137 display using template map file (DEPRECATED)
8138
8139 -T,--template <TEMPLATE>
8140 display with template
8141
8142 -I,--include <PATTERN[+]>
8143 include names matching the given patterns
8144
8145 -X,--exclude <PATTERN[+]>
8146 exclude names matching the given patterns
8147
8148 [+] marked option can be specified multiple times
8149
8150 acl
8151 hooks for controlling repository access
8152
8153 This hook makes it possible to allow or deny write access to given
8154 branches and paths of a repository when receiving incoming changesets
8155 via pretxnchangegroup and pretxncommit.
8156
8157 The authorization is matched based on the local user name on the system
8158 where the hook runs, and not the committer of the original changeset
8159 (since the latter is merely informative).
8160
8161 The acl hook is best used along with a restricted shell like hgsh, pre‐
8162 venting authenticating users from doing anything other than pushing or
8163 pulling. The hook is not safe to use if users have interactive shell
8164 access, as they can then disable the hook. Nor is it safe if remote
8165 users share an account, because then there is no way to distinguish
8166 them.
8167
8168 The order in which access checks are performed is:
8169
8170 1. Deny list for branches (section acl.deny.branches)
8171
8172 2. Allow list for branches (section acl.allow.branches)
8173
8174 3. Deny list for paths (section acl.deny)
8175
8176 4. Allow list for paths (section acl.allow)
8177
8178 The allow and deny sections take key-value pairs.
8179
8180 Branch-based Access Control
8181 Use the acl.deny.branches and acl.allow.branches sections to have
8182 branch-based access control. Keys in these sections can be either:
8183
8184 • a branch name, or
8185
8186 • an asterisk, to match any branch;
8187
8188 The corresponding values can be either:
8189
8190 • a comma-separated list containing users and groups, or
8191
8192 • an asterisk, to match anyone;
8193
8194 You can add the "!" prefix to a user or group name to invert the sense
8195 of the match.
8196
8197 Path-based Access Control
8198 Use the acl.deny and acl.allow sections to have path-based access con‐
8199 trol. Keys in these sections accept a subtree pattern (with a glob syn‐
8200 tax by default). The corresponding values follow the same syntax as the
8201 other sections above.
8202
8203 Bookmark-based Access Control
8204 Use the acl.deny.bookmarks and acl.allow.bookmarks sections to have
8205 bookmark-based access control. Keys in these sections can be either:
8206
8207 • a bookmark name, or
8208
8209 • an asterisk, to match any bookmark;
8210
8211 The corresponding values can be either:
8212
8213 • a comma-separated list containing users and groups, or
8214
8215 • an asterisk, to match anyone;
8216
8217 You can add the "!" prefix to a user or group name to invert the sense
8218 of the match.
8219
8220 Note: for interactions between clients and servers using Mercurial 3.6+
8221 a rejection will generally reject the entire push, for interactions in‐
8222 volving older clients, the commit transactions will already be ac‐
8223 cepted, and only the bookmark movement will be rejected.
8224
8225 Groups
8226 Group names must be prefixed with an @ symbol. Specifying a group name
8227 has the same effect as specifying all the users in that group.
8228
8229 You can define group members in the acl.groups section. If a group
8230 name is not defined there, and Mercurial is running under a Unix-like
8231 system, the list of users will be taken from the OS. Otherwise, an ex‐
8232 ception will be raised.
8233
8234 Example Configuration
8235 [hooks]
8236
8237 # Use this if you want to check access restrictions at commit time
8238 pretxncommit.acl = python:hgext.acl.hook
8239
8240 # Use this if you want to check access restrictions for pull, push,
8241 # bundle and serve.
8242 pretxnchangegroup.acl = python:hgext.acl.hook
8243
8244 [acl]
8245 # Allow or deny access for incoming changes only if their source is
8246 # listed here, let them pass otherwise. Source is "serve" for all
8247 # remote access (http or ssh), "push", "pull" or "bundle" when the
8248 # related commands are run locally.
8249 # Default: serve
8250 sources = serve
8251
8252 [acl.deny.branches]
8253
8254 # Everyone is denied to the frozen branch:
8255 frozen-branch = *
8256
8257 # A bad user is denied on all branches:
8258 * = bad-user
8259
8260 [acl.allow.branches]
8261
8262 # A few users are allowed on branch-a:
8263 branch-a = user-1, user-2, user-3
8264
8265 # Only one user is allowed on branch-b:
8266 branch-b = user-1
8267
8268 # The super user is allowed on any branch:
8269 * = super-user
8270
8271 # Everyone is allowed on branch-for-tests:
8272 branch-for-tests = *
8273
8274 [acl.deny]
8275 # This list is checked first. If a match is found, acl.allow is not
8276 # checked. All users are granted access if acl.deny is not present.
8277 # Format for both lists: glob pattern = user, ..., @group, ...
8278
8279 # To match everyone, use an asterisk for the user:
8280 # my/glob/pattern = *
8281
8282 # user6 will not have write access to any file:
8283 ** = user6
8284
8285 # Group "hg-denied" will not have write access to any file:
8286 ** = @hg-denied
8287
8288 # Nobody will be able to change "DONT-TOUCH-THIS.txt", despite
8289 # everyone being able to change all other files. See below.
8290 src/main/resources/DONT-TOUCH-THIS.txt = *
8291
8292 [acl.allow]
8293 # if acl.allow is not present, all users are allowed by default
8294 # empty acl.allow = no users allowed
8295
8296 # User "doc_writer" has write access to any file under the "docs"
8297 # folder:
8298 docs/** = doc_writer
8299
8300 # User "jack" and group "designers" have write access to any file
8301 # under the "images" folder:
8302 images/** = jack, @designers
8303
8304 # Everyone (except for "user6" and "@hg-denied" - see acl.deny above)
8305 # will have write access to any file under the "resources" folder
8306 # (except for 1 file. See acl.deny):
8307 src/main/resources/** = *
8308
8309 .hgtags = release_engineer
8310
8311 Examples using the ! prefix
8312 Suppose there's a branch that only a given user (or group) should be
8313 able to push to, and you don't want to restrict access to any other
8314 branch that may be created.
8315
8316 The "!" prefix allows you to prevent anyone except a given user or
8317 group to push changesets in a given branch or path.
8318
8319 In the examples below, we will: 1) Deny access to branch "ring" to any‐
8320 one but user "gollum" 2) Deny access to branch "lake" to anyone but
8321 members of the group "hobbit" 3) Deny access to a file to anyone but
8322 user "gollum"
8323
8324 [acl.allow.branches]
8325 # Empty
8326
8327 [acl.deny.branches]
8328
8329 # 1) only 'gollum' can commit to branch 'ring';
8330 # 'gollum' and anyone else can still commit to any other branch.
8331 ring = !gollum
8332
8333 # 2) only members of the group 'hobbit' can commit to branch 'lake';
8334 # 'hobbit' members and anyone else can still commit to any other branch.
8335 lake = !@hobbit
8336
8337 # You can also deny access based on file paths:
8338
8339 [acl.allow]
8340 # Empty
8341
8342 [acl.deny]
8343 # 3) only 'gollum' can change the file below;
8344 # 'gollum' and anyone else can still change any other file.
8345 /misty/mountains/cave/ring = !gollum
8346
8347 amend
8348 provide the amend command (EXPERIMENTAL)
8349
8350 This extension provides an amend command that is similar to commit
8351 --amend but does not prompt an editor.
8352
8353 Commands
8354 Change creation
8355 amend
8356 amend the working copy parent with all or specified outstanding
8357 changes:
8358
8359 hg amend [OPTION]... [FILE]...
8360
8361 Similar to hg commit --amend, but reuse the commit message without in‐
8362 voking editor, unless --edit was set.
8363
8364 See hg help commit for more details.
8365
8366 Options:
8367
8368 -A, --addremove
8369 mark new/missing files as added/removed before committing
8370
8371 -e, --edit
8372 invoke editor on commit messages
8373
8374 -i, --interactive
8375 use interactive mode
8376
8377 --close-branch
8378 mark a branch as closed, hiding it from the branch list
8379
8380 -s, --secret
8381 use the secret phase for committing
8382
8383 -n,--note <VALUE>
8384 store a note on the amend
8385
8386 -I,--include <PATTERN[+]>
8387 include names matching the given patterns
8388
8389 -X,--exclude <PATTERN[+]>
8390 exclude names matching the given patterns
8391
8392 -m,--message <TEXT>
8393 use text as commit message
8394
8395 -l,--logfile <FILE>
8396 read commit message from file
8397
8398 -d,--date <DATE>
8399 record the specified date as commit date
8400
8401 -u,--user <USER>
8402 record the specified user as committer
8403
8404 -D, --currentdate
8405 record the current date as commit date
8406
8407 -U, --currentuser
8408 record the current user as committer
8409
8410 [+] marked option can be specified multiple times
8411
8412 automv
8413 check for unrecorded moves at commit time (EXPERIMENTAL)
8414
8415 This extension checks at commit/amend time if any of the committed
8416 files comes from an unrecorded mv.
8417
8418 The threshold at which a file is considered a move can be set with the
8419 automv.similarity config option. This option takes a percentage between
8420 0 (disabled) and 100 (files must be identical), the default is 95.
8421
8422 beautifygraph
8423 beautify log -G output by using Unicode characters (EXPERIMENTAL)
8424
8425 A terminal with UTF-8 support and monospace narrow text are re‐
8426 quired.
8427
8428 blackbox
8429 log repository events to a blackbox for debugging
8430
8431 Logs event information to .hg/blackbox.log to help debug and diagnose
8432 problems. The events that get logged can be configured via the black‐
8433 box.track and blackbox.ignore config keys.
8434
8435 Examples:
8436
8437 [blackbox]
8438 track = *
8439 ignore = pythonhook
8440 # dirty is *EXPENSIVE* (slow);
8441 # each log entry indicates `+` if the repository is dirty, like :hg:`id`.
8442 dirty = True
8443 # record the source of log messages
8444 logsource = True
8445
8446 [blackbox]
8447 track = command, commandfinish, commandexception, exthook, pythonhook
8448
8449 [blackbox]
8450 track = incoming
8451
8452 [blackbox]
8453 # limit the size of a log file
8454 maxsize = 1.5 MB
8455 # rotate up to N log files when the current one gets too big
8456 maxfiles = 3
8457
8458 [blackbox]
8459 # Include nanoseconds in log entries with %f (see Python function
8460 # datetime.datetime.strftime)
8461 date-format = %Y-%m-%d @ %H:%M:%S.%f
8462
8463 Commands
8464 Repository maintenance
8465 blackbox
8466 view the recent repository events:
8467
8468 hg blackbox [OPTION]...
8469
8470 view the recent repository events
8471
8472 Options:
8473
8474 -l,--limit <VALUE>
8475 the number of events to show (default: 10)
8476
8477 bookflow
8478 implements bookmark-based branching (EXPERIMENTAL)
8479
8480 • Disables creation of new branches (config: enable_branches=False).
8481
8482 • Requires an active bookmark on commit (config: require_book‐
8483 mark=True).
8484
8485 • Doesn't move the active bookmark on update, only on commit.
8486
8487 • Requires '--rev' for moving an existing bookmark.
8488
8489 • Protects special bookmarks (config: protect=@).
8490
8491 flow related commands
8492
8493 hg book NAME
8494 create a new bookmark
8495
8496 hg book NAME -r REV
8497 move bookmark to revision (fast-forward)
8498
8499 hg up|co NAME
8500 switch to bookmark
8501
8502 hg push -B .
8503 push active bookmark
8504
8505 bugzilla
8506 hooks for integrating with the Bugzilla bug tracker
8507
8508 This hook extension adds comments on bugs in Bugzilla when changesets
8509 that refer to bugs by Bugzilla ID are seen. The comment is formatted
8510 using the Mercurial template mechanism.
8511
8512 The bug references can optionally include an update for Bugzilla of the
8513 hours spent working on the bug. Bugs can also be marked fixed.
8514
8515 Four basic modes of access to Bugzilla are provided:
8516
8517 1. Access via the Bugzilla REST-API. Requires bugzilla 5.0 or later.
8518
8519 2. Access via the Bugzilla XMLRPC interface. Requires Bugzilla 3.4 or
8520 later.
8521
8522 3. Check data via the Bugzilla XMLRPC interface and submit bug change
8523 via email to Bugzilla email interface. Requires Bugzilla 3.4 or
8524 later.
8525
8526 4. Writing directly to the Bugzilla database. Only Bugzilla installa‐
8527 tions using MySQL are supported. Requires Python MySQLdb.
8528
8529 Writing directly to the database is susceptible to schema changes, and
8530 relies on a Bugzilla contrib script to send out bug change notification
8531 emails. This script runs as the user running Mercurial, must be run on
8532 the host with the Bugzilla install, and requires permission to read
8533 Bugzilla configuration details and the necessary MySQL user and pass‐
8534 word to have full access rights to the Bugzilla database. For these
8535 reasons this access mode is now considered deprecated, and will not be
8536 updated for new Bugzilla versions going forward. Only adding comments
8537 is supported in this access mode.
8538
8539 Access via XMLRPC needs a Bugzilla username and password to be speci‐
8540 fied in the configuration. Comments are added under that username.
8541 Since the configuration must be readable by all Mercurial users, it is
8542 recommended that the rights of that user are restricted in Bugzilla to
8543 the minimum necessary to add comments. Marking bugs fixed requires
8544 Bugzilla 4.0 and later.
8545
8546 Access via XMLRPC/email uses XMLRPC to query Bugzilla, but sends email
8547 to the Bugzilla email interface to submit comments to bugs. The From:
8548 address in the email is set to the email address of the Mercurial user,
8549 so the comment appears to come from the Mercurial user. In the event
8550 that the Mercurial user email is not recognized by Bugzilla as a
8551 Bugzilla user, the email associated with the Bugzilla username used to
8552 log into Bugzilla is used instead as the source of the comment. Marking
8553 bugs fixed works on all supported Bugzilla versions.
8554
8555 Access via the REST-API needs either a Bugzilla username and password
8556 or an apikey specified in the configuration. Comments are made under
8557 the given username or the user associated with the apikey in Bugzilla.
8558
8559 Configuration items common to all access modes:
8560
8561 bugzilla.version
8562 The access type to use. Values recognized are:
8563
8564 restapi
8565
8566 Bugzilla REST-API, Bugzilla 5.0 and later.
8567
8568 xmlrpc
8569
8570 Bugzilla XMLRPC interface.
8571
8572 xmlrpc+email
8573
8574 Bugzilla XMLRPC and email interfaces.
8575
8576 3.0
8577
8578 MySQL access, Bugzilla 3.0 and later.
8579
8580 2.18
8581
8582 MySQL access, Bugzilla 2.18 and up to but not including
8583 3.0.
8584
8585 2.16
8586
8587 MySQL access, Bugzilla 2.16 and up to but not including
8588 2.18.
8589
8590 bugzilla.regexp
8591 Regular expression to match bug IDs for update in changeset com‐
8592 mit message. It must contain one "()" named group <ids> con‐
8593 taining the bug IDs separated by non-digit characters. It may
8594 also contain a named group <hours> with a floating-point number
8595 giving the hours worked on the bug. If no named groups are
8596 present, the first "()" group is assumed to contain the bug IDs,
8597 and work time is not updated. The default expression matches Bug
8598 1234, Bug no. 1234, Bug number 1234, Bugs 1234,5678, Bug 1234
8599 and 5678 and variations thereof, followed by an hours number
8600 prefixed by h or hours, e.g. hours 1.5. Matching is case insen‐
8601 sitive.
8602
8603 bugzilla.fixregexp
8604 Regular expression to match bug IDs for marking fixed in change‐
8605 set commit message. This must contain a "()" named group <ids>`
8606 containing the bug IDs separated by non-digit characters. It may
8607 also contain a named group ``<hours> with a floating-point num‐
8608 ber giving the hours worked on the bug. If no named groups are
8609 present, the first "()" group is assumed to contain the bug IDs,
8610 and work time is not updated. The default expression matches
8611 Fixes 1234, Fixes bug 1234, Fixes bugs 1234,5678, Fixes 1234 and
8612 5678 and variations thereof, followed by an hours number pre‐
8613 fixed by h or hours, e.g. hours 1.5. Matching is case insensi‐
8614 tive.
8615
8616 bugzilla.fixstatus
8617 The status to set a bug to when marking fixed. Default RESOLVED.
8618
8619 bugzilla.fixresolution
8620 The resolution to set a bug to when marking fixed. Default
8621 FIXED.
8622
8623 bugzilla.style
8624 The style file to use when formatting comments.
8625
8626 bugzilla.template
8627 Template to use when formatting comments. Overrides style if
8628 specified. In addition to the usual Mercurial keywords, the ex‐
8629 tension specifies:
8630
8631 {bug}
8632
8633 The Bugzilla bug ID.
8634
8635 {root}
8636
8637 The full pathname of the Mercurial repository.
8638
8639 {webroot}
8640
8641 Stripped pathname of the Mercurial repository.
8642
8643 {hgweb}
8644
8645 Base URL for browsing Mercurial repositories.
8646
8647 Default changeset {node|short} in repo {root} refers to bug
8648 {bug}.\ndetails:\n\t{desc|tabindent}
8649
8650 bugzilla.strip
8651 The number of path separator characters to strip from the front
8652 of the Mercurial repository path ({root} in templates) to pro‐
8653 duce {webroot}. For example, a repository with {root} /var/lo‐
8654 cal/my-project with a strip of 2 gives a value for {webroot} of
8655 my-project. Default 0.
8656
8657 web.baseurl
8658 Base URL for browsing Mercurial repositories. Referenced from
8659 templates as {hgweb}.
8660
8661 Configuration items common to XMLRPC+email and MySQL access modes:
8662
8663 bugzilla.usermap
8664 Path of file containing Mercurial committer email to Bugzilla
8665 user email mappings. If specified, the file should contain one
8666 mapping per line:
8667
8668 committer = Bugzilla user
8669
8670 See also the [usermap] section.
8671
8672 The [usermap] section is used to specify mappings of Mercurial commit‐
8673 ter email to Bugzilla user email. See also bugzilla.usermap. Contains
8674 entries of the form committer = Bugzilla user.
8675
8676 XMLRPC and REST-API access mode configuration:
8677
8678 bugzilla.bzurl
8679 The base URL for the Bugzilla installation. Default http://lo‐
8680 calhost/bugzilla.
8681
8682 bugzilla.user
8683 The username to use to log into Bugzilla via XMLRPC. Default
8684 bugs.
8685
8686 bugzilla.password
8687 The password for Bugzilla login.
8688
8689 REST-API access mode uses the options listed above as well as:
8690
8691 bugzilla.apikey
8692 An apikey generated on the Bugzilla instance for api access.
8693 Using an apikey removes the need to store the user and password
8694 options.
8695
8696 XMLRPC+email access mode uses the XMLRPC access mode configuration
8697 items, and also:
8698
8699 bugzilla.bzemail
8700 The Bugzilla email address.
8701
8702 In addition, the Mercurial email settings must be configured. See the
8703 documentation in hgrc(5), sections [email] and [smtp].
8704
8705 MySQL access mode configuration:
8706
8707 bugzilla.host
8708 Hostname of the MySQL server holding the Bugzilla database. De‐
8709 fault localhost.
8710
8711 bugzilla.db
8712 Name of the Bugzilla database in MySQL. Default bugs.
8713
8714 bugzilla.user
8715 Username to use to access MySQL server. Default bugs.
8716
8717 bugzilla.password
8718 Password to use to access MySQL server.
8719
8720 bugzilla.timeout
8721 Database connection timeout (seconds). Default 5.
8722
8723 bugzilla.bzuser
8724 Fallback Bugzilla user name to record comments with, if change‐
8725 set committer cannot be found as a Bugzilla user.
8726
8727 bugzilla.bzdir
8728 Bugzilla install directory. Used by default notify. Default
8729 /var/www/html/bugzilla.
8730
8731 bugzilla.notify
8732 The command to run to get Bugzilla to send bug change notifica‐
8733 tion emails. Substitutes from a map with 3 keys, bzdir, id (bug
8734 id) and user (committer bugzilla email). Default depends on ver‐
8735 sion; from 2.18 it is "cd %(bzdir)s && perl -T contrib/sendbug‐
8736 mail.pl %(id)s %(user)s".
8737
8738 Activating the extension:
8739
8740 [extensions]
8741 bugzilla =
8742
8743 [hooks]
8744 # run bugzilla hook on every change pulled or pushed in here
8745 incoming.bugzilla = python:hgext.bugzilla.hook
8746
8747 Example configurations:
8748
8749 XMLRPC example configuration. This uses the Bugzilla at
8750 http://my-project.org/bugzilla, logging in as user bug‐
8751 mail@my-project.org with password plugh. It is used with a collection
8752 of Mercurial repositories in /var/local/hg/repos/, with a web interface
8753 at http://my-project.org/hg.
8754
8755 [bugzilla]
8756 bzurl=http://my-project.org/bugzilla
8757 user=bugmail@my-project.org
8758 password=plugh
8759 version=xmlrpc
8760 template=Changeset {node|short} in {root|basename}.
8761 {hgweb}/{webroot}/rev/{node|short}\n
8762 {desc}\n
8763 strip=5
8764
8765 [web]
8766 baseurl=http://my-project.org/hg
8767
8768 XMLRPC+email example configuration. This uses the Bugzilla at
8769 http://my-project.org/bugzilla, logging in as user bug‐
8770 mail@my-project.org with password plugh. It is used with a collection
8771 of Mercurial repositories in /var/local/hg/repos/, with a web interface
8772 at http://my-project.org/hg. Bug comments are sent to the Bugzilla
8773 email address bugzilla@my-project.org.
8774
8775 [bugzilla]
8776 bzurl=http://my-project.org/bugzilla
8777 user=bugmail@my-project.org
8778 password=plugh
8779 version=xmlrpc+email
8780 bzemail=bugzilla@my-project.org
8781 template=Changeset {node|short} in {root|basename}.
8782 {hgweb}/{webroot}/rev/{node|short}\n
8783 {desc}\n
8784 strip=5
8785
8786 [web]
8787 baseurl=http://my-project.org/hg
8788
8789 [usermap]
8790 user@emaildomain.com=user.name@bugzilladomain.com
8791
8792 MySQL example configuration. This has a local Bugzilla 3.2 installation
8793 in /opt/bugzilla-3.2. The MySQL database is on localhost, the Bugzilla
8794 database name is bugs and MySQL is accessed with MySQL username bugs
8795 password XYZZY. It is used with a collection of Mercurial repositories
8796 in /var/local/hg/repos/, with a web interface at
8797 http://my-project.org/hg.
8798
8799 [bugzilla]
8800 host=localhost
8801 password=XYZZY
8802 version=3.0
8803 bzuser=unknown@domain.com
8804 bzdir=/opt/bugzilla-3.2
8805 template=Changeset {node|short} in {root|basename}.
8806 {hgweb}/{webroot}/rev/{node|short}\n
8807 {desc}\n
8808 strip=5
8809
8810 [web]
8811 baseurl=http://my-project.org/hg
8812
8813 [usermap]
8814 user@emaildomain.com=user.name@bugzilladomain.com
8815
8816 All the above add a comment to the Bugzilla bug record of the form:
8817
8818 Changeset 3b16791d6642 in repository-name.
8819 http://my-project.org/hg/repository-name/rev/3b16791d6642
8820
8821 Changeset commit comment. Bug 1234.
8822
8823 censor
8824 erase file content at a given revision
8825
8826 The censor command instructs Mercurial to erase all content of a file
8827 at a given revision without updating the changeset hash. This allows
8828 existing history to remain valid while preventing future clones/pulls
8829 from receiving the erased data.
8830
8831 Typical uses for censor are due to security or legal requirements, in‐
8832 cluding:
8833
8834 * Passwords, private keys, cryptographic material
8835 * Licensed data/code/libraries for which the license has expired
8836 * Personally Identifiable Information or other private data
8837
8838 Censored nodes can interrupt mercurial's typical operation whenever the
8839 excised data needs to be materialized. Some commands, like hg cat/hg
8840 revert, simply fail when asked to produce censored data. Others, like
8841 hg verify and hg update, must be capable of tolerating censored data to
8842 continue to function in a meaningful way. Such commands only tolerate
8843 censored file revisions if they are allowed by the "censor.policy=ig‐
8844 nore" config option.
8845
8846 A few informative commands such as hg grep will unconditionally ignore
8847 censored data and merely report that it was encountered.
8848
8849 Commands
8850 Repository maintenance
8851 censor
8852 hg censor -r REV [-t TEXT] [FILE]
8853
8854 Options:
8855
8856 -r,--rev <REV>
8857 censor file from specified revision
8858
8859 -t,--tombstone <TEXT>
8860 replacement tombstone data
8861
8862 children
8863 command to display child changesets (DEPRECATED)
8864
8865 This extension is deprecated. You should use hg log -r "children(REV)"
8866 instead.
8867
8868 Commands
8869 Change navigation
8870 children
8871 show the children of the given or working directory revision:
8872
8873 hg children [-r REV] [FILE]
8874
8875 Print the children of the working directory's revisions. If a revision
8876 is given via -r/--rev, the children of that revision will be printed.
8877 If a file argument is given, revision in which the file was last
8878 changed (after the working directory revision or the argument to --rev
8879 if given) is printed.
8880
8881 Please use hg log instead:
8882
8883 hg children => hg log -r "children(.)"
8884 hg children -r REV => hg log -r "children(REV)"
8885
8886 See hg help log and hg help revsets.children.
8887
8888 Options:
8889
8890 -r,--rev <REV>
8891 show children of the specified revision (default: .)
8892
8893 --style <STYLE>
8894 display using template map file (DEPRECATED)
8895
8896 -T,--template <TEMPLATE>
8897 display with template
8898
8899 churn
8900 command to display statistics about repository history
8901
8902 Commands
8903 Repository maintenance
8904 churn
8905 histogram of changes to the repository:
8906
8907 hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]
8908
8909 This command will display a histogram representing the number of
8910 changed lines or revisions, grouped according to the given template.
8911 The default template will group changes by author. The --dateformat
8912 option may be used to group the results by date instead.
8913
8914 Statistics are based on the number of changed lines, or alternatively
8915 the number of matching revisions if the --changesets option is speci‐
8916 fied.
8917
8918 Examples:
8919
8920 # display count of changed lines for every committer
8921 hg churn -T "{author|email}"
8922
8923 # display daily activity graph
8924 hg churn -f "%H" -s -c
8925
8926 # display activity of developers by month
8927 hg churn -f "%Y-%m" -s -c
8928
8929 # display count of lines changed in every year
8930 hg churn -f "%Y" -s
8931
8932 # display count of lines changed in a time range
8933 hg churn -d "2020-04 to 2020-09"
8934
8935 It is possible to map alternate email addresses to a main address by
8936 providing a file using the following format:
8937
8938 <alias email> = <actual email>
8939
8940 Such a file may be specified with the --aliases option, otherwise a
8941 .hgchurn file will be looked for in the working directory root.
8942 Aliases will be split from the rightmost "=".
8943
8944 Options:
8945
8946 -r,--rev <REV[+]>
8947 count rate for the specified revision or revset
8948
8949 -d,--date <DATE>
8950 count rate for revisions matching date spec
8951
8952 -t,--oldtemplate <TEMPLATE>
8953 template to group changesets (DEPRECATED)
8954
8955 -T,--template <TEMPLATE>
8956 template to group changesets (default: {author|email})
8957
8958 -f,--dateformat <FORMAT>
8959 strftime-compatible format for grouping by date
8960
8961 -c, --changesets
8962 count rate by number of changesets
8963
8964 -s, --sort
8965 sort by key (default: sort by count)
8966
8967 --diffstat
8968 display added/removed lines separately
8969
8970 --aliases <FILE>
8971 file with email aliases
8972
8973 -I,--include <PATTERN[+]>
8974 include names matching the given patterns
8975
8976 -X,--exclude <PATTERN[+]>
8977 exclude names matching the given patterns
8978
8979 [+] marked option can be specified multiple times
8980
8981 clonebundles
8982 advertise pre-generated bundles to seed clones
8983
8984 "clonebundles" is a server-side extension used to advertise the exis‐
8985 tence of pre-generated, externally hosted bundle files to clients that
8986 are cloning so that cloning can be faster, more reliable, and require
8987 less resources on the server. "pullbundles" is a related feature for
8988 sending pre-generated bundle files to clients as part of pull opera‐
8989 tions.
8990
8991 Cloning can be a CPU and I/O intensive operation on servers. Tradition‐
8992 ally, the server, in response to a client's request to clone, dynami‐
8993 cally generates a bundle containing the entire repository content and
8994 sends it to the client. There is no caching on the server and the
8995 server will have to redundantly generate the same outgoing bundle in
8996 response to each clone request. For servers with large repositories or
8997 with high clone volume, the load from clones can make scaling the
8998 server challenging and costly.
8999
9000 This extension provides server operators the ability to offload poten‐
9001 tially expensive clone load to an external service. Pre-generated bun‐
9002 dles also allow using more CPU intensive compression, reducing the ef‐
9003 fective bandwidth requirements.
9004
9005 Here's how clone bundles work:
9006
9007 1. A server operator establishes a mechanism for making bundle files
9008 available on a hosting service where Mercurial clients can fetch
9009 them.
9010
9011 2. A manifest file listing available bundle URLs and some optional
9012 metadata is added to the Mercurial repository on the server.
9013
9014 3. A client initiates a clone against a clone bundles aware server.
9015
9016 4. The client sees the server is advertising clone bundles and fetches
9017 the manifest listing available bundles.
9018
9019 5. The client filters and sorts the available bundles based on what it
9020 supports and prefers.
9021
9022 6. The client downloads and applies an available bundle from the
9023 server-specified URL.
9024
9025 7. The client reconnects to the original server and performs the equiv‐
9026 alent of hg pull to retrieve all repository data not in the bundle.
9027 (The repository could have been updated between when the bundle was
9028 created and when the client started the clone.) This may use "pull‐
9029 bundles".
9030
9031 Instead of the server generating full repository bundles for every
9032 clone request, it generates full bundles once and they are subsequently
9033 reused to bootstrap new clones. The server may still transfer data at
9034 clone time. However, this is only data that has been added/changed
9035 since the bundle was created. For large, established repositories, this
9036 can reduce server load for clones to less than 1% of original.
9037
9038 Here's how pullbundles work:
9039
9040 1. A manifest file listing available bundles and describing the revi‐
9041 sions is added to the Mercurial repository on the server.
9042
9043 2. A new-enough client informs the server that it supports partial
9044 pulls and initiates a pull.
9045
9046 3. If the server has pull bundles enabled and sees the client advertis‐
9047 ing partial pulls, it checks for a matching pull bundle in the mani‐
9048 fest. A bundle matches if the format is supported by the client,
9049 the client has the required revisions already and needs something
9050 from the bundle.
9051
9052 4. If there is at least one matching bundle, the server sends it to the
9053 client.
9054
9055 5. The client applies the bundle and notices that the server reply was
9056 incomplete. It initiates another pull.
9057
9058 To work, this extension requires the following of server operators:
9059
9060 • Generating bundle files of repository content (typically periodi‐
9061 cally, such as once per day).
9062
9063 • Clone bundles: A file server that clients have network access to and
9064 that Python knows how to talk to through its normal URL handling fa‐
9065 cility (typically an HTTP/HTTPS server).
9066
9067 • A process for keeping the bundles manifest in sync with available
9068 bundle files.
9069
9070 Strictly speaking, using a static file hosting server isn't required: a
9071 server operator could use a dynamic service for retrieving bundle data.
9072 However, static file hosting services are simple and scalable and
9073 should be sufficient for most needs.
9074
9075 Bundle files can be generated with the hg bundle command. Typically hg
9076 bundle --all is used to produce a bundle of the entire repository.
9077
9078 hg debugcreatestreamclonebundle can be used to produce a special
9079 streaming clonebundle. These are bundle files that are extremely effi‐
9080 cient to produce and consume (read: fast). However, they are larger
9081 than traditional bundle formats and require that clients support the
9082 exact set of repository data store formats in use by the repository
9083 that created them. Typically, a newer server can serve data that is
9084 compatible with older clients. However, streaming clone bundles don't
9085 have this guarantee. Server operators need to be aware that newer ver‐
9086 sions of Mercurial may produce streaming clone bundles incompatible
9087 with older Mercurial versions.
9088
9089 A server operator is responsible for creating a .hg/clonebundles.mani‐
9090 fest file containing the list of available bundle files suitable for
9091 seeding clones. If this file does not exist, the repository will not
9092 advertise the existence of clone bundles when clients connect. For pull
9093 bundles, .hg/pullbundles.manifest is used.
9094
9095 The manifest file contains a newline (n) delimited list of entries.
9096
9097 Each line in this file defines an available bundle. Lines have the for‐
9098 mat:
9099
9100 <URL> [<key>=<value>[ <key>=<value>]]
9101
9102 That is, a URL followed by an optional, space-delimited list of
9103 key=value pairs describing additional properties of this bundle. Both
9104 keys and values are URI encoded.
9105
9106 For pull bundles, the URL is a path under the .hg directory of the
9107 repository.
9108
9109 Keys in UPPERCASE are reserved for use by Mercurial and are defined be‐
9110 low. All non-uppercase keys can be used by site installations. An ex‐
9111 ample use for custom properties is to use the datacenter attribute to
9112 define which data center a file is hosted in. Clients could then prefer
9113 a server in the data center closest to them.
9114
9115 The following reserved keys are currently defined:
9116
9117 BUNDLESPEC
9118 A "bundle specification" string that describes the type of the
9119 bundle.
9120
9121 These are string values that are accepted by the "--type" argu‐
9122 ment of hg bundle.
9123
9124 The values are parsed in strict mode, which means they must be
9125 of the "<compression>-<type>" form. See mercurial.ex‐
9126 change.parsebundlespec() for more details.
9127
9128 hg debugbundle --spec can be used to print the bundle specifica‐
9129 tion string for a bundle file. The output of this command can be
9130 used verbatim for the value of BUNDLESPEC (it is already es‐
9131 caped).
9132
9133 Clients will automatically filter out specifications that are
9134 unknown or unsupported so they won't attempt to download some‐
9135 thing that likely won't apply.
9136
9137 The actual value doesn't impact client behavior beyond filter‐
9138 ing: clients will still sniff the bundle type from the header of
9139 downloaded files.
9140
9141 Use of this key is highly recommended, as it allows clients to
9142 easily skip unsupported bundles. If this key is not defined, an
9143 old client may attempt to apply a bundle that it is incapable of
9144 reading.
9145
9146 REQUIRESNI
9147 Whether Server Name Indication (SNI) is required to connect to
9148 the URL. SNI allows servers to use multiple certificates on the
9149 same IP. It is somewhat common in CDNs and other hosting
9150 providers. Older Python versions do not support SNI. Defining
9151 this attribute enables clients with older Python versions to
9152 filter this entry without experiencing an opaque SSL failure at
9153 connection time.
9154
9155 If this is defined, it is important to advertise a non-SNI fall‐
9156 back URL or clients running old Python releases may not be able
9157 to clone with the clonebundles facility.
9158
9159 Value should be "true".
9160
9161 REQUIREDRAM
9162 Value specifies expected memory requirements to decode the pay‐
9163 load. Values can have suffixes for common bytes sizes. e.g.
9164 "64MB".
9165
9166 This key is often used with zstd-compressed bundles using a high
9167 compression level / window size, which can require 100+ MB of
9168 memory to decode.
9169
9170 heads Used for pull bundles. This contains the ; separated changeset
9171 hashes of the heads of the bundle content.
9172
9173 bases Used for pull bundles. This contains the ; separated changeset
9174 hashes of the roots of the bundle content. This can be skipped
9175 if the bundle was created without --base.
9176
9177 Manifests can contain multiple entries. Assuming metadata is defined,
9178 clients will filter entries from the manifest that they don't support.
9179 The remaining entries are optionally sorted by client preferences
9180 (ui.clonebundleprefers config option). The client then attempts to
9181 fetch the bundle at the first URL in the remaining list.
9182
9183 Errors when downloading a bundle will fail the entire clone operation:
9184 clients do not automatically fall back to a traditional clone. The rea‐
9185 son for this is that if a server is using clone bundles, it is probably
9186 doing so because the feature is necessary to help it scale. In other
9187 words, there is an assumption that clone load will be offloaded to an‐
9188 other service and that the Mercurial server isn't responsible for serv‐
9189 ing this clone load. If that other service experiences issues and
9190 clients start mass falling back to the original Mercurial server, the
9191 added clone load could overwhelm the server due to unexpected load and
9192 effectively take it offline. Not having clients automatically fall back
9193 to cloning from the original server mitigates this scenario.
9194
9195 Because there is no automatic Mercurial server fallback on failure of
9196 the bundle hosting service, it is important for server operators to
9197 view the bundle hosting service as an extension of the Mercurial server
9198 in terms of availability and service level agreements: if the bundle
9199 hosting service goes down, so does the ability for clients to clone.
9200 Note: clients will see a message informing them how to bypass the clone
9201 bundles facility when a failure occurs. So server operators should pre‐
9202 pare for some people to follow these instructions when a failure oc‐
9203 curs, thus driving more load to the original Mercurial server when the
9204 bundle hosting service fails.
9205
9206 closehead
9207 close arbitrary heads without checking them out first
9208
9209 Commands
9210 Change manipulation
9211 close-head
9212 close the given head revisions:
9213
9214 hg close-head [OPTION]... [REV]...
9215
9216 This is equivalent to checking out each revision in a clean tree and
9217 running hg commit --close-branch, except that it doesn't change the
9218 working directory.
9219
9220 The commit message must be specified with -l or -m.
9221
9222 Options:
9223
9224 -m,--message <TEXT>
9225 use text as commit message
9226
9227 -l,--logfile <FILE>
9228 read commit message from file
9229
9230 -d,--date <DATE>
9231 record the specified date as commit date
9232
9233 -u,--user <USER>
9234 record the specified user as committer
9235
9236 -r,--rev <REV[+]>
9237 revision to check
9238
9239 [+] marked option can be specified multiple times
9240
9241 aliases: close-heads
9242
9243 commitextras
9244 adds a new flag extras to commit (ADVANCED)
9245
9246 convert
9247 import revisions from foreign VCS repositories into Mercurial
9248
9249 Commands
9250 Uncategorized commands
9251 convert
9252 convert a foreign SCM repository to a Mercurial one.:
9253
9254 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
9255
9256 Accepted source formats [identifiers]:
9257
9258 • Mercurial [hg]
9259
9260 • CVS [cvs]
9261
9262 • Darcs [darcs]
9263
9264 • git [git]
9265
9266 • Subversion [svn]
9267
9268 • Monotone [mtn]
9269
9270 • GNU Arch [gnuarch]
9271
9272 • Bazaar [bzr]
9273
9274 • Perforce [p4]
9275
9276 Accepted destination formats [identifiers]:
9277
9278 • Mercurial [hg]
9279
9280 • Subversion [svn] (history on branches is not preserved)
9281
9282 If no revision is given, all revisions will be converted. Otherwise,
9283 convert will only import up to the named revision (given in a format
9284 understood by the source).
9285
9286 If no destination directory name is specified, it defaults to the base‐
9287 name of the source with -hg appended. If the destination repository
9288 doesn't exist, it will be created.
9289
9290 By default, all sources except Mercurial will use --branchsort. Mercu‐
9291 rial uses --sourcesort to preserve original revision numbers order.
9292 Sort modes have the following effects:
9293
9294 --branchsort
9295 convert from parent to child revision when possible, which means
9296 branches are usually converted one after the other. It generates
9297 more compact repositories.
9298
9299 --datesort
9300 sort revisions by date. Converted repositories have good-looking
9301 changelogs but are often an order of magnitude larger than the
9302 same ones generated by --branchsort.
9303
9304 --sourcesort
9305 try to preserve source revisions order, only supported by Mercu‐
9306 rial sources.
9307
9308 --closesort
9309 try to move closed revisions as close as possible to parent
9310 branches, only supported by Mercurial sources.
9311
9312 If REVMAP isn't given, it will be put in a default location
9313 (<dest>/.hg/shamap by default). The REVMAP is a simple text file that
9314 maps each source commit ID to the destination ID for that revision,
9315 like so:
9316
9317 <source ID> <destination ID>
9318
9319 If the file doesn't exist, it's automatically created. It's updated on
9320 each commit copied, so hg convert can be interrupted and can be run re‐
9321 peatedly to copy new commits.
9322
9323 The authormap is a simple text file that maps each source commit author
9324 to a destination commit author. It is handy for source SCMs that use
9325 unix logins to identify authors (e.g.: CVS). One line per author map‐
9326 ping and the line format is:
9327
9328 source author = destination author
9329
9330 Empty lines and lines starting with a # are ignored.
9331
9332 The filemap is a file that allows filtering and remapping of files and
9333 directories. Each line can contain one of the following directives:
9334
9335 include path/to/file-or-dir
9336
9337 exclude path/to/file-or-dir
9338
9339 rename path/to/source path/to/destination
9340
9341 Comment lines start with #. A specified path matches if it equals the
9342 full relative name of a file or one of its parent directories. The in‐
9343 clude or exclude directive with the longest matching path applies, so
9344 line order does not matter.
9345
9346 The include directive causes a file, or all files under a directory, to
9347 be included in the destination repository. The default if there are no
9348 include statements is to include everything. If there are any include
9349 statements, nothing else is included. The exclude directive causes
9350 files or directories to be omitted. The rename directive renames a file
9351 or directory if it is converted. To rename from a subdirectory into the
9352 root of the repository, use . as the path to rename to.
9353
9354 --full will make sure the converted changesets contain exactly the
9355 right files with the right content. It will make a full conversion of
9356 all files, not just the ones that have changed. Files that already are
9357 correct will not be changed. This can be used to apply filemap changes
9358 when converting incrementally. This is currently only supported for
9359 Mercurial and Subversion.
9360
9361 The splicemap is a file that allows insertion of synthetic history,
9362 letting you specify the parents of a revision. This is useful if you
9363 want to e.g. give a Subversion merge two parents, or graft two discon‐
9364 nected series of history together. Each entry contains a key, followed
9365 by a space, followed by one or two comma-separated values:
9366
9367 key parent1, parent2
9368
9369 The key is the revision ID in the source revision control system whose
9370 parents should be modified (same format as a key in .hg/shamap). The
9371 values are the revision IDs (in either the source or destination revi‐
9372 sion control system) that should be used as the new parents for that
9373 node. For example, if you have merged "release-1.0" into "trunk", then
9374 you should specify the revision on "trunk" as the first parent and the
9375 one on the "release-1.0" branch as the second.
9376
9377 The branchmap is a file that allows you to rename a branch when it is
9378 being brought in from whatever external repository. When used in con‐
9379 junction with a splicemap, it allows for a powerful combination to help
9380 fix even the most badly mismanaged repositories and turn them into
9381 nicely structured Mercurial repositories. The branchmap contains lines
9382 of the form:
9383
9384 original_branch_name new_branch_name
9385
9386 where "original_branch_name" is the name of the branch in the source
9387 repository, and "new_branch_name" is the name of the branch is the des‐
9388 tination repository. No whitespace is allowed in the new branch name.
9389 This can be used to (for instance) move code in one repository from
9390 "default" to a named branch.
9391
9392 Mercurial Source
9393 The Mercurial source recognizes the following configuration options,
9394 which you can set on the command line with --config:
9395
9396 convert.hg.ignoreerrors
9397 ignore integrity errors when reading. Use it to fix Mercurial
9398 repositories with missing revlogs, by converting from and to
9399 Mercurial. Default is False.
9400
9401 convert.hg.saverev
9402 store original revision ID in changeset (forces target IDs to
9403 change). It takes a boolean argument and defaults to False.
9404
9405 convert.hg.startrev
9406 specify the initial Mercurial revision. The default is 0.
9407
9408 convert.hg.revs
9409 revset specifying the source revisions to convert.
9410
9411 Bazaar Source
9412 The following options can be used with --config:
9413
9414 convert.bzr.saverev
9415 whether to store the original Bazaar commit ID in the metadata
9416 of the destination commit. The default is True.
9417
9418 CVS Source
9419 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to in‐
9420 dicate the starting point of what will be converted. Direct access to
9421 the repository files is not needed, unless of course the repository is
9422 :local:. The conversion uses the top level directory in the sandbox to
9423 find the CVS repository, and then uses CVS rlog commands to find files
9424 to convert. This means that unless a filemap is given, all files under
9425 the starting directory will be converted, and that any directory reor‐
9426 ganization in the CVS sandbox is ignored.
9427
9428 The following options can be used with --config:
9429
9430 convert.cvsps.cache
9431 Set to False to disable remote log caching, for testing and de‐
9432 bugging purposes. Default is True.
9433
9434 convert.cvsps.fuzz
9435 Specify the maximum time (in seconds) that is allowed between
9436 commits with identical user and log message in a single change‐
9437 set. When very large files were checked in as part of a change‐
9438 set then the default may not be long enough. The default is 60.
9439
9440 convert.cvsps.logencoding
9441 Specify encoding name to be used for transcoding CVS log mes‐
9442 sages. Multiple encoding names can be specified as a list (see
9443 hg help config.Syntax), but only the first acceptable encoding
9444 in the list is used per CVS log entries. This transcoding is ex‐
9445 ecuted before cvslog hook below.
9446
9447 convert.cvsps.mergeto
9448 Specify a regular expression to which commit log messages are
9449 matched. If a match occurs, then the conversion process will in‐
9450 sert a dummy revision merging the branch on which this log mes‐
9451 sage occurs to the branch indicated in the regex. Default is
9452 {{mergetobranch ([-\w]+)}}
9453
9454 convert.cvsps.mergefrom
9455 Specify a regular expression to which commit log messages are
9456 matched. If a match occurs, then the conversion process will add
9457 the most recent revision on the branch indicated in the regex as
9458 the second parent of the changeset. Default is {{mergefrombranch
9459 ([-\w]+)}}
9460
9461 convert.localtimezone
9462 use local time (as determined by the TZ environment variable)
9463 for changeset date/times. The default is False (use UTC).
9464
9465 hooks.cvslog
9466 Specify a Python function to be called at the end of gathering
9467 the CVS log. The function is passed a list with the log entries,
9468 and can modify the entries in-place, or add or delete them.
9469
9470 hooks.cvschangesets
9471 Specify a Python function to be called after the changesets are
9472 calculated from the CVS log. The function is passed a list with
9473 the changeset entries, and can modify the changesets in-place,
9474 or add or delete them.
9475
9476 An additional "debugcvsps" Mercurial command allows the builtin change‐
9477 set merging code to be run without doing a conversion. Its parameters
9478 and output are similar to that of cvsps 2.1. Please see the command
9479 help for more details.
9480
9481 Subversion Source
9482 Subversion source detects classical trunk/branches/tags layouts. By
9483 default, the supplied svn://repo/path/ source URL is converted as a
9484 single branch. If svn://repo/path/trunk exists it replaces the default
9485 branch. If svn://repo/path/branches exists, its subdirectories are
9486 listed as possible branches. If svn://repo/path/tags exists, it is
9487 looked for tags referencing converted branches. Default trunk, branches
9488 and tags values can be overridden with following options. Set them to
9489 paths relative to the source URL, or leave them blank to disable auto
9490 detection.
9491
9492 The following options can be set with --config:
9493
9494 convert.svn.branches
9495 specify the directory containing branches. The default is
9496 branches.
9497
9498 convert.svn.tags
9499 specify the directory containing tags. The default is tags.
9500
9501 convert.svn.trunk
9502 specify the name of the trunk branch. The default is trunk.
9503
9504 convert.localtimezone
9505 use local time (as determined by the TZ environment variable)
9506 for changeset date/times. The default is False (use UTC).
9507
9508 Source history can be retrieved starting at a specific revision, in‐
9509 stead of being integrally converted. Only single branch conversions are
9510 supported.
9511
9512 convert.svn.startrev
9513 specify start Subversion revision number. The default is 0.
9514
9515 Git Source
9516 The Git importer converts commits from all reachable branches (refs in
9517 refs/heads) and remotes (refs in refs/remotes) to Mercurial. Branches
9518 are converted to bookmarks with the same name, with the leading
9519 'refs/heads' stripped. Git submodules are converted to Git subrepos in
9520 Mercurial.
9521
9522 The following options can be set with --config:
9523
9524 convert.git.similarity
9525 specify how similar files modified in a commit must be to be im‐
9526 ported as renames or copies, as a percentage between 0 (dis‐
9527 abled) and 100 (files must be identical). For example, 90 means
9528 that a delete/add pair will be imported as a rename if more than
9529 90% of the file hasn't changed. The default is 50.
9530
9531 convert.git.findcopiesharder
9532 while detecting copies, look at all files in the working copy
9533 instead of just changed ones. This is very expensive for large
9534 projects, and is only effective when convert.git.similarity is
9535 greater than 0. The default is False.
9536
9537 convert.git.renamelimit
9538 perform rename and copy detection up to this many changed files
9539 in a commit. Increasing this will make rename and copy detection
9540 more accurate but will significantly slow down computation on
9541 large projects. The option is only relevant if convert.git.simi‐
9542 larity is greater than 0. The default is 400.
9543
9544 convert.git.committeractions
9545 list of actions to take when processing author and committer
9546 values.
9547
9548 Git commits have separate author (who wrote the commit) and com‐
9549 mitter (who applied the commit) fields. Not all destinations
9550 support separate author and committer fields (including Mercu‐
9551 rial). This config option controls what to do with these author
9552 and committer fields during conversion.
9553
9554 A value of messagedifferent will append a committer: ... line
9555 to the commit message if the Git committer is different from the
9556 author. The prefix of that line can be specified using the syn‐
9557 tax messagedifferent=<prefix>. e.g. messagedifferent=git-commit‐
9558 ter:. When a prefix is specified, a space will always be in‐
9559 serted between the prefix and the value.
9560
9561 messagealways behaves like messagedifferent except it will al‐
9562 ways result in a committer: ... line being appended to the com‐
9563 mit message. This value is mutually exclusive with messagedif‐
9564 ferent.
9565
9566 dropcommitter will remove references to the committer. Only ref‐
9567 erences to the author will remain. Actions that add references
9568 to the committer will have no effect when this is set.
9569
9570 replaceauthor will replace the value of the author field with
9571 the committer. Other actions that add references to the commit‐
9572 ter will still take effect when this is set.
9573
9574 The default is messagedifferent.
9575
9576 convert.git.extrakeys
9577 list of extra keys from commit metadata to copy to the destina‐
9578 tion. Some Git repositories store extra metadata in commits. By
9579 default, this non-default metadata will be lost during conver‐
9580 sion. Setting this config option can retain that metadata. Some
9581 built-in keys such as parent and branch are not allowed to be
9582 copied.
9583
9584 convert.git.remoteprefix
9585 remote refs are converted as bookmarks with convert.git.re‐
9586 moteprefix as a prefix followed by a /. The default is 'remote'.
9587
9588 convert.git.saverev
9589 whether to store the original Git commit ID in the metadata of
9590 the destination commit. The default is True.
9591
9592 convert.git.skipsubmodules
9593 does not convert root level .gitmodules files or files with
9594 160000 mode indicating a submodule. Default is False.
9595
9596 Perforce Source
9597 The Perforce (P4) importer can be given a p4 depot path or a client
9598 specification as source. It will convert all files in the source to a
9599 flat Mercurial repository, ignoring labels, branches and integrations.
9600 Note that when a depot path is given you then usually should specify a
9601 target directory, because otherwise the target may be named ...-hg.
9602
9603 The following options can be set with --config:
9604
9605 convert.p4.encoding
9606 specify the encoding to use when decoding standard output of the
9607 Perforce command line tool. The default is default system encod‐
9608 ing.
9609
9610 convert.p4.startrev
9611 specify initial Perforce revision (a Perforce changelist num‐
9612 ber).
9613
9614 Mercurial Destination
9615 The Mercurial destination will recognize Mercurial subrepositories in
9616 the destination directory, and update the .hgsubstate file automati‐
9617 cally if the destination subrepositories contain the
9618 <dest>/<sub>/.hg/shamap file. Converting a repository with subreposi‐
9619 tories requires converting a single repository at a time, from the bot‐
9620 tom up.
9621
9622 An example showing how to convert a repository with subrepositories:
9623
9624 # so convert knows the type when it sees a non empty destination
9625 $ hg init converted
9626
9627 $ hg convert orig/sub1 converted/sub1
9628 $ hg convert orig/sub2 converted/sub2
9629 $ hg convert orig converted
9630
9631 The following options are supported:
9632
9633 convert.hg.clonebranches
9634 dispatch source branches in separate clones. The default is
9635 False.
9636
9637 convert.hg.tagsbranch
9638 branch name for tag revisions, defaults to default.
9639
9640 convert.hg.usebranchnames
9641 preserve branch names. The default is True.
9642
9643 convert.hg.sourcename
9644 records the given string as a 'convert_source' extra value on
9645 each commit made in the target repository. The default is None.
9646
9647 convert.hg.preserve-hash
9648 only works with mercurial sources. Make convert prevent perfor‐
9649 mance improvement to the list of modified files in commits when
9650 such an improvement would cause the hash of a commit to change.
9651 The default is False.
9652
9653 All Destinations
9654 All destination types accept the following options:
9655
9656 convert.skiptags
9657 does not convert tags from the source repo to the target repo.
9658 The default is False.
9659
9660 Subversion Destination
9661 Original commit dates are not preserved by default.
9662
9663 convert.svn.dangerous-set-commit-dates
9664 preserve original commit dates, forcefully setting svn:date re‐
9665 vision properties. This option is DANGEROUS and may break some
9666 subversion functionality for the resulting repository (e.g. fil‐
9667 tering revisions with date ranges in svn log), as original com‐
9668 mit dates are not guaranteed to be monotonically increasing.
9669
9670 For commit dates setting to work destination repository must have
9671 pre-revprop-change hook configured to allow setting of svn:date revi‐
9672 sion properties. See Subversion documentation for more details.
9673
9674 Options:
9675
9676 --authors <FILE>
9677 username mapping filename (DEPRECATED) (use --authormap instead)
9678
9679 -s,--source-type <TYPE>
9680 source repository type
9681
9682 -d,--dest-type <TYPE>
9683 destination repository type
9684
9685 -r,--rev <REV[+]>
9686 import up to source revision REV
9687
9688 -A,--authormap <FILE>
9689 remap usernames using this file
9690
9691 --filemap <FILE>
9692 remap file names using contents of file
9693
9694 --full apply filemap changes by converting all files again
9695
9696 --splicemap <FILE>
9697 splice synthesized history into place
9698
9699 --branchmap <FILE>
9700 change branch names while converting
9701
9702 --branchsort
9703 try to sort changesets by branches
9704
9705 --datesort
9706 try to sort changesets by date
9707
9708 --sourcesort
9709 preserve source changesets order
9710
9711 --closesort
9712 try to reorder closed revisions
9713
9714 [+] marked option can be specified multiple times
9715
9716 eol
9717 automatically manage newlines in repository files
9718
9719 This extension allows you to manage the type of line endings (CRLF or
9720 LF) that are used in the repository and in the local working directory.
9721 That way you can get CRLF line endings on Windows and LF on Unix/Mac,
9722 thereby letting everybody use their OS native line endings.
9723
9724 The extension reads its configuration from a versioned .hgeol configu‐
9725 ration file found in the root of the working directory. The .hgeol file
9726 use the same syntax as all other Mercurial configuration files. It uses
9727 two sections, [patterns] and [repository].
9728
9729 The [patterns] section specifies how line endings should be converted
9730 between the working directory and the repository. The format is speci‐
9731 fied by a file pattern. The first match is used, so put more specific
9732 patterns first. The available line endings are LF, CRLF, and BIN.
9733
9734 Files with the declared format of CRLF or LF are always checked out and
9735 stored in the repository in that format and files declared to be binary
9736 (BIN) are left unchanged. Additionally, native is an alias for checking
9737 out in the platform's default line ending: LF on Unix (including Mac OS
9738 X) and CRLF on Windows. Note that BIN (do nothing to line endings) is
9739 Mercurial's default behavior; it is only needed if you need to override
9740 a later, more general pattern.
9741
9742 The optional [repository] section specifies the line endings to use for
9743 files stored in the repository. It has a single setting, native, which
9744 determines the storage line endings for files declared as native in the
9745 [patterns] section. It can be set to LF or CRLF. The default is LF. For
9746 example, this means that on Windows, files configured as native (CRLF
9747 by default) will be converted to LF when stored in the repository.
9748 Files declared as LF, CRLF, or BIN in the [patterns] section are always
9749 stored as-is in the repository.
9750
9751 Example versioned .hgeol file:
9752
9753 [patterns]
9754 **.py = native
9755 **.vcproj = CRLF
9756 **.txt = native
9757 Makefile = LF
9758 **.jpg = BIN
9759
9760 [repository]
9761 native = LF
9762
9763 Note The rules will first apply when files are touched in the working
9764 directory, e.g. by updating to null and back to tip to touch all
9765 files.
9766
9767 The extension uses an optional [eol] section read from both the normal
9768 Mercurial configuration files and the .hgeol file, with the latter
9769 overriding the former. You can use that section to control the overall
9770 behavior. There are three settings:
9771
9772 • eol.native (default os.linesep) can be set to LF or CRLF to override
9773 the default interpretation of native for checkout. This can be used
9774 with hg archive on Unix, say, to generate an archive where files have
9775 line endings for Windows.
9776
9777 • eol.only-consistent (default True) can be set to False to make the
9778 extension convert files with inconsistent EOLs. Inconsistent means
9779 that there is both CRLF and LF present in the file. Such files are
9780 normally not touched under the assumption that they have mixed EOLs
9781 on purpose.
9782
9783 • eol.fix-trailing-newline (default False) can be set to True to ensure
9784 that converted files end with a EOL character (either \n or \r\n as
9785 per the configured patterns).
9786
9787 The extension provides cleverencode: and cleverdecode: filters like the
9788 deprecated win32text extension does. This means that you can disable
9789 win32text and enable eol and your filters will still work. You only
9790 need to these filters until you have prepared a .hgeol file.
9791
9792 The win32text.forbid* hooks provided by the win32text extension have
9793 been unified into a single hook named eol.checkheadshook. The hook will
9794 lookup the expected line endings from the .hgeol file, which means you
9795 must migrate to a .hgeol file first before using the hook. eol.check‐
9796 headshook only checks heads, intermediate invalid revisions will be
9797 pushed. To forbid them completely, use the eol.checkallhook hook. These
9798 hooks are best used as pretxnchangegroup hooks.
9799
9800 See hg help patterns for more information about the glob patterns used.
9801
9802 extdiff
9803 command to allow external programs to compare revisions
9804
9805 The extdiff Mercurial extension allows you to use external programs to
9806 compare revisions, or revision with working directory. The external
9807 diff programs are called with a configurable set of options and two
9808 non-option arguments: paths to directories containing snapshots of
9809 files to compare.
9810
9811 If there is more than one file being compared and the "child" revision
9812 is the working directory, any modifications made in the external diff
9813 program will be copied back to the working directory from the temporary
9814 directory.
9815
9816 The extdiff extension also allows you to configure new diff commands,
9817 so you do not need to type hg extdiff -p kdiff3 always.
9818
9819 [extdiff]
9820 # add new command that runs GNU diff(1) in 'context diff' mode
9821 cdiff = gdiff -Nprc5
9822 ## or the old way:
9823 #cmd.cdiff = gdiff
9824 #opts.cdiff = -Nprc5
9825
9826 # add new command called meld, runs meld (no need to name twice). If
9827 # the meld executable is not available, the meld tool in [merge-tools]
9828 # will be used, if available
9829 meld =
9830
9831 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
9832 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
9833 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
9834 # your .vimrc
9835 vimdiff = gvim -f "+next" \
9836 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
9837
9838 Tool arguments can include variables that are expanded at runtime:
9839
9840 $parent1, $plabel1 - filename, descriptive label of first parent
9841 $child, $clabel - filename, descriptive label of child revision
9842 $parent2, $plabel2 - filename, descriptive label of second parent
9843 $root - repository root
9844 $parent is an alias for $parent1.
9845
9846 The extdiff extension will look in your [diff-tools] and [merge-tools]
9847 sections for diff tool arguments, when none are specified in [extdiff].
9848
9849 [extdiff]
9850 kdiff3 =
9851
9852 [diff-tools]
9853 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
9854
9855 If a program has a graphical interface, it might be interesting to tell
9856 Mercurial about it. It will prevent the program from being mistakenly
9857 used in a terminal-only environment (such as an SSH terminal session),
9858 and will make hg extdiff --per-file open multiple file diffs at once
9859 instead of one by one (if you still want to open file diffs one by one,
9860 you can use the --confirm option).
9861
9862 Declaring that a tool has a graphical interface can be done with the
9863 gui flag next to where diffargs are specified:
9864
9865 [diff-tools]
9866 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
9867 kdiff3.gui = true
9868
9869 You can use -I/-X and list of file or directory names like normal hg
9870 diff command. The extdiff extension makes snapshots of only needed
9871 files, so running the external diff program will actually be pretty
9872 fast (at least faster than having to compare the entire tree).
9873
9874 Commands
9875 File content management
9876 extdiff
9877 use external program to diff repository (or selected files):
9878
9879 hg extdiff [OPT]... [FILE]...
9880
9881 Show differences between revisions for the specified files, using an
9882 external program. The default program used is diff, with default op‐
9883 tions "-Npru".
9884
9885 To select a different program, use the -p/--program option. The program
9886 will be passed the names of two directories to compare, unless the
9887 --per-file option is specified (see below). To pass additional options
9888 to the program, use -o/--option. These will be passed before the names
9889 of the directories or files to compare.
9890
9891 The --from, --to, and --change options work the same way they do for hg
9892 diff.
9893
9894 The --per-file option runs the external program repeatedly on each file
9895 to diff, instead of once on two directories. By default, this happens
9896 one by one, where the next file diff is open in the external program
9897 only once the previous external program (for the previous file diff)
9898 has exited. If the external program has a graphical interface, it can
9899 open all the file diffs at once instead of one by one. See hg help -e
9900 extdiff for information about how to tell Mercurial that a given pro‐
9901 gram has a graphical interface.
9902
9903 The --confirm option will prompt the user before each invocation of the
9904 external program. It is ignored if --per-file isn't specified.
9905
9906 Options:
9907
9908 -p,--program <CMD>
9909 comparison program to run
9910
9911 -o,--option <OPT[+]>
9912 pass option to comparison program
9913
9914 -r,--rev <REV[+]>
9915 revision (DEPRECATED)
9916
9917 --from <REV1>
9918 revision to diff from
9919
9920 --to <REV2>
9921 revision to diff to
9922
9923 -c,--change <REV>
9924 change made by revision
9925
9926 --per-file
9927 compare each file instead of revision snapshots
9928
9929 --confirm
9930 prompt user before each external program invocation
9931
9932 --patch
9933 compare patches for two revisions
9934
9935 -I,--include <PATTERN[+]>
9936 include names matching the given patterns
9937
9938 -X,--exclude <PATTERN[+]>
9939 exclude names matching the given patterns
9940
9941 -S, --subrepos
9942 recurse into subrepositories
9943
9944 [+] marked option can be specified multiple times
9945
9946 factotum
9947 http authentication with factotum
9948
9949 This extension allows the factotum(4) facility on Plan 9 from Bell Labs
9950 platforms to provide authentication information for HTTP access. Con‐
9951 figuration entries specified in the auth section as well as authentica‐
9952 tion information provided in the repository URL are fully supported. If
9953 no prefix is specified, a value of "*" will be assumed.
9954
9955 By default, keys are specified as:
9956
9957 proto=pass service=hg prefix=<prefix> user=<username> !password=<password>
9958
9959 If the factotum extension is unable to read the required key, one will
9960 be requested interactively.
9961
9962 A configuration section is available to customize runtime behavior. By
9963 default, these entries are:
9964
9965 [factotum]
9966 executable = /bin/auth/factotum
9967 mountpoint = /mnt/factotum
9968 service = hg
9969
9970 The executable entry defines the full path to the factotum binary. The
9971 mountpoint entry defines the path to the factotum file service. Lastly,
9972 the service entry controls the service name used when reading keys.
9973
9974 fastannotate
9975 yet another annotate implementation that might be faster (EXPERIMENTAL)
9976
9977 The fastannotate extension provides a 'fastannotate' command that makes
9978 use of the linelog data structure as a cache layer and is expected to
9979 be faster than the vanilla 'annotate' if the cache is present.
9980
9981 In most cases, fastannotate requires a setup that mainbranch is some
9982 pointer that always moves forward, to be most efficient.
9983
9984 Using fastannotate together with linkrevcache would speed up building
9985 the annotate cache greatly. Run "debugbuildlinkrevcache" before "debug‐
9986 buildannotatecache".
9987
9988 [fastannotate]
9989 # specify the main branch head. the internal linelog will only contain
9990 # the linear (ignoring p2) "mainbranch". since linelog cannot move
9991 # backwards without a rebuild, this should be something that always moves
9992 # forward, usually it is "master" or "@".
9993 mainbranch = master
9994
9995 # fastannotate supports different modes to expose its feature.
9996 # a list of combination:
9997 # - fastannotate: expose the feature via the "fastannotate" command which
9998 # deals with everything in a most efficient way, and provides extra
9999 # features like --deleted etc.
10000 # - fctx: replace fctx.annotate implementation. note:
10001 # a. it is less efficient than the "fastannotate" command
10002 # b. it will make it practically impossible to access the old (disk
10003 # side-effect free) annotate implementation
10004 # c. it implies "hgweb".
10005 # - hgweb: replace hgweb's annotate implementation. conflict with "fctx".
10006 # (default: fastannotate)
10007 modes = fastannotate
10008
10009 # default format when no format flags are used (default: number)
10010 defaultformat = changeset, user, date
10011
10012 # serve the annotate cache via wire protocol (default: False)
10013 # tip: the .hg/fastannotate directory is portable - can be rsynced
10014 server = True
10015
10016 # build annotate cache on demand for every client request (default: True)
10017 # disabling it could make server response faster, useful when there is a
10018 # cronjob building the cache.
10019 serverbuildondemand = True
10020
10021 # update local annotate cache from remote on demand
10022 client = False
10023
10024 # path to use when connecting to the remote server (default: default)
10025 remotepath = default
10026
10027 # minimal length of the history of a file required to fetch linelog from
10028 # the server. (default: 10)
10029 clientfetchthreshold = 10
10030
10031 # for "fctx" mode, always follow renames regardless of command line option.
10032 # this is a BC with the original command but will reduced the space needed
10033 # for annotate cache, and is useful for client-server setup since the
10034 # server will only provide annotate cache with default options (i.e. with
10035 # follow). do not affect "fastannotate" mode. (default: True)
10036 forcefollow = True
10037
10038 # for "fctx" mode, always treat file as text files, to skip the "isbinary"
10039 # check. this is consistent with the "fastannotate" command and could help
10040 # to avoid a file fetch if remotefilelog is used. (default: True)
10041 forcetext = True
10042
10043 # use unfiltered repo for better performance.
10044 unfilteredrepo = True
10045
10046 # sacrifice correctness in some corner cases for performance. it does not
10047 # affect the correctness of the annotate cache being built. the option
10048 # is experimental and may disappear in the future (default: False)
10049 perfhack = True
10050
10051 Commands
10052 Uncategorized commands
10053 fastexport
10054 export repositories as git fast-import stream
10055
10056 Commands
10057 Change import/export
10058 fastexport
10059 export repository as git fast-import stream:
10060
10061 hg fastexport [OPTION]... [REV]...
10062
10063 This command lets you dump a repository as a human-readable text
10064 stream. It can be piped into corresponding import routines like "git
10065 fast-import". Incremental dumps can be created by using marks files.
10066
10067 Options:
10068
10069 -r,--rev <REV[+]>
10070 revisions to export
10071
10072 -i,--import-marks <FILE>
10073 old marks file to read
10074
10075 -e,--export-marks <FILE>
10076 new marks file to write
10077
10078 -A,--authormap <FILE>
10079 remap usernames using this file
10080
10081 [+] marked option can be specified multiple times
10082
10083 fetch
10084 pull, update and merge in one command (DEPRECATED)
10085
10086 Commands
10087 Remote repository management
10088 fetch
10089 pull changes from a remote repository, merge new changes if needed.:
10090
10091 hg fetch [SOURCE]
10092
10093 This finds all changes from the repository at the specified path or URL
10094 and adds them to the local repository.
10095
10096 If the pulled changes add a new branch head, the head is automatically
10097 merged, and the result of the merge is committed. Otherwise, the work‐
10098 ing directory is updated to include the new changes.
10099
10100 When a merge is needed, the working directory is first updated to the
10101 newly pulled changes. Local changes are then merged into the pulled
10102 changes. To switch the merge order, use --switch-parent.
10103
10104 See hg help dates for a list of formats valid for -d/--date.
10105
10106 Returns 0 on success.
10107
10108 Options:
10109
10110 -r,--rev <REV[+]>
10111 a specific revision you would like to pull
10112
10113 --edit invoke editor on commit messages
10114
10115 --force-editor
10116 edit commit message (DEPRECATED)
10117
10118 --switch-parent
10119 switch parents when merging
10120
10121 -m,--message <TEXT>
10122 use text as commit message
10123
10124 -l,--logfile <FILE>
10125 read commit message from file
10126
10127 -d,--date <DATE>
10128 record the specified date as commit date
10129
10130 -u,--user <USER>
10131 record the specified user as committer
10132
10133 -e,--ssh <CMD>
10134 specify ssh command to use
10135
10136 --remotecmd <CMD>
10137 specify hg command to run on the remote side
10138
10139 --insecure
10140 do not verify server certificate (ignoring web.cacerts config)
10141
10142 [+] marked option can be specified multiple times
10143
10144 fix
10145 rewrite file content in changesets or working copy (EXPERIMENTAL)
10146
10147 Provides a command that runs configured tools on the contents of modi‐
10148 fied files, writing back any fixes to the working copy or replacing
10149 changesets.
10150
10151 Here is an example configuration that causes hg fix to apply automatic
10152 formatting fixes to modified lines in C++ code:
10153
10154 [fix]
10155 clang-format:command=clang-format --assume-filename={rootpath}
10156 clang-format:linerange=--lines={first}:{last}
10157 clang-format:pattern=set:**.cpp or **.hpp
10158
10159 The :command suboption forms the first part of the shell command that
10160 will be used to fix a file. The content of the file is passed on stan‐
10161 dard input, and the fixed file content is expected on standard output.
10162 Any output on standard error will be displayed as a warning. If the
10163 exit status is not zero, the file will not be affected. A placeholder
10164 warning is displayed if there is a non-zero exit status but no standard
10165 error output. Some values may be substituted into the command:
10166
10167 {rootpath} The path of the file being fixed, relative to the repo root
10168 {basename} The name of the file being fixed, without the directory path
10169
10170 If the :linerange suboption is set, the tool will only be run if there
10171 are changed lines in a file. The value of this suboption is appended to
10172 the shell command once for every range of changed lines in the file.
10173 Some values may be substituted into the command:
10174
10175 {first} The 1-based line number of the first line in the modified range
10176 {last} The 1-based line number of the last line in the modified range
10177
10178 Deleted sections of a file will be ignored by :linerange, because there
10179 is no corresponding line range in the version being fixed.
10180
10181 By default, tools that set :linerange will only be executed if there is
10182 at least one changed line range. This is meant to prevent accidents
10183 like running a code formatter in such a way that it unexpectedly refor‐
10184 mats the whole file. If such a tool needs to operate on unchanged
10185 files, it should set the :skipclean suboption to false.
10186
10187 The :pattern suboption determines which files will be passed through
10188 each configured tool. See hg help patterns for possible values. How‐
10189 ever, all patterns are relative to the repo root, even if that text
10190 says they are relative to the current working directory. If there are
10191 file arguments to hg fix, the intersection of these patterns is used.
10192
10193 There is also a configurable limit for the maximum size of file that
10194 will be processed by hg fix:
10195
10196 [fix]
10197 maxfilesize = 2MB
10198
10199 Normally, execution of configured tools will continue after a failure
10200 (indicated by a non-zero exit status). It can also be configured to
10201 abort after the first such failure, so that no files will be affected
10202 if any tool fails. This abort will also cause hg fix to exit with a
10203 non-zero status:
10204
10205 [fix]
10206 failure = abort
10207
10208 When multiple tools are configured to affect a file, they execute in an
10209 order defined by the :priority suboption. The priority suboption has a
10210 default value of zero for each tool. Tools are executed in order of de‐
10211 scending priority. The execution order of tools with equal priority is
10212 unspecified. For example, you could use the 'sort' and 'head' utilities
10213 to keep only the 10 smallest numbers in a text file by ensuring that
10214 'sort' runs before 'head':
10215
10216 [fix]
10217 sort:command = sort -n
10218 head:command = head -n 10
10219 sort:pattern = numbers.txt
10220 head:pattern = numbers.txt
10221 sort:priority = 2
10222 head:priority = 1
10223
10224 To account for changes made by each tool, the line numbers used for in‐
10225 cremental formatting are recomputed before executing the next tool. So,
10226 each tool may see different values for the arguments added by the :lin‐
10227 erange suboption.
10228
10229 Each fixer tool is allowed to return some metadata in addition to the
10230 fixed file content. The metadata must be placed before the file content
10231 on stdout, separated from the file content by a zero byte. The metadata
10232 is parsed as a JSON value (so, it should be UTF-8 encoded and contain
10233 no zero bytes). A fixer tool is expected to produce this metadata en‐
10234 coding if and only if the :metadata suboption is true:
10235
10236 [fix]
10237 tool:command = tool --prepend-json-metadata
10238 tool:metadata = true
10239
10240 The metadata values are passed to hooks, which can be used to print
10241 summaries or perform other post-fixing work. The supported hooks are:
10242
10243 "postfixfile"
10244 Run once for each file in each revision where any fixer tools made changes
10245 to the file content. Provides "$HG_REV" and "$HG_PATH" to identify the file,
10246 and "$HG_METADATA" with a map of fixer names to metadata values from fixer
10247 tools that affected the file. Fixer tools that didn't affect the file have a
10248 value of None. Only fixer tools that executed are present in the metadata.
10249
10250 "postfix"
10251 Run once after all files and revisions have been handled. Provides
10252 "$HG_REPLACEMENTS" with information about what revisions were created and
10253 made obsolete. Provides a boolean "$HG_WDIRWRITTEN" to indicate whether any
10254 files in the working copy were updated. Provides a list "$HG_METADATA"
10255 mapping fixer tool names to lists of metadata values returned from
10256 executions that modified a file. This aggregates the same metadata
10257 previously passed to the "postfixfile" hook.
10258
10259 Fixer tools are run in the repository's root directory. This allows
10260 them to read configuration files from the working copy, or even write
10261 to the working copy. The working copy is not updated to match the re‐
10262 vision being fixed. In fact, several revisions may be fixed in paral‐
10263 lel. Writes to the working copy are not amended into the revision being
10264 fixed; fixer tools should always write fixed file content back to std‐
10265 out as documented above.
10266
10267 Commands
10268 File content management
10269 fix
10270 rewrite file content in changesets or working directory:
10271
10272 hg fix [OPTION]... [FILE]...
10273
10274 Runs any configured tools to fix the content of files. Only affects
10275 files with changes, unless file arguments are provided. Only affects
10276 changed lines of files, unless the --whole flag is used. Some tools may
10277 always affect the whole file regardless of --whole.
10278
10279 If --working-dir is used, files with uncommitted changes in the working
10280 copy will be fixed. Note that no backup are made.
10281
10282 If revisions are specified with --source, those revisions and their de‐
10283 scendants will be checked, and they may be replaced with new revisions
10284 that have fixed file content. By automatically including the descen‐
10285 dants, no merging, rebasing, or evolution will be required. If an an‐
10286 cestor of the working copy is included, then the working copy itself
10287 will also be fixed, and the working copy will be updated to the fixed
10288 parent.
10289
10290 When determining what lines of each file to fix at each revision, the
10291 whole set of revisions being fixed is considered, so that fixes to ear‐
10292 lier revisions are not forgotten in later ones. The --base flag can be
10293 used to override this default behavior, though it is not usually desir‐
10294 able to do so.
10295
10296 Options:
10297
10298 --all fix all non-public non-obsolete revisions
10299
10300 --base <REV[+]>
10301 revisions to diff against (overrides automatic selection, and
10302 applies to every revision being fixed)
10303
10304 -r,--rev <REV[+]>
10305 revisions to fix (ADVANCED)
10306
10307 -s,--source <REV[+]>
10308 fix the specified revisions and their descendants
10309
10310 -w, --working-dir
10311 fix the working directory
10312
10313 --whole
10314 always fix every line of a file
10315
10316 [+] marked option can be specified multiple times
10317
10318 fsmonitor
10319 Faster status operations with the Watchman file monitor (EXPERIMENTAL)
10320
10321 Integrates the file-watching program Watchman with Mercurial to produce
10322 faster status results.
10323
10324 On a particular Linux system, for a real-world repository with over
10325 400,000 files hosted on ext4, vanilla hg status takes 1.3 seconds. On
10326 the same system, with fsmonitor it takes about 0.3 seconds.
10327
10328 fsmonitor requires no configuration -- it will tell Watchman about your
10329 repository as necessary. You'll need to install Watchman from
10330 https://facebook.github.io/watchman/ and make sure it is in your PATH.
10331
10332 fsmonitor is incompatible with the largefiles and eol extensions, and
10333 will disable itself if any of those are active.
10334
10335 The following configuration options exist:
10336
10337 [fsmonitor]
10338 mode = {off, on, paranoid}
10339
10340 When mode = off, fsmonitor will disable itself (similar to not loading
10341 the extension at all). When mode = on, fsmonitor will be enabled (the
10342 default). When mode = paranoid, fsmonitor will query both Watchman and
10343 the filesystem, and ensure that the results are consistent.
10344
10345 [fsmonitor]
10346 timeout = (float)
10347
10348 A value, in seconds, that determines how long fsmonitor will wait for
10349 Watchman to return results. Defaults to 2.0.
10350
10351 [fsmonitor]
10352 blacklistusers = (list of userids)
10353
10354 A list of usernames for which fsmonitor will disable itself altogether.
10355
10356 [fsmonitor]
10357 walk_on_invalidate = (boolean)
10358
10359 Whether or not to walk the whole repo ourselves when our cached state
10360 has been invalidated, for example when Watchman has been restarted or
10361 .hgignore rules have been changed. Walking the repo in that case can
10362 result in competing for I/O with Watchman. For large repos it is recom‐
10363 mended to set this value to false. You may wish to set this to true if
10364 you have a very fast filesystem that can outpace the IPC overhead of
10365 getting the result data for the full repo from Watchman. Defaults to
10366 false.
10367
10368 [fsmonitor]
10369 warn_when_unused = (boolean)
10370
10371 Whether to print a warning during certain operations when fsmonitor
10372 would be beneficial to performance but isn't enabled.
10373
10374 [fsmonitor]
10375 warn_update_file_count = (integer)
10376 # or when mercurial is built with rust support
10377 warn_update_file_count_rust = (integer)
10378
10379 If warn_when_unused is set and fsmonitor isn't enabled, a warning will
10380 be printed during working directory updates if this many files will be
10381 created.
10382
10383 git
10384 grant Mercurial the ability to operate on Git repositories. (EXPERIMEN‐
10385 TAL)
10386
10387 This is currently super experimental. It probably will consume your
10388 firstborn a la Rumpelstiltskin, etc.
10389
10390 githelp
10391 try mapping git commands to Mercurial commands
10392
10393 Tries to map a given git command to a Mercurial command:
10394
10395 $ hg githelp -- git checkout master hg update master
10396
10397 If an unknown command or parameter combination is detected, an error is
10398 produced.
10399
10400 Commands
10401 Help
10402 githelp
10403 suggests the Mercurial equivalent of the given git command:
10404
10405 hg githelp
10406
10407 Usage: hg githelp -- <git command>
10408
10409 aliases: git
10410
10411 gpg
10412 commands to sign and verify changesets
10413
10414 Commands
10415 Signing changes (GPG)
10416 sigcheck
10417 verify all the signatures there may be for a particular revision:
10418
10419 hg sigcheck REV
10420
10421 verify all the signatures there may be for a particular revision
10422
10423 sign
10424 add a signature for the current or given revision:
10425
10426 hg sign [OPTION]... [REV]...
10427
10428 If no revision is given, the parent of the working directory is used,
10429 or tip if no revision is checked out.
10430
10431 The gpg.cmd config setting can be used to specify the command to run. A
10432 default key can be specified with gpg.key.
10433
10434 See hg help dates for a list of formats valid for -d/--date.
10435
10436 Options:
10437
10438 -l, --local
10439 make the signature local
10440
10441 -f, --force
10442 sign even if the sigfile is modified
10443
10444 --no-commit
10445 do not commit the sigfile after signing
10446
10447 -k,--key <ID>
10448 the key id to sign with
10449
10450 -m,--message <TEXT>
10451 use text as commit message
10452
10453 -e, --edit
10454 invoke editor on commit messages
10455
10456 -d,--date <DATE>
10457 record the specified date as commit date
10458
10459 -u,--user <USER>
10460 record the specified user as committer
10461
10462 sigs
10463 list signed changesets:
10464
10465 hg sigs
10466
10467 list signed changesets
10468
10469 graphlog
10470 command to view revision graphs from a shell (DEPRECATED)
10471
10472 The functionality of this extension has been include in core Mercurial
10473 since version 2.3. Please use hg log -G ... instead.
10474
10475 This extension adds a --graph option to the incoming, outgoing and log
10476 commands. When this options is given, an ASCII representation of the
10477 revision graph is also shown.
10478
10479 Commands
10480 Change navigation
10481 glog
10482 show revision history alongside an ASCII revision graph:
10483
10484 hg glog [OPTION]... [FILE]
10485
10486 Print a revision history alongside a revision graph drawn with ASCII
10487 characters.
10488
10489 Nodes printed as an @ character are parents of the working directory.
10490
10491 This is an alias to hg log -G.
10492
10493 Options:
10494
10495 -f, --follow
10496 follow changeset history, or file history across copies and re‐
10497 names
10498
10499 --follow-first
10500 only follow the first parent of merge changesets (DEPRECATED)
10501
10502 -d,--date <DATE>
10503 show revisions matching date spec
10504
10505 -C, --copies
10506 show copied files
10507
10508 -k,--keyword <TEXT[+]>
10509 do case-insensitive search for a given text
10510
10511 -r,--rev <REV[+]>
10512 show the specified revision or revset
10513
10514 --removed
10515 include revisions where files were removed
10516
10517 -m, --only-merges
10518 show only merges (DEPRECATED)
10519
10520 -u,--user <USER[+]>
10521 revisions committed by user
10522
10523 --only-branch <BRANCH[+]>
10524 show only changesets within the given named branch (DEPRECATED)
10525
10526 -b,--branch <BRANCH[+]>
10527 show changesets within the given named branch
10528
10529 -P,--prune <REV[+]>
10530 do not display revision or any of its ancestors
10531
10532 -p, --patch
10533 show patch
10534
10535 -g, --git
10536 use git extended diff format
10537
10538 -l,--limit <NUM>
10539 limit number of changes displayed
10540
10541 -M, --no-merges
10542 do not show merges
10543
10544 --stat output diffstat-style summary of changes
10545
10546 -G, --graph
10547 show the revision DAG
10548
10549 --style <STYLE>
10550 display using template map file (DEPRECATED)
10551
10552 -T,--template <TEMPLATE>
10553 display with template
10554
10555 -I,--include <PATTERN[+]>
10556 include names matching the given patterns
10557
10558 -X,--exclude <PATTERN[+]>
10559 exclude names matching the given patterns
10560
10561 [+] marked option can be specified multiple times
10562
10563 hgk
10564 browse the repository in a graphical way
10565
10566 The hgk extension allows browsing the history of a repository in a
10567 graphical way. It requires Tcl/Tk version 8.4 or later. (Tcl/Tk is not
10568 distributed with Mercurial.)
10569
10570 hgk consists of two parts: a Tcl script that does the displaying and
10571 querying of information, and an extension to Mercurial named hgk.py,
10572 which provides hooks for hgk to get information. hgk can be found in
10573 the contrib directory, and the extension is shipped in the hgext repos‐
10574 itory, and needs to be enabled.
10575
10576 The hg view command will launch the hgk Tcl script. For this command to
10577 work, hgk must be in your search path. Alternately, you can specify the
10578 path to hgk in your configuration file:
10579
10580 [hgk]
10581 path = /location/of/hgk
10582
10583 hgk can make use of the extdiff extension to visualize revisions. As‐
10584 suming you had already configured extdiff vdiff command, just add:
10585
10586 [hgk]
10587 vdiff=vdiff
10588
10589 Revisions context menu will now display additional entries to fire vd‐
10590 iff on hovered and selected revisions.
10591
10592 Commands
10593 Change navigation
10594 view
10595 start interactive history viewer:
10596
10597 hg view [-l LIMIT] [REVRANGE]
10598
10599 start interactive history viewer
10600
10601 Options:
10602
10603 -l,--limit <NUM>
10604 limit number of changes displayed
10605
10606 Uncategorized commands
10607 highlight
10608 syntax highlighting for hgweb (requires Pygments)
10609
10610 It depends on the Pygments syntax highlighting library:
10611 http://pygments.org/
10612
10613 There are the following configuration options:
10614
10615 [web]
10616 pygments_style = <style> (default: colorful)
10617 highlightfiles = <fileset> (default: size('<5M'))
10618 highlightonlymatchfilename = <bool> (default False)
10619
10620 highlightonlymatchfilename will only highlight files if their type
10621 could be identified by their filename. When this is not enabled (the
10622 default), Pygments will try very hard to identify the file type from
10623 content and any match (even matches with a low confidence score) will
10624 be used.
10625
10626 histedit
10627 interactive history editing
10628
10629 With this extension installed, Mercurial gains one new command: histe‐
10630 dit. Usage is as follows, assuming the following history:
10631
10632 @ 3[tip] 7c2fd3b9020c 2009-04-27 18:04 -0500 durin42
10633 | Add delta
10634 |
10635 o 2 030b686bedc4 2009-04-27 18:04 -0500 durin42
10636 | Add gamma
10637 |
10638 o 1 c561b4e977df 2009-04-27 18:04 -0500 durin42
10639 | Add beta
10640 |
10641 o 0 d8d2fcd0e319 2009-04-27 18:04 -0500 durin42
10642 Add alpha
10643
10644 If you were to run hg histedit c561b4e977df, you would see the follow‐
10645 ing file open in your editor:
10646
10647 pick c561b4e977df Add beta
10648 pick 030b686bedc4 Add gamma
10649 pick 7c2fd3b9020c Add delta
10650
10651 # Edit history between c561b4e977df and 7c2fd3b9020c
10652 #
10653 # Commits are listed from least to most recent
10654 #
10655 # Commands:
10656 # p, pick = use commit
10657 # e, edit = use commit, but allow edits before making new commit
10658 # f, fold = use commit, but combine it with the one above
10659 # r, roll = like fold, but discard this commit's description and date
10660 # d, drop = remove commit from history
10661 # m, mess = edit commit message without changing commit content
10662 # b, base = checkout changeset and apply further changesets from there
10663 #
10664
10665 In this file, lines beginning with # are ignored. You must specify a
10666 rule for each revision in your history. For example, if you had meant
10667 to add gamma before beta, and then wanted to add delta in the same re‐
10668 vision as beta, you would reorganize the file to look like this:
10669
10670 pick 030b686bedc4 Add gamma
10671 pick c561b4e977df Add beta
10672 fold 7c2fd3b9020c Add delta
10673
10674 # Edit history between c561b4e977df and 7c2fd3b9020c
10675 #
10676 # Commits are listed from least to most recent
10677 #
10678 # Commands:
10679 # p, pick = use commit
10680 # e, edit = use commit, but allow edits before making new commit
10681 # f, fold = use commit, but combine it with the one above
10682 # r, roll = like fold, but discard this commit's description and date
10683 # d, drop = remove commit from history
10684 # m, mess = edit commit message without changing commit content
10685 # b, base = checkout changeset and apply further changesets from there
10686 #
10687
10688 At which point you close the editor and histedit starts working. When
10689 you specify a fold operation, histedit will open an editor when it
10690 folds those revisions together, offering you a chance to clean up the
10691 commit message:
10692
10693 Add beta
10694 ***
10695 Add delta
10696
10697 Edit the commit message to your liking, then close the editor. The date
10698 used for the commit will be the later of the two commits' dates. For
10699 this example, let's assume that the commit message was changed to Add
10700 beta and delta. After histedit has run and had a chance to remove any
10701 old or temporary revisions it needed, the history looks like this:
10702
10703 @ 2[tip] 989b4d060121 2009-04-27 18:04 -0500 durin42
10704 | Add beta and delta.
10705 |
10706 o 1 081603921c3f 2009-04-27 18:04 -0500 durin42
10707 | Add gamma
10708 |
10709 o 0 d8d2fcd0e319 2009-04-27 18:04 -0500 durin42
10710 Add alpha
10711
10712 Note that histedit does not remove any revisions (even its own tempo‐
10713 rary ones) until after it has completed all the editing operations, so
10714 it will probably perform several strip operations when it's done. For
10715 the above example, it had to run strip twice. Strip can be slow depend‐
10716 ing on a variety of factors, so you might need to be a little patient.
10717 You can choose to keep the original revisions by passing the --keep
10718 flag.
10719
10720 The edit operation will drop you back to a command prompt, allowing you
10721 to edit files freely, or even use hg record to commit some changes as a
10722 separate commit. When you're done, any remaining uncommitted changes
10723 will be committed as well. When done, run hg histedit --continue to
10724 finish this step. If there are uncommitted changes, you'll be prompted
10725 for a new commit message, but the default commit message will be the
10726 original message for the edit ed revision, and the date of the original
10727 commit will be preserved.
10728
10729 The message operation will give you a chance to revise a commit message
10730 without changing the contents. It's a shortcut for doing edit immedi‐
10731 ately followed by hg histedit --continue`.
10732
10733 If histedit encounters a conflict when moving a revision (while han‐
10734 dling pick or fold), it'll stop in a similar manner to edit with the
10735 difference that it won't prompt you for a commit message when done. If
10736 you decide at this point that you don't like how much work it will be
10737 to rearrange history, or that you made a mistake, you can use hg histe‐
10738 dit --abort to abandon the new changes you have made and return to the
10739 state before you attempted to edit your history.
10740
10741 If we clone the histedit-ed example repository above and add four more
10742 changes, such that we have the following history:
10743
10744 @ 6[tip] 038383181893 2009-04-27 18:04 -0500 stefan
10745 | Add theta
10746 |
10747 o 5 140988835471 2009-04-27 18:04 -0500 stefan
10748 | Add eta
10749 |
10750 o 4 122930637314 2009-04-27 18:04 -0500 stefan
10751 | Add zeta
10752 |
10753 o 3 836302820282 2009-04-27 18:04 -0500 stefan
10754 | Add epsilon
10755 |
10756 o 2 989b4d060121 2009-04-27 18:04 -0500 durin42
10757 | Add beta and delta.
10758 |
10759 o 1 081603921c3f 2009-04-27 18:04 -0500 durin42
10760 | Add gamma
10761 |
10762 o 0 d8d2fcd0e319 2009-04-27 18:04 -0500 durin42
10763 Add alpha
10764
10765 If you run hg histedit --outgoing on the clone then it is the same as
10766 running hg histedit 836302820282. If you need plan to push to a reposi‐
10767 tory that Mercurial does not detect to be related to the source repo,
10768 you can add a --force option.
10769
10770 Config
10771 Histedit rule lines are truncated to 80 characters by default. You can
10772 customize this behavior by setting a different length in your configu‐
10773 ration file:
10774
10775 [histedit]
10776 linelen = 120 # truncate rule lines at 120 characters
10777
10778 The summary of a change can be customized as well:
10779
10780 [histedit]
10781 summary-template = '{rev} {bookmarks} {desc|firstline}'
10782
10783 The customized summary should be kept short enough that rule lines will
10784 fit in the configured line length. See above if that requires cus‐
10785 tomization.
10786
10787 hg histedit attempts to automatically choose an appropriate base revi‐
10788 sion to use. To change which base revision is used, define a revset in
10789 your configuration file:
10790
10791 [histedit]
10792 defaultrev = only(.) & draft()
10793
10794 By default each edited revision needs to be present in histedit com‐
10795 mands. To remove revision you need to use drop operation. You can con‐
10796 figure the drop to be implicit for missing commits by adding:
10797
10798 [histedit]
10799 dropmissing = True
10800
10801 By default, histedit will close the transaction after each action. For
10802 performance purposes, you can configure histedit to use a single trans‐
10803 action across the entire histedit. WARNING: This setting introduces a
10804 significant risk of losing the work you've done in a histedit if the
10805 histedit aborts unexpectedly:
10806
10807 [histedit]
10808 singletransaction = True
10809
10810 Commands
10811 Change manipulation
10812 histedit
10813 interactively edit changeset history:
10814
10815 hg histedit [OPTIONS] ([ANCESTOR] | --outgoing [URL])
10816
10817 This command lets you edit a linear series of changesets (up to and in‐
10818 cluding the working directory, which should be clean). You can:
10819
10820 • pick to [re]order a changeset
10821
10822 • drop to omit changeset
10823
10824 • mess to reword the changeset commit message
10825
10826 • fold to combine it with the preceding changeset (using the later
10827 date)
10828
10829 • roll like fold, but discarding this commit's description and date
10830
10831 • edit to edit this changeset (preserving date)
10832
10833 • base to checkout changeset and apply further changesets from there
10834
10835 There are a number of ways to select the root changeset:
10836
10837 • Specify ANCESTOR directly
10838
10839 • Use --outgoing -- it will be the first linear changeset not included
10840 in destination. (See hg help config.paths.default-push)
10841
10842 • Otherwise, the value from the "histedit.defaultrev" config option is
10843 used as a revset to select the base revision when ANCESTOR is not
10844 specified. The first revision returned by the revset is used. By de‐
10845 fault, this selects the editable history that is unique to the ances‐
10846 try of the working directory.
10847
10848 If you use --outgoing, this command will abort if there are ambiguous
10849 outgoing revisions. For example, if there are multiple branches con‐
10850 taining outgoing revisions.
10851
10852 Use "min(outgoing() and ::.)" or similar revset specification instead
10853 of --outgoing to specify edit target revision exactly in such ambiguous
10854 situation. See hg help revsets for detail about selecting revisions.
10855
10856 Examples:
10857
10858 • A number of changes have been made. Revision 3 is no longer
10859 needed.
10860
10861 Start history editing from revision 3:
10862
10863 hg histedit -r 3
10864
10865 An editor opens, containing the list of revisions, with specific
10866 actions specified:
10867
10868 pick 5339bf82f0ca 3 Zworgle the foobar
10869 pick 8ef592ce7cc4 4 Bedazzle the zerlog
10870 pick 0a9639fcda9d 5 Morgify the cromulancy
10871
10872 Additional information about the possible actions to take appears
10873 below the list of revisions.
10874
10875 To remove revision 3 from the history, its action (at the begin‐
10876 ning of the relevant line) is changed to 'drop':
10877
10878 drop 5339bf82f0ca 3 Zworgle the foobar
10879 pick 8ef592ce7cc4 4 Bedazzle the zerlog
10880 pick 0a9639fcda9d 5 Morgify the cromulancy
10881
10882 • A number of changes have been made. Revision 2 and 4 need to be
10883 swapped.
10884
10885 Start history editing from revision 2:
10886
10887 hg histedit -r 2
10888
10889 An editor opens, containing the list of revisions, with specific
10890 actions specified:
10891
10892 pick 252a1af424ad 2 Blorb a morgwazzle
10893 pick 5339bf82f0ca 3 Zworgle the foobar
10894 pick 8ef592ce7cc4 4 Bedazzle the zerlog
10895
10896 To swap revision 2 and 4, its lines are swapped in the editor:
10897
10898 pick 8ef592ce7cc4 4 Bedazzle the zerlog
10899 pick 5339bf82f0ca 3 Zworgle the foobar
10900 pick 252a1af424ad 2 Blorb a morgwazzle
10901
10902 Returns 0 on success, 1 if user intervention is required (not only for
10903 intentional "edit" command, but also for resolving unexpected con‐
10904 flicts).
10905
10906 Options:
10907
10908 --commands <FILE>
10909 read history edits from the specified file
10910
10911 -c, --continue
10912 continue an edit already in progress
10913
10914 --edit-plan
10915 edit remaining actions list
10916
10917 -k, --keep
10918 don't strip old nodes after edit is complete
10919
10920 --abort
10921 abort an edit in progress
10922
10923 -o, --outgoing
10924 changesets not found in destination
10925
10926 -f, --force
10927 force outgoing even for unrelated repositories
10928
10929 -r,--rev <REV[+]>
10930 first revision to be edited
10931
10932 -T,--template <TEMPLATE>
10933 display with template
10934
10935 [+] marked option can be specified multiple times
10936
10937 hooklib
10938 collection of simple hooks for common tasks (EXPERIMENTAL)
10939
10940 This extension provides a number of simple hooks to handle issues com‐
10941 monly found in repositories with many contributors: - email notifica‐
10942 tion when changesets move from draft to public phase - email notifica‐
10943 tion when changesets are obsoleted - enforcement of draft phase for all
10944 incoming changesets - enforcement of a no-branch-merge policy - en‐
10945 forcement of a no-multiple-heads policy
10946
10947 The implementation of the hooks is subject to change, e.g. whether to
10948 implement them as individual hooks or merge them into the notify exten‐
10949 sion as option. The functionality itself is planned to be supported
10950 long-term.
10951
10952 infinitepush
10953 store some pushes in a remote blob store on the server (EXPERIMEN‐
10954 TAL)
10955
10956 IMPORTANT: if you use this extension, please contact
10957 mercurial-devel@mercurial-scm.org ASAP. This extension is believed to
10958 be unused and barring learning of users of this functionality, we will
10959 delete this code at the end of 2020.
10960
10961 [infinitepush] # Server-side and client-side option. Pattern of the
10962 infinitepush bookmark branchpattern = PATTERN
10963
10964 # Server or client server = False
10965
10966 # Server-side option. Possible values: 'disk' or 'sql'. Fails if not
10967 set indextype = disk
10968
10969 # Server-side option. Used only if indextype=sql. # Format:
10970 'IP:PORT:DB_NAME:USER:PASSWORD' sqlhost = IP:PORT:DB_NAME:USER:PASS‐
10971 WORD
10972
10973 # Server-side option. Used only if indextype=disk. # Filesystem
10974 path to the index store indexpath = PATH
10975
10976 # Server-side option. Possible values: 'disk' or 'external' # Fails
10977 if not set storetype = disk
10978
10979 # Server-side option. # Path to the binary that will save bundle to
10980 the bundlestore # Formatted cmd line will be passed to it (see
10981 put_args) put_binary = put
10982
10983 # Serser-side option. Used only if storetype=external. # Format
10984 cmd-line string for put binary. Placeholder: {filename} put_args =
10985 {filename}
10986
10987 # Server-side option. # Path to the binary that get bundle from the
10988 bundlestore. # Formatted cmd line will be passed to it (see
10989 get_args) get_binary = get
10990
10991 # Serser-side option. Used only if storetype=external. # Format
10992 cmd-line string for get binary. Placeholders: {filename} {handle}
10993 get_args = {filename} {handle}
10994
10995 # Server-side option logfile = FIlE
10996
10997 # Server-side option loglevel = DEBUG
10998
10999 # Server-side option. Used only if indextype=sql. # Sets mysql
11000 wait_timeout option. waittimeout = 300
11001
11002 # Server-side option. Used only if indextype=sql. # Sets mysql inn‐
11003 odb_lock_wait_timeout option. locktimeout = 120
11004
11005 # Server-side option. Used only if indextype=sql. # Name of the
11006 repository reponame = ''
11007
11008 # Client-side option. Used by --list-remote option. List of remote
11009 scratch # patterns to list if no patterns are specified. default‐
11010 remotepatterns = ['*']
11011
11012 # Instructs infinitepush to forward all received bundle2 parts to
11013 the # bundle for storage. Defaults to False. storeallparts = True
11014
11015 # routes each incoming push to the bundlestore. defaults to False
11016 pushtobundlestore = True
11017
11018 [remotenames] # Client-side option # This option should be set only
11019 if remotenames extension is enabled. # Whether remote bookmarks are
11020 tracked by remotenames extension. bookmarks = True
11021
11022 journal
11023 track previous positions of bookmarks (EXPERIMENTAL)
11024
11025 This extension adds a new command: hg journal, which shows you where
11026 bookmarks were previously located.
11027
11028 Commands
11029 Change organization
11030 journal
11031 show the previous position of bookmarks and the working copy:
11032
11033 hg journal [OPTION]... [BOOKMARKNAME]
11034
11035 The journal is used to see the previous commits that bookmarks and the
11036 working copy pointed to. By default the previous locations for the
11037 working copy. Passing a bookmark name will show all the previous posi‐
11038 tions of that bookmark. Use the --all switch to show previous locations
11039 for all bookmarks and the working copy; each line will then include the
11040 bookmark name, or '.' for the working copy, as well.
11041
11042 If name starts with re:, the remainder of the name is treated as a reg‐
11043 ular expression. To match a name that actually starts with re:, use the
11044 prefix literal:.
11045
11046 By default hg journal only shows the commit hash and the command that
11047 was running at that time. -v/--verbose will show the prior hash, the
11048 user, and the time at which it happened.
11049
11050 Use -c/--commits to output log information on each commit hash; at this
11051 point you can use the usual --patch, --git, --stat and --template
11052 switches to alter the log output for these.
11053
11054 hg journal -T json can be used to produce machine readable output.
11055
11056 Options:
11057
11058 --all show history for all names
11059
11060 -c, --commits
11061 show commit metadata
11062
11063 -p, --patch
11064 show patch
11065
11066 -g, --git
11067 use git extended diff format
11068
11069 -l,--limit <NUM>
11070 limit number of changes displayed
11071
11072 --stat output diffstat-style summary of changes
11073
11074 --style <STYLE>
11075 display using template map file (DEPRECATED)
11076
11077 -T,--template <TEMPLATE>
11078 display with template
11079
11080 keyword
11081 expand keywords in tracked files
11082
11083 This extension expands RCS/CVS-like or self-customized $Keywords$ in
11084 tracked text files selected by your configuration.
11085
11086 Keywords are only expanded in local repositories and not stored in the
11087 change history. The mechanism can be regarded as a convenience for the
11088 current user or for archive distribution.
11089
11090 Keywords expand to the changeset data pertaining to the latest change
11091 relative to the working directory parent of each file.
11092
11093 Configuration is done in the [keyword], [keywordset] and [keywordmaps]
11094 sections of hgrc files.
11095
11096 Example:
11097
11098 [keyword]
11099 # expand keywords in every python file except those matching "x*"
11100 **.py =
11101 x* = ignore
11102
11103 [keywordset]
11104 # prefer svn- over cvs-like default keywordmaps
11105 svn = True
11106
11107 Note The more specific you are in your filename patterns the less you
11108 lose speed in huge repositories.
11109
11110 For [keywordmaps] template mapping and expansion demonstration and con‐
11111 trol run hg kwdemo. See hg help templates for a list of available tem‐
11112 plates and filters.
11113
11114 Three additional date template filters are provided:
11115
11116 utcdate
11117
11118 "2006/09/18 15:13:13"
11119
11120 svnutcdate
11121
11122 "2006-09-18 15:13:13Z"
11123
11124 svnisodate
11125
11126 "2006-09-18 08:13:13 -700 (Mon, 18 Sep 2006)"
11127
11128 The default template mappings (view with hg kwdemo -d) can be replaced
11129 with customized keywords and templates. Again, run hg kwdemo to control
11130 the results of your configuration changes.
11131
11132 Before changing/disabling active keywords, you must run hg kwshrink to
11133 avoid storing expanded keywords in the change history.
11134
11135 To force expansion after enabling it, or a configuration change, run hg
11136 kwexpand.
11137
11138 Expansions spanning more than one line and incremental expansions, like
11139 CVS' $Log$, are not supported. A keyword template map "Log = {desc}"
11140 expands to the first line of the changeset description.
11141
11142 Commands
11143 Uncategorized commands
11144 kwdemo
11145 print [keywordmaps] configuration and an expansion example:
11146
11147 hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP]...
11148
11149 Show current, custom, or default keyword template maps and their expan‐
11150 sions.
11151
11152 Extend the current configuration by specifying maps as arguments and
11153 using -f/--rcfile to source an external hgrc file.
11154
11155 Use -d/--default to disable current configuration.
11156
11157 See hg help templates for information on templates and filters.
11158
11159 Options:
11160
11161 -d, --default
11162 show default keyword template maps
11163
11164 -f,--rcfile <FILE>
11165 read maps from rcfile
11166
11167 kwexpand
11168 expand keywords in the working directory:
11169
11170 hg kwexpand [OPTION]... [FILE]...
11171
11172 Run after (re)enabling keyword expansion.
11173
11174 kwexpand refuses to run if given files contain local changes.
11175
11176 Options:
11177
11178 -I,--include <PATTERN[+]>
11179 include names matching the given patterns
11180
11181 -X,--exclude <PATTERN[+]>
11182 exclude names matching the given patterns
11183
11184 [+] marked option can be specified multiple times
11185
11186 kwfiles
11187 show files configured for keyword expansion:
11188
11189 hg kwfiles [OPTION]... [FILE]...
11190
11191 List which files in the working directory are matched by the [keyword]
11192 configuration patterns.
11193
11194 Useful to prevent inadvertent keyword expansion and to speed up execu‐
11195 tion by including only files that are actual candidates for expansion.
11196
11197 See hg help keyword on how to construct patterns both for inclusion and
11198 exclusion of files.
11199
11200 With -A/--all and -v/--verbose the codes used to show the status of
11201 files are:
11202
11203 K = keyword expansion candidate
11204 k = keyword expansion candidate (not tracked)
11205 I = ignored
11206 i = ignored (not tracked)
11207
11208 Options:
11209
11210 -A, --all
11211 show keyword status flags of all files
11212
11213 -i, --ignore
11214 show files excluded from expansion
11215
11216 -u, --unknown
11217 only show unknown (not tracked) files
11218
11219 -I,--include <PATTERN[+]>
11220 include names matching the given patterns
11221
11222 -X,--exclude <PATTERN[+]>
11223 exclude names matching the given patterns
11224
11225 [+] marked option can be specified multiple times
11226
11227 kwshrink
11228 revert expanded keywords in the working directory:
11229
11230 hg kwshrink [OPTION]... [FILE]...
11231
11232 Must be run before changing/disabling active keywords.
11233
11234 kwshrink refuses to run if given files contain local changes.
11235
11236 Options:
11237
11238 -I,--include <PATTERN[+]>
11239 include names matching the given patterns
11240
11241 -X,--exclude <PATTERN[+]>
11242 exclude names matching the given patterns
11243
11244 [+] marked option can be specified multiple times
11245
11246 largefiles
11247 track large binary files
11248
11249 Large binary files tend to be not very compressible, not very diffable,
11250 and not at all mergeable. Such files are not handled efficiently by
11251 Mercurial's storage format (revlog), which is based on compressed bi‐
11252 nary deltas; storing large binary files as regular Mercurial files
11253 wastes bandwidth and disk space and increases Mercurial's memory usage.
11254 The largefiles extension addresses these problems by adding a central‐
11255 ized client-server layer on top of Mercurial: largefiles live in a cen‐
11256 tral store out on the network somewhere, and you only fetch the revi‐
11257 sions that you need when you need them.
11258
11259 largefiles works by maintaining a "standin file" in .hglf/ for each
11260 largefile. The standins are small (41 bytes: an SHA-1 hash plus new‐
11261 line) and are tracked by Mercurial. Largefile revisions are identified
11262 by the SHA-1 hash of their contents, which is written to the standin.
11263 largefiles uses that revision ID to get/put largefile revisions from/to
11264 the central store. This saves both disk space and bandwidth, since you
11265 don't need to retrieve all historical revisions of large files when you
11266 clone or pull.
11267
11268 To start a new repository or add new large binary files, just add
11269 --large to your hg add command. For example:
11270
11271 $ dd if=/dev/urandom of=randomdata count=2000
11272 $ hg add --large randomdata
11273 $ hg commit -m "add randomdata as a largefile"
11274
11275 When you push a changeset that adds/modifies largefiles to a remote
11276 repository, its largefile revisions will be uploaded along with it.
11277 Note that the remote Mercurial must also have the largefiles extension
11278 enabled for this to work.
11279
11280 When you pull a changeset that affects largefiles from a remote reposi‐
11281 tory, the largefiles for the changeset will by default not be pulled
11282 down. However, when you update to such a revision, any largefiles
11283 needed by that revision are downloaded and cached (if they have never
11284 been downloaded before). One way to pull largefiles when pulling is
11285 thus to use --update, which will update your working copy to the latest
11286 pulled revision (and thereby downloading any new largefiles).
11287
11288 If you want to pull largefiles you don't need for update yet, then you
11289 can use pull with the --lfrev option or the hg lfpull command.
11290
11291 If you know you are pulling from a non-default location and want to
11292 download all the largefiles that correspond to the new changesets at
11293 the same time, then you can pull with --lfrev "pulled()".
11294
11295 If you just want to ensure that you will have the largefiles needed to
11296 merge or rebase with new heads that you are pulling, then you can pull
11297 with --lfrev "head(pulled())" flag to pre-emptively download any large‐
11298 files that are new in the heads you are pulling.
11299
11300 Keep in mind that network access may now be required to update to
11301 changesets that you have not previously updated to. The nature of the
11302 largefiles extension means that updating is no longer guaranteed to be
11303 a local-only operation.
11304
11305 If you already have large files tracked by Mercurial without the large‐
11306 files extension, you will need to convert your repository in order to
11307 benefit from largefiles. This is done with the hg lfconvert command:
11308
11309 $ hg lfconvert --size 10 oldrepo newrepo
11310
11311 In repositories that already have largefiles in them, any new file over
11312 10MB will automatically be added as a largefile. To change this thresh‐
11313 old, set largefiles.minsize in your Mercurial config file to the mini‐
11314 mum size in megabytes to track as a largefile, or use the --lfsize op‐
11315 tion to the add command (also in megabytes):
11316
11317 [largefiles]
11318 minsize = 2
11319
11320 $ hg add --lfsize 2
11321
11322 The largefiles.patterns config option allows you to specify a list of
11323 filename patterns (see hg help patterns) that should always be tracked
11324 as largefiles:
11325
11326 [largefiles]
11327 patterns =
11328 *.jpg
11329 re:.*\.(png|bmp)$
11330 library.zip
11331 content/audio/*
11332
11333 Files that match one of these patterns will be added as largefiles re‐
11334 gardless of their size.
11335
11336 The largefiles.minsize and largefiles.patterns config options will be
11337 ignored for any repositories not already containing a largefile. To add
11338 the first largefile to a repository, you must explicitly do so with the
11339 --large flag passed to the hg add command.
11340
11341 Commands
11342 Uncategorized commands
11343 lfconvert
11344 convert a normal repository to a largefiles repository:
11345
11346 hg lfconvert SOURCE DEST [FILE ...]
11347
11348 Convert repository SOURCE to a new repository DEST, identical to SOURCE
11349 except that certain files will be converted as largefiles: specifi‐
11350 cally, any file that matches any PATTERN or whose size is above the
11351 minimum size threshold is converted as a largefile. The size used to
11352 determine whether or not to track a file as a largefile is the size of
11353 the first version of the file. The minimum size can be specified either
11354 with --size or in configuration as largefiles.size.
11355
11356 After running this command you will need to make sure that largefiles
11357 is enabled anywhere you intend to push the new repository.
11358
11359 Use --to-normal to convert largefiles back to normal files; after this,
11360 the DEST repository can be used without largefiles at all.
11361
11362 Options:
11363
11364 -s,--size <SIZE>
11365 minimum size (MB) for files to be converted as largefiles
11366
11367 --to-normal
11368 convert from a largefiles repo to a normal repo
11369
11370 lfpull
11371 pull largefiles for the specified revisions from the specified source:
11372
11373 hg lfpull -r REV... [-e CMD] [--remotecmd CMD] [SOURCE]
11374
11375 Pull largefiles that are referenced from local changesets but missing
11376 locally, pulling from a remote repository to the local cache.
11377
11378 If SOURCE is omitted, the 'default' path will be used. See hg help
11379 urls for more information.
11380
11381 Some examples:
11382
11383 • pull largefiles for all branch heads:
11384
11385 hg lfpull -r "head() and not closed()"
11386
11387 • pull largefiles on the default branch:
11388
11389 hg lfpull -r "branch(default)"
11390
11391 Options:
11392
11393 -r,--rev <VALUE[+]>
11394 pull largefiles for these revisions
11395
11396 -e,--ssh <CMD>
11397 specify ssh command to use
11398
11399 --remotecmd <CMD>
11400 specify hg command to run on the remote side
11401
11402 --insecure
11403 do not verify server certificate (ignoring web.cacerts config)
11404
11405 [+] marked option can be specified multiple times
11406
11407 lfs
11408 lfs - large file support (EXPERIMENTAL)
11409
11410 This extension allows large files to be tracked outside of the normal
11411 repository storage and stored on a centralized server, similar to the
11412 largefiles extension. The git-lfs protocol is used when communicating
11413 with the server, so existing git infrastructure can be harnessed. Even
11414 though the files are stored outside of the repository, they are still
11415 integrity checked in the same manner as normal files.
11416
11417 The files stored outside of the repository are downloaded on demand,
11418 which reduces the time to clone, and possibly the local disk usage.
11419 This changes fundamental workflows in a DVCS, so careful thought should
11420 be given before deploying it. hg convert can be used to convert LFS
11421 repositories to normal repositories that no longer require this exten‐
11422 sion, and do so without changing the commit hashes. This allows the
11423 extension to be disabled if the centralized workflow becomes burden‐
11424 some. However, the pre and post convert clones will not be able to
11425 communicate with each other unless the extension is enabled on both.
11426
11427 To start a new repository, or to add LFS files to an existing one, just
11428 create an .hglfs file as described below in the root directory of the
11429 repository. Typically, this file should be put under version control,
11430 so that the settings will propagate to other repositories with push and
11431 pull. During any commit, Mercurial will consult this file to determine
11432 if an added or modified file should be stored externally. The type of
11433 storage depends on the characteristics of the file at each commit. A
11434 file that is near a size threshold may switch back and forth between
11435 LFS and normal storage, as needed.
11436
11437 Alternately, both normal repositories and largefile controlled reposi‐
11438 tories can be converted to LFS by using hg convert and the lfs.track
11439 config option described below. The .hglfs file should then be created
11440 and added, to control subsequent LFS selection. The hashes are also
11441 unchanged in this case. The LFS and non-LFS repositories can be dis‐
11442 tinguished because the LFS repository will abort any command if this
11443 extension is disabled.
11444
11445 Committed LFS files are held locally, until the repository is pushed.
11446 Prior to pushing the normal repository data, the LFS files that are
11447 tracked by the outgoing commits are automatically uploaded to the con‐
11448 figured central server. No LFS files are transferred on hg pull or hg
11449 clone. Instead, the files are downloaded on demand as they need to be
11450 read, if a cached copy cannot be found locally. Both committing and
11451 downloading an LFS file will link the file to a usercache, to speed up
11452 future access. See the usercache config setting described below.
11453
11454 The extension reads its configuration from a versioned .hglfs configu‐
11455 ration file found in the root of the working directory. The .hglfs file
11456 uses the same syntax as all other Mercurial configuration files. It
11457 uses a single section, [track].
11458
11459 The [track] section specifies which files are stored as LFS (or not).
11460 Each line is keyed by a file pattern, with a predicate value. The
11461 first file pattern match is used, so put more specific patterns first.
11462 The available predicates are all(), none(), and size(). See "hg help
11463 filesets.size" for the latter.
11464
11465 Example versioned .hglfs file:
11466
11467 [track]
11468 # No Makefile or python file, anywhere, will be LFS
11469 **Makefile = none()
11470 **.py = none()
11471
11472 **.zip = all()
11473 **.exe = size(">1MB")
11474
11475 # Catchall for everything not matched above
11476 ** = size(">10MB")
11477
11478 Configs:
11479
11480 [lfs]
11481 # Remote endpoint. Multiple protocols are supported:
11482 # - http(s)://user:pass@example.com/path
11483 # git-lfs endpoint
11484 # - file:///tmp/path
11485 # local filesystem, usually for testing
11486 # if unset, lfs will assume the remote repository also handles blob storage
11487 # for http(s) URLs. Otherwise, lfs will prompt to set this when it must
11488 # use this value.
11489 # (default: unset)
11490 url = https://example.com/repo.git/info/lfs
11491
11492 # Which files to track in LFS. Path tests are "**.extname" for file
11493 # extensions, and "path:under/some/directory" for path prefix. Both
11494 # are relative to the repository root.
11495 # File size can be tested with the "size()" fileset, and tests can be
11496 # joined with fileset operators. (See "hg help filesets.operators".)
11497 #
11498 # Some examples:
11499 # - all() # everything
11500 # - none() # nothing
11501 # - size(">20MB") # larger than 20MB
11502 # - !**.txt # anything not a *.txt file
11503 # - **.zip | **.tar.gz | **.7z # some types of compressed files
11504 # - path:bin # files under "bin" in the project root
11505 # - (**.php & size(">2MB")) | (**.js & size(">5MB")) | **.tar.gz
11506 # | (path:bin & !path:/bin/README) | size(">1GB")
11507 # (default: none())
11508 #
11509 # This is ignored if there is a tracked '.hglfs' file, and this setting
11510 # will eventually be deprecated and removed.
11511 track = size(">10M")
11512
11513 # how many times to retry before giving up on transferring an object
11514 retry = 5
11515
11516 # the local directory to store lfs files for sharing across local clones.
11517 # If not set, the cache is located in an OS specific cache location.
11518 usercache = /path/to/global/cache
11519
11520 Commands
11521 Uncategorized commands
11522 logtoprocess
11523 send ui.log() data to a subprocess (EXPERIMENTAL)
11524
11525 This extension lets you specify a shell command per ui.log() event,
11526 sending all remaining arguments to as environment variables to that
11527 command.
11528
11529 Positional arguments construct a log message, which is passed in the
11530 MSG1 environment variables. Each keyword argument is set as a OPT_UP‐
11531 PERCASE_KEY variable (so the key is uppercased, and prefixed with
11532 OPT_). The original event name is passed in the EVENT environment vari‐
11533 able, and the process ID of mercurial is given in HGPID.
11534
11535 So given a call ui.log('foo', 'bar %s ', 'baz', spam='eggs'), a script
11536 configured for the `foo event can expect an environment with MSG1=bar
11537 baz, and OPT_SPAM=eggs.
11538
11539 Scripts are configured in the [logtoprocess] section, each key an event
11540 name. For example:
11541
11542 [logtoprocess]
11543 commandexception = echo "$MSG1" > /var/log/mercurial_exceptions.log
11544
11545 would log the warning message and traceback of any failed command dis‐
11546 patch.
11547
11548 Scripts are run asynchronously as detached daemon processes; mercurial
11549 will not ensure that they exit cleanly.
11550
11551 mq
11552 manage a stack of patches
11553
11554 This extension lets you work with a stack of patches in a Mercurial
11555 repository. It manages two stacks of patches - all known patches, and
11556 applied patches (subset of known patches).
11557
11558 Known patches are represented as patch files in the .hg/patches direc‐
11559 tory. Applied patches are both patch files and changesets.
11560
11561 Common tasks (use hg help COMMAND for more details):
11562
11563 create new patch qnew
11564 import existing patch qimport
11565
11566 print patch series qseries
11567 print applied patches qapplied
11568
11569 add known patch to applied stack qpush
11570 remove patch from applied stack qpop
11571 refresh contents of top applied patch qrefresh
11572
11573 By default, mq will automatically use git patches when required to
11574 avoid losing file mode changes, copy records, binary files or empty
11575 files creations or deletions. This behavior can be configured with:
11576
11577 [mq]
11578 git = auto/keep/yes/no
11579
11580 If set to 'keep', mq will obey the [diff] section configuration while
11581 preserving existing git patches upon qrefresh. If set to 'yes' or 'no',
11582 mq will override the [diff] section and always generate git or regular
11583 patches, possibly losing data in the second case.
11584
11585 It may be desirable for mq changesets to be kept in the secret phase
11586 (see hg help phases), which can be enabled with the following setting:
11587
11588 [mq]
11589 secret = True
11590
11591 You will by default be managing a patch queue named "patches". You can
11592 create other, independent patch queues with the hg qqueue command.
11593
11594 If the working directory contains uncommitted files, qpush, qpop and
11595 qgoto abort immediately. If -f/--force is used, the changes are dis‐
11596 carded. Setting:
11597
11598 [mq]
11599 keepchanges = True
11600
11601 make them behave as if --keep-changes were passed, and non-conflicting
11602 local changes will be tolerated and preserved. If incompatible options
11603 such as -f/--force or --exact are passed, this setting is ignored.
11604
11605 This extension used to provide a strip command. This command now lives
11606 in the strip extension.
11607
11608 Commands
11609 Repository creation
11610 qclone
11611 clone main and patch repository at same time:
11612
11613 hg qclone [OPTION]... SOURCE [DEST]
11614
11615 If source is local, destination will have no patches applied. If source
11616 is remote, this command can not check if patches are applied in source,
11617 so cannot guarantee that patches are not applied in destination. If you
11618 clone remote repository, be sure before that it has no patches applied.
11619
11620 Source patch repository is looked for in <src>/.hg/patches by default.
11621 Use -p <url> to change.
11622
11623 The patch directory must be a nested Mercurial repository, as would be
11624 created by hg init --mq.
11625
11626 Return 0 on success.
11627
11628 Options:
11629
11630 --pull use pull protocol to copy metadata
11631
11632 -U, --noupdate
11633 do not update the new working directories
11634
11635 --uncompressed
11636 use uncompressed transfer (fast over LAN)
11637
11638 -p,--patches <REPO>
11639 location of source patch repository
11640
11641 -e,--ssh <CMD>
11642 specify ssh command to use
11643
11644 --remotecmd <CMD>
11645 specify hg command to run on the remote side
11646
11647 --insecure
11648 do not verify server certificate (ignoring web.cacerts config)
11649
11650 qinit
11651 init a new queue repository (DEPRECATED):
11652
11653 hg qinit [-c]
11654
11655 The queue repository is unversioned by default. If -c/--create-repo is
11656 specified, qinit will create a separate nested repository for patches
11657 (qinit -c may also be run later to convert an unversioned patch reposi‐
11658 tory into a versioned one). You can use qcommit to commit changes to
11659 this queue repository.
11660
11661 This command is deprecated. Without -c, it's implied by other relevant
11662 commands. With -c, use hg init --mq instead.
11663
11664 Options:
11665
11666 -c, --create-repo
11667 create queue repository
11668
11669 Change creation
11670 qcommit
11671 commit changes in the queue repository (DEPRECATED):
11672
11673 hg qcommit [OPTION]... [FILE]...
11674
11675 This command is deprecated; use hg commit --mq instead.
11676
11677 Options:
11678
11679 -A, --addremove
11680 mark new/missing files as added/removed before committing
11681
11682 --close-branch
11683 mark a branch head as closed
11684
11685 --amend
11686 amend the parent of the working directory
11687
11688 -s, --secret
11689 use the secret phase for committing
11690
11691 -e, --edit
11692 invoke editor on commit messages
11693
11694 --force-close-branch
11695 forcibly close branch from a non-head changeset (ADVANCED)
11696
11697 -i, --interactive
11698 use interactive mode
11699
11700 -I,--include <PATTERN[+]>
11701 include names matching the given patterns
11702
11703 -X,--exclude <PATTERN[+]>
11704 exclude names matching the given patterns
11705
11706 -m,--message <TEXT>
11707 use text as commit message
11708
11709 -l,--logfile <FILE>
11710 read commit message from file
11711
11712 -d,--date <DATE>
11713 record the specified date as commit date
11714
11715 -u,--user <USER>
11716 record the specified user as committer
11717
11718 -S, --subrepos
11719 recurse into subrepositories
11720
11721 [+] marked option can be specified multiple times
11722
11723 aliases: qci
11724
11725 qnew
11726 create a new patch:
11727
11728 hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...
11729
11730 qnew creates a new patch on top of the currently-applied patch (if
11731 any). The patch will be initialized with any outstanding changes in the
11732 working directory. You may also use -I/--include, -X/--exclude, and/or
11733 a list of files after the patch name to add only changes to matching
11734 files to the new patch, leaving the rest as uncommitted modifications.
11735
11736 -u/--user and -d/--date can be used to set the (given) user and date,
11737 respectively. -U/--currentuser and -D/--currentdate set user to current
11738 user and date to current date.
11739
11740 -e/--edit, -m/--message or -l/--logfile set the patch header as well as
11741 the commit message. If none is specified, the header is empty and the
11742 commit message is '[mq]: PATCH'.
11743
11744 Use the -g/--git option to keep the patch in the git extended diff for‐
11745 mat. Read the diffs help topic for more information on why this is im‐
11746 portant for preserving permission changes and copy/rename information.
11747
11748 Returns 0 on successful creation of a new patch.
11749
11750 Options:
11751
11752 -e, --edit
11753 invoke editor on commit messages
11754
11755 -f, --force
11756 import uncommitted changes (DEPRECATED)
11757
11758 -g, --git
11759 use git extended diff format
11760
11761 -U, --currentuser
11762 add "From: <current user>" to patch
11763
11764 -u,--user <USER>
11765 add "From: <USER>" to patch
11766
11767 -D, --currentdate
11768 add "Date: <current date>" to patch
11769
11770 -d,--date <DATE>
11771 add "Date: <DATE>" to patch
11772
11773 -I,--include <PATTERN[+]>
11774 include names matching the given patterns
11775
11776 -X,--exclude <PATTERN[+]>
11777 exclude names matching the given patterns
11778
11779 -m,--message <TEXT>
11780 use text as commit message
11781
11782 -l,--logfile <FILE>
11783 read commit message from file
11784
11785 [+] marked option can be specified multiple times
11786
11787 qrefresh
11788 update the current patch:
11789
11790 hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...
11791
11792 If any file patterns are provided, the refreshed patch will contain
11793 only the modifications that match those patterns; the remaining modifi‐
11794 cations will remain in the working directory.
11795
11796 If -s/--short is specified, files currently included in the patch will
11797 be refreshed just like matched files and remain in the patch.
11798
11799 If -e/--edit is specified, Mercurial will start your configured editor
11800 for you to enter a message. In case qrefresh fails, you will find a
11801 backup of your message in .hg/last-message.txt.
11802
11803 hg add/remove/copy/rename work as usual, though you might want to use
11804 git-style patches (-g/--git or [diff] git=1) to track copies and re‐
11805 names. See the diffs help topic for more information on the git diff
11806 format.
11807
11808 Returns 0 on success.
11809
11810 Options:
11811
11812 -e, --edit
11813 invoke editor on commit messages
11814
11815 -g, --git
11816 use git extended diff format
11817
11818 -s, --short
11819 refresh only files already in the patch and specified files
11820
11821 -U, --currentuser
11822 add/update author field in patch with current user
11823
11824 -u,--user <USER>
11825 add/update author field in patch with given user
11826
11827 -D, --currentdate
11828 add/update date field in patch with current date
11829
11830 -d,--date <DATE>
11831 add/update date field in patch with given date
11832
11833 -I,--include <PATTERN[+]>
11834 include names matching the given patterns
11835
11836 -X,--exclude <PATTERN[+]>
11837 exclude names matching the given patterns
11838
11839 -m,--message <TEXT>
11840 use text as commit message
11841
11842 -l,--logfile <FILE>
11843 read commit message from file
11844
11845 [+] marked option can be specified multiple times
11846
11847 Change manipulation
11848 qfold
11849 fold the named patches into the current patch:
11850
11851 hg qfold [-e] [-k] [-m TEXT] [-l FILE] PATCH...
11852
11853 Patches must not yet be applied. Each patch will be successively ap‐
11854 plied to the current patch in the order given. If all the patches apply
11855 successfully, the current patch will be refreshed with the new cumula‐
11856 tive patch, and the folded patches will be deleted. With -k/--keep, the
11857 folded patch files will not be removed afterwards.
11858
11859 The header for each folded patch will be concatenated with the current
11860 patch header, separated by a line of * * *.
11861
11862 Returns 0 on success.
11863
11864 Options:
11865
11866 -e, --edit
11867 invoke editor on commit messages
11868
11869 -k, --keep
11870 keep folded patch files
11871
11872 -m,--message <TEXT>
11873 use text as commit message
11874
11875 -l,--logfile <FILE>
11876 read commit message from file
11877
11878 Change organization
11879 qapplied
11880 print the patches already applied:
11881
11882 hg qapplied [-1] [-s] [PATCH]
11883
11884 Returns 0 on success.
11885
11886 Options:
11887
11888 -1, --last
11889 show only the preceding applied patch
11890
11891 -s, --summary
11892 print first line of patch header
11893
11894 qdelete
11895 remove patches from queue:
11896
11897 hg qdelete [-k] [PATCH]...
11898
11899 The patches must not be applied, and at least one patch is required.
11900 Exact patch identifiers must be given. With -k/--keep, the patch files
11901 are preserved in the patch directory.
11902
11903 To stop managing a patch and move it into permanent history, use the hg
11904 qfinish command.
11905
11906 Options:
11907
11908 -k, --keep
11909 keep patch file
11910
11911 -r,--rev <REV[+]>
11912 stop managing a revision (DEPRECATED)
11913
11914 [+] marked option can be specified multiple times
11915
11916 aliases: qremove qrm
11917
11918 qfinish
11919 move applied patches into repository history:
11920
11921 hg qfinish [-a] [REV]...
11922
11923 Finishes the specified revisions (corresponding to applied patches) by
11924 moving them out of mq control into regular repository history.
11925
11926 Accepts a revision range or the -a/--applied option. If --applied is
11927 specified, all applied mq revisions are removed from mq control. Other‐
11928 wise, the given revisions must be at the base of the stack of applied
11929 patches.
11930
11931 This can be especially useful if your changes have been applied to an
11932 upstream repository, or if you are about to push your changes to up‐
11933 stream.
11934
11935 Returns 0 on success.
11936
11937 Options:
11938
11939 -a, --applied
11940 finish all applied changesets
11941
11942 qgoto
11943 push or pop patches until named patch is at top of stack:
11944
11945 hg qgoto [OPTION]... PATCH
11946
11947 Returns 0 on success.
11948
11949 Options:
11950
11951 --keep-changes
11952 tolerate non-conflicting local changes
11953
11954 -f, --force
11955 overwrite any local changes
11956
11957 --no-backup
11958 do not save backup copies of files
11959
11960 qguard
11961 set or print guards for a patch:
11962
11963 hg qguard [-l] [-n] [PATCH] [-- [+GUARD]... [-GUARD]...]
11964
11965 Guards control whether a patch can be pushed. A patch with no guards is
11966 always pushed. A patch with a positive guard ("+foo") is pushed only if
11967 the hg qselect command has activated it. A patch with a negative guard
11968 ("-foo") is never pushed if the hg qselect command has activated it.
11969
11970 With no arguments, print the currently active guards. With arguments,
11971 set guards for the named patch.
11972
11973 Note Specifying negative guards now requires '--'.
11974
11975 To set guards on another patch:
11976
11977 hg qguard other.patch -- +2.6.17 -stable
11978
11979 Returns 0 on success.
11980
11981 Options:
11982
11983 -l, --list
11984 list all patches and guards
11985
11986 -n, --none
11987 drop all guards
11988
11989 qheader
11990 print the header of the topmost or specified patch:
11991
11992 hg qheader [PATCH]
11993
11994 Returns 0 on success.
11995
11996 qnext
11997 print the name of the next pushable patch:
11998
11999 hg qnext [-s]
12000
12001 Returns 0 on success.
12002
12003 Options:
12004
12005 -s, --summary
12006 print first line of patch header
12007
12008 qpop
12009 pop the current patch off the stack:
12010
12011 hg qpop [-a] [-f] [PATCH | INDEX]
12012
12013 Without argument, pops off the top of the patch stack. If given a patch
12014 name, keeps popping off patches until the named patch is at the top of
12015 the stack.
12016
12017 By default, abort if the working directory contains uncommitted
12018 changes. With --keep-changes, abort only if the uncommitted files over‐
12019 lap with patched files. With -f/--force, backup and discard changes
12020 made to such files.
12021
12022 Return 0 on success.
12023
12024 Options:
12025
12026 -a, --all
12027 pop all patches
12028
12029 -n,--name <NAME>
12030 queue name to pop (DEPRECATED)
12031
12032 --keep-changes
12033 tolerate non-conflicting local changes
12034
12035 -f, --force
12036 forget any local changes to patched files
12037
12038 --no-backup
12039 do not save backup copies of files
12040
12041 qprev
12042 print the name of the preceding applied patch:
12043
12044 hg qprev [-s]
12045
12046 Returns 0 on success.
12047
12048 Options:
12049
12050 -s, --summary
12051 print first line of patch header
12052
12053 qpush
12054 push the next patch onto the stack:
12055
12056 hg qpush [-f] [-l] [-a] [--move] [PATCH | INDEX]
12057
12058 By default, abort if the working directory contains uncommitted
12059 changes. With --keep-changes, abort only if the uncommitted files over‐
12060 lap with patched files. With -f/--force, backup and patch over uncom‐
12061 mitted changes.
12062
12063 Return 0 on success.
12064
12065 Options:
12066
12067 --keep-changes
12068 tolerate non-conflicting local changes
12069
12070 -f, --force
12071 apply on top of local changes
12072
12073 -e, --exact
12074 apply the target patch to its recorded parent
12075
12076 -l, --list
12077 list patch name in commit text
12078
12079 -a, --all
12080 apply all patches
12081
12082 -m, --merge
12083 merge from another queue (DEPRECATED)
12084
12085 -n,--name <NAME>
12086 merge queue name (DEPRECATED)
12087
12088 --move reorder patch series and apply only the patch
12089
12090 --no-backup
12091 do not save backup copies of files
12092
12093 qqueue
12094 manage multiple patch queues:
12095
12096 hg qqueue [OPTION] [QUEUE]
12097
12098 Supports switching between different patch queues, as well as creating
12099 new patch queues and deleting existing ones.
12100
12101 Omitting a queue name or specifying -l/--list will show you the regis‐
12102 tered queues - by default the "normal" patches queue is registered. The
12103 currently active queue will be marked with "(active)". Specifying --ac‐
12104 tive will print only the name of the active queue.
12105
12106 To create a new queue, use -c/--create. The queue is automatically made
12107 active, except in the case where there are applied patches from the
12108 currently active queue in the repository. Then the queue will only be
12109 created and switching will fail.
12110
12111 To delete an existing queue, use --delete. You cannot delete the cur‐
12112 rently active queue.
12113
12114 Returns 0 on success.
12115
12116 Options:
12117
12118 -l, --list
12119 list all available queues
12120
12121 --active
12122 print name of active queue
12123
12124 -c, --create
12125 create new queue
12126
12127 --rename
12128 rename active queue
12129
12130 --delete
12131 delete reference to queue
12132
12133 --purge
12134 delete queue, and remove patch dir
12135
12136 qrename
12137 rename a patch:
12138
12139 hg qrename PATCH1 [PATCH2]
12140
12141 With one argument, renames the current patch to PATCH1. With two argu‐
12142 ments, renames PATCH1 to PATCH2.
12143
12144 Returns 0 on success.
12145
12146 aliases: qmv
12147
12148 qrestore
12149 restore the queue state saved by a revision (DEPRECATED):
12150
12151 hg qrestore [-d] [-u] REV
12152
12153 This command is deprecated, use hg rebase instead.
12154
12155 Options:
12156
12157 -d, --delete
12158 delete save entry
12159
12160 -u, --update
12161 update queue working directory
12162
12163 qsave
12164 save current queue state (DEPRECATED):
12165
12166 hg qsave [-m TEXT] [-l FILE] [-c] [-n NAME] [-e] [-f]
12167
12168 This command is deprecated, use hg rebase instead.
12169
12170 Options:
12171
12172 -c, --copy
12173 copy patch directory
12174
12175 -n,--name <NAME>
12176 copy directory name
12177
12178 -e, --empty
12179 clear queue status file
12180
12181 -f, --force
12182 force copy
12183
12184 -m,--message <TEXT>
12185 use text as commit message
12186
12187 -l,--logfile <FILE>
12188 read commit message from file
12189
12190 qselect
12191 set or print guarded patches to push:
12192
12193 hg qselect [OPTION]... [GUARD]...
12194
12195 Use the hg qguard command to set or print guards on patch, then use qs‐
12196 elect to tell mq which guards to use. A patch will be pushed if it has
12197 no guards or any positive guards match the currently selected guard,
12198 but will not be pushed if any negative guards match the current guard.
12199 For example:
12200
12201 qguard foo.patch -- -stable (negative guard)
12202 qguard bar.patch +stable (positive guard)
12203 qselect stable
12204
12205 This activates the "stable" guard. mq will skip foo.patch (because it
12206 has a negative match) but push bar.patch (because it has a positive
12207 match).
12208
12209 With no arguments, prints the currently active guards. With one argu‐
12210 ment, sets the active guard.
12211
12212 Use -n/--none to deactivate guards (no other arguments needed). When
12213 no guards are active, patches with positive guards are skipped and
12214 patches with negative guards are pushed.
12215
12216 qselect can change the guards on applied patches. It does not pop
12217 guarded patches by default. Use --pop to pop back to the last applied
12218 patch that is not guarded. Use --reapply (which implies --pop) to push
12219 back to the current patch afterwards, but skip guarded patches.
12220
12221 Use -s/--series to print a list of all guards in the series file (no
12222 other arguments needed). Use -v for more information.
12223
12224 Returns 0 on success.
12225
12226 Options:
12227
12228 -n, --none
12229 disable all guards
12230
12231 -s, --series
12232 list all guards in series file
12233
12234 --pop pop to before first guarded applied patch
12235
12236 --reapply
12237 pop, then reapply patches
12238
12239 qseries
12240 print the entire series file:
12241
12242 hg qseries [-ms]
12243
12244 Returns 0 on success.
12245
12246 Options:
12247
12248 -m, --missing
12249 print patches not in series
12250
12251 -s, --summary
12252 print first line of patch header
12253
12254 qtop
12255 print the name of the current patch:
12256
12257 hg qtop [-s]
12258
12259 Returns 0 on success.
12260
12261 Options:
12262
12263 -s, --summary
12264 print first line of patch header
12265
12266 qunapplied
12267 print the patches not yet applied:
12268
12269 hg qunapplied [-1] [-s] [PATCH]
12270
12271 Returns 0 on success.
12272
12273 Options:
12274
12275 -1, --first
12276 show only the first patch
12277
12278 -s, --summary
12279 print first line of patch header
12280
12281 File content management
12282 qdiff
12283 diff of the current patch and subsequent modifications:
12284
12285 hg qdiff [OPTION]... [FILE]...
12286
12287 Shows a diff which includes the current patch as well as any changes
12288 which have been made in the working directory since the last refresh
12289 (thus showing what the current patch would become after a qrefresh).
12290
12291 Use hg diff if you only want to see the changes made since the last
12292 qrefresh, or hg export qtip if you want to see changes made by the cur‐
12293 rent patch without including changes made since the qrefresh.
12294
12295 Returns 0 on success.
12296
12297 Options:
12298
12299 -a, --text
12300 treat all files as text
12301
12302 -g, --git
12303 use git extended diff format (DEFAULT: diff.git)
12304
12305 --binary
12306 generate binary diffs in git mode (default)
12307
12308 --nodates
12309 omit dates from diff headers
12310
12311 --noprefix
12312 omit a/ and b/ prefixes from filenames
12313
12314 -p, --show-function
12315 show which function each change is in (DEFAULT: diff.showfunc)
12316
12317 --reverse
12318 produce a diff that undoes the changes
12319
12320 -w, --ignore-all-space
12321 ignore white space when comparing lines
12322
12323 -b, --ignore-space-change
12324 ignore changes in the amount of white space
12325
12326 -B, --ignore-blank-lines
12327 ignore changes whose lines are all blank
12328
12329 -Z, --ignore-space-at-eol
12330 ignore changes in whitespace at EOL
12331
12332 -U,--unified <NUM>
12333 number of lines of context to show
12334
12335 --stat output diffstat-style summary of changes
12336
12337 --root <DIR>
12338 produce diffs relative to subdirectory
12339
12340 -I,--include <PATTERN[+]>
12341 include names matching the given patterns
12342
12343 -X,--exclude <PATTERN[+]>
12344 exclude names matching the given patterns
12345
12346 [+] marked option can be specified multiple times
12347
12348 Change import/export
12349 qimport
12350 import a patch or existing changeset:
12351
12352 hg qimport [-e] [-n NAME] [-f] [-g] [-P] [-r REV]... [FILE]...
12353
12354 The patch is inserted into the series after the last applied patch. If
12355 no patches have been applied, qimport prepends the patch to the series.
12356
12357 The patch will have the same name as its source file unless you give it
12358 a new one with -n/--name.
12359
12360 You can register an existing patch inside the patch directory with the
12361 -e/--existing flag.
12362
12363 With -f/--force, an existing patch of the same name will be overwrit‐
12364 ten.
12365
12366 An existing changeset may be placed under mq control with -r/--rev
12367 (e.g. qimport --rev . -n patch will place the current revision under mq
12368 control). With -g/--git, patches imported with --rev will use the git
12369 diff format. See the diffs help topic for information on why this is
12370 important for preserving rename/copy information and permission
12371 changes. Use hg qfinish to remove changesets from mq control.
12372
12373 To import a patch from standard input, pass - as the patch file. When
12374 importing from standard input, a patch name must be specified using the
12375 --name flag.
12376
12377 To import an existing patch while renaming it:
12378
12379 hg qimport -e existing-patch -n new-name
12380
12381 Returns 0 if import succeeded.
12382
12383 Options:
12384
12385 -e, --existing
12386 import file in patch directory
12387
12388 -n,--name <NAME>
12389 name of patch file
12390
12391 -f, --force
12392 overwrite existing files
12393
12394 -r,--rev <REV[+]>
12395 place existing revisions under mq control
12396
12397 -g, --git
12398 use git extended diff format
12399
12400 -P, --push
12401 qpush after importing
12402
12403 [+] marked option can be specified multiple times
12404
12405 narrow
12406 create clones which fetch history data for subset of files (EXPERIMEN‐
12407 TAL)
12408
12409 Commands
12410 Repository maintenance
12411 tracked
12412 show or change the current narrowspec:
12413
12414 hg tracked [OPTIONS]... [REMOTE]
12415
12416 With no argument, shows the current narrowspec entries, one per line.
12417 Each line will be prefixed with 'I' or 'X' for included or excluded
12418 patterns, respectively.
12419
12420 The narrowspec is comprised of expressions to match remote files and/or
12421 directories that should be pulled into your client. The narrowspec has
12422 include and exclude expressions, with excludes always trumping in‐
12423 cludes: that is, if a file matches an exclude expression, it will be
12424 excluded even if it also matches an include expression. Excluding
12425 files that were never included has no effect.
12426
12427 Each included or excluded entry is in the format described by 'hg help
12428 patterns'.
12429
12430 The options allow you to add or remove included and excluded expres‐
12431 sions.
12432
12433 If --clear is specified, then all previous includes and excludes are
12434 DROPPED and replaced by the new ones specified to --addinclude and
12435 --addexclude. If --clear is specified without any further options, the
12436 narrowspec will be empty and will not match any files.
12437
12438 If --auto-remove-includes is specified, then those includes that don't
12439 match any files modified by currently visible local commits (those not
12440 shared by the remote) will be added to the set of explicitly specified
12441 includes to remove.
12442
12443 --import-rules accepts a path to a file containing rules, allowing you
12444 to add --addinclude, --addexclude rules in bulk. Like the other include
12445 and exclude switches, the changes are applied immediately.
12446
12447 Options:
12448
12449 --addinclude <VALUE[+]>
12450 new paths to include
12451
12452 --removeinclude <VALUE[+]>
12453 old paths to no longer include
12454
12455 --auto-remove-includes
12456 automatically choose unused includes to remove
12457
12458 --addexclude <VALUE[+]>
12459 new paths to exclude
12460
12461 --import-rules <VALUE>
12462 import narrowspecs from a file
12463
12464 --removeexclude <VALUE[+]>
12465 old paths to no longer exclude
12466
12467 --clear
12468 whether to replace the existing narrowspec
12469
12470 --force-delete-local-changes
12471 forces deletion of local changes when narrowing
12472
12473 --backup
12474 back up local changes when narrowing (default: True)
12475
12476 --update-working-copy
12477 update working copy when the store has changed
12478
12479 -e,--ssh <CMD>
12480 specify ssh command to use
12481
12482 --remotecmd <CMD>
12483 specify hg command to run on the remote side
12484
12485 --insecure
12486 do not verify server certificate (ignoring web.cacerts config)
12487
12488 [+] marked option can be specified multiple times
12489
12490 notify
12491 hooks for sending email push notifications
12492
12493 This extension implements hooks to send email notifications when
12494 changesets are sent from or received by the local repository.
12495
12496 First, enable the extension as explained in hg help extensions, and
12497 register the hook you want to run. incoming and changegroup hooks are
12498 run when changesets are received, while outgoing hooks are for change‐
12499 sets sent to another repository:
12500
12501 [hooks]
12502 # one email for each incoming changeset
12503 incoming.notify = python:hgext.notify.hook
12504 # one email for all incoming changesets
12505 changegroup.notify = python:hgext.notify.hook
12506
12507 # one email for all outgoing changesets
12508 outgoing.notify = python:hgext.notify.hook
12509
12510 This registers the hooks. To enable notification, subscribers must be
12511 assigned to repositories. The [usersubs] section maps multiple reposi‐
12512 tories to a given recipient. The [reposubs] section maps multiple re‐
12513 cipients to a single repository:
12514
12515 [usersubs]
12516 # key is subscriber email, value is a comma-separated list of repo patterns
12517 user@host = pattern
12518
12519 [reposubs]
12520 # key is repo pattern, value is a comma-separated list of subscriber emails
12521 pattern = user@host
12522
12523 A pattern is a glob matching the absolute path to a repository, option‐
12524 ally combined with a revset expression. A revset expression, if
12525 present, is separated from the glob by a hash. Example:
12526
12527 [reposubs]
12528 */widgets#branch(release) = qa-team@example.com
12529
12530 This sends to qa-team@example.com whenever a changeset on the release
12531 branch triggers a notification in any repository ending in widgets.
12532
12533 In order to place them under direct user management, [usersubs] and
12534 [reposubs] sections may be placed in a separate hgrc file and incorpo‐
12535 rated by reference:
12536
12537 [notify]
12538 config = /path/to/subscriptionsfile
12539
12540 Notifications will not be sent until the notify.test value is set to
12541 False; see below.
12542
12543 Notifications content can be tweaked with the following configuration
12544 entries:
12545
12546 notify.test
12547 If True, print messages to stdout instead of sending them. De‐
12548 fault: True.
12549
12550 notify.sources
12551 Space-separated list of change sources. Notifications are acti‐
12552 vated only when a changeset's source is in this list. Sources
12553 may be:
12554
12555 serve
12556
12557 changesets received via http or ssh
12558
12559 pull
12560
12561 changesets received via hg pull
12562
12563 unbundle
12564
12565 changesets received via hg unbundle
12566
12567 push
12568
12569 changesets sent or received via hg push
12570
12571 bundle
12572
12573 changesets sent via hg unbundle
12574
12575 Default: serve.
12576
12577 notify.strip
12578 Number of leading slashes to strip from url paths. By default,
12579 notifications reference repositories with their absolute path.
12580 notify.strip lets you turn them into relative paths. For exam‐
12581 ple, notify.strip=3 will change /long/path/repository into
12582 repository. Default: 0.
12583
12584 notify.domain
12585 Default email domain for sender or recipients with no explicit
12586 domain. It is also used for the domain part of the Message-Id
12587 when using notify.messageidseed.
12588
12589 notify.messageidseed
12590 Create deterministic Message-Id headers for the mails based on
12591 the seed and the revision identifier of the first commit in the
12592 changeset.
12593
12594 notify.style
12595 Style file to use when formatting emails.
12596
12597 notify.template
12598 Template to use when formatting emails.
12599
12600 notify.incoming
12601 Template to use when run as an incoming hook, overriding no‐
12602 tify.template.
12603
12604 notify.outgoing
12605 Template to use when run as an outgoing hook, overriding no‐
12606 tify.template.
12607
12608 notify.changegroup
12609 Template to use when running as a changegroup hook, overriding
12610 notify.template.
12611
12612 notify.maxdiff
12613 Maximum number of diff lines to include in notification email.
12614 Set to 0 to disable the diff, or -1 to include all of it. De‐
12615 fault: 300.
12616
12617 notify.maxdiffstat
12618 Maximum number of diffstat lines to include in notification
12619 email. Set to -1 to include all of it. Default: -1.
12620
12621 notify.maxsubject
12622 Maximum number of characters in email's subject line. Default:
12623 67.
12624
12625 notify.diffstat
12626 Set to True to include a diffstat before diff content. Default:
12627 True.
12628
12629 notify.showfunc
12630 If set, override diff.showfunc for the diff content. Default:
12631 None.
12632
12633 notify.merge
12634 If True, send notifications for merge changesets. Default: True.
12635
12636 notify.mbox
12637 If set, append mails to this mbox file instead of sending. De‐
12638 fault: None.
12639
12640 notify.fromauthor
12641 If set, use the committer of the first changeset in a change‐
12642 group for the "From" field of the notification mail. If not set,
12643 take the user from the pushing repo. Default: False.
12644
12645 notify.reply-to-predecessor (EXPERIMENTAL)
12646 If set and the changeset has a predecessor in the repository,
12647 try to thread the notification mail with the predecessor. This
12648 adds the "In-Reply-To" header to the notification mail with a
12649 reference to the predecessor with the smallest revision number.
12650 Mail threads can still be torn, especially when changesets are
12651 folded.
12652
12653 This option must be used in combination with notify.messageid‐
12654 seed.
12655
12656 If set, the following entries will also be used to customize the noti‐
12657 fications:
12658
12659 email.from
12660 Email From address to use if none can be found in the generated
12661 email content.
12662
12663 web.baseurl
12664 Root repository URL to combine with repository paths when making
12665 references. See also notify.strip.
12666
12667 pager
12668 browse command output with an external pager (DEPRECATED)
12669
12670 Forcibly enable paging for individual commands that don't typically re‐
12671 quest pagination with the attend-<command> option. This setting takes
12672 precedence over ignore options and defaults:
12673
12674 [pager]
12675 attend-cat = false
12676
12677 patchbomb
12678 command to send changesets as (a series of) patch emails
12679
12680 The series is started off with a "[PATCH 0 of N]" introduction, which
12681 describes the series as a whole.
12682
12683 Each patch email has a Subject line of "[PATCH M of N] ...", using the
12684 first line of the changeset description as the subject text. The mes‐
12685 sage contains two or three body parts:
12686
12687 • The changeset description.
12688
12689 • [Optional] The result of running diffstat on the patch.
12690
12691 • The patch itself, as generated by hg export.
12692
12693 Each message refers to the first in the series using the In-Reply-To
12694 and References headers, so they will show up as a sequence in threaded
12695 mail and news readers, and in mail archives.
12696
12697 To configure other defaults, add a section like this to your configura‐
12698 tion file:
12699
12700 [email]
12701 from = My Name <my@email>
12702 to = recipient1, recipient2, ...
12703 cc = cc1, cc2, ...
12704 bcc = bcc1, bcc2, ...
12705 reply-to = address1, address2, ...
12706
12707 Use [patchbomb] as configuration section name if you need to override
12708 global [email] address settings.
12709
12710 Then you can use the hg email command to mail a series of changesets as
12711 a patchbomb.
12712
12713 You can also either configure the method option in the email section to
12714 be a sendmail compatible mailer or fill out the [smtp] section so that
12715 the patchbomb extension can automatically send patchbombs directly from
12716 the commandline. See the [email] and [smtp] sections in hgrc(5) for de‐
12717 tails.
12718
12719 By default, hg email will prompt for a To or CC header if you do not
12720 supply one via configuration or the command line. You can override
12721 this to never prompt by configuring an empty value:
12722
12723 [email]
12724 cc =
12725
12726 You can control the default inclusion of an introduction message with
12727 the patchbomb.intro configuration option. The configuration is always
12728 overwritten by command line flags like --intro and --desc:
12729
12730 [patchbomb]
12731 intro=auto # include introduction message if more than 1 patch (default)
12732 intro=never # never include an introduction message
12733 intro=always # always include an introduction message
12734
12735 You can specify a template for flags to be added in subject prefixes.
12736 Flags specified by --flag option are exported as {flags} keyword:
12737
12738 [patchbomb]
12739 flagtemplate = "{separate(' ',
12740 ifeq(branch, 'default', '', branch|upper),
12741 flags)}"
12742
12743 You can set patchbomb to always ask for confirmation by setting patch‐
12744 bomb.confirm to true.
12745
12746 Commands
12747 Change import/export
12748 email
12749 send changesets by email:
12750
12751 hg email [OPTION]... [DEST]...
12752
12753 By default, diffs are sent in the format generated by hg export, one
12754 per message. The series starts with a "[PATCH 0 of N]" introduction,
12755 which describes the series as a whole.
12756
12757 Each patch email has a Subject line of "[PATCH M of N] ...", using the
12758 first line of the changeset description as the subject text. The mes‐
12759 sage contains two or three parts. First, the changeset description.
12760
12761 With the -d/--diffstat option, if the diffstat program is installed,
12762 the result of running diffstat on the patch is inserted.
12763
12764 Finally, the patch itself, as generated by hg export.
12765
12766 With the -d/--diffstat or --confirm options, you will be presented with
12767 a final summary of all messages and asked for confirmation before the
12768 messages are sent.
12769
12770 By default the patch is included as text in the email body for easy re‐
12771 viewing. Using the -a/--attach option will instead create an attachment
12772 for the patch. With -i/--inline an inline attachment will be created.
12773 You can include a patch both as text in the email body and as a regular
12774 or an inline attachment by combining the -a/--attach or -i/--inline
12775 with the --body option.
12776
12777 With -B/--bookmark changesets reachable by the given bookmark are se‐
12778 lected.
12779
12780 With -o/--outgoing, emails will be generated for patches not found in
12781 the destination repository (or only those which are ancestors of the
12782 specified revisions if any are provided)
12783
12784 With -b/--bundle, changesets are selected as for --outgoing, but a sin‐
12785 gle email containing a binary Mercurial bundle as an attachment will be
12786 sent. Use the patchbomb.bundletype config option to control the bundle
12787 type as with hg bundle --type.
12788
12789 With -m/--mbox, instead of previewing each patchbomb message in a pager
12790 or sending the messages directly, it will create a UNIX mailbox file
12791 with the patch emails. This mailbox file can be previewed with any mail
12792 user agent which supports UNIX mbox files.
12793
12794 With -n/--test, all steps will run, but mail will not be sent. You
12795 will be prompted for an email recipient address, a subject and an in‐
12796 troductory message describing the patches of your patchbomb. Then when
12797 all is done, patchbomb messages are displayed.
12798
12799 In case email sending fails, you will find a backup of your series in‐
12800 troductory message in .hg/last-email.txt.
12801
12802 The default behavior of this command can be customized through configu‐
12803 ration. (See hg help patchbomb for details)
12804
12805 Examples:
12806
12807 hg email -r 3000 # send patch 3000 only
12808 hg email -r 3000 -r 3001 # send patches 3000 and 3001
12809 hg email -r 3000:3005 # send patches 3000 through 3005
12810 hg email 3000 # send patch 3000 (deprecated)
12811
12812 hg email -o # send all patches not in default
12813 hg email -o DEST # send all patches not in DEST
12814 hg email -o -r 3000 # send all ancestors of 3000 not in default
12815 hg email -o -r 3000 DEST # send all ancestors of 3000 not in DEST
12816
12817 hg email -B feature # send all ancestors of feature bookmark
12818
12819 hg email -b # send bundle of all patches not in default
12820 hg email -b DEST # send bundle of all patches not in DEST
12821 hg email -b -r 3000 # bundle of all ancestors of 3000 not in default
12822 hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in DEST
12823
12824 hg email -o -m mbox && # generate an mbox file...
12825 mutt -R -f mbox # ... and view it with mutt
12826 hg email -o -m mbox && # generate an mbox file ...
12827 formail -s sendmail \ # ... and use formail to send from the mbox
12828 -bm -t < mbox # ... using sendmail
12829
12830 Before using this command, you will need to enable email in your hgrc.
12831 See the [email] section in hgrc(5) for details.
12832
12833 Options:
12834
12835 -g, --git
12836 use git extended diff format
12837
12838 --plain
12839 omit hg patch header
12840
12841 -o, --outgoing
12842 send changes not found in the target repository
12843
12844 -b, --bundle
12845 send changes not in target as a binary bundle
12846
12847 -B,--bookmark <BOOKMARK>
12848 send changes only reachable by given bookmark
12849
12850 --bundlename <NAME>
12851 name of the bundle attachment file (default: bundle)
12852
12853 -r,--rev <REV[+]>
12854 a revision to send
12855
12856 --force
12857 run even when remote repository is unrelated (with -b/--bundle)
12858
12859 --base <REV[+]>
12860 a base changeset to specify instead of a destination (with
12861 -b/--bundle)
12862
12863 --intro
12864 send an introduction email for a single patch
12865
12866 --body send patches as inline message text (default)
12867
12868 -a, --attach
12869 send patches as attachments
12870
12871 -i, --inline
12872 send patches as inline attachments
12873
12874 --bcc <EMAIL[+]>
12875 email addresses of blind carbon copy recipients
12876
12877 -c,--cc <EMAIL[+]>
12878 email addresses of copy recipients
12879
12880 --confirm
12881 ask for confirmation before sending
12882
12883 -d, --diffstat
12884 add diffstat output to messages
12885
12886 --date <DATE>
12887 use the given date as the sending date
12888
12889 --desc <FILE>
12890 use the given file as the series description
12891
12892 -f,--from <EMAIL>
12893 email address of sender
12894
12895 -n, --test
12896 print messages that would be sent
12897
12898 -m,--mbox <FILE>
12899 write messages to mbox file instead of sending them
12900
12901 --reply-to <EMAIL[+]>
12902 email addresses replies should be sent to
12903
12904 -s,--subject <TEXT>
12905 subject of first message (intro or single patch)
12906
12907 --in-reply-to <MSGID>
12908 message identifier to reply to
12909
12910 --flag <FLAG[+]>
12911 flags to add in subject prefixes
12912
12913 -t,--to <EMAIL[+]>
12914 email addresses of recipients
12915
12916 -e,--ssh <CMD>
12917 specify ssh command to use
12918
12919 --remotecmd <CMD>
12920 specify hg command to run on the remote side
12921
12922 --insecure
12923 do not verify server certificate (ignoring web.cacerts config)
12924
12925 [+] marked option can be specified multiple times
12926
12927 phabricator
12928 simple Phabricator integration (EXPERIMENTAL)
12929
12930 This extension provides a phabsend command which sends a stack of
12931 changesets to Phabricator, and a phabread command which prints a stack
12932 of revisions in a format suitable for hg import, and a phabupdate com‐
12933 mand to update statuses in batch.
12934
12935 A "phabstatus" view for hg show is also provided; it displays status
12936 information of Phabricator differentials associated with unfinished
12937 changesets.
12938
12939 By default, Phabricator requires Test Plan which might prevent some
12940 changeset from being sent. The requirement could be disabled by chang‐
12941 ing differential.require-test-plan-field config server side.
12942
12943 Config:
12944
12945 [phabricator]
12946 # Phabricator URL
12947 url = https://phab.example.com/
12948
12949 # Repo callsign. If a repo has a URL https://$HOST/diffusion/FOO, then its
12950 # callsign is "FOO".
12951 callsign = FOO
12952
12953 # curl command to use. If not set (default), use builtin HTTP library to
12954 # communicate. If set, use the specified curl command. This could be useful
12955 # if you need to specify advanced options that is not easily supported by
12956 # the internal library.
12957 curlcmd = curl --connect-timeout 2 --retry 3 --silent
12958
12959 # retry failed command N time (default 0). Useful when using the extension
12960 # over flakly connection.
12961 #
12962 # We wait `retry.interval` between each retry, in seconds.
12963 # (default 1 second).
12964 retry = 3
12965 retry.interval = 10
12966
12967 # the retry option can combine well with the http.timeout one.
12968 #
12969 # For example to give up on http request after 20 seconds:
12970 [http]
12971 timeout=20
12972
12973 [auth]
12974 example.schemes = https
12975 example.prefix = phab.example.com
12976
12977 # API token. Get it from https://$HOST/conduit/login/
12978 example.phabtoken = cli-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
12979
12980 Commands
12981 Change import/export
12982 phabimport
12983 import patches from Phabricator for the specified Differential Revi‐
12984 sions:
12985
12986 hg phabimport DREVSPEC... [OPTIONS]
12987
12988 The patches are read and applied starting at the parent of the working
12989 directory.
12990
12991 See hg help phabread for how to specify DREVSPEC.
12992
12993 Options:
12994
12995 --stack
12996 import dependencies as well
12997
12998 --test-vcr <VALUE>
12999 Path to a vcr file. If nonexistent, will record a new vcr tran‐
13000 script, otherwise will mock all http requests using the speci‐
13001 fied vcr file. (ADVANCED)
13002
13003 phabread
13004 print patches from Phabricator suitable for importing:
13005
13006 hg phabread DREVSPEC... [OPTIONS]
13007
13008 DREVSPEC could be a Differential Revision identity, like D123, or just
13009 the number 123. It could also have common operators like +, -, &, (, )
13010 for complex queries. Prefix : could be used to select a stack. If mul‐
13011 tiple DREVSPEC values are given, the result is the union of each indi‐
13012 vidually evaluated value. No attempt is currently made to reorder the
13013 values to run from parent to child.
13014
13015 abandoned, accepted, closed, needsreview, needsrevision could be used
13016 to filter patches by status. For performance reason, they only repre‐
13017 sent a subset of non-status selections and cannot be used alone.
13018
13019 For example, :D6+8-(2+D4) selects a stack up to D6, plus D8 and exclude
13020 D2 and D4. :D9 & needsreview selects "Needs Review" revisions in a
13021 stack up to D9.
13022
13023 If --stack is given, follow dependencies information and read all
13024 patches. It is equivalent to the : operator.
13025
13026 Options:
13027
13028 --stack
13029 read dependencies
13030
13031 --test-vcr <VALUE>
13032 Path to a vcr file. If nonexistent, will record a new vcr tran‐
13033 script, otherwise will mock all http requests using the speci‐
13034 fied vcr file. (ADVANCED)
13035
13036 phabsend
13037 upload changesets to Phabricator:
13038
13039 hg phabsend REV [OPTIONS]
13040
13041 If there are multiple revisions specified, they will be send as a stack
13042 with a linear dependencies relationship using the order specified by
13043 the revset.
13044
13045 For the first time uploading changesets, local tags will be created to
13046 maintain the association. After the first time, phabsend will check ob‐
13047 sstore and tags information so it can figure out whether to update an
13048 existing Differential Revision, or create a new one.
13049
13050 If --amend is set, update commit messages so they have the Differential
13051 Revision URL, remove related tags. This is similar to what arcanist
13052 will do, and is more desired in author-push workflows. Otherwise, use
13053 local tags to record the Differential Revision association.
13054
13055 The --confirm option lets you confirm changesets before sending them.
13056 You can also add following to your configuration file to make it de‐
13057 fault behaviour:
13058
13059 [phabsend]
13060 confirm = true
13061
13062 By default, a separate review will be created for each commit that is
13063 selected, and will have the same parent/child relationship in Phabrica‐
13064 tor. If --fold is set, multiple commits are rolled up into a single
13065 review as if diffed from the parent of the first revision to the last.
13066 The commit messages are concatenated in the summary field on Phabrica‐
13067 tor.
13068
13069 phabsend will check obsstore and the above association to decide
13070 whether to update an existing Differential Revision, or create a new
13071 one.
13072
13073 Options:
13074
13075 -r,--rev <REV[+]>
13076 revisions to send
13077
13078 --amend
13079 update commit messages (default: True)
13080
13081 --reviewer <VALUE[+]>
13082 specify reviewers
13083
13084 --blocker <VALUE[+]>
13085 specify blocking reviewers
13086
13087 -m,--comment <VALUE>
13088 add a comment to Revisions with new/updated Diffs
13089
13090 --confirm
13091 ask for confirmation before sending
13092
13093 --fold combine the revisions into one review
13094
13095 --test-vcr <VALUE>
13096 Path to a vcr file. If nonexistent, will record a new vcr tran‐
13097 script, otherwise will mock all http requests using the speci‐
13098 fied vcr file. (ADVANCED)
13099
13100 [+] marked option can be specified multiple times
13101
13102 phabupdate
13103 update Differential Revision in batch:
13104
13105 hg phabupdate [DREVSPEC...| -r REV...] [OPTIONS]
13106
13107 DREVSPEC selects revisions. See hg help phabread for its usage.
13108
13109 Options:
13110
13111 --accept
13112 accept revisions
13113
13114 --reject
13115 reject revisions
13116
13117 --request-review
13118 request review on revisions
13119
13120 --abandon
13121 abandon revisions
13122
13123 --reclaim
13124 reclaim revisions
13125
13126 --close
13127 close revisions
13128
13129 --reopen
13130 reopen revisions
13131
13132 --plan-changes
13133 plan changes for revisions
13134
13135 --resign
13136 resign as a reviewer from revisions
13137
13138 --commandeer
13139 commandeer revisions
13140
13141 -m,--comment <VALUE>
13142 comment on the last revision
13143
13144 -r,--rev <REV>
13145 local revision to update
13146
13147 --test-vcr <VALUE>
13148 Path to a vcr file. If nonexistent, will record a new vcr tran‐
13149 script, otherwise will mock all http requests using the speci‐
13150 fied vcr file. (ADVANCED)
13151
13152 Uncategorized commands
13153 purge
13154 command to delete untracked files from the working directory (DEPRE‐
13155 CATED)
13156
13157 The functionality of this extension has been included in core Mercurial
13158 since version 5.7. Please use hg purge ... instead. hg purge --confirm
13159 is now the default, unless the extension is enabled for backward com‐
13160 patibility.
13161
13162 rebase
13163 command to move sets of revisions to a different ancestor
13164
13165 This extension lets you rebase changesets in an existing Mercurial
13166 repository.
13167
13168 For more information: https://mercurial-scm.org/wiki/RebaseExtension
13169
13170 Commands
13171 Change manipulation
13172 rebase
13173 move changeset (and descendants) to a different branch:
13174
13175 hg rebase [[-s REV]... | [-b REV]... | [-r REV]...] [-d REV] [OPTION]...
13176
13177 Rebase uses repeated merging to graft changesets from one part of his‐
13178 tory (the source) onto another (the destination). This can be useful
13179 for linearizing local changes relative to a master development tree.
13180
13181 Published commits cannot be rebased (see hg help phases). To copy com‐
13182 mits, see hg help graft.
13183
13184 If you don't specify a destination changeset (-d/--dest), rebase will
13185 use the same logic as hg merge to pick a destination. if the current
13186 branch contains exactly one other head, the other head is merged with
13187 by default. Otherwise, an explicit revision with which to merge with
13188 must be provided. (destination changeset is not modified by rebasing,
13189 but new changesets are added as its descendants.)
13190
13191 Here are the ways to select changesets:
13192
13193 1. Explicitly select them using --rev.
13194
13195 2. Use --source to select a root changeset and include all of its
13196 descendants.
13197
13198 3. Use --base to select a changeset; rebase will find ancestors and
13199 their descendants which are not also ancestors of the destina‐
13200 tion.
13201
13202 4. If you do not specify any of --rev, --source, or --base, rebase
13203 will use --base . as above.
13204
13205 If --source or --rev is used, special names SRC and ALLSRC can be used
13206 in --dest. Destination would be calculated per source revision with SRC
13207 substituted by that single source revision and ALLSRC substituted by
13208 all source revisions.
13209
13210 Rebase will destroy original changesets unless you use --keep. It will
13211 also move your bookmarks (even if you do).
13212
13213 Some changesets may be dropped if they do not contribute changes (e.g.
13214 merges from the destination branch).
13215
13216 Unlike merge, rebase will do nothing if you are at the branch tip of a
13217 named branch with two heads. You will need to explicitly specify source
13218 and/or destination.
13219
13220 If you need to use a tool to automate merge/conflict decisions, you can
13221 specify one with --tool, see hg help merge-tools. As a caveat: the
13222 tool will not be used to mediate when a file was deleted, there is no
13223 hook presently available for this.
13224
13225 If a rebase is interrupted to manually resolve a conflict, it can be
13226 continued with --continue/-c, aborted with --abort/-a, or stopped with
13227 --stop.
13228
13229 Examples:
13230
13231 • move "local changes" (current commit back to branching point) to the
13232 current branch tip after a pull:
13233
13234 hg rebase
13235
13236 • move a single changeset to the stable branch:
13237
13238 hg rebase -r 5f493448 -d stable
13239
13240 • splice a commit and all its descendants onto another part of history:
13241
13242 hg rebase --source c0c3 --dest 4cf9
13243
13244 • rebase everything on a branch marked by a bookmark onto the default
13245 branch:
13246
13247 hg rebase --base myfeature --dest default
13248
13249 • collapse a sequence of changes into a single commit:
13250
13251 hg rebase --collapse -r 1520:1525 -d .
13252
13253 • move a named branch while preserving its name:
13254
13255 hg rebase -r "branch(featureX)" -d 1.3 --keepbranches
13256
13257 • stabilize orphaned changesets so history looks linear:
13258
13259 hg rebase -r 'orphan()-obsolete()' -d 'first(max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::) + max(::((roots(ALLSRC) & ::SRC)^)-obsolete()))'
13260
13261 Configuration Options:
13262
13263 You can make rebase require a destination if you set the following con‐
13264 fig option:
13265
13266 [commands]
13267 rebase.requiredest = True
13268
13269 By default, rebase will close the transaction after each commit. For
13270 performance purposes, you can configure rebase to use a single transac‐
13271 tion across the entire rebase. WARNING: This setting introduces a sig‐
13272 nificant risk of losing the work you've done in a rebase if the rebase
13273 aborts unexpectedly:
13274
13275 [rebase]
13276 singletransaction = True
13277
13278 By default, rebase writes to the working copy, but you can configure it
13279 to run in-memory for better performance. When the rebase is not moving
13280 the parent(s) of the working copy (AKA the "currently checked out
13281 changesets"), this may also allow it to run even if the working copy is
13282 dirty:
13283
13284 [rebase]
13285 experimental.inmemory = True
13286
13287 Return Values:
13288
13289 Returns 0 on success, 1 if nothing to rebase or there are unresolved
13290 conflicts.
13291
13292 Options:
13293
13294 -s,--source <REV[+]>
13295 rebase the specified changesets and their descendants
13296
13297 -b,--base <REV[+]>
13298 rebase everything from branching point of specified changeset
13299
13300 -r,--rev <REV[+]>
13301 rebase these revisions
13302
13303 -d,--dest <REV>
13304 rebase onto the specified changeset
13305
13306 --collapse
13307 collapse the rebased changesets
13308
13309 -m,--message <TEXT>
13310 use text as collapse commit message
13311
13312 -e, --edit
13313 invoke editor on commit messages
13314
13315 -l,--logfile <FILE>
13316 read collapse commit message from file
13317
13318 -k, --keep
13319 keep original changesets
13320
13321 --keepbranches
13322 keep original branch names
13323
13324 -D, --detach
13325 (DEPRECATED)
13326
13327 -i, --interactive
13328 (DEPRECATED)
13329
13330 -t,--tool <VALUE>
13331 specify merge tool
13332
13333 --stop stop interrupted rebase
13334
13335 -c, --continue
13336 continue an interrupted rebase
13337
13338 -a, --abort
13339 abort an interrupted rebase
13340
13341 --auto-orphans <VALUE>
13342 automatically rebase orphan revisions in the specified revset
13343 (EXPERIMENTAL)
13344
13345 -n, --dry-run
13346 do not perform actions, just print output
13347
13348 -T,--template <TEMPLATE>
13349 display with template
13350
13351 --confirm
13352 ask before applying actions
13353
13354 [+] marked option can be specified multiple times
13355
13356 record
13357 commands to interactively select changes for commit/qrefresh (DEPRE‐
13358 CATED)
13359
13360 The feature provided by this extension has been moved into core Mercu‐
13361 rial as hg commit --interactive.
13362
13363 Commands
13364 Change creation
13365 qrecord
13366 interactively record a new patch:
13367
13368 hg qrecord [OPTION]... PATCH [FILE]...
13369
13370 See hg help qnew & hg help record for more information and usage.
13371
13372 record
13373 interactively select changes to commit:
13374
13375 hg record [OPTION]... [FILE]...
13376
13377 If a list of files is omitted, all changes reported by hg status will
13378 be candidates for recording.
13379
13380 See hg help dates for a list of formats valid for -d/--date.
13381
13382 If using the text interface (see hg help config), you will be prompted
13383 for whether to record changes to each modified file, and for files with
13384 multiple changes, for each change to use. For each query, the following
13385 responses are possible:
13386
13387 y - record this change
13388 n - skip this change
13389 e - edit this change manually
13390
13391 s - skip remaining changes to this file
13392 f - record remaining changes to this file
13393
13394 d - done, skip remaining changes and files
13395 a - record all changes to all remaining files
13396 q - quit, recording no changes
13397
13398 ? - display help
13399
13400 This command is not available when committing a merge.
13401
13402 Options:
13403
13404 -A, --addremove
13405 mark new/missing files as added/removed before committing
13406
13407 --close-branch
13408 mark a branch head as closed
13409
13410 --amend
13411 amend the parent of the working directory
13412
13413 -s, --secret
13414 use the secret phase for committing
13415
13416 -e, --edit
13417 invoke editor on commit messages
13418
13419 --force-close-branch
13420 forcibly close branch from a non-head changeset (ADVANCED)
13421
13422 -I,--include <PATTERN[+]>
13423 include names matching the given patterns
13424
13425 -X,--exclude <PATTERN[+]>
13426 exclude names matching the given patterns
13427
13428 -m,--message <TEXT>
13429 use text as commit message
13430
13431 -l,--logfile <FILE>
13432 read commit message from file
13433
13434 -d,--date <DATE>
13435 record the specified date as commit date
13436
13437 -u,--user <USER>
13438 record the specified user as committer
13439
13440 -S, --subrepos
13441 recurse into subrepositories
13442
13443 -w, --ignore-all-space
13444 ignore white space when comparing lines
13445
13446 -b, --ignore-space-change
13447 ignore changes in the amount of white space
13448
13449 -B, --ignore-blank-lines
13450 ignore changes whose lines are all blank
13451
13452 -Z, --ignore-space-at-eol
13453 ignore changes in whitespace at EOL
13454
13455 [+] marked option can be specified multiple times
13456
13457 releasenotes
13458 generate release notes from commit messages (EXPERIMENTAL)
13459
13460 It is common to maintain files detailing changes in a project between
13461 releases. Maintaining these files can be difficult and time consuming.
13462 The hg releasenotes command provided by this extension makes the
13463 process simpler by automating it.
13464
13465 Commands
13466 Change navigation
13467 releasenotes
13468 parse release notes from commit messages into an output file:
13469
13470 hg releasenotes [-r REV] [-c] FILE
13471
13472 Given an output file and set of revisions, this command will parse com‐
13473 mit messages for release notes then add them to the output file.
13474
13475 Release notes are defined in commit messages as ReStructuredText direc‐
13476 tives. These have the form:
13477
13478 .. directive:: title
13479
13480 content
13481
13482 Each directive maps to an output section in a generated release notes
13483 file, which itself is ReStructuredText. For example, the .. feature::
13484 directive would map to a New Features section.
13485
13486 Release note directives can be either short-form or long-form. In
13487 short- form, title is omitted and the release note is rendered as a
13488 bullet list. In long form, a sub-section with the title title is added
13489 to the section.
13490
13491 The FILE argument controls the output file to write gathered release
13492 notes to. The format of the file is:
13493
13494 Section 1
13495 =========
13496
13497 ...
13498
13499 Section 2
13500 =========
13501
13502 ...
13503
13504 Only sections with defined release notes are emitted.
13505
13506 If a section only has short-form notes, it will consist of bullet list:
13507
13508 Section
13509 =======
13510
13511 * Release note 1
13512 * Release note 2
13513
13514 If a section has long-form notes, sub-sections will be emitted:
13515
13516 Section
13517 =======
13518
13519 Note 1 Title
13520 ------------
13521
13522 Description of the first long-form note.
13523
13524 Note 2 Title
13525 ------------
13526
13527 Description of the second long-form note.
13528
13529 If the FILE argument points to an existing file, that file will be
13530 parsed for release notes having the format that would be generated by
13531 this command. The notes from the processed commit messages will be
13532 merged into this parsed set.
13533
13534 During release notes merging:
13535
13536 • Duplicate items are automatically ignored
13537
13538 • Items that are different are automatically ignored if the similarity
13539 is greater than a threshold.
13540
13541 This means that the release notes file can be updated independently
13542 from this command and changes should not be lost when running this com‐
13543 mand on that file. A particular use case for this is to tweak the word‐
13544 ing of a release note after it has been added to the release notes
13545 file.
13546
13547 The -c/--check option checks the commit message for invalid admoni‐
13548 tions.
13549
13550 The -l/--list option, presents the user with a list of existing avail‐
13551 able admonitions along with their title. This also includes the custom
13552 admonitions (if any).
13553
13554 Options:
13555
13556 -r,--rev <REV>
13557 revisions to process for release notes
13558
13559 -c, --check
13560 checks for validity of admonitions (if any)
13561
13562 -l, --list
13563 list the available admonitions with their title
13564
13565 Uncategorized commands
13566 relink
13567 recreates hardlinks between repository clones
13568
13569 Commands
13570 Repository maintenance
13571 relink
13572 recreate hardlinks between two repositories:
13573
13574 hg relink [ORIGIN]
13575
13576 When repositories are cloned locally, their data files will be
13577 hardlinked so that they only use the space of a single repository.
13578
13579 Unfortunately, subsequent pulls into either repository will break
13580 hardlinks for any files touched by the new changesets, even if both
13581 repositories end up pulling the same changes.
13582
13583 Similarly, passing --rev to "hg clone" will fail to use any hardlinks,
13584 falling back to a complete copy of the source repository.
13585
13586 This command lets you recreate those hardlinks and reclaim that wasted
13587 space.
13588
13589 This repository will be relinked to share space with ORIGIN, which must
13590 be on the same local disk. If ORIGIN is omitted, looks for "default-re‐
13591 link", then "default", in [paths].
13592
13593 Do not attempt any read operations on this repository while the command
13594 is running. (Both repositories will be locked against writes.)
13595
13596 remotefilelog
13597 remotefilelog causes Mercurial to lazilly fetch file contents (EXPERI‐
13598 MENTAL)
13599
13600 This extension is HIGHLY EXPERIMENTAL. There are NO BACKWARDS COMPATI‐
13601 BILITY GUARANTEES. This means that repositories created with this ex‐
13602 tension may only be usable with the exact version of this exten‐
13603 sion/Mercurial that was used. The extension attempts to enforce this in
13604 order to prevent repository corruption.
13605
13606 remotefilelog works by fetching file contents lazily and storing them
13607 in a cache on the client rather than in revlogs. This allows enormous
13608 histories to be transferred only partially, making them easier to oper‐
13609 ate on.
13610
13611 Configs:
13612
13613 packs.maxchainlen specifies the maximum delta chain length in pack
13614 files
13615
13616 packs.maxpacksize specifies the maximum pack file size
13617
13618 packs.maxpackfilecount specifies the maximum number of packs in the
13619
13620 shared cache (trees only for now)
13621
13622 remotefilelog.backgroundprefetch runs prefetch in background when
13623 True
13624
13625 remotefilelog.bgprefetchrevs specifies revisions to fetch on commit
13626 and
13627
13628 update, and on other commands that use them. Different from
13629 pullprefetch.
13630
13631 remotefilelog.gcrepack does garbage collection during repack when
13632 True
13633
13634 remotefilelog.nodettl specifies maximum TTL of a node in seconds be‐
13635 fore
13636
13637 it is garbage collected
13638
13639 remotefilelog.repackonhggc runs repack on hg gc when True
13640
13641 remotefilelog.prefetchdays specifies the maximum age of a commit in
13642
13643 days after which it is no longer prefetched.
13644
13645 remotefilelog.prefetchdelay specifies delay between background
13646
13647 prefetches in seconds after operations that change the work‐
13648 ing copy parent
13649
13650 remotefilelog.data.gencountlimit constraints the minimum number of
13651 data
13652
13653 pack files required to be considered part of a generation. In
13654 particular, minimum number of packs files > gencountlimit.
13655
13656 remotefilelog.data.generations list for specifying the lower bound
13657 of
13658
13659 each generation of the data pack files. For example, list
13660 ['100MB','1MB'] or ['1MB', '100MB'] will lead to three gener‐
13661 ations: [0, 1MB), [ 1MB, 100MB) and [100MB, infinity).
13662
13663 remotefilelog.data.maxrepackpacks the maximum number of pack files
13664 to
13665
13666 include in an incremental data repack.
13667
13668 remotefilelog.data.repackmaxpacksize the maximum size of a pack file
13669 for
13670
13671 it to be considered for an incremental data repack.
13672
13673 remotefilelog.data.repacksizelimit the maximum total size of pack
13674 files
13675
13676 to include in an incremental data repack.
13677
13678 remotefilelog.history.gencountlimit constraints the minimum number
13679 of
13680
13681 history pack files required to be considered part of a gener‐
13682 ation. In particular, minimum number of packs files > gen‐
13683 countlimit.
13684
13685 remotefilelog.history.generations list for specifying the lower
13686 bound of
13687
13688 each generation of the history pack files. For example, list
13689 [ '100MB', '1MB'] or ['1MB', '100MB'] will lead to three gen‐
13690 erations: [ 0, 1MB), [1MB, 100MB) and [100MB, infinity).
13691
13692 remotefilelog.history.maxrepackpacks the maximum number of pack
13693 files to
13694
13695 include in an incremental history repack.
13696
13697 remotefilelog.history.repackmaxpacksize the maximum size of a pack
13698 file
13699
13700 for it to be considered for an incremental history repack.
13701
13702 remotefilelog.history.repacksizelimit the maximum total size of pack
13703
13704 files to include in an incremental history repack.
13705
13706 remotefilelog.backgroundrepack automatically consolidate packs in
13707 the
13708
13709 background
13710
13711 remotefilelog.cachepath path to cache
13712
13713 remotefilelog.cachegroup if set, make cache directory sgid to this
13714
13715 group
13716
13717 remotefilelog.cacheprocess binary to invoke for fetching file data
13718
13719 remotefilelog.debug turn on remotefilelog-specific debug output
13720
13721 remotefilelog.excludepattern pattern of files to exclude from pulls
13722
13723 remotefilelog.includepattern pattern of files to include in pulls
13724
13725 remotefilelog.fetchwarning: message to print when too many
13726
13727 single-file fetches occur
13728
13729 remotefilelog.getfilesstep number of files to request in a single
13730 RPC
13731
13732 remotefilelog.getfilestype if set to 'threaded' use threads to fetch
13733
13734 files, otherwise use optimistic fetching
13735
13736 remotefilelog.pullprefetch revset for selecting files that should be
13737
13738 eagerly downloaded rather than lazily
13739
13740 remotefilelog.reponame name of the repo. If set, used to partition
13741
13742 data from other repos in a shared store.
13743
13744 remotefilelog.server if true, enable server-side functionality
13745
13746 remotefilelog.servercachepath path for caching blobs on the server
13747
13748 remotefilelog.serverexpiration number of days to keep cached server
13749
13750 blobs
13751
13752 remotefilelog.validatecache if set, check cache entries for corrup‐
13753 tion
13754
13755 before returning blobs
13756
13757 remotefilelog.validatecachelog if set, check cache entries for
13758
13759 corruption before returning metadata
13760
13761 Commands
13762 Repository maintenance
13763 prefetch
13764 prefetch file revisions from the server:
13765
13766 hg prefetch [OPTIONS] [FILE...]
13767
13768 Prefetchs file revisions for the specified revs and stores them in the
13769 local remotefilelog cache. If no rev is specified, the default rev is
13770 used which is the union of dot, draft, pullprefetch and bgprefetchrev.
13771 File names or patterns can be used to limit which files are downloaded.
13772
13773 Return 0 on success.
13774
13775 Options:
13776
13777 -r,--rev <REV[+]>
13778 prefetch the specified revisions
13779
13780 --repack
13781 run repack after prefetch
13782
13783 -b,--base <VALUE>
13784 rev that is assumed to already be local
13785
13786 -I,--include <PATTERN[+]>
13787 include names matching the given patterns
13788
13789 -X,--exclude <PATTERN[+]>
13790 exclude names matching the given patterns
13791
13792 [+] marked option can be specified multiple times
13793
13794 Uncategorized commands
13795 gc
13796 garbage collect the client and server filelog caches:
13797
13798 hg gc [REPO...]
13799
13800 garbage collect the client and server filelog caches
13801
13802 repack
13803 hg repack [OPTIONS]
13804
13805 Options:
13806
13807 --background
13808 run in a background process
13809
13810 --incremental
13811 do an incremental repack
13812
13813 --packsonly
13814 only repack packs (skip loose objects)
13815
13816 verifyremotefilelog
13817 hg verifyremotefilelogs <directory>
13818
13819 Options:
13820
13821 -d, --decompress
13822 decompress the filelogs first
13823
13824 remotenames
13825 showing remotebookmarks and remotebranches in UI (EXPERIMENTAL)
13826
13827 By default both remotebookmarks and remotebranches are turned on. Con‐
13828 fig knob to control the individually are as follows.
13829
13830 Config options to tweak the default behaviour:
13831
13832 remotenames.bookmarks
13833 Boolean value to enable or disable showing of remotebookmarks
13834 (default: True)
13835
13836 remotenames.branches
13837 Boolean value to enable or disable showing of remotebranches
13838 (default: True)
13839
13840 remotenames.hoistedpeer
13841 Name of the peer whose remotebookmarks should be hoisted into
13842 the top-level namespace (default: 'default')
13843
13844 schemes
13845 extend schemes with shortcuts to repository swarms
13846
13847 This extension allows you to specify shortcuts for parent URLs with a
13848 lot of repositories to act like a scheme, for example:
13849
13850 [schemes]
13851 py = http://code.python.org/hg/
13852
13853 After that you can use it like:
13854
13855 hg clone py://trunk/
13856
13857 Additionally there is support for some more complex schemas, for exam‐
13858 ple used by Google Code:
13859
13860 [schemes]
13861 gcode = http://{1}.googlecode.com/hg/
13862
13863 The syntax is taken from Mercurial templates, and you have unlimited
13864 number of variables, starting with {1} and continuing with {2}, {3} and
13865 so on. This variables will receive parts of URL supplied, split by /.
13866 Anything not specified as {part} will be just appended to an URL.
13867
13868 For convenience, the extension adds these schemes by default:
13869
13870 [schemes]
13871 py = http://hg.python.org/
13872 bb = https://bitbucket.org/
13873 bb+ssh = ssh://hg@bitbucket.org/
13874 gcode = https://{1}.googlecode.com/hg/
13875 kiln = https://{1}.kilnhg.com/Repo/
13876
13877 You can override a predefined scheme by defining a new scheme with the
13878 same name.
13879
13880 Commands
13881 Uncategorized commands
13882 share
13883 share a common history between several working directories
13884
13885 The share extension introduces a new command hg share to create a new
13886 working directory. This is similar to hg clone, but doesn't involve
13887 copying or linking the storage of the repository. This allows working
13888 on different branches or changes in parallel without the associated
13889 cost in terms of disk space.
13890
13891 Note: destructive operations or extensions like hg rollback should be
13892 used with care as they can result in confusing problems.
13893
13894 Automatic Pooled Storage for Clones
13895 When this extension is active, hg clone can be configured to automati‐
13896 cally share/pool storage across multiple clones. This mode effectively
13897 converts hg clone to hg clone + hg share. The benefit of using this
13898 mode is the automatic management of store paths and intelligent pooling
13899 of related repositories.
13900
13901 The following share. config options influence this feature:
13902
13903 share.pool
13904
13905 Filesystem path where shared repository data will be stored.
13906 When defined, hg clone will automatically use shared repository
13907 storage instead of creating a store inside each clone.
13908
13909 share.poolnaming
13910
13911 How directory names in share.pool are constructed.
13912
13913 "identity" means the name is derived from the first changeset in
13914 the repository. In this mode, different remotes share storage if
13915 their root/initial changeset is identical. In this mode, the lo‐
13916 cal shared repository is an aggregate of all encountered remote
13917 repositories.
13918
13919 "remote" means the name is derived from the source repository's
13920 path or URL. In this mode, storage is only shared if the path or
13921 URL requested in the hg clone command matches exactly to a
13922 repository that was cloned before.
13923
13924 The default naming mode is "identity".
13925
13926 Sharing requirements and configs of source repository with shares:
13927
13928 By default creating a shared repository only enables sharing a common
13929 history and does not share requirements and configs between them. This
13930 may lead to problems in some cases, for example when you upgrade the
13931 storage format from one repository but does not set related configs in
13932 the shares.
13933
13934 Setting format.exp-share-safe = True enables sharing configs and re‐
13935 quirements. This only applies to shares which are done after enabling
13936 the config option.
13937
13938 For enabling this in existing shares, enable the config option and re‐
13939 share.
13940
13941 For resharing existing shares, make sure your working directory is
13942 clean and there are no untracked files, delete that share and create a
13943 new share.
13944
13945 Commands
13946 Repository creation
13947 share
13948 create a new shared repository:
13949
13950 hg share [-U] [-B] SOURCE [DEST]
13951
13952 Initialize a new repository and working directory that shares its his‐
13953 tory (and optionally bookmarks) with another repository.
13954
13955 Note using rollback or extensions that destroy/modify history (mq,
13956 rebase, etc.) can cause considerable confusion with shared
13957 clones. In particular, if two shared clones are both updated to
13958 the same changeset, and one of them destroys that changeset with
13959 rollback, the other clone will suddenly stop working: all opera‐
13960 tions will fail with "abort: working directory has unknown par‐
13961 ent". The only known workaround is to use debugsetparents on the
13962 broken clone to reset it to a changeset that still exists.
13963
13964 Options:
13965
13966 -U, --noupdate
13967 do not create a working directory
13968
13969 -B, --bookmarks
13970 also share bookmarks
13971
13972 --relative
13973 point to source using a relative path
13974
13975 Repository maintenance
13976 unshare
13977 convert a shared repository to a normal one:
13978
13979 hg unshare
13980
13981 Copy the store data to the repo and remove the sharedpath data.
13982
13983 show
13984 unified command to show various repository information (EXPERIMENTAL)
13985
13986 This extension provides the hg show command, which provides a central
13987 command for displaying commonly-accessed repository data and views of
13988 that data.
13989
13990 The following config options can influence operation.
13991
13992 commands
13993 show.aliasprefix
13994
13995 List of strings that will register aliases for views. e.g. s
13996 will effectively set config options alias.s<view> = show <view>
13997 for all views. i.e. hg swork would execute hg show work.
13998
13999 Aliases that would conflict with existing registrations will not
14000 be performed.
14001
14002 Commands
14003 Change navigation
14004 show
14005 show various repository information:
14006
14007 hg show VIEW
14008
14009 A requested view of repository data is displayed.
14010
14011 If no view is requested, the list of available views is shown and the
14012 command aborts.
14013
14014 Note There are no backwards compatibility guarantees for the output
14015 of this command. Output may change in any future Mercurial re‐
14016 lease.
14017
14018 Consumers wanting stable command output should specify a tem‐
14019 plate via -T/--template.
14020
14021 List of available views:
14022
14023 bookmarks bookmarks and their associated changeset
14024
14025 stack current line of work
14026
14027 work changesets that aren't finished
14028
14029 Options:
14030
14031 -T,--template <TEMPLATE>
14032 display with template
14033
14034 sparse
14035 allow sparse checkouts of the working directory (EXPERIMENTAL)
14036
14037 (This extension is not yet protected by backwards compatibility guaran‐
14038 tees. Any aspect may break in future releases until this notice is re‐
14039 moved.)
14040
14041 This extension allows the working directory to only consist of a subset
14042 of files for the revision. This allows specific files or directories to
14043 be explicitly included or excluded. Many repository operations have
14044 performance proportional to the number of files in the working direc‐
14045 tory. So only realizing a subset of files in the working directory can
14046 improve performance.
14047
14048 Sparse Config Files
14049 The set of files that are part of a sparse checkout are defined by a
14050 sparse config file. The file defines 3 things: includes (files to in‐
14051 clude in the sparse checkout), excludes (files to exclude from the
14052 sparse checkout), and profiles (links to other config files).
14053
14054 The file format is newline delimited. Empty lines and lines beginning
14055 with # are ignored.
14056
14057 Lines beginning with %include `` denote another sparse config file to
14058 include. e.g. ``%include tests.sparse. The filename is relative to the
14059 repository root.
14060
14061 The special lines [include] and [exclude] denote the section for in‐
14062 cludes and excludes that follow, respectively. It is illegal to have
14063 [include] after [exclude].
14064
14065 Non-special lines resemble file patterns to be added to either includes
14066 or excludes. The syntax of these lines is documented by hg help pat‐
14067 terns. Patterns are interpreted as glob: by default and match against
14068 the root of the repository.
14069
14070 Exclusion patterns take precedence over inclusion patterns. So even if
14071 a file is explicitly included, an [exclude] entry can remove it.
14072
14073 For example, say you have a repository with 3 directories, frontend/,
14074 backend/, and tools/. frontend/ and backend/ correspond to different
14075 projects and it is uncommon for someone working on one to need the
14076 files for the other. But tools/ contains files shared between both
14077 projects. Your sparse config files may resemble:
14078
14079 # frontend.sparse
14080 frontend/**
14081 tools/**
14082
14083 # backend.sparse
14084 backend/**
14085 tools/**
14086
14087 Say the backend grows in size. Or there's a directory with thousands of
14088 files you wish to exclude. You can modify the profile to exclude cer‐
14089 tain files:
14090
14091 [include]
14092 backend/**
14093 tools/**
14094
14095 [exclude]
14096 tools/tests/**
14097
14098 Commands
14099 Uncategorized commands
14100 split
14101 command to split a changeset into smaller ones (EXPERIMENTAL)
14102
14103 Commands
14104 Change manipulation
14105 split
14106 split a changeset into smaller ones:
14107
14108 hg split [--no-rebase] [[-r] REV]
14109
14110 Repeatedly prompt changes and commit message for new changesets until
14111 there is nothing left in the original changeset.
14112
14113 If --rev was not given, split the working directory parent.
14114
14115 By default, rebase connected non-obsoleted descendants onto the new
14116 changeset. Use --no-rebase to avoid the rebase.
14117
14118 Options:
14119
14120 -r,--rev <REV>
14121 revision to split
14122
14123 --rebase
14124 rebase descendants after split (default: True)
14125
14126 -d,--date <DATE>
14127 record the specified date as commit date
14128
14129 -u,--user <USER>
14130 record the specified user as committer
14131
14132 sqlitestore
14133 store repository data in SQLite (EXPERIMENTAL)
14134
14135 The sqlitestore extension enables the storage of repository data in
14136 SQLite.
14137
14138 This extension is HIGHLY EXPERIMENTAL. There are NO BACKWARDS COMPATI‐
14139 BILITY GUARANTEES. This means that repositories created with this ex‐
14140 tension may only be usable with the exact version of this exten‐
14141 sion/Mercurial that was used. The extension attempts to enforce this in
14142 order to prevent repository corruption.
14143
14144 In addition, several features are not yet supported or have known bugs:
14145
14146 • Only some data is stored in SQLite. Changeset, manifest, and other
14147 repository data is not yet stored in SQLite.
14148
14149 • Transactions are not robust. If the process is aborted at the right
14150 time during transaction close/rollback, the repository could be in an
14151 inconsistent state. This problem will diminish once all repository
14152 data is tracked by SQLite.
14153
14154 • Bundle repositories do not work (the ability to use e.g. hg -R <bun‐
14155 dle-file> log to automatically overlay a bundle on top of the exist‐
14156 ing repository).
14157
14158 • Various other features don't work.
14159
14160 This extension should work for basic clone/pull, update, and commit
14161 workflows. Some history rewriting operations may fail due to lack of
14162 support for bundle repositories.
14163
14164 To use, activate the extension and set the storage.new-repo-backend
14165 config option to sqlite to enable new repositories to use SQLite for
14166 storage.
14167
14168 strip
14169 strip changesets and their descendants from history (DEPRECATED)
14170
14171 The functionality of this extension has been included in core Mercurial
14172 since version 5.7. Please use hg debugstrip ... instead.
14173
14174 This extension allows you to strip changesets and all their descendants
14175 from the repository. See the command help for details.
14176
14177 transplant
14178 command to transplant changesets from another branch
14179
14180 This extension allows you to transplant changes to another parent revi‐
14181 sion, possibly in another repository. The transplant is done using
14182 'diff' patches.
14183
14184 Transplanted patches are recorded in .hg/transplant/transplants, as a
14185 map from a changeset hash to its hash in the source repository.
14186
14187 Commands
14188 Change manipulation
14189 transplant
14190 transplant changesets from another branch:
14191
14192 hg transplant [-s REPO] [-b BRANCH [-a]] [-p REV] [-m REV] [REV]...
14193
14194 Selected changesets will be applied on top of the current working di‐
14195 rectory with the log of the original changeset. The changesets are
14196 copied and will thus appear twice in the history with different identi‐
14197 ties.
14198
14199 Consider using the graft command if everything is inside the same
14200 repository - it will use merges and will usually give a better result.
14201 Use the rebase extension if the changesets are unpublished and you want
14202 to move them instead of copying them.
14203
14204 If --log is specified, log messages will have a comment appended of the
14205 form:
14206
14207 (transplanted from CHANGESETHASH)
14208
14209 You can rewrite the changelog message with the --filter option. Its
14210 argument will be invoked with the current changelog message as $1 and
14211 the patch as $2.
14212
14213 --source/-s specifies another repository to use for selecting change‐
14214 sets, just as if it temporarily had been pulled. If --branch/-b is
14215 specified, these revisions will be used as heads when deciding which
14216 changesets to transplant, just as if only these revisions had been
14217 pulled. If --all/-a is specified, all the revisions up to the heads
14218 specified with --branch will be transplanted.
14219
14220 Example:
14221
14222 • transplant all changes up to REV on top of your current revision:
14223
14224 hg transplant --branch REV --all
14225
14226 You can optionally mark selected transplanted changesets as merge
14227 changesets. You will not be prompted to transplant any ancestors of a
14228 merged transplant, and you can merge descendants of them normally in‐
14229 stead of transplanting them.
14230
14231 Merge changesets may be transplanted directly by specifying the proper
14232 parent changeset by calling hg transplant --parent.
14233
14234 If no merges or revisions are provided, hg transplant will start an in‐
14235 teractive changeset browser.
14236
14237 If a changeset application fails, you can fix the merge by hand and
14238 then resume where you left off by calling hg transplant --continue/-c.
14239
14240 Options:
14241
14242 -s,--source <REPO>
14243 transplant changesets from REPO
14244
14245 -b,--branch <REV[+]>
14246 use this source changeset as head
14247
14248 -a, --all
14249 pull all changesets up to the --branch revisions
14250
14251 -p,--prune <REV[+]>
14252 skip over REV
14253
14254 -m,--merge <REV[+]>
14255 merge at REV
14256
14257 --parent <REV>
14258 parent to choose when transplanting merge
14259
14260 -e, --edit
14261 invoke editor on commit messages
14262
14263 --log append transplant info to log message
14264
14265 --stop stop interrupted transplant
14266
14267 -c, --continue
14268 continue last transplant session after fixing conflicts
14269
14270 --filter <CMD>
14271 filter changesets through command
14272
14273 [+] marked option can be specified multiple times
14274
14275 uncommit
14276 uncommit part or all of a local changeset (EXPERIMENTAL)
14277
14278 This command undoes the effect of a local commit, returning the af‐
14279 fected files to their uncommitted state. This means that files modi‐
14280 fied, added or removed in the changeset will be left unchanged, and so
14281 will remain modified, added and removed in the working directory.
14282
14283 Commands
14284 Change manipulation
14285 unamend
14286 undo the most recent amend operation on a current changeset:
14287
14288 hg unamend
14289
14290 This command will roll back to the previous version of a changeset,
14291 leaving working directory in state in which it was before running hg
14292 amend (e.g. files modified as part of an amend will be marked as modi‐
14293 fied hg status)
14294
14295 uncommit
14296 uncommit part or all of a local changeset:
14297
14298 hg uncommit [OPTION]... [FILE]...
14299
14300 This command undoes the effect of a local commit, returning the af‐
14301 fected files to their uncommitted state. This means that files modified
14302 or deleted in the changeset will be left unchanged, and so will remain
14303 modified in the working directory.
14304
14305 If no files are specified, the commit will be pruned, unless --keep is
14306 given.
14307
14308 Options:
14309
14310 --keep allow an empty commit after uncommitting
14311
14312 --allow-dirty-working-copy
14313 allow uncommit with outstanding changes
14314
14315 -n,--note <TEXT>
14316 store a note on uncommit
14317
14318 -I,--include <PATTERN[+]>
14319 include names matching the given patterns
14320
14321 -X,--exclude <PATTERN[+]>
14322 exclude names matching the given patterns
14323
14324 -m,--message <TEXT>
14325 use text as commit message
14326
14327 -l,--logfile <FILE>
14328 read commit message from file
14329
14330 -d,--date <DATE>
14331 record the specified date as commit date
14332
14333 -u,--user <USER>
14334 record the specified user as committer
14335
14336 -D, --currentdate
14337 record the current date as commit date
14338
14339 -U, --currentuser
14340 record the current user as committer
14341
14342 [+] marked option can be specified multiple times
14343
14344 win32mbcs
14345 allow the use of MBCS paths with problematic encodings
14346
14347 Some MBCS encodings are not good for some path operations (i.e. split‐
14348 ting path, case conversion, etc.) with its encoded bytes. We call such
14349 a encoding (i.e. shift_jis and big5) as "problematic encoding". This
14350 extension can be used to fix the issue with those encodings by wrapping
14351 some functions to convert to Unicode string before path operation.
14352
14353 This extension is useful for:
14354
14355 • Japanese Windows users using shift_jis encoding.
14356
14357 • Chinese Windows users using big5 encoding.
14358
14359 • All users who use a repository with one of problematic encodings on
14360 case-insensitive file system.
14361
14362 This extension is not needed for:
14363
14364 • Any user who use only ASCII chars in path.
14365
14366 • Any user who do not use any of problematic encodings.
14367
14368 Note that there are some limitations on using this extension:
14369
14370 • You should use single encoding in one repository.
14371
14372 • If the repository path ends with 0x5c, .hg/hgrc cannot be read.
14373
14374 • win32mbcs is not compatible with fixutf8 extension.
14375
14376 By default, win32mbcs uses encoding.encoding decided by Mercurial. You
14377 can specify the encoding by config option:
14378
14379 [win32mbcs]
14380 encoding = sjis
14381
14382 It is useful for the users who want to commit with UTF-8 log message.
14383
14384 win32text
14385 perform automatic newline conversion (DEPRECATED)
14386
14387 Deprecation: The win32text extension requires each user to configure
14388 the extension again and again for each clone since the configuration
14389 is not copied when cloning.
14390
14391 We have therefore made the eol as an alternative. The eol uses a
14392 version controlled file for its configuration and each clone will
14393 therefore use the right settings from the start.
14394
14395 To perform automatic newline conversion, use:
14396
14397 [extensions]
14398 win32text =
14399 [encode]
14400 ** = cleverencode:
14401 # or ** = macencode:
14402
14403 [decode]
14404 ** = cleverdecode:
14405 # or ** = macdecode:
14406
14407 If not doing conversion, to make sure you do not commit CRLF/CR by ac‐
14408 cident:
14409
14410 [hooks]
14411 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
14412 # or pretxncommit.cr = python:hgext.win32text.forbidcr
14413
14414 To do the same check on a server to prevent CRLF/CR from being pushed
14415 or pulled:
14416
14417 [hooks]
14418 pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
14419 # or pretxnchangegroup.cr = python:hgext.win32text.forbidcr
14420
14421 zeroconf
14422 discover and advertise repositories on the local network
14423
14424 The zeroconf extension will advertise hg serve instances over DNS-SD so
14425 that they can be discovered using the hg paths command without knowing
14426 the server's IP address.
14427
14428 To allow other people to discover your repository using run hg serve in
14429 your repository:
14430
14431 $ cd test
14432 $ hg serve
14433
14434 You can discover Zeroconf-enabled repositories by running hg paths:
14435
14436 $ hg paths
14437 zc-test = http://example.com:8000/test
14438
14440 /etc/mercurial/hgrc, $HOME/.hgrc, .hg/hgrc
14441
14442 This file contains defaults and configuration. Values in
14443 .hg/hgrc override those in $HOME/.hgrc, and these override set‐
14444 tings made in the global /etc/mercurial/hgrc configuration. See
14445 hgrc(5) for details of the contents and format of these files.
14446
14447 .hgignore
14448
14449 This file contains regular expressions (one per line) that de‐
14450 scribe file names that should be ignored by hg. For details, see
14451 hgignore(5).
14452
14453 .hgsub
14454
14455 This file defines the locations of all subrepositories, and
14456 tells where the subrepository checkouts came from. For details,
14457 see hg help subrepos.
14458
14459 .hgsubstate
14460
14461 This file is where Mercurial stores all nested repository
14462 states. NB: This file should not be edited manually.
14463
14464 .hgtags
14465
14466 This file contains changeset hash values and text tag names (one
14467 of each separated by spaces) that correspond to tagged versions
14468 of the repository contents. The file content is encoded using
14469 UTF-8.
14470
14471 .hg/last-message.txt
14472
14473 This file is used by hg commit to store a backup of the commit
14474 message in case the commit fails.
14475
14476 .hg/localtags
14477
14478 This file can be used to define local tags which are not shared
14479 among repositories. The file format is the same as for .hgtags,
14480 but it is encoded using the local system encoding.
14481
14482 Some commands (e.g. revert) produce backup files ending in .orig, if
14483 the .orig file already exists and is not tracked by Mercurial, it will
14484 be overwritten.
14485
14487 Probably lots, please post them to the mailing list (see Resources
14488 below) when you find them.
14489
14491 hgignore(5), hgrc(5)
14492
14494 Written by Olivia Mackall <olivia@selenic.com>
14495
14497 Main Web Site: https://mercurial-scm.org/
14498
14499 Source code repository: https://www.mercurial-scm.org/repo/hg
14500
14501 Mailing list: https://www.mercurial-scm.org/mailman/listinfo/mercurial/
14502
14504 Copyright (C) 2005-2021 Olivia Mackall. Free use of this software is
14505 granted under the terms of the GNU General Public License version 2 or
14506 any later version.
14507
14509 Olivia Mackall <olivia@selenic.com>
14510
14511 Organization: Mercurial
14512
14513
14514
14515
14516 HG(1)