Mercurial > hg
view mercurial/helptext/hgignore.txt @ 51594:e3a5ec2d236a
outgoing: rework the handling of the `missingroots` case to be faster
The previous implementation was slow, to the point it was taking a significant
amount of `hg bundle --type none-streamv2` call. We rework the code to compute
the same value much faster, making the operation disappear from the `hg bundle
--type none-streamv2` profile. Someone would remark that producing a streamclone
does not requires an `outgoing` object. However that is a matter for another
day. There is other user of `missingroots` (non stream `hg bundle` call for
example), and they will also benefit from this rework.
We implement an old TODO in the process, directly computing the missing and
common attribute as we have most element at hand already.
### benchmark.name = hg.command.bundle
# bin-env-vars.hg.flavor = default
# bin-env-vars.hg.py-re2-module = default
# benchmark.variants.revs = all
# benchmark.variants.type = none-streamv2
## data-env-vars.name = heptapod-public-2024-03-25-zstd-sparse-revlog
before: 7.750458
after: 6.665565 (-14.00%, -1.08)
## data-env-vars.name = mercurial-public-2024-03-22-zstd-sparse-revlog
before: 0.700229
after: 0.496050 (-29.16%, -0.20)
## data-env-vars.name = mozilla-try-2023-03-22-zstd-sparse-revlog
before: 346.508952
after: 316.749699 (-8.59%, -29.76)
## data-env-vars.name = pypy-2024-03-22-zstd-sparse-revlog
before: 3.401700
after: 2.915810 (-14.28%, -0.49)
## data-env-vars.name = tryton-public-2024-03-22-zstd-sparse-revlog
before: 1.870798
after: 1.461583 (-21.87%, -0.41)
note: this whole `missingroots` of outgoing has a limited number of callers and
could likely be replace by something simpler (like taking an explicit
"missing_revs" set for example). However this is a wider change and we focus on
a small impact, quick rework that does not change the API for now.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 09 Apr 2024 22:36:35 +0200 |
parents | b77d5b568496 |
children |
line wrap: on
line source
Synopsis ======== The Mercurial system uses a file called ``.hgignore`` in the root directory of a repository to control its behavior when it searches for files that it is not currently tracking. Description =========== The working directory of a Mercurial repository will often contain files that should not be tracked by Mercurial. These include backup files created by editors and build products created by compilers. These files can be ignored by listing them in a ``.hgignore`` file in the root of the working directory. The ``.hgignore`` file must be created manually. It is typically put under version control, so that the settings will propagate to other repositories with push and pull. An untracked file is ignored if its path relative to the repository root directory, or any prefix path of that path, is matched against any pattern in ``.hgignore``. For example, say we have an untracked file, ``file.c``, at ``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c`` if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``. In addition, a Mercurial configuration file can reference a set of per-user or global ignore files. See the ``ignore`` configuration key on the ``[ui]`` section of :hg:`help config` for details of how to configure these files. To control Mercurial's handling of files that it manages, many commands support the ``-I`` and ``-X`` options; see :hg:`help <command>` and :hg:`help patterns` for details. Files that are already tracked are not affected by .hgignore, even if they appear in .hgignore. An untracked file X can be explicitly added with :hg:`add X`, even if X would be excluded by a pattern in .hgignore. Syntax ====== An ignore file is a plain text file consisting of a list of patterns, with one pattern per line. Empty lines are skipped. The ``#`` character is treated as a comment character, and the ``\`` character is treated as an escape character. Mercurial supports several pattern syntaxes. The default syntax used is Python/Perl-style regular expressions. To change the syntax used, use a line of the following form:: syntax: NAME where ``NAME`` is one of the following: ``regexp`` Regular expression, Python/Perl syntax. ``glob`` Shell-style glob. ``rootglob`` A variant of ``glob`` that is rooted (see below). The chosen syntax stays in effect when parsing all patterns that follow, until another syntax is selected. Neither ``glob`` nor regexp patterns are rooted. A glob-syntax pattern of the form ``*.c`` will match a file ending in ``.c`` in any directory, and a regexp pattern of the form ``\.c$`` will do the same. To root a regexp pattern, start it with ``^``. To get the same effect with glob-syntax, you have to use ``rootglob``. Subdirectories can have their own .hgignore settings by adding ``subinclude:path/to/subdir/.hgignore`` to the root ``.hgignore``. See :hg:`help patterns` for details on ``subinclude:`` and ``include:``. .. note:: Patterns specified in other than ``.hgignore`` are always rooted. Please see :hg:`help patterns` for details. Example ======= Here is an example ignore file. :: # use glob syntax. syntax: glob *.elc *.pyc *~ # switch to regexp syntax. syntax: regexp ^\.pc/ Debugging ========= Use the ``debugignore`` command to see if and why a file is ignored, or to see the combined ignore pattern. See :hg:`help debugignore` for details.