##// END OF EJS Templates
revert: option to choose what to keep, not what to discard...
revert: option to choose what to keep, not what to discard I know the you (the reader) are probably tired of discussing how `hg revert -i -r .` should behave and so am I. And I know I'm one of the people who argued that showing the diff from the working copy to the parent was confusing. I think it is less confusing now that we show the diff from the parent to the working copy, but I still find it confusing. I think showing the diff of hunks to keep might make it easier to understand. So that's what this patch provides an option for. One argument doing it this way is that most people seem to find `hg split` natural. I suspect that is because it shows the forward diff (from parent commit to the commit) and asks you what to put in the first commit. I think the new "keep" mode for revert (this patch) matches that. In "keep" mode, all the changes are still selected by default. That means that `hg revert -i` followed by 'A' (keep all) (or 'c' in curses) will be different from `hg revert -a`. That's mostly because that was simplest. It can also be argued that it's safest. But it can also be argued that it should be consistent with `hg revert -a`. Note that in this mode, you can edit the hunks and it will do what you expect (e.g. add new lines to your file if you added a new lines when editing). The test case shows that that works. Differential Revision: https://phab.mercurial-scm.org/D6125

File last commit:

r35036:b0262b25 default
r42154:c1d83d91 default
Show More
flags.txt
104 lines | 2.8 KiB | text/plain | TextLexer
Rodrigo Damazio Bovendorp
help: adding a topic on flags...
r35036 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.
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