author | Mads Kiilerich <mads@kiilerich.com> |
Sat, 28 Apr 2012 02:00:04 +0200 | |
branch | stable |
changeset 16541 | bb3334806ace |
parent 16504 | e3c7ca15cde2 |
child 17116 | d8c76c82d012 |
permissions | -rw-r--r-- |
14044
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
1 |
Synopsis |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
2 |
-------- |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
3 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
4 |
The Mercurial system uses a file called ``.hgignore`` in the root |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
5 |
directory of a repository to control its behavior when it searches |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
6 |
for files that it is not currently tracking. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
7 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
8 |
Description |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
9 |
----------- |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
10 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
11 |
The working directory of a Mercurial repository will often contain |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
12 |
files that should not be tracked by Mercurial. These include backup |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
13 |
files created by editors and build products created by compilers. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
14 |
These files can be ignored by listing them in a ``.hgignore`` file in |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
15 |
the root of the working directory. The ``.hgignore`` file must be |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
16 |
created manually. It is typically put under version control, so that |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
17 |
the settings will propagate to other repositories with push and pull. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
18 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
19 |
An untracked file is ignored if its path relative to the repository |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
20 |
root directory, or any prefix path of that path, is matched against |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
21 |
any pattern in ``.hgignore``. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
22 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
23 |
For example, say we have an untracked file, ``file.c``, at |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
24 |
``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c`` |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
25 |
if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
26 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
27 |
In addition, a Mercurial configuration file can reference a set of |
14668
2d6f1b2c6a82
help/hgignore: refer to the builtin help instead of external URLs
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
14044
diff
changeset
|
28 |
per-user or global ignore files. See the ``ignore`` configuration |
2d6f1b2c6a82
help/hgignore: refer to the builtin help instead of external URLs
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
14044
diff
changeset
|
29 |
key on the ``[ui]`` section of :hg:`help config` for details of how to |
2d6f1b2c6a82
help/hgignore: refer to the builtin help instead of external URLs
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
14044
diff
changeset
|
30 |
configure these files. |
14044
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
31 |
|
14668
2d6f1b2c6a82
help/hgignore: refer to the builtin help instead of external URLs
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
14044
diff
changeset
|
32 |
To control Mercurial's handling of files that it manages, many |
2d6f1b2c6a82
help/hgignore: refer to the builtin help instead of external URLs
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
14044
diff
changeset
|
33 |
commands support the ``-I`` and ``-X`` options; see |
2d6f1b2c6a82
help/hgignore: refer to the builtin help instead of external URLs
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
14044
diff
changeset
|
34 |
:hg:`help <command>` and :hg:`help patterns` for details. |
14044
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
35 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
36 |
Syntax |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
37 |
------ |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
38 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
39 |
An ignore file is a plain text file consisting of a list of patterns, |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
40 |
with one pattern per line. Empty lines are skipped. The ``#`` |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
41 |
character is treated as a comment character, and the ``\`` character |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
42 |
is treated as an escape character. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
43 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
44 |
Mercurial supports several pattern syntaxes. The default syntax used |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
45 |
is Python/Perl-style regular expressions. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
46 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
47 |
To change the syntax used, use a line of the following form:: |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
48 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
49 |
syntax: NAME |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
50 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
51 |
where ``NAME`` is one of the following: |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
52 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
53 |
``regexp`` |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
54 |
Regular expression, Python/Perl syntax. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
55 |
``glob`` |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
56 |
Shell-style glob. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
57 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
58 |
The chosen syntax stays in effect when parsing all patterns that |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
59 |
follow, until another syntax is selected. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
60 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
61 |
Neither glob nor regexp patterns are rooted. A glob-syntax pattern of |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
62 |
the form ``*.c`` will match a file ending in ``.c`` in any directory, |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
63 |
and a regexp pattern of the form ``\.c$`` will do the same. To root a |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
64 |
regexp pattern, start it with ``^``. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
65 |
|
16504
e3c7ca15cde2
doc: add note about pattern rooted/unrooted cases to "hgignore" and "patterns"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
14668
diff
changeset
|
66 |
.. note:: |
e3c7ca15cde2
doc: add note about pattern rooted/unrooted cases to "hgignore" and "patterns"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
14668
diff
changeset
|
67 |
Patterns specified in other than ``.hgignore`` are always rooted. |
e3c7ca15cde2
doc: add note about pattern rooted/unrooted cases to "hgignore" and "patterns"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
14668
diff
changeset
|
68 |
Please see :hg:`help patterns` for details. |
e3c7ca15cde2
doc: add note about pattern rooted/unrooted cases to "hgignore" and "patterns"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
14668
diff
changeset
|
69 |
|
14044
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
70 |
Example |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
71 |
------- |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
72 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
73 |
Here is an example ignore file. :: |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
74 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
75 |
# use glob syntax. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
76 |
syntax: glob |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
77 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
78 |
*.elc |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
79 |
*.pyc |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
80 |
*~ |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
81 |
|
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
82 |
# switch to regexp syntax. |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
83 |
syntax: regexp |
0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
Yun Lee <yun.lee.bj@gmail.com>
parents:
diff
changeset
|
84 |
^\.pc/ |