hgignore.5.txt
111 lines
| 3.1 KiB
| text/plain
|
TextLexer
/ doc / hgignore.5.txt
Martin Geisler
|
r9158 | ========== | ||
hgignore | ||||
========== | ||||
Vadim Gelfer
|
r2209 | |||
Martin Geisler
|
r9158 | --------------------------------- | ||
syntax for Mercurial ignore files | ||||
--------------------------------- | ||||
:Author: Vadim Gelfer <vadim.gelfer@gmail.com> | ||||
:Organization: Mercurial | ||||
:Manual section: 5 | ||||
:Manual group: Mercurial Manual | ||||
Vadim Gelfer
|
r2209 | |||
Martin Geisler
|
r9792 | Synopsis | ||
Vadim Gelfer
|
r2209 | -------- | ||
Martin Geisler
|
r9158 | The Mercurial system uses a file called ``.hgignore`` in the root | ||
Henri Wiechers
|
r9127 | directory of a repository to control its behavior when it searches | ||
for files that it is not currently tracking. | ||||
Vadim Gelfer
|
r2209 | |||
Martin Geisler
|
r9792 | Description | ||
Vadim Gelfer
|
r2209 | ----------- | ||
Martin Geisler
|
r9182 | 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. | ||||
Martin Geisler
|
r9194 | These files can be ignored by listing them in a ``.hgignore`` file in | ||
the root of the working directory. The ``.hgignore`` file must be | ||||
Martin Geisler
|
r9182 | created manually. It is typically put under version control, so that | ||
the settings will propagate to other repositories with push and pull. | ||||
Henri Wiechers
|
r9127 | An untracked file is ignored if its path relative to the repository | ||
root directory, or any prefix path of that path, is matched against | ||||
Martin Geisler
|
r9194 | any pattern in ``.hgignore``. | ||
Vadim Gelfer
|
r2209 | |||
Martin Geisler
|
r9834 | For example, say we have an untracked file, ``file.c``, at | ||
Martin Geisler
|
r9161 | ``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``. | ||||
Henri Wiechers
|
r9127 | |||
In addition, a Mercurial configuration file can reference a set of | ||||
Martin Geisler
|
r9162 | per-user or global ignore files. See the |hgrc(5)|_ man page for details | ||
Christian Ebert
|
r6446 | of how to configure these files. Look for the "ignore" entry in the | ||
Vadim Gelfer
|
r2209 | "ui" section. | ||
Henri Wiechers
|
r9127 | To control Mercurial's handling of files that it manages, see the | ||
Martin Geisler
|
r9624 | |hg(1)|_ man page. Look for the ``-I`` and ``-X`` options. | ||
Henri Wiechers
|
r9127 | |||
Martin Geisler
|
r9792 | Syntax | ||
Vadim Gelfer
|
r2209 | ------ | ||
An ignore file is a plain text file consisting of a list of patterns, | ||||
Martin Geisler
|
r9624 | with one pattern per line. Empty lines are skipped. The ``#`` | ||
character is treated as a comment character, and the ``\`` character | ||||
Martin Geisler
|
r8782 | is treated as an escape character. | ||
Vadim Gelfer
|
r2209 | |||
Christian Ebert
|
r6446 | Mercurial supports several pattern syntaxes. The default syntax used | ||
Vadim Gelfer
|
r2209 | is Python/Perl-style regular expressions. | ||
Martin Geisler
|
r9158 | To change the syntax used, use a line of the following form:: | ||
Vadim Gelfer
|
r2209 | |||
Martin Geisler
|
r9158 | syntax: NAME | ||
Vadim Gelfer
|
r2209 | |||
Martin Geisler
|
r9158 | where ``NAME`` is one of the following: | ||
Vadim Gelfer
|
r2209 | |||
Martin Geisler
|
r9158 | ``regexp`` | ||
Vadim Gelfer
|
r2209 | Regular expression, Python/Perl syntax. | ||
Martin Geisler
|
r9158 | ``glob`` | ||
Vadim Gelfer
|
r2209 | Shell-style glob. | ||
The chosen syntax stays in effect when parsing all patterns that | ||||
follow, until another syntax is selected. | ||||
Christian Ebert
|
r6446 | Neither glob nor regexp patterns are rooted. A glob-syntax pattern of | ||
Martin Geisler
|
r9624 | 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 ``^``. | ||||
Vadim Gelfer
|
r2209 | |||
Martin Geisler
|
r9792 | Example | ||
Vadim Gelfer
|
r2209 | ------- | ||
Martin Geisler
|
r9158 | Here is an example ignore file. :: | ||
Vadim Gelfer
|
r2209 | |||
# use glob syntax. | ||||
syntax: glob | ||||
*.elc | ||||
*.pyc | ||||
*~ | ||||
# switch to regexp syntax. | ||||
syntax: regexp | ||||
^\.pc/ | ||||
Martin Geisler
|
r9792 | Author | ||
Vadim Gelfer
|
r2209 | ------ | ||
Vadim Gelfer <vadim.gelfer@gmail.com> | ||||
Mercurial was written by Matt Mackall <mpm@selenic.com>. | ||||
Martin Geisler
|
r9792 | See Also | ||
Vadim Gelfer
|
r2209 | -------- | ||
Martin Geisler
|
r9162 | |hg(1)|_, |hgrc(5)|_ | ||
Vadim Gelfer
|
r2209 | |||
Martin Geisler
|
r9792 | Copying | ||
Vadim Gelfer
|
r2209 | ------- | ||
This manual page is copyright 2006 Vadim Gelfer. | ||||
Pascal Quantin
|
r10209 | Mercurial is copyright 2005-2010 Matt Mackall. | ||
Vadim Gelfer
|
r2209 | Free use of this software is granted under the terms of the GNU General | ||
Matt Mackall
|
r10263 | Public License version 2 or any later version. | ||
Martin Geisler
|
r9162 | |||
.. include:: common.txt | ||||