Mercurial > hg
comparison hgext/sparse.py @ 33294:a5921ad2eb99
sparse: document config file format
This was previously undocumented. Seems useful to have.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 06 Jul 2017 10:57:26 -0700 |
parents | c9cbf4de27ba |
children | c72e9c61d2b1 |
comparison
equal
deleted
inserted
replaced
33293:c9cbf4de27ba | 33294:a5921ad2eb99 |
---|---|
15 subset of files for the revision. This allows specific files or | 15 subset of files for the revision. This allows specific files or |
16 directories to be explicitly included or excluded. Many repository | 16 directories to be explicitly included or excluded. Many repository |
17 operations have performance proportional to the number of files in | 17 operations have performance proportional to the number of files in |
18 the working directory. So only realizing a subset of files in the | 18 the working directory. So only realizing a subset of files in the |
19 working directory can improve performance. | 19 working directory can improve performance. |
20 | |
21 Sparse Config Files | |
22 ------------------- | |
23 | |
24 The set of files that are part of a sparse checkout are defined by | |
25 a sparse config file. The file defines 3 things: includes (files to | |
26 include in the sparse checkout), excludes (files to exclude from the | |
27 sparse checkout), and profiles (links to other config files). | |
28 | |
29 The file format is newline delimited. Empty lines and lines beginning | |
30 with ``#`` are ignored. | |
31 | |
32 Lines beginning with ``%include `` denote another sparse config file | |
33 to include. e.g. ``%include tests.sparse``. The filename is relative | |
34 to the repository root. | |
35 | |
36 The special lines ``[include]`` and ``[exclude]`` denote the section | |
37 for includes and excludes that follow, respectively. It is illegal to | |
38 have ``[include]`` after ``[exclude]``. If no sections are defined, | |
39 entries are assumed to be in the ``[include]`` section. | |
40 | |
41 Non-special lines resemble file patterns to be added to either includes | |
42 or excludes. The syntax of these lines is documented by :hg:`help patterns`. | |
43 Patterns are interpreted as ``glob:`` by default and match against the | |
44 root of the repository. | |
45 | |
46 Exclusion patterns take precedence over inclusion patterns. So even | |
47 if a file is explicitly included, an ``[exclude]`` entry can remove it. | |
48 | |
49 For example, say you have a repository with 3 directories, ``frontend/``, | |
50 ``backend/``, and ``tools/``. ``frontend/`` and ``backend/`` correspond | |
51 to different projects and it is uncommon for someone working on one | |
52 to need the files for the other. But ``tools/`` contains files shared | |
53 between both projects. Your sparse config files may resemble:: | |
54 | |
55 # frontend.sparse | |
56 frontend/** | |
57 tools/** | |
58 | |
59 # backend.sparse | |
60 backend/** | |
61 tools/** | |
62 | |
63 Say the backend grows in size. Or there's a directory with thousands | |
64 of files you wish to exclude. You can modify the profile to exclude | |
65 certain files:: | |
66 | |
67 [include] | |
68 backend/** | |
69 tools/** | |
70 | |
71 [exclude] | |
72 tools/tests/** | |
20 """ | 73 """ |
21 | 74 |
22 from __future__ import absolute_import | 75 from __future__ import absolute_import |
23 | 76 |
24 import collections | 77 import collections |