##// END OF EJS Templates
contrib: add a partial-merge tool for sorted lists (such as Python imports)...
contrib: add a partial-merge tool for sorted lists (such as Python imports) This is a pretty naive tool that uses a regular expression for matching lines. It is based on a Google-internal tool that worked in a similar way. For now, the regular expression is hard-coded to attempt to match single-line Python imports. The only commit I've found in the hg core repo where the tool helped was commit 9cd6292abfdf. I think that's because we often use multiple imports per import statement. I think this tool is still a decent first step (especially once the regex is made configurable in the next patch). The merging should ideally use a proper Python parser and do the merge at the AST (or CST?) level, but that's significantly harder, especially if you want to preserve comments and whitespace. It's also less generic. Differential Revision: https://phab.mercurial-scm.org/D12380

File last commit:

r45459:33ef8841 default
r49874:681b25ea default
Show More
flags.txt
106 lines | 2.9 KiB | text/plain | TextLexer
Most Mercurial commands accept various flags.
Flag names
==========
Flags for each command are listed in :hg:`help` for that command.
Additionally, some flags, such as --repository, are global and can be used with
any command - those are seen in :hg:`help -v`, and can be specified before or
after the command.
Every flag has at least a long name, such as --repository. Some flags may also
have a short one-letter name, such as the equivalent -R. Using the short or long
name is equivalent and has the same effect. The long name may be abbreviated to
any unambiguous prefix. For example, :hg:`commit --amend` can be abbreviated
to :hg:`commit --am`.
Flags that have a short name can also be bundled together - for instance, to
specify both --edit (short -e) and --interactive (short -i), one could use::
hg commit -ei
If any of the bundled flags takes a value (i.e. is not a boolean), it must be
last, followed by the value::
hg commit -im 'Message'
Flag types
==========
Mercurial command-line flags can be strings, numbers, booleans, or lists of
strings.
Specifying flag values
======================
The following syntaxes are allowed, assuming a flag 'flagname' with short name
'f'::
--flagname=foo
--flagname foo
-f foo
-ffoo
This syntax applies to all non-boolean flags (strings, numbers or lists).
Specifying boolean flags
========================
Boolean flags do not take a value parameter. To specify a boolean, use the flag
name to set it to true, or the same name prefixed with 'no-' to set it to
false::
hg commit --interactive
hg commit --no-interactive
Specifying list flags
=====================
List flags take multiple values. To specify them, pass the flag multiple times::
hg files --include mercurial --include tests
Setting flag defaults
=====================
In order to set a default value for a flag in an hgrc file, it is recommended to
use aliases::
[alias]
commit = commit --interactive
For more information on hgrc files, see :hg:`help config`.
Overriding flags on the command line
====================================
If the same non-list flag is specified multiple times on the command line, the
latest specification is used::
hg commit -m "Ignored value" -m "Used value"
This includes the use of aliases - e.g., if one has::
[alias]
committemp = commit -m "Ignored value"
then the following command will override that -m::
hg committemp -m "Used value"
Overriding flag defaults
========================
Every flag has a default value, and you may also set your own defaults in hgrc
as described above.
Except for list flags, defaults can be overridden on the command line simply by
specifying the flag in that location.
Hidden flags
============
Some flags are not shown in a command's help by default - specifically, those
that are deemed to be experimental, deprecated or advanced. To show all flags,
add the --verbose flag for the help command::
hg help --verbose commit