Mercurial > hg
view mercurial/help/flags.txt @ 37443:65250a66b55c
revlog: move censor logic into main revlog class
Previously, the revlog class implemented dummy methods for
various censor-related functionality. Revision censoring was
(and will continue to be) only possible on filelog instances.
So filelog implemented these methods to perform something
reasonable.
A problem with implementing censoring on filelog is that
it assumes filelog is a revlog. Upcoming work to formalize
the filelog interface will make this not true.
Furthermore, the censoring logic is security-sensitive. I
think action-at-a-distance with custom implementation of core
revlog APIs in derived classes is a bit dangerous. I think at
a minimum the censor logic should live in revlog.py.
I was tempted to created a "censored revlog" class that
basically pulled these methods out of filelog. But, I wasn't
a huge fan of overriding core methods in child classes. A
reason to do that would be performance. However, the censoring
code only comes into play when:
* hash verification fails
* delta generation
* applying deltas from changegroups
The new code is conditional on an instance attribute. So the
overhead for running the censored code when the revlog isn't
censorable is an attribute lookup. All of these operations are
at least a magnitude slower than a Python attribute lookup. So
there shouldn't be a performance concern.
Differential Revision: https://phab.mercurial-scm.org/D3151
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 05 Apr 2018 16:31:45 -0700 |
parents | b0262b25ab48 |
children |
line wrap: on
line source
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