Show More
@@ -1,558 +1,559 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | # |
|
2 | # | |
3 | # check-code - a style and portability checker for Mercurial |
|
3 | # check-code - a style and portability checker for Mercurial | |
4 | # |
|
4 | # | |
5 | # Copyright 2010 Matt Mackall <mpm@selenic.com> |
|
5 | # Copyright 2010 Matt Mackall <mpm@selenic.com> | |
6 | # |
|
6 | # | |
7 | # This software may be used and distributed according to the terms of the |
|
7 | # This software may be used and distributed according to the terms of the | |
8 | # GNU General Public License version 2 or any later version. |
|
8 | # GNU General Public License version 2 or any later version. | |
9 |
|
9 | |||
10 | """style and portability checker for Mercurial |
|
10 | """style and portability checker for Mercurial | |
11 |
|
11 | |||
12 | when a rule triggers wrong, do one of the following (prefer one from top): |
|
12 | when a rule triggers wrong, do one of the following (prefer one from top): | |
13 | * do the work-around the rule suggests |
|
13 | * do the work-around the rule suggests | |
14 | * doublecheck that it is a false match |
|
14 | * doublecheck that it is a false match | |
15 | * improve the rule pattern |
|
15 | * improve the rule pattern | |
16 | * add an ignore pattern to the rule (3rd arg) which matches your good line |
|
16 | * add an ignore pattern to the rule (3rd arg) which matches your good line | |
17 | (you can append a short comment and match this, like: #re-raises, # no-py24) |
|
17 | (you can append a short comment and match this, like: #re-raises, # no-py24) | |
18 | * change the pattern to a warning and list the exception in test-check-code-hg |
|
18 | * change the pattern to a warning and list the exception in test-check-code-hg | |
19 | * ONLY use no--check-code for skipping entire files from external sources |
|
19 | * ONLY use no--check-code for skipping entire files from external sources | |
20 | """ |
|
20 | """ | |
21 |
|
21 | |||
22 | import re, glob, os, sys |
|
22 | import re, glob, os, sys | |
23 | import keyword |
|
23 | import keyword | |
24 | import optparse |
|
24 | import optparse | |
25 | try: |
|
25 | try: | |
26 | import re2 |
|
26 | import re2 | |
27 | except ImportError: |
|
27 | except ImportError: | |
28 | re2 = None |
|
28 | re2 = None | |
29 |
|
29 | |||
30 | def compilere(pat, multiline=False): |
|
30 | def compilere(pat, multiline=False): | |
31 | if multiline: |
|
31 | if multiline: | |
32 | pat = '(?m)' + pat |
|
32 | pat = '(?m)' + pat | |
33 | if re2: |
|
33 | if re2: | |
34 | try: |
|
34 | try: | |
35 | return re2.compile(pat) |
|
35 | return re2.compile(pat) | |
36 | except re2.error: |
|
36 | except re2.error: | |
37 | pass |
|
37 | pass | |
38 | return re.compile(pat) |
|
38 | return re.compile(pat) | |
39 |
|
39 | |||
40 | def repquote(m): |
|
40 | def repquote(m): | |
41 | fromc = '.:' |
|
41 | fromc = '.:' | |
42 | tochr = 'pq' |
|
42 | tochr = 'pq' | |
43 | def encodechr(i): |
|
43 | def encodechr(i): | |
44 | if i > 255: |
|
44 | if i > 255: | |
45 | return 'u' |
|
45 | return 'u' | |
46 | c = chr(i) |
|
46 | c = chr(i) | |
47 | if c in ' \n': |
|
47 | if c in ' \n': | |
48 | return c |
|
48 | return c | |
49 | if c.isalpha(): |
|
49 | if c.isalpha(): | |
50 | return 'x' |
|
50 | return 'x' | |
51 | if c.isdigit(): |
|
51 | if c.isdigit(): | |
52 | return 'n' |
|
52 | return 'n' | |
53 | try: |
|
53 | try: | |
54 | return tochr[fromc.find(c)] |
|
54 | return tochr[fromc.find(c)] | |
55 | except (ValueError, IndexError): |
|
55 | except (ValueError, IndexError): | |
56 | return 'o' |
|
56 | return 'o' | |
57 | t = m.group('text') |
|
57 | t = m.group('text') | |
58 | tt = ''.join(encodechr(i) for i in xrange(256)) |
|
58 | tt = ''.join(encodechr(i) for i in xrange(256)) | |
59 | t = t.translate(tt) |
|
59 | t = t.translate(tt) | |
60 | return m.group('quote') + t + m.group('quote') |
|
60 | return m.group('quote') + t + m.group('quote') | |
61 |
|
61 | |||
62 | def reppython(m): |
|
62 | def reppython(m): | |
63 | comment = m.group('comment') |
|
63 | comment = m.group('comment') | |
64 | if comment: |
|
64 | if comment: | |
65 | l = len(comment.rstrip()) |
|
65 | l = len(comment.rstrip()) | |
66 | return "#" * l + comment[l:] |
|
66 | return "#" * l + comment[l:] | |
67 | return repquote(m) |
|
67 | return repquote(m) | |
68 |
|
68 | |||
69 | def repcomment(m): |
|
69 | def repcomment(m): | |
70 | return m.group(1) + "#" * len(m.group(2)) |
|
70 | return m.group(1) + "#" * len(m.group(2)) | |
71 |
|
71 | |||
72 | def repccomment(m): |
|
72 | def repccomment(m): | |
73 | t = re.sub(r"((?<=\n) )|\S", "x", m.group(2)) |
|
73 | t = re.sub(r"((?<=\n) )|\S", "x", m.group(2)) | |
74 | return m.group(1) + t + "*/" |
|
74 | return m.group(1) + t + "*/" | |
75 |
|
75 | |||
76 | def repcallspaces(m): |
|
76 | def repcallspaces(m): | |
77 | t = re.sub(r"\n\s+", "\n", m.group(2)) |
|
77 | t = re.sub(r"\n\s+", "\n", m.group(2)) | |
78 | return m.group(1) + t |
|
78 | return m.group(1) + t | |
79 |
|
79 | |||
80 | def repinclude(m): |
|
80 | def repinclude(m): | |
81 | return m.group(1) + "<foo>" |
|
81 | return m.group(1) + "<foo>" | |
82 |
|
82 | |||
83 | def rephere(m): |
|
83 | def rephere(m): | |
84 | t = re.sub(r"\S", "x", m.group(2)) |
|
84 | t = re.sub(r"\S", "x", m.group(2)) | |
85 | return m.group(1) + t |
|
85 | return m.group(1) + t | |
86 |
|
86 | |||
87 |
|
87 | |||
88 | testpats = [ |
|
88 | testpats = [ | |
89 | [ |
|
89 | [ | |
90 | (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"), |
|
90 | (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"), | |
91 | (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"), |
|
91 | (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"), | |
92 | (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"), |
|
92 | (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"), | |
93 | (r'(?<!hg )grep.*-a', "don't use 'grep -a', use in-line python"), |
|
93 | (r'(?<!hg )grep.*-a', "don't use 'grep -a', use in-line python"), | |
94 | (r'sed.*-i', "don't use 'sed -i', use a temporary file"), |
|
94 | (r'sed.*-i', "don't use 'sed -i', use a temporary file"), | |
95 | (r'\becho\b.*\\n', "don't use 'echo \\n', use printf"), |
|
95 | (r'\becho\b.*\\n', "don't use 'echo \\n', use printf"), | |
96 | (r'echo -n', "don't use 'echo -n', use printf"), |
|
96 | (r'echo -n', "don't use 'echo -n', use printf"), | |
97 | (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"), |
|
97 | (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"), | |
98 | (r'head -c', "don't use 'head -c', use 'dd'"), |
|
98 | (r'head -c', "don't use 'head -c', use 'dd'"), | |
99 | (r'tail -n', "don't use the '-n' option to tail, just use '-<num>'"), |
|
99 | (r'tail -n', "don't use the '-n' option to tail, just use '-<num>'"), | |
100 | (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"), |
|
100 | (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"), | |
101 | (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"), |
|
101 | (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"), | |
102 | (r'printf.*[^\\]\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"), |
|
102 | (r'printf.*[^\\]\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"), | |
103 | (r'printf.*[^\\]\\x', "don't use printf \\x, use Python"), |
|
103 | (r'printf.*[^\\]\\x', "don't use printf \\x, use Python"), | |
104 | (r'\$\(.*\)', "don't use $(expr), use `expr`"), |
|
104 | (r'\$\(.*\)', "don't use $(expr), use `expr`"), | |
105 | (r'rm -rf \*', "don't use naked rm -rf, target a directory"), |
|
105 | (r'rm -rf \*', "don't use naked rm -rf, target a directory"), | |
106 | (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w', |
|
106 | (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w', | |
107 | "use egrep for extended grep syntax"), |
|
107 | "use egrep for extended grep syntax"), | |
108 | (r'/bin/', "don't use explicit paths for tools"), |
|
108 | (r'/bin/', "don't use explicit paths for tools"), | |
109 | (r'[^\n]\Z', "no trailing newline"), |
|
109 | (r'[^\n]\Z', "no trailing newline"), | |
110 | (r'export.*=', "don't export and assign at once"), |
|
110 | (r'export.*=', "don't export and assign at once"), | |
111 | (r'^source\b', "don't use 'source', use '.'"), |
|
111 | (r'^source\b', "don't use 'source', use '.'"), | |
112 | (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"), |
|
112 | (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"), | |
113 | (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"), |
|
113 | (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"), | |
114 | (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"), |
|
114 | (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"), | |
115 | (r'^stop\(\)', "don't use 'stop' as a shell function name"), |
|
115 | (r'^stop\(\)', "don't use 'stop' as a shell function name"), | |
116 | (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"), |
|
116 | (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"), | |
117 | (r'^alias\b.*=', "don't use alias, use a function"), |
|
117 | (r'^alias\b.*=', "don't use alias, use a function"), | |
118 | (r'if\s*!', "don't use '!' to negate exit status"), |
|
118 | (r'if\s*!', "don't use '!' to negate exit status"), | |
119 | (r'/dev/u?random', "don't use entropy, use /dev/zero"), |
|
119 | (r'/dev/u?random', "don't use entropy, use /dev/zero"), | |
120 | (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"), |
|
120 | (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"), | |
121 | (r'^( *)\t', "don't use tabs to indent"), |
|
121 | (r'^( *)\t', "don't use tabs to indent"), | |
122 | (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)', |
|
122 | (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)', | |
123 | "put a backslash-escaped newline after sed 'i' command"), |
|
123 | "put a backslash-escaped newline after sed 'i' command"), | |
124 | ], |
|
124 | ], | |
125 | # warnings |
|
125 | # warnings | |
126 | [ |
|
126 | [ | |
127 | (r'^function', "don't use 'function', use old style"), |
|
127 | (r'^function', "don't use 'function', use old style"), | |
128 | (r'^diff.*-\w*N', "don't use 'diff -N'"), |
|
128 | (r'^diff.*-\w*N', "don't use 'diff -N'"), | |
129 | (r'\$PWD|\${PWD}', "don't use $PWD, use `pwd`"), |
|
129 | (r'\$PWD|\${PWD}', "don't use $PWD, use `pwd`"), | |
130 | (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"), |
|
130 | (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"), | |
131 | (r'kill (`|\$\()', "don't use kill, use killdaemons.py") |
|
131 | (r'kill (`|\$\()', "don't use kill, use killdaemons.py") | |
132 | ] |
|
132 | ] | |
133 | ] |
|
133 | ] | |
134 |
|
134 | |||
135 | testfilters = [ |
|
135 | testfilters = [ | |
136 | (r"( *)(#([^\n]*\S)?)", repcomment), |
|
136 | (r"( *)(#([^\n]*\S)?)", repcomment), | |
137 | (r"<<(\S+)((.|\n)*?\n\1)", rephere), |
|
137 | (r"<<(\S+)((.|\n)*?\n\1)", rephere), | |
138 | ] |
|
138 | ] | |
139 |
|
139 | |||
140 | winglobmsg = "use (glob) to match Windows paths too" |
|
140 | winglobmsg = "use (glob) to match Windows paths too" | |
141 | uprefix = r"^ \$ " |
|
141 | uprefix = r"^ \$ " | |
142 | utestpats = [ |
|
142 | utestpats = [ | |
143 | [ |
|
143 | [ | |
144 | (r'^(\S.*|| [$>] .*)[ \t]\n', "trailing whitespace on non-output"), |
|
144 | (r'^(\S.*|| [$>] .*)[ \t]\n', "trailing whitespace on non-output"), | |
145 | (uprefix + r'.*\|\s*sed[^|>\n]*\n', |
|
145 | (uprefix + r'.*\|\s*sed[^|>\n]*\n', | |
146 | "use regex test output patterns instead of sed"), |
|
146 | "use regex test output patterns instead of sed"), | |
147 | (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"), |
|
147 | (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"), | |
148 | (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"), |
|
148 | (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"), | |
149 | (uprefix + r'.*\|\| echo.*(fail|error)', |
|
149 | (uprefix + r'.*\|\| echo.*(fail|error)', | |
150 | "explicit exit code checks unnecessary"), |
|
150 | "explicit exit code checks unnecessary"), | |
151 | (uprefix + r'set -e', "don't use set -e"), |
|
151 | (uprefix + r'set -e', "don't use set -e"), | |
152 | (uprefix + r'(\s|fi\b|done\b)', "use > for continued lines"), |
|
152 | (uprefix + r'(\s|fi\b|done\b)', "use > for continued lines"), | |
153 | (uprefix + r'.*:\.\S*/', "x:.y in a path does not work on msys, rewrite " |
|
153 | (uprefix + r'.*:\.\S*/', "x:.y in a path does not work on msys, rewrite " | |
154 | "as x://.y, or see `hg log -k msys` for alternatives", r'-\S+:\.|' #-Rxxx |
|
154 | "as x://.y, or see `hg log -k msys` for alternatives", r'-\S+:\.|' #-Rxxx | |
155 | 'hg pull -q file:../test'), # in test-pull.t which is skipped on windows |
|
155 | 'hg pull -q file:../test'), # in test-pull.t which is skipped on windows | |
156 | (r'^ saved backup bundle to \$TESTTMP.*\.hg$', winglobmsg), |
|
156 | (r'^ saved backup bundle to \$TESTTMP.*\.hg$', winglobmsg), | |
157 | (r'^ changeset .* references (corrupted|missing) \$TESTTMP/.*[^)]$', |
|
157 | (r'^ changeset .* references (corrupted|missing) \$TESTTMP/.*[^)]$', | |
158 | winglobmsg), |
|
158 | winglobmsg), | |
159 | (r'^ pulling from \$TESTTMP/.*[^)]$', winglobmsg, |
|
159 | (r'^ pulling from \$TESTTMP/.*[^)]$', winglobmsg, | |
160 | '\$TESTTMP/unix-repo$'), # in test-issue1802.t which skipped on windows |
|
160 | '\$TESTTMP/unix-repo$'), # in test-issue1802.t which skipped on windows | |
161 | (r'^ reverting .*/.*[^)]$', winglobmsg), |
|
161 | (r'^ reverting .*/.*[^)]$', winglobmsg), | |
162 | (r'^ cloning subrepo \S+/.*[^)]$', winglobmsg), |
|
162 | (r'^ cloning subrepo \S+/.*[^)]$', winglobmsg), | |
163 | (r'^ pushing to \$TESTTMP/.*[^)]$', winglobmsg), |
|
163 | (r'^ pushing to \$TESTTMP/.*[^)]$', winglobmsg), | |
164 | (r'^ pushing subrepo \S+/\S+ to.*[^)]$', winglobmsg), |
|
164 | (r'^ pushing subrepo \S+/\S+ to.*[^)]$', winglobmsg), | |
165 | (r'^ moving \S+/.*[^)]$', winglobmsg), |
|
165 | (r'^ moving \S+/.*[^)]$', winglobmsg), | |
166 | (r'^ no changes made to subrepo since.*/.*[^)]$', winglobmsg), |
|
166 | (r'^ no changes made to subrepo since.*/.*[^)]$', winglobmsg), | |
167 | (r'^ .*: largefile \S+ not available from file:.*/.*[^)]$', winglobmsg), |
|
167 | (r'^ .*: largefile \S+ not available from file:.*/.*[^)]$', winglobmsg), | |
168 | (r'^ .*file://\$TESTTMP', |
|
168 | (r'^ .*file://\$TESTTMP', | |
169 | 'write "file:/*/$TESTTMP" + (glob) to match on windows too'), |
|
169 | 'write "file:/*/$TESTTMP" + (glob) to match on windows too'), | |
170 | ], |
|
170 | ], | |
171 | # warnings |
|
171 | # warnings | |
172 | [ |
|
172 | [ | |
173 | (r'^ [^*?/\n]* \(glob\)$', |
|
173 | (r'^ [^*?/\n]* \(glob\)$', | |
174 | "glob match with no glob character (?*/)"), |
|
174 | "glob match with no glob character (?*/)"), | |
175 | ] |
|
175 | ] | |
176 | ] |
|
176 | ] | |
177 |
|
177 | |||
178 | for i in [0, 1]: |
|
178 | for i in [0, 1]: | |
179 | for p, m in testpats[i]: |
|
179 | for p, m in testpats[i]: | |
180 | if p.startswith(r'^'): |
|
180 | if p.startswith(r'^'): | |
181 | p = r"^ [$>] (%s)" % p[1:] |
|
181 | p = r"^ [$>] (%s)" % p[1:] | |
182 | else: |
|
182 | else: | |
183 | p = r"^ [$>] .*(%s)" % p |
|
183 | p = r"^ [$>] .*(%s)" % p | |
184 | utestpats[i].append((p, m)) |
|
184 | utestpats[i].append((p, m)) | |
185 |
|
185 | |||
186 | utestfilters = [ |
|
186 | utestfilters = [ | |
187 | (r"<<(\S+)((.|\n)*?\n > \1)", rephere), |
|
187 | (r"<<(\S+)((.|\n)*?\n > \1)", rephere), | |
188 | (r"( *)(#([^\n]*\S)?)", repcomment), |
|
188 | (r"( *)(#([^\n]*\S)?)", repcomment), | |
189 | ] |
|
189 | ] | |
190 |
|
190 | |||
191 | pypats = [ |
|
191 | pypats = [ | |
192 | [ |
|
192 | [ | |
193 | (r'^\s*def\s*\w+\s*\(.*,\s*\(', |
|
193 | (r'^\s*def\s*\w+\s*\(.*,\s*\(', | |
194 | "tuple parameter unpacking not available in Python 3+"), |
|
194 | "tuple parameter unpacking not available in Python 3+"), | |
195 | (r'lambda\s*\(.*,.*\)', |
|
195 | (r'lambda\s*\(.*,.*\)', | |
196 | "tuple parameter unpacking not available in Python 3+"), |
|
196 | "tuple parameter unpacking not available in Python 3+"), | |
197 | (r'import (.+,[^.]+\.[^.]+|[^.]+\.[^.]+,)', |
|
197 | (r'import (.+,[^.]+\.[^.]+|[^.]+\.[^.]+,)', | |
198 | '2to3 can\'t always rewrite "import qux, foo.bar", ' |
|
198 | '2to3 can\'t always rewrite "import qux, foo.bar", ' | |
199 | 'use "import foo.bar" on its own line instead.'), |
|
199 | 'use "import foo.bar" on its own line instead.'), | |
200 | (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"), |
|
200 | (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"), | |
201 | (r'\breduce\s*\(.*', "reduce is not available in Python 3+"), |
|
201 | (r'\breduce\s*\(.*', "reduce is not available in Python 3+"), | |
202 | (r'\.has_key\b', "dict.has_key is not available in Python 3+"), |
|
202 | (r'\.has_key\b', "dict.has_key is not available in Python 3+"), | |
203 | (r'\s<>\s', '<> operator is not available in Python 3+, use !='), |
|
203 | (r'\s<>\s', '<> operator is not available in Python 3+, use !='), | |
204 | (r'^\s*\t', "don't use tabs"), |
|
204 | (r'^\s*\t', "don't use tabs"), | |
205 | (r'\S;\s*\n', "semicolon"), |
|
205 | (r'\S;\s*\n', "semicolon"), | |
206 | (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"), |
|
206 | (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"), | |
207 | (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"), |
|
207 | (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"), | |
208 | (r'(\w|\)),\w', "missing whitespace after ,"), |
|
208 | (r'(\w|\)),\w', "missing whitespace after ,"), | |
209 | (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"), |
|
209 | (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"), | |
210 | (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), |
|
210 | (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), | |
211 | (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' |
|
211 | (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' | |
212 | r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Python 2.4'), |
|
212 | r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Python 2.4'), | |
213 | (r'(?<!def)(\s+|^|\()next\(.+\)', |
|
213 | (r'(?<!def)(\s+|^|\()next\(.+\)', | |
214 | 'no next(foo) in Python 2.4 and 2.5, use foo.next() instead'), |
|
214 | 'no next(foo) in Python 2.4 and 2.5, use foo.next() instead'), | |
215 | (r'(\s+)try:\n((?:\n|\1\s.*\n)*?)\1\s*yield\b.*?' |
|
215 | (r'(\s+)try:\n((?:\n|\1\s.*\n)*?)\1\s*yield\b.*?' | |
216 | r'((?:\n|\1\s.*\n)+?)\1finally:', |
|
216 | r'((?:\n|\1\s.*\n)+?)\1finally:', | |
217 | 'no yield inside try/finally in Python 2.4'), |
|
217 | 'no yield inside try/finally in Python 2.4'), | |
218 | (r'.{81}', "line too long"), |
|
218 | (r'.{81}', "line too long"), | |
219 | (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), |
|
219 | (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), | |
220 | (r'[^\n]\Z', "no trailing newline"), |
|
220 | (r'[^\n]\Z', "no trailing newline"), | |
221 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), |
|
221 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), | |
222 | # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', |
|
222 | # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', | |
223 | # "don't use underbars in identifiers"), |
|
223 | # "don't use underbars in identifiers"), | |
224 | (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ', |
|
224 | (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ', | |
225 | "don't use camelcase in identifiers"), |
|
225 | "don't use camelcase in identifiers"), | |
226 | (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', |
|
226 | (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', | |
227 | "linebreak after :"), |
|
227 | "linebreak after :"), | |
228 | (r'class\s[^( \n]+:', "old-style class, use class foo(object)"), |
|
228 | (r'class\s[^( \n]+:', "old-style class, use class foo(object)"), | |
229 | (r'class\s[^( \n]+\(\):', |
|
229 | (r'class\s[^( \n]+\(\):', | |
230 | "class foo() not available in Python 2.4, use class foo(object)"), |
|
230 | "class foo() not available in Python 2.4, use class foo(object)"), | |
231 | (r'\b(%s)\(' % '|'.join(keyword.kwlist), |
|
231 | (r'\b(%s)\(' % '|'.join(keyword.kwlist), | |
232 | "Python keyword is not a function"), |
|
232 | "Python keyword is not a function"), | |
233 | (r',]', "unneeded trailing ',' in list"), |
|
233 | (r',]', "unneeded trailing ',' in list"), | |
234 | # (r'class\s[A-Z][^\(]*\((?!Exception)', |
|
234 | # (r'class\s[A-Z][^\(]*\((?!Exception)', | |
235 | # "don't capitalize non-exception classes"), |
|
235 | # "don't capitalize non-exception classes"), | |
236 | # (r'in range\(', "use xrange"), |
|
236 | # (r'in range\(', "use xrange"), | |
237 | # (r'^\s*print\s+', "avoid using print in core and extensions"), |
|
237 | # (r'^\s*print\s+', "avoid using print in core and extensions"), | |
238 | (r'[\x80-\xff]', "non-ASCII character literal"), |
|
238 | (r'[\x80-\xff]', "non-ASCII character literal"), | |
239 | (r'("\')\.format\(', "str.format() not available in Python 2.4"), |
|
239 | (r'("\')\.format\(', "str.format() not available in Python 2.4"), | |
240 | (r'^\s*with\s+', "with not available in Python 2.4"), |
|
240 | (r'^\s*with\s+', "with not available in Python 2.4"), | |
241 | (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"), |
|
241 | (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"), | |
242 | (r'^\s*except.* as .*:', "except as not available in Python 2.4"), |
|
242 | (r'^\s*except.* as .*:', "except as not available in Python 2.4"), | |
243 | (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"), |
|
243 | (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"), | |
244 | (r'(?<!def)\s+(any|all|format)\(', |
|
244 | (r'(?<!def)\s+(any|all|format)\(', | |
245 | "any/all/format not available in Python 2.4", 'no-py24'), |
|
245 | "any/all/format not available in Python 2.4", 'no-py24'), | |
246 | (r'(?<!def)\s+(callable)\(', |
|
246 | (r'(?<!def)\s+(callable)\(', | |
247 | "callable not available in Python 3, use getattr(f, '__call__', None)"), |
|
247 | "callable not available in Python 3, use getattr(f, '__call__', None)"), | |
248 | (r'if\s.*\selse', "if ... else form not available in Python 2.4"), |
|
248 | (r'if\s.*\selse', "if ... else form not available in Python 2.4"), | |
249 | (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist), |
|
249 | (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist), | |
250 | "gratuitous whitespace after Python keyword"), |
|
250 | "gratuitous whitespace after Python keyword"), | |
251 | (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"), |
|
251 | (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"), | |
252 | # (r'\s\s=', "gratuitous whitespace before ="), |
|
252 | # (r'\s\s=', "gratuitous whitespace before ="), | |
253 | (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S', |
|
253 | (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S', | |
254 | "missing whitespace around operator"), |
|
254 | "missing whitespace around operator"), | |
255 | (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\s', |
|
255 | (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\s', | |
256 | "missing whitespace around operator"), |
|
256 | "missing whitespace around operator"), | |
257 | (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S', |
|
257 | (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S', | |
258 | "missing whitespace around operator"), |
|
258 | "missing whitespace around operator"), | |
259 | (r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]', |
|
259 | (r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]', | |
260 | "wrong whitespace around ="), |
|
260 | "wrong whitespace around ="), | |
261 | (r'\([^()]*( =[^=]|[^<>!=]= )', |
|
261 | (r'\([^()]*( =[^=]|[^<>!=]= )', | |
262 | "no whitespace around = for named parameters"), |
|
262 | "no whitespace around = for named parameters"), | |
263 | (r'raise Exception', "don't raise generic exceptions"), |
|
263 | (r'raise Exception', "don't raise generic exceptions"), | |
264 | (r'raise [^,(]+, (\([^\)]+\)|[^,\(\)]+)$', |
|
264 | (r'raise [^,(]+, (\([^\)]+\)|[^,\(\)]+)$', | |
265 | "don't use old-style two-argument raise, use Exception(message)"), |
|
265 | "don't use old-style two-argument raise, use Exception(message)"), | |
266 | (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"), |
|
266 | (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"), | |
267 | (r' [=!]=\s+(True|False|None)', |
|
267 | (r' [=!]=\s+(True|False|None)', | |
268 | "comparison with singleton, use 'is' or 'is not' instead"), |
|
268 | "comparison with singleton, use 'is' or 'is not' instead"), | |
269 | (r'^\s*(while|if) [01]:', |
|
269 | (r'^\s*(while|if) [01]:', | |
270 | "use True/False for constant Boolean expression"), |
|
270 | "use True/False for constant Boolean expression"), | |
271 | (r'(?:(?<!def)\s+|\()hasattr', |
|
271 | (r'(?:(?<!def)\s+|\()hasattr', | |
272 | 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'), |
|
272 | 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'), | |
273 | (r'opener\([^)]*\).read\(', |
|
273 | (r'opener\([^)]*\).read\(', | |
274 | "use opener.read() instead"), |
|
274 | "use opener.read() instead"), | |
275 | (r'BaseException', 'not in Python 2.4, use Exception'), |
|
275 | (r'BaseException', 'not in Python 2.4, use Exception'), | |
276 | (r'os\.path\.relpath', 'os.path.relpath is not in Python 2.5'), |
|
276 | (r'os\.path\.relpath', 'os.path.relpath is not in Python 2.5'), | |
277 | (r'opener\([^)]*\).write\(', |
|
277 | (r'opener\([^)]*\).write\(', | |
278 | "use opener.write() instead"), |
|
278 | "use opener.write() instead"), | |
279 | (r'[\s\(](open|file)\([^)]*\)\.read\(', |
|
279 | (r'[\s\(](open|file)\([^)]*\)\.read\(', | |
280 | "use util.readfile() instead"), |
|
280 | "use util.readfile() instead"), | |
281 | (r'[\s\(](open|file)\([^)]*\)\.write\(', |
|
281 | (r'[\s\(](open|file)\([^)]*\)\.write\(', | |
282 | "use util.writefile() instead"), |
|
282 | "use util.writefile() instead"), | |
283 | (r'^[\s\(]*(open(er)?|file)\([^)]*\)', |
|
283 | (r'^[\s\(]*(open(er)?|file)\([^)]*\)', | |
284 | "always assign an opened file to a variable, and close it afterwards"), |
|
284 | "always assign an opened file to a variable, and close it afterwards"), | |
285 | (r'[\s\(](open|file)\([^)]*\)\.', |
|
285 | (r'[\s\(](open|file)\([^)]*\)\.', | |
286 | "always assign an opened file to a variable, and close it afterwards"), |
|
286 | "always assign an opened file to a variable, and close it afterwards"), | |
287 | (r'(?i)descendent', "the proper spelling is descendAnt"), |
|
287 | (r'(?i)descendent', "the proper spelling is descendAnt"), | |
288 | (r'\.debug\(\_', "don't mark debug messages for translation"), |
|
288 | (r'\.debug\(\_', "don't mark debug messages for translation"), | |
289 | (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"), |
|
289 | (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"), | |
290 | (r'^\s*except\s*:', "naked except clause", r'#.*re-raises'), |
|
290 | (r'^\s*except\s*:', "naked except clause", r'#.*re-raises'), | |
291 | (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"), |
|
291 | (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"), | |
292 | (r'ui\.(status|progress|write|note|warn)\([\'\"]x', |
|
292 | (r'ui\.(status|progress|write|note|warn)\([\'\"]x', | |
293 | "missing _() in ui message (use () to hide false-positives)"), |
|
293 | "missing _() in ui message (use () to hide false-positives)"), | |
294 | (r'release\(.*wlock, .*lock\)', "wrong lock release order"), |
|
294 | (r'release\(.*wlock, .*lock\)', "wrong lock release order"), | |
295 | ], |
|
295 | ], | |
296 | # warnings |
|
296 | # warnings | |
297 | [ |
|
297 | [ | |
298 | (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"), |
|
298 | (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"), | |
299 | ] |
|
299 | ] | |
300 | ] |
|
300 | ] | |
301 |
|
301 | |||
302 | pyfilters = [ |
|
302 | pyfilters = [ | |
303 | (r"""(?msx)(?P<comment>\#.*?$)| |
|
303 | (r"""(?msx)(?P<comment>\#.*?$)| | |
304 | ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) |
|
304 | ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) | |
305 | (?P<text>(([^\\]|\\.)*?)) |
|
305 | (?P<text>(([^\\]|\\.)*?)) | |
306 | (?P=quote))""", reppython), |
|
306 | (?P=quote))""", reppython), | |
307 | ] |
|
307 | ] | |
308 |
|
308 | |||
309 | txtfilters = [] |
|
309 | txtfilters = [] | |
310 |
|
310 | |||
311 | txtpats = [ |
|
311 | txtpats = [ | |
312 | [ |
|
312 | [ | |
313 | ('\s$', 'trailing whitespace'), |
|
313 | ('\s$', 'trailing whitespace'), | |
|
314 | ('.. note::[ \n][^\n]', 'add two newlines after note::') | |||
314 | ], |
|
315 | ], | |
315 | [] |
|
316 | [] | |
316 | ] |
|
317 | ] | |
317 |
|
318 | |||
318 | cpats = [ |
|
319 | cpats = [ | |
319 | [ |
|
320 | [ | |
320 | (r'//', "don't use //-style comments"), |
|
321 | (r'//', "don't use //-style comments"), | |
321 | (r'^ ', "don't use spaces to indent"), |
|
322 | (r'^ ', "don't use spaces to indent"), | |
322 | (r'\S\t', "don't use tabs except for indent"), |
|
323 | (r'\S\t', "don't use tabs except for indent"), | |
323 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), |
|
324 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), | |
324 | (r'.{81}', "line too long"), |
|
325 | (r'.{81}', "line too long"), | |
325 | (r'(while|if|do|for)\(', "use space after while/if/do/for"), |
|
326 | (r'(while|if|do|for)\(', "use space after while/if/do/for"), | |
326 | (r'return\(', "return is not a function"), |
|
327 | (r'return\(', "return is not a function"), | |
327 | (r' ;', "no space before ;"), |
|
328 | (r' ;', "no space before ;"), | |
328 | (r'[)][{]', "space between ) and {"), |
|
329 | (r'[)][{]', "space between ) and {"), | |
329 | (r'\w+\* \w+', "use int *foo, not int* foo"), |
|
330 | (r'\w+\* \w+', "use int *foo, not int* foo"), | |
330 | (r'\W\([^\)]+\) \w+', "use (int)foo, not (int) foo"), |
|
331 | (r'\W\([^\)]+\) \w+', "use (int)foo, not (int) foo"), | |
331 | (r'\w+ (\+\+|--)', "use foo++, not foo ++"), |
|
332 | (r'\w+ (\+\+|--)', "use foo++, not foo ++"), | |
332 | (r'\w,\w', "missing whitespace after ,"), |
|
333 | (r'\w,\w', "missing whitespace after ,"), | |
333 | (r'^[^#]\w[+/*]\w', "missing whitespace in expression"), |
|
334 | (r'^[^#]\w[+/*]\w', "missing whitespace in expression"), | |
334 | (r'^#\s+\w', "use #foo, not # foo"), |
|
335 | (r'^#\s+\w', "use #foo, not # foo"), | |
335 | (r'[^\n]\Z', "no trailing newline"), |
|
336 | (r'[^\n]\Z', "no trailing newline"), | |
336 | (r'^\s*#import\b', "use only #include in standard C code"), |
|
337 | (r'^\s*#import\b', "use only #include in standard C code"), | |
337 | ], |
|
338 | ], | |
338 | # warnings |
|
339 | # warnings | |
339 | [] |
|
340 | [] | |
340 | ] |
|
341 | ] | |
341 |
|
342 | |||
342 | cfilters = [ |
|
343 | cfilters = [ | |
343 | (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment), |
|
344 | (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment), | |
344 | (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote), |
|
345 | (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote), | |
345 | (r'''(#\s*include\s+<)([^>]+)>''', repinclude), |
|
346 | (r'''(#\s*include\s+<)([^>]+)>''', repinclude), | |
346 | (r'(\()([^)]+\))', repcallspaces), |
|
347 | (r'(\()([^)]+\))', repcallspaces), | |
347 | ] |
|
348 | ] | |
348 |
|
349 | |||
349 | inutilpats = [ |
|
350 | inutilpats = [ | |
350 | [ |
|
351 | [ | |
351 | (r'\bui\.', "don't use ui in util"), |
|
352 | (r'\bui\.', "don't use ui in util"), | |
352 | ], |
|
353 | ], | |
353 | # warnings |
|
354 | # warnings | |
354 | [] |
|
355 | [] | |
355 | ] |
|
356 | ] | |
356 |
|
357 | |||
357 | inrevlogpats = [ |
|
358 | inrevlogpats = [ | |
358 | [ |
|
359 | [ | |
359 | (r'\brepo\.', "don't use repo in revlog"), |
|
360 | (r'\brepo\.', "don't use repo in revlog"), | |
360 | ], |
|
361 | ], | |
361 | # warnings |
|
362 | # warnings | |
362 | [] |
|
363 | [] | |
363 | ] |
|
364 | ] | |
364 |
|
365 | |||
365 | checks = [ |
|
366 | checks = [ | |
366 | ('python', r'.*\.(py|cgi)$', pyfilters, pypats), |
|
367 | ('python', r'.*\.(py|cgi)$', pyfilters, pypats), | |
367 | ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats), |
|
368 | ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats), | |
368 | ('c', r'.*\.[ch]$', cfilters, cpats), |
|
369 | ('c', r'.*\.[ch]$', cfilters, cpats), | |
369 | ('unified test', r'.*\.t$', utestfilters, utestpats), |
|
370 | ('unified test', r'.*\.t$', utestfilters, utestpats), | |
370 | ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters, |
|
371 | ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters, | |
371 | inrevlogpats), |
|
372 | inrevlogpats), | |
372 | ('layering violation ui in util', r'mercurial/util\.py', pyfilters, |
|
373 | ('layering violation ui in util', r'mercurial/util\.py', pyfilters, | |
373 | inutilpats), |
|
374 | inutilpats), | |
374 | ('txt', r'.*\.txt$', txtfilters, txtpats), |
|
375 | ('txt', r'.*\.txt$', txtfilters, txtpats), | |
375 | ] |
|
376 | ] | |
376 |
|
377 | |||
377 | def _preparepats(): |
|
378 | def _preparepats(): | |
378 | for c in checks: |
|
379 | for c in checks: | |
379 | failandwarn = c[-1] |
|
380 | failandwarn = c[-1] | |
380 | for pats in failandwarn: |
|
381 | for pats in failandwarn: | |
381 | for i, pseq in enumerate(pats): |
|
382 | for i, pseq in enumerate(pats): | |
382 | # fix-up regexes for multi-line searches |
|
383 | # fix-up regexes for multi-line searches | |
383 | p = pseq[0] |
|
384 | p = pseq[0] | |
384 | # \s doesn't match \n |
|
385 | # \s doesn't match \n | |
385 | p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p) |
|
386 | p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p) | |
386 | # [^...] doesn't match newline |
|
387 | # [^...] doesn't match newline | |
387 | p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p) |
|
388 | p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p) | |
388 |
|
389 | |||
389 | pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:] |
|
390 | pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:] | |
390 | filters = c[2] |
|
391 | filters = c[2] | |
391 | for i, flt in enumerate(filters): |
|
392 | for i, flt in enumerate(filters): | |
392 | filters[i] = re.compile(flt[0]), flt[1] |
|
393 | filters[i] = re.compile(flt[0]), flt[1] | |
393 | _preparepats() |
|
394 | _preparepats() | |
394 |
|
395 | |||
395 | class norepeatlogger(object): |
|
396 | class norepeatlogger(object): | |
396 | def __init__(self): |
|
397 | def __init__(self): | |
397 | self._lastseen = None |
|
398 | self._lastseen = None | |
398 |
|
399 | |||
399 | def log(self, fname, lineno, line, msg, blame): |
|
400 | def log(self, fname, lineno, line, msg, blame): | |
400 | """print error related a to given line of a given file. |
|
401 | """print error related a to given line of a given file. | |
401 |
|
402 | |||
402 | The faulty line will also be printed but only once in the case |
|
403 | The faulty line will also be printed but only once in the case | |
403 | of multiple errors. |
|
404 | of multiple errors. | |
404 |
|
405 | |||
405 | :fname: filename |
|
406 | :fname: filename | |
406 | :lineno: line number |
|
407 | :lineno: line number | |
407 | :line: actual content of the line |
|
408 | :line: actual content of the line | |
408 | :msg: error message |
|
409 | :msg: error message | |
409 | """ |
|
410 | """ | |
410 | msgid = fname, lineno, line |
|
411 | msgid = fname, lineno, line | |
411 | if msgid != self._lastseen: |
|
412 | if msgid != self._lastseen: | |
412 | if blame: |
|
413 | if blame: | |
413 | print "%s:%d (%s):" % (fname, lineno, blame) |
|
414 | print "%s:%d (%s):" % (fname, lineno, blame) | |
414 | else: |
|
415 | else: | |
415 | print "%s:%d:" % (fname, lineno) |
|
416 | print "%s:%d:" % (fname, lineno) | |
416 | print " > %s" % line |
|
417 | print " > %s" % line | |
417 | self._lastseen = msgid |
|
418 | self._lastseen = msgid | |
418 | print " " + msg |
|
419 | print " " + msg | |
419 |
|
420 | |||
420 | _defaultlogger = norepeatlogger() |
|
421 | _defaultlogger = norepeatlogger() | |
421 |
|
422 | |||
422 | def getblame(f): |
|
423 | def getblame(f): | |
423 | lines = [] |
|
424 | lines = [] | |
424 | for l in os.popen('hg annotate -un %s' % f): |
|
425 | for l in os.popen('hg annotate -un %s' % f): | |
425 | start, line = l.split(':', 1) |
|
426 | start, line = l.split(':', 1) | |
426 | user, rev = start.split() |
|
427 | user, rev = start.split() | |
427 | lines.append((line[1:-1], user, rev)) |
|
428 | lines.append((line[1:-1], user, rev)) | |
428 | return lines |
|
429 | return lines | |
429 |
|
430 | |||
430 | def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False, |
|
431 | def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False, | |
431 | blame=False, debug=False, lineno=True): |
|
432 | blame=False, debug=False, lineno=True): | |
432 | """checks style and portability of a given file |
|
433 | """checks style and portability of a given file | |
433 |
|
434 | |||
434 | :f: filepath |
|
435 | :f: filepath | |
435 | :logfunc: function used to report error |
|
436 | :logfunc: function used to report error | |
436 | logfunc(filename, linenumber, linecontent, errormessage) |
|
437 | logfunc(filename, linenumber, linecontent, errormessage) | |
437 | :maxerr: number of error to display before aborting. |
|
438 | :maxerr: number of error to display before aborting. | |
438 | Set to false (default) to report all errors |
|
439 | Set to false (default) to report all errors | |
439 |
|
440 | |||
440 | return True if no error is found, False otherwise. |
|
441 | return True if no error is found, False otherwise. | |
441 | """ |
|
442 | """ | |
442 | blamecache = None |
|
443 | blamecache = None | |
443 | result = True |
|
444 | result = True | |
444 | for name, match, filters, pats in checks: |
|
445 | for name, match, filters, pats in checks: | |
445 | if debug: |
|
446 | if debug: | |
446 | print name, f |
|
447 | print name, f | |
447 | fc = 0 |
|
448 | fc = 0 | |
448 | if not re.match(match, f): |
|
449 | if not re.match(match, f): | |
449 | if debug: |
|
450 | if debug: | |
450 | print "Skipping %s for %s it doesn't match %s" % ( |
|
451 | print "Skipping %s for %s it doesn't match %s" % ( | |
451 | name, match, f) |
|
452 | name, match, f) | |
452 | continue |
|
453 | continue | |
453 | try: |
|
454 | try: | |
454 | fp = open(f) |
|
455 | fp = open(f) | |
455 | except IOError, e: |
|
456 | except IOError, e: | |
456 | print "Skipping %s, %s" % (f, str(e).split(':', 1)[0]) |
|
457 | print "Skipping %s, %s" % (f, str(e).split(':', 1)[0]) | |
457 | continue |
|
458 | continue | |
458 | pre = post = fp.read() |
|
459 | pre = post = fp.read() | |
459 | fp.close() |
|
460 | fp.close() | |
460 | if "no-" "check-code" in pre: |
|
461 | if "no-" "check-code" in pre: | |
461 | print "Skipping %s it has no-" "check-code" % f |
|
462 | print "Skipping %s it has no-" "check-code" % f | |
462 | return "Skip" # skip checking this file |
|
463 | return "Skip" # skip checking this file | |
463 | for p, r in filters: |
|
464 | for p, r in filters: | |
464 | post = re.sub(p, r, post) |
|
465 | post = re.sub(p, r, post) | |
465 | nerrs = len(pats[0]) # nerr elements are errors |
|
466 | nerrs = len(pats[0]) # nerr elements are errors | |
466 | if warnings: |
|
467 | if warnings: | |
467 | pats = pats[0] + pats[1] |
|
468 | pats = pats[0] + pats[1] | |
468 | else: |
|
469 | else: | |
469 | pats = pats[0] |
|
470 | pats = pats[0] | |
470 | # print post # uncomment to show filtered version |
|
471 | # print post # uncomment to show filtered version | |
471 |
|
472 | |||
472 | if debug: |
|
473 | if debug: | |
473 | print "Checking %s for %s" % (name, f) |
|
474 | print "Checking %s for %s" % (name, f) | |
474 |
|
475 | |||
475 | prelines = None |
|
476 | prelines = None | |
476 | errors = [] |
|
477 | errors = [] | |
477 | for i, pat in enumerate(pats): |
|
478 | for i, pat in enumerate(pats): | |
478 | if len(pat) == 3: |
|
479 | if len(pat) == 3: | |
479 | p, msg, ignore = pat |
|
480 | p, msg, ignore = pat | |
480 | else: |
|
481 | else: | |
481 | p, msg = pat |
|
482 | p, msg = pat | |
482 | ignore = None |
|
483 | ignore = None | |
483 | if i >= nerrs: |
|
484 | if i >= nerrs: | |
484 | msg = "warning: " + msg |
|
485 | msg = "warning: " + msg | |
485 |
|
486 | |||
486 | pos = 0 |
|
487 | pos = 0 | |
487 | n = 0 |
|
488 | n = 0 | |
488 | for m in p.finditer(post): |
|
489 | for m in p.finditer(post): | |
489 | if prelines is None: |
|
490 | if prelines is None: | |
490 | prelines = pre.splitlines() |
|
491 | prelines = pre.splitlines() | |
491 | postlines = post.splitlines(True) |
|
492 | postlines = post.splitlines(True) | |
492 |
|
493 | |||
493 | start = m.start() |
|
494 | start = m.start() | |
494 | while n < len(postlines): |
|
495 | while n < len(postlines): | |
495 | step = len(postlines[n]) |
|
496 | step = len(postlines[n]) | |
496 | if pos + step > start: |
|
497 | if pos + step > start: | |
497 | break |
|
498 | break | |
498 | pos += step |
|
499 | pos += step | |
499 | n += 1 |
|
500 | n += 1 | |
500 | l = prelines[n] |
|
501 | l = prelines[n] | |
501 |
|
502 | |||
502 | if ignore and re.search(ignore, l, re.MULTILINE): |
|
503 | if ignore and re.search(ignore, l, re.MULTILINE): | |
503 | if debug: |
|
504 | if debug: | |
504 | print "Skipping %s for %s:%s (ignore pattern)" % ( |
|
505 | print "Skipping %s for %s:%s (ignore pattern)" % ( | |
505 | name, f, n) |
|
506 | name, f, n) | |
506 | continue |
|
507 | continue | |
507 | bd = "" |
|
508 | bd = "" | |
508 | if blame: |
|
509 | if blame: | |
509 | bd = 'working directory' |
|
510 | bd = 'working directory' | |
510 | if not blamecache: |
|
511 | if not blamecache: | |
511 | blamecache = getblame(f) |
|
512 | blamecache = getblame(f) | |
512 | if n < len(blamecache): |
|
513 | if n < len(blamecache): | |
513 | bl, bu, br = blamecache[n] |
|
514 | bl, bu, br = blamecache[n] | |
514 | if bl == l: |
|
515 | if bl == l: | |
515 | bd = '%s@%s' % (bu, br) |
|
516 | bd = '%s@%s' % (bu, br) | |
516 |
|
517 | |||
517 | errors.append((f, lineno and n + 1, l, msg, bd)) |
|
518 | errors.append((f, lineno and n + 1, l, msg, bd)) | |
518 | result = False |
|
519 | result = False | |
519 |
|
520 | |||
520 | errors.sort() |
|
521 | errors.sort() | |
521 | for e in errors: |
|
522 | for e in errors: | |
522 | logfunc(*e) |
|
523 | logfunc(*e) | |
523 | fc += 1 |
|
524 | fc += 1 | |
524 | if maxerr and fc >= maxerr: |
|
525 | if maxerr and fc >= maxerr: | |
525 | print " (too many errors, giving up)" |
|
526 | print " (too many errors, giving up)" | |
526 | break |
|
527 | break | |
527 |
|
528 | |||
528 | return result |
|
529 | return result | |
529 |
|
530 | |||
530 | if __name__ == "__main__": |
|
531 | if __name__ == "__main__": | |
531 | parser = optparse.OptionParser("%prog [options] [files]") |
|
532 | parser = optparse.OptionParser("%prog [options] [files]") | |
532 | parser.add_option("-w", "--warnings", action="store_true", |
|
533 | parser.add_option("-w", "--warnings", action="store_true", | |
533 | help="include warning-level checks") |
|
534 | help="include warning-level checks") | |
534 | parser.add_option("-p", "--per-file", type="int", |
|
535 | parser.add_option("-p", "--per-file", type="int", | |
535 | help="max warnings per file") |
|
536 | help="max warnings per file") | |
536 | parser.add_option("-b", "--blame", action="store_true", |
|
537 | parser.add_option("-b", "--blame", action="store_true", | |
537 | help="use annotate to generate blame info") |
|
538 | help="use annotate to generate blame info") | |
538 | parser.add_option("", "--debug", action="store_true", |
|
539 | parser.add_option("", "--debug", action="store_true", | |
539 | help="show debug information") |
|
540 | help="show debug information") | |
540 | parser.add_option("", "--nolineno", action="store_false", |
|
541 | parser.add_option("", "--nolineno", action="store_false", | |
541 | dest='lineno', help="don't show line numbers") |
|
542 | dest='lineno', help="don't show line numbers") | |
542 |
|
543 | |||
543 | parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False, |
|
544 | parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False, | |
544 | lineno=True) |
|
545 | lineno=True) | |
545 | (options, args) = parser.parse_args() |
|
546 | (options, args) = parser.parse_args() | |
546 |
|
547 | |||
547 | if len(args) == 0: |
|
548 | if len(args) == 0: | |
548 | check = glob.glob("*") |
|
549 | check = glob.glob("*") | |
549 | else: |
|
550 | else: | |
550 | check = args |
|
551 | check = args | |
551 |
|
552 | |||
552 | ret = 0 |
|
553 | ret = 0 | |
553 | for f in check: |
|
554 | for f in check: | |
554 | if not checkfile(f, maxerr=options.per_file, warnings=options.warnings, |
|
555 | if not checkfile(f, maxerr=options.per_file, warnings=options.warnings, | |
555 | blame=options.blame, debug=options.debug, |
|
556 | blame=options.blame, debug=options.debug, | |
556 | lineno=options.lineno): |
|
557 | lineno=options.lineno): | |
557 | ret = 1 |
|
558 | ret = 1 | |
558 | sys.exit(ret) |
|
559 | sys.exit(ret) |
@@ -1,1535 +1,1547 b'' | |||||
1 | The Mercurial system uses a set of configuration files to control |
|
1 | The Mercurial system uses a set of configuration files to control | |
2 | aspects of its behavior. |
|
2 | aspects of its behavior. | |
3 |
|
3 | |||
4 | The configuration files use a simple ini-file format. A configuration |
|
4 | The configuration files use a simple ini-file format. A configuration | |
5 | file consists of sections, led by a ``[section]`` header and followed |
|
5 | file consists of sections, led by a ``[section]`` header and followed | |
6 | by ``name = value`` entries:: |
|
6 | by ``name = value`` entries:: | |
7 |
|
7 | |||
8 | [ui] |
|
8 | [ui] | |
9 | username = Firstname Lastname <firstname.lastname@example.net> |
|
9 | username = Firstname Lastname <firstname.lastname@example.net> | |
10 | verbose = True |
|
10 | verbose = True | |
11 |
|
11 | |||
12 | The above entries will be referred to as ``ui.username`` and |
|
12 | The above entries will be referred to as ``ui.username`` and | |
13 | ``ui.verbose``, respectively. See the Syntax section below. |
|
13 | ``ui.verbose``, respectively. See the Syntax section below. | |
14 |
|
14 | |||
15 | Files |
|
15 | Files | |
16 | ===== |
|
16 | ===== | |
17 |
|
17 | |||
18 | Mercurial reads configuration data from several files, if they exist. |
|
18 | Mercurial reads configuration data from several files, if they exist. | |
19 | These files do not exist by default and you will have to create the |
|
19 | These files do not exist by default and you will have to create the | |
20 | appropriate configuration files yourself: global configuration like |
|
20 | appropriate configuration files yourself: global configuration like | |
21 | the username setting is typically put into |
|
21 | the username setting is typically put into | |
22 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local |
|
22 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local | |
23 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
23 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. | |
24 |
|
24 | |||
25 | The names of these files depend on the system on which Mercurial is |
|
25 | The names of these files depend on the system on which Mercurial is | |
26 | installed. ``*.rc`` files from a single directory are read in |
|
26 | installed. ``*.rc`` files from a single directory are read in | |
27 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
27 | alphabetical order, later ones overriding earlier ones. Where multiple | |
28 | paths are given below, settings from earlier paths override later |
|
28 | paths are given below, settings from earlier paths override later | |
29 | ones. |
|
29 | ones. | |
30 |
|
30 | |||
31 | | (All) ``<repo>/.hg/hgrc`` |
|
31 | | (All) ``<repo>/.hg/hgrc`` | |
32 |
|
32 | |||
33 | Per-repository configuration options that only apply in a |
|
33 | Per-repository configuration options that only apply in a | |
34 | particular repository. This file is not version-controlled, and |
|
34 | particular repository. This file is not version-controlled, and | |
35 | will not get transferred during a "clone" operation. Options in |
|
35 | will not get transferred during a "clone" operation. Options in | |
36 | this file override options in all other configuration files. On |
|
36 | this file override options in all other configuration files. On | |
37 | Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
37 | Plan 9 and Unix, most of this file will be ignored if it doesn't | |
38 | belong to a trusted user or to a trusted group. See the documentation |
|
38 | belong to a trusted user or to a trusted group. See the documentation | |
39 | for the ``[trusted]`` section below for more details. |
|
39 | for the ``[trusted]`` section below for more details. | |
40 |
|
40 | |||
41 | | (Plan 9) ``$home/lib/hgrc`` |
|
41 | | (Plan 9) ``$home/lib/hgrc`` | |
42 | | (Unix) ``$HOME/.hgrc`` |
|
42 | | (Unix) ``$HOME/.hgrc`` | |
43 | | (Windows) ``%USERPROFILE%\.hgrc`` |
|
43 | | (Windows) ``%USERPROFILE%\.hgrc`` | |
44 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` |
|
44 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` | |
45 | | (Windows) ``%HOME%\.hgrc`` |
|
45 | | (Windows) ``%HOME%\.hgrc`` | |
46 | | (Windows) ``%HOME%\Mercurial.ini`` |
|
46 | | (Windows) ``%HOME%\Mercurial.ini`` | |
47 |
|
47 | |||
48 | Per-user configuration file(s), for the user running Mercurial. On |
|
48 | Per-user configuration file(s), for the user running Mercurial. On | |
49 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these |
|
49 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these | |
50 | files apply to all Mercurial commands executed by this user in any |
|
50 | files apply to all Mercurial commands executed by this user in any | |
51 | directory. Options in these files override per-system and per-installation |
|
51 | directory. Options in these files override per-system and per-installation | |
52 | options. |
|
52 | options. | |
53 |
|
53 | |||
54 | | (Plan 9) ``/lib/mercurial/hgrc`` |
|
54 | | (Plan 9) ``/lib/mercurial/hgrc`` | |
55 | | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc`` |
|
55 | | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc`` | |
56 | | (Unix) ``/etc/mercurial/hgrc`` |
|
56 | | (Unix) ``/etc/mercurial/hgrc`` | |
57 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` |
|
57 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` | |
58 |
|
58 | |||
59 | Per-system configuration files, for the system on which Mercurial |
|
59 | Per-system configuration files, for the system on which Mercurial | |
60 | is running. Options in these files apply to all Mercurial commands |
|
60 | is running. Options in these files apply to all Mercurial commands | |
61 | executed by any user in any directory. Options in these files |
|
61 | executed by any user in any directory. Options in these files | |
62 | override per-installation options. |
|
62 | override per-installation options. | |
63 |
|
63 | |||
64 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc`` |
|
64 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc`` | |
65 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc`` |
|
65 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc`` | |
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` |
|
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` | |
67 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` |
|
67 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` | |
68 |
|
68 | |||
69 | Per-installation configuration files, searched for in the |
|
69 | Per-installation configuration files, searched for in the | |
70 | directory where Mercurial is installed. ``<install-root>`` is the |
|
70 | directory where Mercurial is installed. ``<install-root>`` is the | |
71 | parent directory of the **hg** executable (or symlink) being run. For |
|
71 | parent directory of the **hg** executable (or symlink) being run. For | |
72 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look |
|
72 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look | |
73 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply |
|
73 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply | |
74 | to all Mercurial commands executed by any user in any directory. |
|
74 | to all Mercurial commands executed by any user in any directory. | |
75 |
|
75 | |||
76 | | (Windows) ``<install-dir>\Mercurial.ini`` **or** |
|
76 | | (Windows) ``<install-dir>\Mercurial.ini`` **or** | |
77 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or** |
|
77 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or** | |
78 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` |
|
78 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` | |
79 |
|
79 | |||
80 | Per-installation/system configuration files, for the system on |
|
80 | Per-installation/system configuration files, for the system on | |
81 | which Mercurial is running. Options in these files apply to all |
|
81 | which Mercurial is running. Options in these files apply to all | |
82 | Mercurial commands executed by any user in any directory. Registry |
|
82 | Mercurial commands executed by any user in any directory. Registry | |
83 | keys contain PATH-like strings, every part of which must reference |
|
83 | keys contain PATH-like strings, every part of which must reference | |
84 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
84 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
85 | be read. Mercurial checks each of these locations in the specified |
|
85 | be read. Mercurial checks each of these locations in the specified | |
86 | order until one or more configuration files are detected. |
|
86 | order until one or more configuration files are detected. | |
87 |
|
87 | |||
88 | .. note:: The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
88 | .. note:: | |
|
89 | ||||
|
90 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` | |||
89 | is used when running 32-bit Python on 64-bit Windows. |
|
91 | is used when running 32-bit Python on 64-bit Windows. | |
90 |
|
92 | |||
91 | Syntax |
|
93 | Syntax | |
92 | ====== |
|
94 | ====== | |
93 |
|
95 | |||
94 | A configuration file consists of sections, led by a ``[section]`` header |
|
96 | A configuration file consists of sections, led by a ``[section]`` header | |
95 | and followed by ``name = value`` entries (sometimes called |
|
97 | and followed by ``name = value`` entries (sometimes called | |
96 | ``configuration keys``):: |
|
98 | ``configuration keys``):: | |
97 |
|
99 | |||
98 | [spam] |
|
100 | [spam] | |
99 | eggs=ham |
|
101 | eggs=ham | |
100 | green= |
|
102 | green= | |
101 | eggs |
|
103 | eggs | |
102 |
|
104 | |||
103 | Each line contains one entry. If the lines that follow are indented, |
|
105 | Each line contains one entry. If the lines that follow are indented, | |
104 | they are treated as continuations of that entry. Leading whitespace is |
|
106 | they are treated as continuations of that entry. Leading whitespace is | |
105 | removed from values. Empty lines are skipped. Lines beginning with |
|
107 | removed from values. Empty lines are skipped. Lines beginning with | |
106 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
108 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
107 |
|
109 | |||
108 | Configuration keys can be set multiple times, in which case Mercurial |
|
110 | Configuration keys can be set multiple times, in which case Mercurial | |
109 | will use the value that was configured last. As an example:: |
|
111 | will use the value that was configured last. As an example:: | |
110 |
|
112 | |||
111 | [spam] |
|
113 | [spam] | |
112 | eggs=large |
|
114 | eggs=large | |
113 | ham=serrano |
|
115 | ham=serrano | |
114 | eggs=small |
|
116 | eggs=small | |
115 |
|
117 | |||
116 | This would set the configuration key named ``eggs`` to ``small``. |
|
118 | This would set the configuration key named ``eggs`` to ``small``. | |
117 |
|
119 | |||
118 | It is also possible to define a section multiple times. A section can |
|
120 | It is also possible to define a section multiple times. A section can | |
119 | be redefined on the same and/or on different configuration files. For |
|
121 | be redefined on the same and/or on different configuration files. For | |
120 | example:: |
|
122 | example:: | |
121 |
|
123 | |||
122 | [foo] |
|
124 | [foo] | |
123 | eggs=large |
|
125 | eggs=large | |
124 | ham=serrano |
|
126 | ham=serrano | |
125 | eggs=small |
|
127 | eggs=small | |
126 |
|
128 | |||
127 | [bar] |
|
129 | [bar] | |
128 | eggs=ham |
|
130 | eggs=ham | |
129 | green= |
|
131 | green= | |
130 | eggs |
|
132 | eggs | |
131 |
|
133 | |||
132 | [foo] |
|
134 | [foo] | |
133 | ham=prosciutto |
|
135 | ham=prosciutto | |
134 | eggs=medium |
|
136 | eggs=medium | |
135 | bread=toasted |
|
137 | bread=toasted | |
136 |
|
138 | |||
137 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
139 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys | |
138 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
140 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, | |
139 | respectively. As you can see there only thing that matters is the last |
|
141 | respectively. As you can see there only thing that matters is the last | |
140 | value that was set for each of the configuration keys. |
|
142 | value that was set for each of the configuration keys. | |
141 |
|
143 | |||
142 | If a configuration key is set multiple times in different |
|
144 | If a configuration key is set multiple times in different | |
143 | configuration files the final value will depend on the order in which |
|
145 | configuration files the final value will depend on the order in which | |
144 | the different configuration files are read, with settings from earlier |
|
146 | the different configuration files are read, with settings from earlier | |
145 | paths overriding later ones as described on the ``Files`` section |
|
147 | paths overriding later ones as described on the ``Files`` section | |
146 | above. |
|
148 | above. | |
147 |
|
149 | |||
148 | A line of the form ``%include file`` will include ``file`` into the |
|
150 | A line of the form ``%include file`` will include ``file`` into the | |
149 | current configuration file. The inclusion is recursive, which means |
|
151 | current configuration file. The inclusion is recursive, which means | |
150 | that included files can include other files. Filenames are relative to |
|
152 | that included files can include other files. Filenames are relative to | |
151 | the configuration file in which the ``%include`` directive is found. |
|
153 | the configuration file in which the ``%include`` directive is found. | |
152 | Environment variables and ``~user`` constructs are expanded in |
|
154 | Environment variables and ``~user`` constructs are expanded in | |
153 | ``file``. This lets you do something like:: |
|
155 | ``file``. This lets you do something like:: | |
154 |
|
156 | |||
155 | %include ~/.hgrc.d/$HOST.rc |
|
157 | %include ~/.hgrc.d/$HOST.rc | |
156 |
|
158 | |||
157 | to include a different configuration file on each computer you use. |
|
159 | to include a different configuration file on each computer you use. | |
158 |
|
160 | |||
159 | A line with ``%unset name`` will remove ``name`` from the current |
|
161 | A line with ``%unset name`` will remove ``name`` from the current | |
160 | section, if it has been set previously. |
|
162 | section, if it has been set previously. | |
161 |
|
163 | |||
162 | The values are either free-form text strings, lists of text strings, |
|
164 | The values are either free-form text strings, lists of text strings, | |
163 | or Boolean values. Boolean values can be set to true using any of "1", |
|
165 | or Boolean values. Boolean values can be set to true using any of "1", | |
164 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
166 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" | |
165 | (all case insensitive). |
|
167 | (all case insensitive). | |
166 |
|
168 | |||
167 | List values are separated by whitespace or comma, except when values are |
|
169 | List values are separated by whitespace or comma, except when values are | |
168 | placed in double quotation marks:: |
|
170 | placed in double quotation marks:: | |
169 |
|
171 | |||
170 | allow_read = "John Doe, PhD", brian, betty |
|
172 | allow_read = "John Doe, PhD", brian, betty | |
171 |
|
173 | |||
172 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
174 | Quotation marks can be escaped by prefixing them with a backslash. Only | |
173 | quotation marks at the beginning of a word is counted as a quotation |
|
175 | quotation marks at the beginning of a word is counted as a quotation | |
174 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
176 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). | |
175 |
|
177 | |||
176 | Sections |
|
178 | Sections | |
177 | ======== |
|
179 | ======== | |
178 |
|
180 | |||
179 | This section describes the different sections that may appear in a |
|
181 | This section describes the different sections that may appear in a | |
180 | Mercurial configuration file, the purpose of each section, its possible |
|
182 | Mercurial configuration file, the purpose of each section, its possible | |
181 | keys, and their possible values. |
|
183 | keys, and their possible values. | |
182 |
|
184 | |||
183 | ``alias`` |
|
185 | ``alias`` | |
184 | --------- |
|
186 | --------- | |
185 |
|
187 | |||
186 | Defines command aliases. |
|
188 | Defines command aliases. | |
187 | Aliases allow you to define your own commands in terms of other |
|
189 | Aliases allow you to define your own commands in terms of other | |
188 | commands (or aliases), optionally including arguments. Positional |
|
190 | commands (or aliases), optionally including arguments. Positional | |
189 | arguments in the form of ``$1``, ``$2``, etc in the alias definition |
|
191 | arguments in the form of ``$1``, ``$2``, etc in the alias definition | |
190 | are expanded by Mercurial before execution. Positional arguments not |
|
192 | are expanded by Mercurial before execution. Positional arguments not | |
191 | already used by ``$N`` in the definition are put at the end of the |
|
193 | already used by ``$N`` in the definition are put at the end of the | |
192 | command to be executed. |
|
194 | command to be executed. | |
193 |
|
195 | |||
194 | Alias definitions consist of lines of the form:: |
|
196 | Alias definitions consist of lines of the form:: | |
195 |
|
197 | |||
196 | <alias> = <command> [<argument>]... |
|
198 | <alias> = <command> [<argument>]... | |
197 |
|
199 | |||
198 | For example, this definition:: |
|
200 | For example, this definition:: | |
199 |
|
201 | |||
200 | latest = log --limit 5 |
|
202 | latest = log --limit 5 | |
201 |
|
203 | |||
202 | creates a new command ``latest`` that shows only the five most recent |
|
204 | creates a new command ``latest`` that shows only the five most recent | |
203 | changesets. You can define subsequent aliases using earlier ones:: |
|
205 | changesets. You can define subsequent aliases using earlier ones:: | |
204 |
|
206 | |||
205 | stable5 = latest -b stable |
|
207 | stable5 = latest -b stable | |
206 |
|
208 | |||
207 | .. note:: It is possible to create aliases with the same names as |
|
209 | .. note:: | |
|
210 | ||||
|
211 | It is possible to create aliases with the same names as | |||
208 | existing commands, which will then override the original |
|
212 | existing commands, which will then override the original | |
209 | definitions. This is almost always a bad idea! |
|
213 | definitions. This is almost always a bad idea! | |
210 |
|
214 | |||
211 | An alias can start with an exclamation point (``!``) to make it a |
|
215 | An alias can start with an exclamation point (``!``) to make it a | |
212 | shell alias. A shell alias is executed with the shell and will let you |
|
216 | shell alias. A shell alias is executed with the shell and will let you | |
213 | run arbitrary commands. As an example, :: |
|
217 | run arbitrary commands. As an example, :: | |
214 |
|
218 | |||
215 | echo = !echo $@ |
|
219 | echo = !echo $@ | |
216 |
|
220 | |||
217 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
221 | will let you do ``hg echo foo`` to have ``foo`` printed in your | |
218 | terminal. A better example might be:: |
|
222 | terminal. A better example might be:: | |
219 |
|
223 | |||
220 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm |
|
224 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm | |
221 |
|
225 | |||
222 | which will make ``hg purge`` delete all unknown files in the |
|
226 | which will make ``hg purge`` delete all unknown files in the | |
223 | repository in the same manner as the purge extension. |
|
227 | repository in the same manner as the purge extension. | |
224 |
|
228 | |||
225 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
229 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition | |
226 | expand to the command arguments. Unmatched arguments are |
|
230 | expand to the command arguments. Unmatched arguments are | |
227 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
231 | removed. ``$0`` expands to the alias name and ``$@`` expands to all | |
228 | arguments separated by a space. These expansions happen before the |
|
232 | arguments separated by a space. These expansions happen before the | |
229 | command is passed to the shell. |
|
233 | command is passed to the shell. | |
230 |
|
234 | |||
231 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
235 | Shell aliases are executed in an environment where ``$HG`` expands to | |
232 | the path of the Mercurial that was used to execute the alias. This is |
|
236 | the path of the Mercurial that was used to execute the alias. This is | |
233 | useful when you want to call further Mercurial commands in a shell |
|
237 | useful when you want to call further Mercurial commands in a shell | |
234 | alias, as was done above for the purge alias. In addition, |
|
238 | alias, as was done above for the purge alias. In addition, | |
235 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
239 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg | |
236 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
240 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. | |
237 |
|
241 | |||
238 | .. note:: Some global configuration options such as ``-R`` are |
|
242 | .. note:: | |
|
243 | ||||
|
244 | Some global configuration options such as ``-R`` are | |||
239 | processed before shell aliases and will thus not be passed to |
|
245 | processed before shell aliases and will thus not be passed to | |
240 | aliases. |
|
246 | aliases. | |
241 |
|
247 | |||
242 |
|
248 | |||
243 | ``annotate`` |
|
249 | ``annotate`` | |
244 | ------------ |
|
250 | ------------ | |
245 |
|
251 | |||
246 | Settings used when displaying file annotations. All values are |
|
252 | Settings used when displaying file annotations. All values are | |
247 | Booleans and default to False. See ``diff`` section for related |
|
253 | Booleans and default to False. See ``diff`` section for related | |
248 | options for the diff command. |
|
254 | options for the diff command. | |
249 |
|
255 | |||
250 | ``ignorews`` |
|
256 | ``ignorews`` | |
251 | Ignore white space when comparing lines. |
|
257 | Ignore white space when comparing lines. | |
252 |
|
258 | |||
253 | ``ignorewsamount`` |
|
259 | ``ignorewsamount`` | |
254 | Ignore changes in the amount of white space. |
|
260 | Ignore changes in the amount of white space. | |
255 |
|
261 | |||
256 | ``ignoreblanklines`` |
|
262 | ``ignoreblanklines`` | |
257 | Ignore changes whose lines are all blank. |
|
263 | Ignore changes whose lines are all blank. | |
258 |
|
264 | |||
259 |
|
265 | |||
260 | ``auth`` |
|
266 | ``auth`` | |
261 | -------- |
|
267 | -------- | |
262 |
|
268 | |||
263 | Authentication credentials for HTTP authentication. This section |
|
269 | Authentication credentials for HTTP authentication. This section | |
264 | allows you to store usernames and passwords for use when logging |
|
270 | allows you to store usernames and passwords for use when logging | |
265 | *into* HTTP servers. See the ``[web]`` configuration section if |
|
271 | *into* HTTP servers. See the ``[web]`` configuration section if | |
266 | you want to configure *who* can login to your HTTP server. |
|
272 | you want to configure *who* can login to your HTTP server. | |
267 |
|
273 | |||
268 | Each line has the following format:: |
|
274 | Each line has the following format:: | |
269 |
|
275 | |||
270 | <name>.<argument> = <value> |
|
276 | <name>.<argument> = <value> | |
271 |
|
277 | |||
272 | where ``<name>`` is used to group arguments into authentication |
|
278 | where ``<name>`` is used to group arguments into authentication | |
273 | entries. Example:: |
|
279 | entries. Example:: | |
274 |
|
280 | |||
275 | foo.prefix = hg.intevation.org/mercurial |
|
281 | foo.prefix = hg.intevation.org/mercurial | |
276 | foo.username = foo |
|
282 | foo.username = foo | |
277 | foo.password = bar |
|
283 | foo.password = bar | |
278 | foo.schemes = http https |
|
284 | foo.schemes = http https | |
279 |
|
285 | |||
280 | bar.prefix = secure.example.org |
|
286 | bar.prefix = secure.example.org | |
281 | bar.key = path/to/file.key |
|
287 | bar.key = path/to/file.key | |
282 | bar.cert = path/to/file.cert |
|
288 | bar.cert = path/to/file.cert | |
283 | bar.schemes = https |
|
289 | bar.schemes = https | |
284 |
|
290 | |||
285 | Supported arguments: |
|
291 | Supported arguments: | |
286 |
|
292 | |||
287 | ``prefix`` |
|
293 | ``prefix`` | |
288 | Either ``*`` or a URI prefix with or without the scheme part. |
|
294 | Either ``*`` or a URI prefix with or without the scheme part. | |
289 | The authentication entry with the longest matching prefix is used |
|
295 | The authentication entry with the longest matching prefix is used | |
290 | (where ``*`` matches everything and counts as a match of length |
|
296 | (where ``*`` matches everything and counts as a match of length | |
291 | 1). If the prefix doesn't include a scheme, the match is performed |
|
297 | 1). If the prefix doesn't include a scheme, the match is performed | |
292 | against the URI with its scheme stripped as well, and the schemes |
|
298 | against the URI with its scheme stripped as well, and the schemes | |
293 | argument, q.v., is then subsequently consulted. |
|
299 | argument, q.v., is then subsequently consulted. | |
294 |
|
300 | |||
295 | ``username`` |
|
301 | ``username`` | |
296 | Optional. Username to authenticate with. If not given, and the |
|
302 | Optional. Username to authenticate with. If not given, and the | |
297 | remote site requires basic or digest authentication, the user will |
|
303 | remote site requires basic or digest authentication, the user will | |
298 | be prompted for it. Environment variables are expanded in the |
|
304 | be prompted for it. Environment variables are expanded in the | |
299 | username letting you do ``foo.username = $USER``. If the URI |
|
305 | username letting you do ``foo.username = $USER``. If the URI | |
300 | includes a username, only ``[auth]`` entries with a matching |
|
306 | includes a username, only ``[auth]`` entries with a matching | |
301 | username or without a username will be considered. |
|
307 | username or without a username will be considered. | |
302 |
|
308 | |||
303 | ``password`` |
|
309 | ``password`` | |
304 | Optional. Password to authenticate with. If not given, and the |
|
310 | Optional. Password to authenticate with. If not given, and the | |
305 | remote site requires basic or digest authentication, the user |
|
311 | remote site requires basic or digest authentication, the user | |
306 | will be prompted for it. |
|
312 | will be prompted for it. | |
307 |
|
313 | |||
308 | ``key`` |
|
314 | ``key`` | |
309 | Optional. PEM encoded client certificate key file. Environment |
|
315 | Optional. PEM encoded client certificate key file. Environment | |
310 | variables are expanded in the filename. |
|
316 | variables are expanded in the filename. | |
311 |
|
317 | |||
312 | ``cert`` |
|
318 | ``cert`` | |
313 | Optional. PEM encoded client certificate chain file. Environment |
|
319 | Optional. PEM encoded client certificate chain file. Environment | |
314 | variables are expanded in the filename. |
|
320 | variables are expanded in the filename. | |
315 |
|
321 | |||
316 | ``schemes`` |
|
322 | ``schemes`` | |
317 | Optional. Space separated list of URI schemes to use this |
|
323 | Optional. Space separated list of URI schemes to use this | |
318 | authentication entry with. Only used if the prefix doesn't include |
|
324 | authentication entry with. Only used if the prefix doesn't include | |
319 | a scheme. Supported schemes are http and https. They will match |
|
325 | a scheme. Supported schemes are http and https. They will match | |
320 | static-http and static-https respectively, as well. |
|
326 | static-http and static-https respectively, as well. | |
321 | Default: https. |
|
327 | Default: https. | |
322 |
|
328 | |||
323 | If no suitable authentication entry is found, the user is prompted |
|
329 | If no suitable authentication entry is found, the user is prompted | |
324 | for credentials as usual if required by the remote. |
|
330 | for credentials as usual if required by the remote. | |
325 |
|
331 | |||
326 |
|
332 | |||
327 | ``decode/encode`` |
|
333 | ``decode/encode`` | |
328 | ----------------- |
|
334 | ----------------- | |
329 |
|
335 | |||
330 | Filters for transforming files on checkout/checkin. This would |
|
336 | Filters for transforming files on checkout/checkin. This would | |
331 | typically be used for newline processing or other |
|
337 | typically be used for newline processing or other | |
332 | localization/canonicalization of files. |
|
338 | localization/canonicalization of files. | |
333 |
|
339 | |||
334 | Filters consist of a filter pattern followed by a filter command. |
|
340 | Filters consist of a filter pattern followed by a filter command. | |
335 | Filter patterns are globs by default, rooted at the repository root. |
|
341 | Filter patterns are globs by default, rooted at the repository root. | |
336 | For example, to match any file ending in ``.txt`` in the root |
|
342 | For example, to match any file ending in ``.txt`` in the root | |
337 | directory only, use the pattern ``*.txt``. To match any file ending |
|
343 | directory only, use the pattern ``*.txt``. To match any file ending | |
338 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
344 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
339 | For each file only the first matching filter applies. |
|
345 | For each file only the first matching filter applies. | |
340 |
|
346 | |||
341 | The filter command can start with a specifier, either ``pipe:`` or |
|
347 | The filter command can start with a specifier, either ``pipe:`` or | |
342 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
348 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
343 |
|
349 | |||
344 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
350 | A ``pipe:`` command must accept data on stdin and return the transformed | |
345 | data on stdout. |
|
351 | data on stdout. | |
346 |
|
352 | |||
347 | Pipe example:: |
|
353 | Pipe example:: | |
348 |
|
354 | |||
349 | [encode] |
|
355 | [encode] | |
350 | # uncompress gzip files on checkin to improve delta compression |
|
356 | # uncompress gzip files on checkin to improve delta compression | |
351 | # note: not necessarily a good idea, just an example |
|
357 | # note: not necessarily a good idea, just an example | |
352 | *.gz = pipe: gunzip |
|
358 | *.gz = pipe: gunzip | |
353 |
|
359 | |||
354 | [decode] |
|
360 | [decode] | |
355 | # recompress gzip files when writing them to the working dir (we |
|
361 | # recompress gzip files when writing them to the working dir (we | |
356 | # can safely omit "pipe:", because it's the default) |
|
362 | # can safely omit "pipe:", because it's the default) | |
357 | *.gz = gzip |
|
363 | *.gz = gzip | |
358 |
|
364 | |||
359 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
365 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
360 | with the name of a temporary file that contains the data to be |
|
366 | with the name of a temporary file that contains the data to be | |
361 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
367 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
362 | of an empty temporary file, where the filtered data must be written by |
|
368 | of an empty temporary file, where the filtered data must be written by | |
363 | the command. |
|
369 | the command. | |
364 |
|
370 | |||
365 | .. note:: The tempfile mechanism is recommended for Windows systems, |
|
371 | .. note:: | |
|
372 | ||||
|
373 | The tempfile mechanism is recommended for Windows systems, | |||
366 | where the standard shell I/O redirection operators often have |
|
374 | where the standard shell I/O redirection operators often have | |
367 | strange effects and may corrupt the contents of your files. |
|
375 | strange effects and may corrupt the contents of your files. | |
368 |
|
376 | |||
369 | This filter mechanism is used internally by the ``eol`` extension to |
|
377 | This filter mechanism is used internally by the ``eol`` extension to | |
370 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
378 | translate line ending characters between Windows (CRLF) and Unix (LF) | |
371 | format. We suggest you use the ``eol`` extension for convenience. |
|
379 | format. We suggest you use the ``eol`` extension for convenience. | |
372 |
|
380 | |||
373 |
|
381 | |||
374 | ``defaults`` |
|
382 | ``defaults`` | |
375 | ------------ |
|
383 | ------------ | |
376 |
|
384 | |||
377 | (defaults are deprecated. Don't use them. Use aliases instead) |
|
385 | (defaults are deprecated. Don't use them. Use aliases instead) | |
378 |
|
386 | |||
379 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
387 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
380 | default options/arguments to pass to the specified commands. |
|
388 | default options/arguments to pass to the specified commands. | |
381 |
|
389 | |||
382 | The following example makes :hg:`log` run in verbose mode, and |
|
390 | The following example makes :hg:`log` run in verbose mode, and | |
383 | :hg:`status` show only the modified files, by default:: |
|
391 | :hg:`status` show only the modified files, by default:: | |
384 |
|
392 | |||
385 | [defaults] |
|
393 | [defaults] | |
386 | log = -v |
|
394 | log = -v | |
387 | status = -m |
|
395 | status = -m | |
388 |
|
396 | |||
389 | The actual commands, instead of their aliases, must be used when |
|
397 | The actual commands, instead of their aliases, must be used when | |
390 | defining command defaults. The command defaults will also be applied |
|
398 | defining command defaults. The command defaults will also be applied | |
391 | to the aliases of the commands defined. |
|
399 | to the aliases of the commands defined. | |
392 |
|
400 | |||
393 |
|
401 | |||
394 | ``diff`` |
|
402 | ``diff`` | |
395 | -------- |
|
403 | -------- | |
396 |
|
404 | |||
397 | Settings used when displaying diffs. Everything except for ``unified`` |
|
405 | Settings used when displaying diffs. Everything except for ``unified`` | |
398 | is a Boolean and defaults to False. See ``annotate`` section for |
|
406 | is a Boolean and defaults to False. See ``annotate`` section for | |
399 | related options for the annotate command. |
|
407 | related options for the annotate command. | |
400 |
|
408 | |||
401 | ``git`` |
|
409 | ``git`` | |
402 | Use git extended diff format. |
|
410 | Use git extended diff format. | |
403 |
|
411 | |||
404 | ``nodates`` |
|
412 | ``nodates`` | |
405 | Don't include dates in diff headers. |
|
413 | Don't include dates in diff headers. | |
406 |
|
414 | |||
407 | ``showfunc`` |
|
415 | ``showfunc`` | |
408 | Show which function each change is in. |
|
416 | Show which function each change is in. | |
409 |
|
417 | |||
410 | ``ignorews`` |
|
418 | ``ignorews`` | |
411 | Ignore white space when comparing lines. |
|
419 | Ignore white space when comparing lines. | |
412 |
|
420 | |||
413 | ``ignorewsamount`` |
|
421 | ``ignorewsamount`` | |
414 | Ignore changes in the amount of white space. |
|
422 | Ignore changes in the amount of white space. | |
415 |
|
423 | |||
416 | ``ignoreblanklines`` |
|
424 | ``ignoreblanklines`` | |
417 | Ignore changes whose lines are all blank. |
|
425 | Ignore changes whose lines are all blank. | |
418 |
|
426 | |||
419 | ``unified`` |
|
427 | ``unified`` | |
420 | Number of lines of context to show. |
|
428 | Number of lines of context to show. | |
421 |
|
429 | |||
422 | ``email`` |
|
430 | ``email`` | |
423 | --------- |
|
431 | --------- | |
424 |
|
432 | |||
425 | Settings for extensions that send email messages. |
|
433 | Settings for extensions that send email messages. | |
426 |
|
434 | |||
427 | ``from`` |
|
435 | ``from`` | |
428 | Optional. Email address to use in "From" header and SMTP envelope |
|
436 | Optional. Email address to use in "From" header and SMTP envelope | |
429 | of outgoing messages. |
|
437 | of outgoing messages. | |
430 |
|
438 | |||
431 | ``to`` |
|
439 | ``to`` | |
432 | Optional. Comma-separated list of recipients' email addresses. |
|
440 | Optional. Comma-separated list of recipients' email addresses. | |
433 |
|
441 | |||
434 | ``cc`` |
|
442 | ``cc`` | |
435 | Optional. Comma-separated list of carbon copy recipients' |
|
443 | Optional. Comma-separated list of carbon copy recipients' | |
436 | email addresses. |
|
444 | email addresses. | |
437 |
|
445 | |||
438 | ``bcc`` |
|
446 | ``bcc`` | |
439 | Optional. Comma-separated list of blind carbon copy recipients' |
|
447 | Optional. Comma-separated list of blind carbon copy recipients' | |
440 | email addresses. |
|
448 | email addresses. | |
441 |
|
449 | |||
442 | ``method`` |
|
450 | ``method`` | |
443 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
451 | Optional. Method to use to send email messages. If value is ``smtp`` | |
444 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
452 | (default), use SMTP (see the ``[smtp]`` section for configuration). | |
445 | Otherwise, use as name of program to run that acts like sendmail |
|
453 | Otherwise, use as name of program to run that acts like sendmail | |
446 | (takes ``-f`` option for sender, list of recipients on command line, |
|
454 | (takes ``-f`` option for sender, list of recipients on command line, | |
447 | message on stdin). Normally, setting this to ``sendmail`` or |
|
455 | message on stdin). Normally, setting this to ``sendmail`` or | |
448 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
456 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
449 |
|
457 | |||
450 | ``charsets`` |
|
458 | ``charsets`` | |
451 | Optional. Comma-separated list of character sets considered |
|
459 | Optional. Comma-separated list of character sets considered | |
452 | convenient for recipients. Addresses, headers, and parts not |
|
460 | convenient for recipients. Addresses, headers, and parts not | |
453 | containing patches of outgoing messages will be encoded in the |
|
461 | containing patches of outgoing messages will be encoded in the | |
454 | first character set to which conversion from local encoding |
|
462 | first character set to which conversion from local encoding | |
455 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
463 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
456 | conversion fails, the text in question is sent as is. Defaults to |
|
464 | conversion fails, the text in question is sent as is. Defaults to | |
457 | empty (explicit) list. |
|
465 | empty (explicit) list. | |
458 |
|
466 | |||
459 | Order of outgoing email character sets: |
|
467 | Order of outgoing email character sets: | |
460 |
|
468 | |||
461 | 1. ``us-ascii``: always first, regardless of settings |
|
469 | 1. ``us-ascii``: always first, regardless of settings | |
462 | 2. ``email.charsets``: in order given by user |
|
470 | 2. ``email.charsets``: in order given by user | |
463 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
471 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
464 | 4. ``$HGENCODING``: if not in email.charsets |
|
472 | 4. ``$HGENCODING``: if not in email.charsets | |
465 | 5. ``utf-8``: always last, regardless of settings |
|
473 | 5. ``utf-8``: always last, regardless of settings | |
466 |
|
474 | |||
467 | Email example:: |
|
475 | Email example:: | |
468 |
|
476 | |||
469 | [email] |
|
477 | [email] | |
470 | from = Joseph User <joe.user@example.com> |
|
478 | from = Joseph User <joe.user@example.com> | |
471 | method = /usr/sbin/sendmail |
|
479 | method = /usr/sbin/sendmail | |
472 | # charsets for western Europeans |
|
480 | # charsets for western Europeans | |
473 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
481 | # us-ascii, utf-8 omitted, as they are tried first and last | |
474 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
482 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
475 |
|
483 | |||
476 |
|
484 | |||
477 | ``extensions`` |
|
485 | ``extensions`` | |
478 | -------------- |
|
486 | -------------- | |
479 |
|
487 | |||
480 | Mercurial has an extension mechanism for adding new features. To |
|
488 | Mercurial has an extension mechanism for adding new features. To | |
481 | enable an extension, create an entry for it in this section. |
|
489 | enable an extension, create an entry for it in this section. | |
482 |
|
490 | |||
483 | If you know that the extension is already in Python's search path, |
|
491 | If you know that the extension is already in Python's search path, | |
484 | you can give the name of the module, followed by ``=``, with nothing |
|
492 | you can give the name of the module, followed by ``=``, with nothing | |
485 | after the ``=``. |
|
493 | after the ``=``. | |
486 |
|
494 | |||
487 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
495 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
488 | the path to the ``.py`` file (including the file name extension) that |
|
496 | the path to the ``.py`` file (including the file name extension) that | |
489 | defines the extension. |
|
497 | defines the extension. | |
490 |
|
498 | |||
491 | To explicitly disable an extension that is enabled in an hgrc of |
|
499 | To explicitly disable an extension that is enabled in an hgrc of | |
492 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
500 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` | |
493 | or ``foo = !`` when path is not supplied. |
|
501 | or ``foo = !`` when path is not supplied. | |
494 |
|
502 | |||
495 | Example for ``~/.hgrc``:: |
|
503 | Example for ``~/.hgrc``:: | |
496 |
|
504 | |||
497 | [extensions] |
|
505 | [extensions] | |
498 | # (the progress extension will get loaded from Mercurial's path) |
|
506 | # (the progress extension will get loaded from Mercurial's path) | |
499 | progress = |
|
507 | progress = | |
500 | # (this extension will get loaded from the file specified) |
|
508 | # (this extension will get loaded from the file specified) | |
501 | myfeature = ~/.hgext/myfeature.py |
|
509 | myfeature = ~/.hgext/myfeature.py | |
502 |
|
510 | |||
503 |
|
511 | |||
504 | ``format`` |
|
512 | ``format`` | |
505 | ---------- |
|
513 | ---------- | |
506 |
|
514 | |||
507 | ``usestore`` |
|
515 | ``usestore`` | |
508 | Enable or disable the "store" repository format which improves |
|
516 | Enable or disable the "store" repository format which improves | |
509 | compatibility with systems that fold case or otherwise mangle |
|
517 | compatibility with systems that fold case or otherwise mangle | |
510 | filenames. Enabled by default. Disabling this option will allow |
|
518 | filenames. Enabled by default. Disabling this option will allow | |
511 | you to store longer filenames in some situations at the expense of |
|
519 | you to store longer filenames in some situations at the expense of | |
512 | compatibility and ensures that the on-disk format of newly created |
|
520 | compatibility and ensures that the on-disk format of newly created | |
513 | repositories will be compatible with Mercurial before version 0.9.4. |
|
521 | repositories will be compatible with Mercurial before version 0.9.4. | |
514 |
|
522 | |||
515 | ``usefncache`` |
|
523 | ``usefncache`` | |
516 | Enable or disable the "fncache" repository format which enhances |
|
524 | Enable or disable the "fncache" repository format which enhances | |
517 | the "store" repository format (which has to be enabled to use |
|
525 | the "store" repository format (which has to be enabled to use | |
518 | fncache) to allow longer filenames and avoids using Windows |
|
526 | fncache) to allow longer filenames and avoids using Windows | |
519 | reserved names, e.g. "nul". Enabled by default. Disabling this |
|
527 | reserved names, e.g. "nul". Enabled by default. Disabling this | |
520 | option ensures that the on-disk format of newly created |
|
528 | option ensures that the on-disk format of newly created | |
521 | repositories will be compatible with Mercurial before version 1.1. |
|
529 | repositories will be compatible with Mercurial before version 1.1. | |
522 |
|
530 | |||
523 | ``dotencode`` |
|
531 | ``dotencode`` | |
524 | Enable or disable the "dotencode" repository format which enhances |
|
532 | Enable or disable the "dotencode" repository format which enhances | |
525 | the "fncache" repository format (which has to be enabled to use |
|
533 | the "fncache" repository format (which has to be enabled to use | |
526 | dotencode) to avoid issues with filenames starting with ._ on |
|
534 | dotencode) to avoid issues with filenames starting with ._ on | |
527 | Mac OS X and spaces on Windows. Enabled by default. Disabling this |
|
535 | Mac OS X and spaces on Windows. Enabled by default. Disabling this | |
528 | option ensures that the on-disk format of newly created |
|
536 | option ensures that the on-disk format of newly created | |
529 | repositories will be compatible with Mercurial before version 1.7. |
|
537 | repositories will be compatible with Mercurial before version 1.7. | |
530 |
|
538 | |||
531 | ``graph`` |
|
539 | ``graph`` | |
532 | --------- |
|
540 | --------- | |
533 |
|
541 | |||
534 | Web graph view configuration. This section let you change graph |
|
542 | Web graph view configuration. This section let you change graph | |
535 | elements display properties by branches, for instance to make the |
|
543 | elements display properties by branches, for instance to make the | |
536 | ``default`` branch stand out. |
|
544 | ``default`` branch stand out. | |
537 |
|
545 | |||
538 | Each line has the following format:: |
|
546 | Each line has the following format:: | |
539 |
|
547 | |||
540 | <branch>.<argument> = <value> |
|
548 | <branch>.<argument> = <value> | |
541 |
|
549 | |||
542 | where ``<branch>`` is the name of the branch being |
|
550 | where ``<branch>`` is the name of the branch being | |
543 | customized. Example:: |
|
551 | customized. Example:: | |
544 |
|
552 | |||
545 | [graph] |
|
553 | [graph] | |
546 | # 2px width |
|
554 | # 2px width | |
547 | default.width = 2 |
|
555 | default.width = 2 | |
548 | # red color |
|
556 | # red color | |
549 | default.color = FF0000 |
|
557 | default.color = FF0000 | |
550 |
|
558 | |||
551 | Supported arguments: |
|
559 | Supported arguments: | |
552 |
|
560 | |||
553 | ``width`` |
|
561 | ``width`` | |
554 | Set branch edges width in pixels. |
|
562 | Set branch edges width in pixels. | |
555 |
|
563 | |||
556 | ``color`` |
|
564 | ``color`` | |
557 | Set branch edges color in hexadecimal RGB notation. |
|
565 | Set branch edges color in hexadecimal RGB notation. | |
558 |
|
566 | |||
559 | ``hooks`` |
|
567 | ``hooks`` | |
560 | --------- |
|
568 | --------- | |
561 |
|
569 | |||
562 | Commands or Python functions that get automatically executed by |
|
570 | Commands or Python functions that get automatically executed by | |
563 | various actions such as starting or finishing a commit. Multiple |
|
571 | various actions such as starting or finishing a commit. Multiple | |
564 | hooks can be run for the same action by appending a suffix to the |
|
572 | hooks can be run for the same action by appending a suffix to the | |
565 | action. Overriding a site-wide hook can be done by changing its |
|
573 | action. Overriding a site-wide hook can be done by changing its | |
566 | value or setting it to an empty string. Hooks can be prioritized |
|
574 | value or setting it to an empty string. Hooks can be prioritized | |
567 | by adding a prefix of ``priority`` to the hook name on a new line |
|
575 | by adding a prefix of ``priority`` to the hook name on a new line | |
568 | and setting the priority. The default priority is 0 if |
|
576 | and setting the priority. The default priority is 0 if | |
569 | not specified. |
|
577 | not specified. | |
570 |
|
578 | |||
571 | Example ``.hg/hgrc``:: |
|
579 | Example ``.hg/hgrc``:: | |
572 |
|
580 | |||
573 | [hooks] |
|
581 | [hooks] | |
574 | # update working directory after adding changesets |
|
582 | # update working directory after adding changesets | |
575 | changegroup.update = hg update |
|
583 | changegroup.update = hg update | |
576 | # do not use the site-wide hook |
|
584 | # do not use the site-wide hook | |
577 | incoming = |
|
585 | incoming = | |
578 | incoming.email = /my/email/hook |
|
586 | incoming.email = /my/email/hook | |
579 | incoming.autobuild = /my/build/hook |
|
587 | incoming.autobuild = /my/build/hook | |
580 | # force autobuild hook to run before other incoming hooks |
|
588 | # force autobuild hook to run before other incoming hooks | |
581 | priority.incoming.autobuild = 1 |
|
589 | priority.incoming.autobuild = 1 | |
582 |
|
590 | |||
583 | Most hooks are run with environment variables set that give useful |
|
591 | Most hooks are run with environment variables set that give useful | |
584 | additional information. For each hook below, the environment |
|
592 | additional information. For each hook below, the environment | |
585 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
593 | variables it is passed are listed with names of the form ``$HG_foo``. | |
586 |
|
594 | |||
587 | ``changegroup`` |
|
595 | ``changegroup`` | |
588 | Run after a changegroup has been added via push, pull or unbundle. |
|
596 | Run after a changegroup has been added via push, pull or unbundle. | |
589 | ID of the first new changeset is in ``$HG_NODE``. URL from which |
|
597 | ID of the first new changeset is in ``$HG_NODE``. URL from which | |
590 | changes came is in ``$HG_URL``. |
|
598 | changes came is in ``$HG_URL``. | |
591 |
|
599 | |||
592 | ``commit`` |
|
600 | ``commit`` | |
593 | Run after a changeset has been created in the local repository. ID |
|
601 | Run after a changeset has been created in the local repository. ID | |
594 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
602 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
595 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
603 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
596 |
|
604 | |||
597 | ``incoming`` |
|
605 | ``incoming`` | |
598 | Run after a changeset has been pulled, pushed, or unbundled into |
|
606 | Run after a changeset has been pulled, pushed, or unbundled into | |
599 | the local repository. The ID of the newly arrived changeset is in |
|
607 | the local repository. The ID of the newly arrived changeset is in | |
600 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
608 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. | |
601 |
|
609 | |||
602 | ``outgoing`` |
|
610 | ``outgoing`` | |
603 | Run after sending changes from local repository to another. ID of |
|
611 | Run after sending changes from local repository to another. ID of | |
604 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
612 | first changeset sent is in ``$HG_NODE``. Source of operation is in | |
605 | ``$HG_SOURCE``; see "preoutgoing" hook for description. |
|
613 | ``$HG_SOURCE``; see "preoutgoing" hook for description. | |
606 |
|
614 | |||
607 | ``post-<command>`` |
|
615 | ``post-<command>`` | |
608 | Run after successful invocations of the associated command. The |
|
616 | Run after successful invocations of the associated command. The | |
609 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
617 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
610 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
618 | code in ``$HG_RESULT``. Parsed command line arguments are passed as | |
611 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
619 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of | |
612 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
620 | the python data internally passed to <command>. ``$HG_OPTS`` is a | |
613 | dictionary of options (with unspecified options set to their defaults). |
|
621 | dictionary of options (with unspecified options set to their defaults). | |
614 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
622 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. | |
615 |
|
623 | |||
616 | ``pre-<command>`` |
|
624 | ``pre-<command>`` | |
617 | Run before executing the associated command. The contents of the |
|
625 | Run before executing the associated command. The contents of the | |
618 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
626 | command line are passed as ``$HG_ARGS``. Parsed command line arguments | |
619 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
627 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string | |
620 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
628 | representations of the data internally passed to <command>. ``$HG_OPTS`` | |
621 | is a dictionary of options (with unspecified options set to their |
|
629 | is a dictionary of options (with unspecified options set to their | |
622 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
630 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns | |
623 | failure, the command doesn't execute and Mercurial returns the failure |
|
631 | failure, the command doesn't execute and Mercurial returns the failure | |
624 | code. |
|
632 | code. | |
625 |
|
633 | |||
626 | ``prechangegroup`` |
|
634 | ``prechangegroup`` | |
627 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
635 | Run before a changegroup is added via push, pull or unbundle. Exit | |
628 | status 0 allows the changegroup to proceed. Non-zero status will |
|
636 | status 0 allows the changegroup to proceed. Non-zero status will | |
629 | cause the push, pull or unbundle to fail. URL from which changes |
|
637 | cause the push, pull or unbundle to fail. URL from which changes | |
630 | will come is in ``$HG_URL``. |
|
638 | will come is in ``$HG_URL``. | |
631 |
|
639 | |||
632 | ``precommit`` |
|
640 | ``precommit`` | |
633 | Run before starting a local commit. Exit status 0 allows the |
|
641 | Run before starting a local commit. Exit status 0 allows the | |
634 | commit to proceed. Non-zero status will cause the commit to fail. |
|
642 | commit to proceed. Non-zero status will cause the commit to fail. | |
635 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
643 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
636 |
|
644 | |||
637 | ``prelistkeys`` |
|
645 | ``prelistkeys`` | |
638 | Run before listing pushkeys (like bookmarks) in the |
|
646 | Run before listing pushkeys (like bookmarks) in the | |
639 | repository. Non-zero status will cause failure. The key namespace is |
|
647 | repository. Non-zero status will cause failure. The key namespace is | |
640 | in ``$HG_NAMESPACE``. |
|
648 | in ``$HG_NAMESPACE``. | |
641 |
|
649 | |||
642 | ``preoutgoing`` |
|
650 | ``preoutgoing`` | |
643 | Run before collecting changes to send from the local repository to |
|
651 | Run before collecting changes to send from the local repository to | |
644 | another. Non-zero status will cause failure. This lets you prevent |
|
652 | another. Non-zero status will cause failure. This lets you prevent | |
645 | pull over HTTP or SSH. Also prevents against local pull, push |
|
653 | pull over HTTP or SSH. Also prevents against local pull, push | |
646 | (outbound) or bundle commands, but not effective, since you can |
|
654 | (outbound) or bundle commands, but not effective, since you can | |
647 | just copy files instead then. Source of operation is in |
|
655 | just copy files instead then. Source of operation is in | |
648 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
656 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote | |
649 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
657 | SSH or HTTP repository. If "push", "pull" or "bundle", operation | |
650 | is happening on behalf of repository on same system. |
|
658 | is happening on behalf of repository on same system. | |
651 |
|
659 | |||
652 | ``prepushkey`` |
|
660 | ``prepushkey`` | |
653 | Run before a pushkey (like a bookmark) is added to the |
|
661 | Run before a pushkey (like a bookmark) is added to the | |
654 | repository. Non-zero status will cause the key to be rejected. The |
|
662 | repository. Non-zero status will cause the key to be rejected. The | |
655 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
663 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, | |
656 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
664 | the old value (if any) is in ``$HG_OLD``, and the new value is in | |
657 | ``$HG_NEW``. |
|
665 | ``$HG_NEW``. | |
658 |
|
666 | |||
659 | ``pretag`` |
|
667 | ``pretag`` | |
660 | Run before creating a tag. Exit status 0 allows the tag to be |
|
668 | Run before creating a tag. Exit status 0 allows the tag to be | |
661 | created. Non-zero status will cause the tag to fail. ID of |
|
669 | created. Non-zero status will cause the tag to fail. ID of | |
662 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
670 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is | |
663 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
671 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. | |
664 |
|
672 | |||
665 | ``pretxnchangegroup`` |
|
673 | ``pretxnchangegroup`` | |
666 | Run after a changegroup has been added via push, pull or unbundle, |
|
674 | Run after a changegroup has been added via push, pull or unbundle, | |
667 | but before the transaction has been committed. Changegroup is |
|
675 | but before the transaction has been committed. Changegroup is | |
668 | visible to hook program. This lets you validate incoming changes |
|
676 | visible to hook program. This lets you validate incoming changes | |
669 | before accepting them. Passed the ID of the first new changeset in |
|
677 | before accepting them. Passed the ID of the first new changeset in | |
670 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero |
|
678 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero | |
671 | status will cause the transaction to be rolled back and the push, |
|
679 | status will cause the transaction to be rolled back and the push, | |
672 | pull or unbundle will fail. URL that was source of changes is in |
|
680 | pull or unbundle will fail. URL that was source of changes is in | |
673 | ``$HG_URL``. |
|
681 | ``$HG_URL``. | |
674 |
|
682 | |||
675 | ``pretxncommit`` |
|
683 | ``pretxncommit`` | |
676 | Run after a changeset has been created but the transaction not yet |
|
684 | Run after a changeset has been created but the transaction not yet | |
677 | committed. Changeset is visible to hook program. This lets you |
|
685 | committed. Changeset is visible to hook program. This lets you | |
678 | validate commit message and changes. Exit status 0 allows the |
|
686 | validate commit message and changes. Exit status 0 allows the | |
679 | commit to proceed. Non-zero status will cause the transaction to |
|
687 | commit to proceed. Non-zero status will cause the transaction to | |
680 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
688 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset | |
681 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
689 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
682 |
|
690 | |||
683 | ``preupdate`` |
|
691 | ``preupdate`` | |
684 | Run before updating the working directory. Exit status 0 allows |
|
692 | Run before updating the working directory. Exit status 0 allows | |
685 | the update to proceed. Non-zero status will prevent the update. |
|
693 | the update to proceed. Non-zero status will prevent the update. | |
686 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
694 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID | |
687 | of second new parent is in ``$HG_PARENT2``. |
|
695 | of second new parent is in ``$HG_PARENT2``. | |
688 |
|
696 | |||
689 | ``listkeys`` |
|
697 | ``listkeys`` | |
690 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
698 | Run after listing pushkeys (like bookmarks) in the repository. The | |
691 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
699 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a | |
692 | dictionary containing the keys and values. |
|
700 | dictionary containing the keys and values. | |
693 |
|
701 | |||
694 | ``pushkey`` |
|
702 | ``pushkey`` | |
695 | Run after a pushkey (like a bookmark) is added to the |
|
703 | Run after a pushkey (like a bookmark) is added to the | |
696 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
704 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in | |
697 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
705 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new | |
698 | value is in ``$HG_NEW``. |
|
706 | value is in ``$HG_NEW``. | |
699 |
|
707 | |||
700 | ``tag`` |
|
708 | ``tag`` | |
701 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
709 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. | |
702 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
710 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in | |
703 | repository if ``$HG_LOCAL=0``. |
|
711 | repository if ``$HG_LOCAL=0``. | |
704 |
|
712 | |||
705 | ``update`` |
|
713 | ``update`` | |
706 | Run after updating the working directory. Changeset ID of first |
|
714 | Run after updating the working directory. Changeset ID of first | |
707 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
715 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is | |
708 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
716 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
709 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
717 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. | |
710 |
|
718 | |||
711 | .. note:: It is generally better to use standard hooks rather than the |
|
719 | .. note:: | |
|
720 | ||||
|
721 | It is generally better to use standard hooks rather than the | |||
712 | generic pre- and post- command hooks as they are guaranteed to be |
|
722 | generic pre- and post- command hooks as they are guaranteed to be | |
713 | called in the appropriate contexts for influencing transactions. |
|
723 | called in the appropriate contexts for influencing transactions. | |
714 | Also, hooks like "commit" will be called in all contexts that |
|
724 | Also, hooks like "commit" will be called in all contexts that | |
715 | generate a commit (e.g. tag) and not just the commit command. |
|
725 | generate a commit (e.g. tag) and not just the commit command. | |
716 |
|
726 | |||
717 | .. note:: Environment variables with empty values may not be passed to |
|
727 | .. note:: | |
|
728 | ||||
|
729 | Environment variables with empty values may not be passed to | |||
718 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
730 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
719 | will have an empty value under Unix-like platforms for non-merge |
|
731 | will have an empty value under Unix-like platforms for non-merge | |
720 | changesets, while it will not be available at all under Windows. |
|
732 | changesets, while it will not be available at all under Windows. | |
721 |
|
733 | |||
722 | The syntax for Python hooks is as follows:: |
|
734 | The syntax for Python hooks is as follows:: | |
723 |
|
735 | |||
724 | hookname = python:modulename.submodule.callable |
|
736 | hookname = python:modulename.submodule.callable | |
725 | hookname = python:/path/to/python/module.py:callable |
|
737 | hookname = python:/path/to/python/module.py:callable | |
726 |
|
738 | |||
727 | Python hooks are run within the Mercurial process. Each hook is |
|
739 | Python hooks are run within the Mercurial process. Each hook is | |
728 | called with at least three keyword arguments: a ui object (keyword |
|
740 | called with at least three keyword arguments: a ui object (keyword | |
729 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
741 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
730 | keyword that tells what kind of hook is used. Arguments listed as |
|
742 | keyword that tells what kind of hook is used. Arguments listed as | |
731 | environment variables above are passed as keyword arguments, with no |
|
743 | environment variables above are passed as keyword arguments, with no | |
732 | ``HG_`` prefix, and names in lower case. |
|
744 | ``HG_`` prefix, and names in lower case. | |
733 |
|
745 | |||
734 | If a Python hook returns a "true" value or raises an exception, this |
|
746 | If a Python hook returns a "true" value or raises an exception, this | |
735 | is treated as a failure. |
|
747 | is treated as a failure. | |
736 |
|
748 | |||
737 |
|
749 | |||
738 | ``hostfingerprints`` |
|
750 | ``hostfingerprints`` | |
739 | -------------------- |
|
751 | -------------------- | |
740 |
|
752 | |||
741 | Fingerprints of the certificates of known HTTPS servers. |
|
753 | Fingerprints of the certificates of known HTTPS servers. | |
742 | A HTTPS connection to a server with a fingerprint configured here will |
|
754 | A HTTPS connection to a server with a fingerprint configured here will | |
743 | only succeed if the servers certificate matches the fingerprint. |
|
755 | only succeed if the servers certificate matches the fingerprint. | |
744 | This is very similar to how ssh known hosts works. |
|
756 | This is very similar to how ssh known hosts works. | |
745 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
757 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. | |
746 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
758 | The CA chain and web.cacerts is not used for servers with a fingerprint. | |
747 |
|
759 | |||
748 | For example:: |
|
760 | For example:: | |
749 |
|
761 | |||
750 | [hostfingerprints] |
|
762 | [hostfingerprints] | |
751 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 |
|
763 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 | |
752 |
|
764 | |||
753 | This feature is only supported when using Python 2.6 or later. |
|
765 | This feature is only supported when using Python 2.6 or later. | |
754 |
|
766 | |||
755 |
|
767 | |||
756 | ``http_proxy`` |
|
768 | ``http_proxy`` | |
757 | -------------- |
|
769 | -------------- | |
758 |
|
770 | |||
759 | Used to access web-based Mercurial repositories through a HTTP |
|
771 | Used to access web-based Mercurial repositories through a HTTP | |
760 | proxy. |
|
772 | proxy. | |
761 |
|
773 | |||
762 | ``host`` |
|
774 | ``host`` | |
763 | Host name and (optional) port of the proxy server, for example |
|
775 | Host name and (optional) port of the proxy server, for example | |
764 | "myproxy:8000". |
|
776 | "myproxy:8000". | |
765 |
|
777 | |||
766 | ``no`` |
|
778 | ``no`` | |
767 | Optional. Comma-separated list of host names that should bypass |
|
779 | Optional. Comma-separated list of host names that should bypass | |
768 | the proxy. |
|
780 | the proxy. | |
769 |
|
781 | |||
770 | ``passwd`` |
|
782 | ``passwd`` | |
771 | Optional. Password to authenticate with at the proxy server. |
|
783 | Optional. Password to authenticate with at the proxy server. | |
772 |
|
784 | |||
773 | ``user`` |
|
785 | ``user`` | |
774 | Optional. User name to authenticate with at the proxy server. |
|
786 | Optional. User name to authenticate with at the proxy server. | |
775 |
|
787 | |||
776 | ``always`` |
|
788 | ``always`` | |
777 | Optional. Always use the proxy, even for localhost and any entries |
|
789 | Optional. Always use the proxy, even for localhost and any entries | |
778 | in ``http_proxy.no``. True or False. Default: False. |
|
790 | in ``http_proxy.no``. True or False. Default: False. | |
779 |
|
791 | |||
780 | ``merge-patterns`` |
|
792 | ``merge-patterns`` | |
781 | ------------------ |
|
793 | ------------------ | |
782 |
|
794 | |||
783 | This section specifies merge tools to associate with particular file |
|
795 | This section specifies merge tools to associate with particular file | |
784 | patterns. Tools matched here will take precedence over the default |
|
796 | patterns. Tools matched here will take precedence over the default | |
785 | merge tool. Patterns are globs by default, rooted at the repository |
|
797 | merge tool. Patterns are globs by default, rooted at the repository | |
786 | root. |
|
798 | root. | |
787 |
|
799 | |||
788 | Example:: |
|
800 | Example:: | |
789 |
|
801 | |||
790 | [merge-patterns] |
|
802 | [merge-patterns] | |
791 | **.c = kdiff3 |
|
803 | **.c = kdiff3 | |
792 | **.jpg = myimgmerge |
|
804 | **.jpg = myimgmerge | |
793 |
|
805 | |||
794 | ``merge-tools`` |
|
806 | ``merge-tools`` | |
795 | --------------- |
|
807 | --------------- | |
796 |
|
808 | |||
797 | This section configures external merge tools to use for file-level |
|
809 | This section configures external merge tools to use for file-level | |
798 | merges. |
|
810 | merges. | |
799 |
|
811 | |||
800 | Example ``~/.hgrc``:: |
|
812 | Example ``~/.hgrc``:: | |
801 |
|
813 | |||
802 | [merge-tools] |
|
814 | [merge-tools] | |
803 | # Override stock tool location |
|
815 | # Override stock tool location | |
804 | kdiff3.executable = ~/bin/kdiff3 |
|
816 | kdiff3.executable = ~/bin/kdiff3 | |
805 | # Specify command line |
|
817 | # Specify command line | |
806 | kdiff3.args = $base $local $other -o $output |
|
818 | kdiff3.args = $base $local $other -o $output | |
807 | # Give higher priority |
|
819 | # Give higher priority | |
808 | kdiff3.priority = 1 |
|
820 | kdiff3.priority = 1 | |
809 |
|
821 | |||
810 | # Define new tool |
|
822 | # Define new tool | |
811 | myHtmlTool.args = -m $local $other $base $output |
|
823 | myHtmlTool.args = -m $local $other $base $output | |
812 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
824 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
813 | myHtmlTool.priority = 1 |
|
825 | myHtmlTool.priority = 1 | |
814 |
|
826 | |||
815 | Supported arguments: |
|
827 | Supported arguments: | |
816 |
|
828 | |||
817 | ``priority`` |
|
829 | ``priority`` | |
818 | The priority in which to evaluate this tool. |
|
830 | The priority in which to evaluate this tool. | |
819 | Default: 0. |
|
831 | Default: 0. | |
820 |
|
832 | |||
821 | ``executable`` |
|
833 | ``executable`` | |
822 | Either just the name of the executable or its pathname. On Windows, |
|
834 | Either just the name of the executable or its pathname. On Windows, | |
823 | the path can use environment variables with ${ProgramFiles} syntax. |
|
835 | the path can use environment variables with ${ProgramFiles} syntax. | |
824 | Default: the tool name. |
|
836 | Default: the tool name. | |
825 |
|
837 | |||
826 | ``args`` |
|
838 | ``args`` | |
827 | The arguments to pass to the tool executable. You can refer to the |
|
839 | The arguments to pass to the tool executable. You can refer to the | |
828 | files being merged as well as the output file through these |
|
840 | files being merged as well as the output file through these | |
829 | variables: ``$base``, ``$local``, ``$other``, ``$output``. |
|
841 | variables: ``$base``, ``$local``, ``$other``, ``$output``. | |
830 | Default: ``$local $base $other`` |
|
842 | Default: ``$local $base $other`` | |
831 |
|
843 | |||
832 | ``premerge`` |
|
844 | ``premerge`` | |
833 | Attempt to run internal non-interactive 3-way merge tool before |
|
845 | Attempt to run internal non-interactive 3-way merge tool before | |
834 | launching external tool. Options are ``true``, ``false``, or ``keep`` |
|
846 | launching external tool. Options are ``true``, ``false``, or ``keep`` | |
835 | to leave markers in the file if the premerge fails. |
|
847 | to leave markers in the file if the premerge fails. | |
836 | Default: True |
|
848 | Default: True | |
837 |
|
849 | |||
838 | ``binary`` |
|
850 | ``binary`` | |
839 | This tool can merge binary files. Defaults to False, unless tool |
|
851 | This tool can merge binary files. Defaults to False, unless tool | |
840 | was selected by file pattern match. |
|
852 | was selected by file pattern match. | |
841 |
|
853 | |||
842 | ``symlink`` |
|
854 | ``symlink`` | |
843 | This tool can merge symlinks. Defaults to False, even if tool was |
|
855 | This tool can merge symlinks. Defaults to False, even if tool was | |
844 | selected by file pattern match. |
|
856 | selected by file pattern match. | |
845 |
|
857 | |||
846 | ``check`` |
|
858 | ``check`` | |
847 | A list of merge success-checking options: |
|
859 | A list of merge success-checking options: | |
848 |
|
860 | |||
849 | ``changed`` |
|
861 | ``changed`` | |
850 | Ask whether merge was successful when the merged file shows no changes. |
|
862 | Ask whether merge was successful when the merged file shows no changes. | |
851 | ``conflicts`` |
|
863 | ``conflicts`` | |
852 | Check whether there are conflicts even though the tool reported success. |
|
864 | Check whether there are conflicts even though the tool reported success. | |
853 | ``prompt`` |
|
865 | ``prompt`` | |
854 | Always prompt for merge success, regardless of success reported by tool. |
|
866 | Always prompt for merge success, regardless of success reported by tool. | |
855 |
|
867 | |||
856 | ``fixeol`` |
|
868 | ``fixeol`` | |
857 | Attempt to fix up EOL changes caused by the merge tool. |
|
869 | Attempt to fix up EOL changes caused by the merge tool. | |
858 | Default: False |
|
870 | Default: False | |
859 |
|
871 | |||
860 | ``gui`` |
|
872 | ``gui`` | |
861 | This tool requires a graphical interface to run. Default: False |
|
873 | This tool requires a graphical interface to run. Default: False | |
862 |
|
874 | |||
863 | ``regkey`` |
|
875 | ``regkey`` | |
864 | Windows registry key which describes install location of this |
|
876 | Windows registry key which describes install location of this | |
865 | tool. Mercurial will search for this key first under |
|
877 | tool. Mercurial will search for this key first under | |
866 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
878 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
867 | Default: None |
|
879 | Default: None | |
868 |
|
880 | |||
869 | ``regkeyalt`` |
|
881 | ``regkeyalt`` | |
870 | An alternate Windows registry key to try if the first key is not |
|
882 | An alternate Windows registry key to try if the first key is not | |
871 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
883 | found. The alternate key uses the same ``regname`` and ``regappend`` | |
872 | semantics of the primary key. The most common use for this key |
|
884 | semantics of the primary key. The most common use for this key | |
873 | is to search for 32bit applications on 64bit operating systems. |
|
885 | is to search for 32bit applications on 64bit operating systems. | |
874 | Default: None |
|
886 | Default: None | |
875 |
|
887 | |||
876 | ``regname`` |
|
888 | ``regname`` | |
877 | Name of value to read from specified registry key. Defaults to the |
|
889 | Name of value to read from specified registry key. Defaults to the | |
878 | unnamed (default) value. |
|
890 | unnamed (default) value. | |
879 |
|
891 | |||
880 | ``regappend`` |
|
892 | ``regappend`` | |
881 | String to append to the value read from the registry, typically |
|
893 | String to append to the value read from the registry, typically | |
882 | the executable name of the tool. |
|
894 | the executable name of the tool. | |
883 | Default: None |
|
895 | Default: None | |
884 |
|
896 | |||
885 |
|
897 | |||
886 | ``patch`` |
|
898 | ``patch`` | |
887 | --------- |
|
899 | --------- | |
888 |
|
900 | |||
889 | Settings used when applying patches, for instance through the 'import' |
|
901 | Settings used when applying patches, for instance through the 'import' | |
890 | command or with Mercurial Queues extension. |
|
902 | command or with Mercurial Queues extension. | |
891 |
|
903 | |||
892 | ``eol`` |
|
904 | ``eol`` | |
893 | When set to 'strict' patch content and patched files end of lines |
|
905 | When set to 'strict' patch content and patched files end of lines | |
894 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
906 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
895 | lines are ignored when patching and the result line endings are |
|
907 | lines are ignored when patching and the result line endings are | |
896 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
908 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
897 | ``auto``, end of lines are again ignored while patching but line |
|
909 | ``auto``, end of lines are again ignored while patching but line | |
898 | endings in patched files are normalized to their original setting |
|
910 | endings in patched files are normalized to their original setting | |
899 | on a per-file basis. If target file does not exist or has no end |
|
911 | on a per-file basis. If target file does not exist or has no end | |
900 | of line, patch line endings are preserved. |
|
912 | of line, patch line endings are preserved. | |
901 | Default: strict. |
|
913 | Default: strict. | |
902 |
|
914 | |||
903 |
|
915 | |||
904 | ``paths`` |
|
916 | ``paths`` | |
905 | --------- |
|
917 | --------- | |
906 |
|
918 | |||
907 | Assigns symbolic names to repositories. The left side is the |
|
919 | Assigns symbolic names to repositories. The left side is the | |
908 | symbolic name, and the right gives the directory or URL that is the |
|
920 | symbolic name, and the right gives the directory or URL that is the | |
909 | location of the repository. Default paths can be declared by setting |
|
921 | location of the repository. Default paths can be declared by setting | |
910 | the following entries. |
|
922 | the following entries. | |
911 |
|
923 | |||
912 | ``default`` |
|
924 | ``default`` | |
913 | Directory or URL to use when pulling if no source is specified. |
|
925 | Directory or URL to use when pulling if no source is specified. | |
914 | Default is set to repository from which the current repository was |
|
926 | Default is set to repository from which the current repository was | |
915 | cloned. |
|
927 | cloned. | |
916 |
|
928 | |||
917 | ``default-push`` |
|
929 | ``default-push`` | |
918 | Optional. Directory or URL to use when pushing if no destination |
|
930 | Optional. Directory or URL to use when pushing if no destination | |
919 | is specified. |
|
931 | is specified. | |
920 |
|
932 | |||
921 | Custom paths can be defined by assigning the path to a name that later can be |
|
933 | Custom paths can be defined by assigning the path to a name that later can be | |
922 | used from the command line. Example:: |
|
934 | used from the command line. Example:: | |
923 |
|
935 | |||
924 | [paths] |
|
936 | [paths] | |
925 | my_path = http://example.com/path |
|
937 | my_path = http://example.com/path | |
926 |
|
938 | |||
927 | To push to the path defined in ``my_path`` run the command:: |
|
939 | To push to the path defined in ``my_path`` run the command:: | |
928 |
|
940 | |||
929 | hg push my_path |
|
941 | hg push my_path | |
930 |
|
942 | |||
931 |
|
943 | |||
932 | ``phases`` |
|
944 | ``phases`` | |
933 | ---------- |
|
945 | ---------- | |
934 |
|
946 | |||
935 | Specifies default handling of phases. See :hg:`help phases` for more |
|
947 | Specifies default handling of phases. See :hg:`help phases` for more | |
936 | information about working with phases. |
|
948 | information about working with phases. | |
937 |
|
949 | |||
938 | ``publish`` |
|
950 | ``publish`` | |
939 | Controls draft phase behavior when working as a server. When true, |
|
951 | Controls draft phase behavior when working as a server. When true, | |
940 | pushed changesets are set to public in both client and server and |
|
952 | pushed changesets are set to public in both client and server and | |
941 | pulled or cloned changesets are set to public in the client. |
|
953 | pulled or cloned changesets are set to public in the client. | |
942 | Default: True |
|
954 | Default: True | |
943 |
|
955 | |||
944 | ``new-commit`` |
|
956 | ``new-commit`` | |
945 | Phase of newly-created commits. |
|
957 | Phase of newly-created commits. | |
946 | Default: draft |
|
958 | Default: draft | |
947 |
|
959 | |||
948 | ``checksubrepos`` |
|
960 | ``checksubrepos`` | |
949 | Check the phase of the current revision of each subrepository. Allowed |
|
961 | Check the phase of the current revision of each subrepository. Allowed | |
950 | values are "ignore", "follow" and "abort". For settings other than |
|
962 | values are "ignore", "follow" and "abort". For settings other than | |
951 | "ignore", the phase of the current revision of each subrepository is |
|
963 | "ignore", the phase of the current revision of each subrepository is | |
952 | checked before committing the parent repository. If any of those phases is |
|
964 | checked before committing the parent repository. If any of those phases is | |
953 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
965 | greater than the phase of the parent repository (e.g. if a subrepo is in a | |
954 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
966 | "secret" phase while the parent repo is in "draft" phase), the commit is | |
955 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
967 | either aborted (if checksubrepos is set to "abort") or the higher phase is | |
956 | used for the parent repository commit (if set to "follow"). |
|
968 | used for the parent repository commit (if set to "follow"). | |
957 | Default: "follow" |
|
969 | Default: "follow" | |
958 |
|
970 | |||
959 |
|
971 | |||
960 | ``profiling`` |
|
972 | ``profiling`` | |
961 | ------------- |
|
973 | ------------- | |
962 |
|
974 | |||
963 | Specifies profiling type, format, and file output. Two profilers are |
|
975 | Specifies profiling type, format, and file output. Two profilers are | |
964 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
976 | supported: an instrumenting profiler (named ``ls``), and a sampling | |
965 | profiler (named ``stat``). |
|
977 | profiler (named ``stat``). | |
966 |
|
978 | |||
967 | In this section description, 'profiling data' stands for the raw data |
|
979 | In this section description, 'profiling data' stands for the raw data | |
968 | collected during profiling, while 'profiling report' stands for a |
|
980 | collected during profiling, while 'profiling report' stands for a | |
969 | statistical text report generated from the profiling data. The |
|
981 | statistical text report generated from the profiling data. The | |
970 | profiling is done using lsprof. |
|
982 | profiling is done using lsprof. | |
971 |
|
983 | |||
972 | ``type`` |
|
984 | ``type`` | |
973 | The type of profiler to use. |
|
985 | The type of profiler to use. | |
974 | Default: ls. |
|
986 | Default: ls. | |
975 |
|
987 | |||
976 | ``ls`` |
|
988 | ``ls`` | |
977 | Use Python's built-in instrumenting profiler. This profiler |
|
989 | Use Python's built-in instrumenting profiler. This profiler | |
978 | works on all platforms, but each line number it reports is the |
|
990 | works on all platforms, but each line number it reports is the | |
979 | first line of a function. This restriction makes it difficult to |
|
991 | first line of a function. This restriction makes it difficult to | |
980 | identify the expensive parts of a non-trivial function. |
|
992 | identify the expensive parts of a non-trivial function. | |
981 | ``stat`` |
|
993 | ``stat`` | |
982 | Use a third-party statistical profiler, statprof. This profiler |
|
994 | Use a third-party statistical profiler, statprof. This profiler | |
983 | currently runs only on Unix systems, and is most useful for |
|
995 | currently runs only on Unix systems, and is most useful for | |
984 | profiling commands that run for longer than about 0.1 seconds. |
|
996 | profiling commands that run for longer than about 0.1 seconds. | |
985 |
|
997 | |||
986 | ``format`` |
|
998 | ``format`` | |
987 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
999 | Profiling format. Specific to the ``ls`` instrumenting profiler. | |
988 | Default: text. |
|
1000 | Default: text. | |
989 |
|
1001 | |||
990 | ``text`` |
|
1002 | ``text`` | |
991 | Generate a profiling report. When saving to a file, it should be |
|
1003 | Generate a profiling report. When saving to a file, it should be | |
992 | noted that only the report is saved, and the profiling data is |
|
1004 | noted that only the report is saved, and the profiling data is | |
993 | not kept. |
|
1005 | not kept. | |
994 | ``kcachegrind`` |
|
1006 | ``kcachegrind`` | |
995 | Format profiling data for kcachegrind use: when saving to a |
|
1007 | Format profiling data for kcachegrind use: when saving to a | |
996 | file, the generated file can directly be loaded into |
|
1008 | file, the generated file can directly be loaded into | |
997 | kcachegrind. |
|
1009 | kcachegrind. | |
998 |
|
1010 | |||
999 | ``frequency`` |
|
1011 | ``frequency`` | |
1000 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1012 | Sampling frequency. Specific to the ``stat`` sampling profiler. | |
1001 | Default: 1000. |
|
1013 | Default: 1000. | |
1002 |
|
1014 | |||
1003 | ``output`` |
|
1015 | ``output`` | |
1004 | File path where profiling data or report should be saved. If the |
|
1016 | File path where profiling data or report should be saved. If the | |
1005 | file exists, it is replaced. Default: None, data is printed on |
|
1017 | file exists, it is replaced. Default: None, data is printed on | |
1006 | stderr |
|
1018 | stderr | |
1007 |
|
1019 | |||
1008 | ``sort`` |
|
1020 | ``sort`` | |
1009 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1021 | Sort field. Specific to the ``ls`` instrumenting profiler. | |
1010 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1022 | One of ``callcount``, ``reccallcount``, ``totaltime`` and | |
1011 | ``inlinetime``. |
|
1023 | ``inlinetime``. | |
1012 | Default: inlinetime. |
|
1024 | Default: inlinetime. | |
1013 |
|
1025 | |||
1014 | ``limit`` |
|
1026 | ``limit`` | |
1015 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1027 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. | |
1016 | Default: 30. |
|
1028 | Default: 30. | |
1017 |
|
1029 | |||
1018 | ``nested`` |
|
1030 | ``nested`` | |
1019 | Show at most this number of lines of drill-down info after each main entry. |
|
1031 | Show at most this number of lines of drill-down info after each main entry. | |
1020 | This can help explain the difference between Total and Inline. |
|
1032 | This can help explain the difference between Total and Inline. | |
1021 | Specific to the ``ls`` instrumenting profiler. |
|
1033 | Specific to the ``ls`` instrumenting profiler. | |
1022 | Default: 5. |
|
1034 | Default: 5. | |
1023 |
|
1035 | |||
1024 | ``revsetalias`` |
|
1036 | ``revsetalias`` | |
1025 | --------------- |
|
1037 | --------------- | |
1026 |
|
1038 | |||
1027 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1039 | Alias definitions for revsets. See :hg:`help revsets` for details. | |
1028 |
|
1040 | |||
1029 | ``server`` |
|
1041 | ``server`` | |
1030 | ---------- |
|
1042 | ---------- | |
1031 |
|
1043 | |||
1032 | Controls generic server settings. |
|
1044 | Controls generic server settings. | |
1033 |
|
1045 | |||
1034 | ``uncompressed`` |
|
1046 | ``uncompressed`` | |
1035 | Whether to allow clients to clone a repository using the |
|
1047 | Whether to allow clients to clone a repository using the | |
1036 | uncompressed streaming protocol. This transfers about 40% more |
|
1048 | uncompressed streaming protocol. This transfers about 40% more | |
1037 | data than a regular clone, but uses less memory and CPU on both |
|
1049 | data than a regular clone, but uses less memory and CPU on both | |
1038 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1050 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
1039 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1051 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
1040 | regular clone. Over most WAN connections (anything slower than |
|
1052 | regular clone. Over most WAN connections (anything slower than | |
1041 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1053 | about 6 Mbps), uncompressed streaming is slower, because of the | |
1042 | extra data transfer overhead. This mode will also temporarily hold |
|
1054 | extra data transfer overhead. This mode will also temporarily hold | |
1043 | the write lock while determining what data to transfer. |
|
1055 | the write lock while determining what data to transfer. | |
1044 | Default is True. |
|
1056 | Default is True. | |
1045 |
|
1057 | |||
1046 | ``preferuncompressed`` |
|
1058 | ``preferuncompressed`` | |
1047 | When set, clients will try to use the uncompressed streaming |
|
1059 | When set, clients will try to use the uncompressed streaming | |
1048 | protocol. Default is False. |
|
1060 | protocol. Default is False. | |
1049 |
|
1061 | |||
1050 | ``validate`` |
|
1062 | ``validate`` | |
1051 | Whether to validate the completeness of pushed changesets by |
|
1063 | Whether to validate the completeness of pushed changesets by | |
1052 | checking that all new file revisions specified in manifests are |
|
1064 | checking that all new file revisions specified in manifests are | |
1053 | present. Default is False. |
|
1065 | present. Default is False. | |
1054 |
|
1066 | |||
1055 | ``smtp`` |
|
1067 | ``smtp`` | |
1056 | -------- |
|
1068 | -------- | |
1057 |
|
1069 | |||
1058 | Configuration for extensions that need to send email messages. |
|
1070 | Configuration for extensions that need to send email messages. | |
1059 |
|
1071 | |||
1060 | ``host`` |
|
1072 | ``host`` | |
1061 | Host name of mail server, e.g. "mail.example.com". |
|
1073 | Host name of mail server, e.g. "mail.example.com". | |
1062 |
|
1074 | |||
1063 | ``port`` |
|
1075 | ``port`` | |
1064 | Optional. Port to connect to on mail server. Default: 465 (if |
|
1076 | Optional. Port to connect to on mail server. Default: 465 (if | |
1065 | ``tls`` is smtps) or 25 (otherwise). |
|
1077 | ``tls`` is smtps) or 25 (otherwise). | |
1066 |
|
1078 | |||
1067 | ``tls`` |
|
1079 | ``tls`` | |
1068 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1080 | Optional. Method to enable TLS when connecting to mail server: starttls, | |
1069 | smtps or none. Default: none. |
|
1081 | smtps or none. Default: none. | |
1070 |
|
1082 | |||
1071 | ``verifycert`` |
|
1083 | ``verifycert`` | |
1072 | Optional. Verification for the certificate of mail server, when |
|
1084 | Optional. Verification for the certificate of mail server, when | |
1073 | ``tls`` is starttls or smtps. "strict", "loose" or False. For |
|
1085 | ``tls`` is starttls or smtps. "strict", "loose" or False. For | |
1074 | "strict" or "loose", the certificate is verified as same as the |
|
1086 | "strict" or "loose", the certificate is verified as same as the | |
1075 | verification for HTTPS connections (see ``[hostfingerprints]`` and |
|
1087 | verification for HTTPS connections (see ``[hostfingerprints]`` and | |
1076 | ``[web] cacerts`` also). For "strict", sending email is also |
|
1088 | ``[web] cacerts`` also). For "strict", sending email is also | |
1077 | aborted, if there is no configuration for mail server in |
|
1089 | aborted, if there is no configuration for mail server in | |
1078 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for |
|
1090 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for | |
1079 | :hg:`email` overwrites this as "loose". Default: "strict". |
|
1091 | :hg:`email` overwrites this as "loose". Default: "strict". | |
1080 |
|
1092 | |||
1081 | ``username`` |
|
1093 | ``username`` | |
1082 | Optional. User name for authenticating with the SMTP server. |
|
1094 | Optional. User name for authenticating with the SMTP server. | |
1083 | Default: none. |
|
1095 | Default: none. | |
1084 |
|
1096 | |||
1085 | ``password`` |
|
1097 | ``password`` | |
1086 | Optional. Password for authenticating with the SMTP server. If not |
|
1098 | Optional. Password for authenticating with the SMTP server. If not | |
1087 | specified, interactive sessions will prompt the user for a |
|
1099 | specified, interactive sessions will prompt the user for a | |
1088 | password; non-interactive sessions will fail. Default: none. |
|
1100 | password; non-interactive sessions will fail. Default: none. | |
1089 |
|
1101 | |||
1090 | ``local_hostname`` |
|
1102 | ``local_hostname`` | |
1091 | Optional. It's the hostname that the sender can use to identify |
|
1103 | Optional. It's the hostname that the sender can use to identify | |
1092 | itself to the MTA. |
|
1104 | itself to the MTA. | |
1093 |
|
1105 | |||
1094 |
|
1106 | |||
1095 | ``subpaths`` |
|
1107 | ``subpaths`` | |
1096 | ------------ |
|
1108 | ------------ | |
1097 |
|
1109 | |||
1098 | Subrepository source URLs can go stale if a remote server changes name |
|
1110 | Subrepository source URLs can go stale if a remote server changes name | |
1099 | or becomes temporarily unavailable. This section lets you define |
|
1111 | or becomes temporarily unavailable. This section lets you define | |
1100 | rewrite rules of the form:: |
|
1112 | rewrite rules of the form:: | |
1101 |
|
1113 | |||
1102 | <pattern> = <replacement> |
|
1114 | <pattern> = <replacement> | |
1103 |
|
1115 | |||
1104 | where ``pattern`` is a regular expression matching a subrepository |
|
1116 | where ``pattern`` is a regular expression matching a subrepository | |
1105 | source URL and ``replacement`` is the replacement string used to |
|
1117 | source URL and ``replacement`` is the replacement string used to | |
1106 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1118 | rewrite it. Groups can be matched in ``pattern`` and referenced in | |
1107 | ``replacements``. For instance:: |
|
1119 | ``replacements``. For instance:: | |
1108 |
|
1120 | |||
1109 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1121 | http://server/(.*)-hg/ = http://hg.server/\1/ | |
1110 |
|
1122 | |||
1111 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1123 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. | |
1112 |
|
1124 | |||
1113 | Relative subrepository paths are first made absolute, and the |
|
1125 | Relative subrepository paths are first made absolute, and the | |
1114 | rewrite rules are then applied on the full (absolute) path. The rules |
|
1126 | rewrite rules are then applied on the full (absolute) path. The rules | |
1115 | are applied in definition order. |
|
1127 | are applied in definition order. | |
1116 |
|
1128 | |||
1117 | ``trusted`` |
|
1129 | ``trusted`` | |
1118 | ----------- |
|
1130 | ----------- | |
1119 |
|
1131 | |||
1120 | Mercurial will not use the settings in the |
|
1132 | Mercurial will not use the settings in the | |
1121 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1133 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
1122 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1134 | user or to a trusted group, as various hgrc features allow arbitrary | |
1123 | commands to be run. This issue is often encountered when configuring |
|
1135 | commands to be run. This issue is often encountered when configuring | |
1124 | hooks or extensions for shared repositories or servers. However, |
|
1136 | hooks or extensions for shared repositories or servers. However, | |
1125 | the web interface will use some safe settings from the ``[web]`` |
|
1137 | the web interface will use some safe settings from the ``[web]`` | |
1126 | section. |
|
1138 | section. | |
1127 |
|
1139 | |||
1128 | This section specifies what users and groups are trusted. The |
|
1140 | This section specifies what users and groups are trusted. The | |
1129 | current user is always trusted. To trust everybody, list a user or a |
|
1141 | current user is always trusted. To trust everybody, list a user or a | |
1130 | group with name ``*``. These settings must be placed in an |
|
1142 | group with name ``*``. These settings must be placed in an | |
1131 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1143 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the | |
1132 | user or service running Mercurial. |
|
1144 | user or service running Mercurial. | |
1133 |
|
1145 | |||
1134 | ``users`` |
|
1146 | ``users`` | |
1135 | Comma-separated list of trusted users. |
|
1147 | Comma-separated list of trusted users. | |
1136 |
|
1148 | |||
1137 | ``groups`` |
|
1149 | ``groups`` | |
1138 | Comma-separated list of trusted groups. |
|
1150 | Comma-separated list of trusted groups. | |
1139 |
|
1151 | |||
1140 |
|
1152 | |||
1141 | ``ui`` |
|
1153 | ``ui`` | |
1142 | ------ |
|
1154 | ------ | |
1143 |
|
1155 | |||
1144 | User interface controls. |
|
1156 | User interface controls. | |
1145 |
|
1157 | |||
1146 | ``archivemeta`` |
|
1158 | ``archivemeta`` | |
1147 | Whether to include the .hg_archival.txt file containing meta data |
|
1159 | Whether to include the .hg_archival.txt file containing meta data | |
1148 | (hashes for the repository base and for tip) in archives created |
|
1160 | (hashes for the repository base and for tip) in archives created | |
1149 | by the :hg:`archive` command or downloaded via hgweb. |
|
1161 | by the :hg:`archive` command or downloaded via hgweb. | |
1150 | Default is True. |
|
1162 | Default is True. | |
1151 |
|
1163 | |||
1152 | ``askusername`` |
|
1164 | ``askusername`` | |
1153 | Whether to prompt for a username when committing. If True, and |
|
1165 | Whether to prompt for a username when committing. If True, and | |
1154 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1166 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
1155 | be prompted to enter a username. If no username is entered, the |
|
1167 | be prompted to enter a username. If no username is entered, the | |
1156 | default ``USER@HOST`` is used instead. |
|
1168 | default ``USER@HOST`` is used instead. | |
1157 | Default is False. |
|
1169 | Default is False. | |
1158 |
|
1170 | |||
1159 | ``commitsubrepos`` |
|
1171 | ``commitsubrepos`` | |
1160 | Whether to commit modified subrepositories when committing the |
|
1172 | Whether to commit modified subrepositories when committing the | |
1161 | parent repository. If False and one subrepository has uncommitted |
|
1173 | parent repository. If False and one subrepository has uncommitted | |
1162 | changes, abort the commit. |
|
1174 | changes, abort the commit. | |
1163 | Default is False. |
|
1175 | Default is False. | |
1164 |
|
1176 | |||
1165 | ``debug`` |
|
1177 | ``debug`` | |
1166 | Print debugging information. True or False. Default is False. |
|
1178 | Print debugging information. True or False. Default is False. | |
1167 |
|
1179 | |||
1168 | ``editor`` |
|
1180 | ``editor`` | |
1169 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. |
|
1181 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. | |
1170 |
|
1182 | |||
1171 | ``fallbackencoding`` |
|
1183 | ``fallbackencoding`` | |
1172 | Encoding to try if it's not possible to decode the changelog using |
|
1184 | Encoding to try if it's not possible to decode the changelog using | |
1173 | UTF-8. Default is ISO-8859-1. |
|
1185 | UTF-8. Default is ISO-8859-1. | |
1174 |
|
1186 | |||
1175 | ``ignore`` |
|
1187 | ``ignore`` | |
1176 | A file to read per-user ignore patterns from. This file should be |
|
1188 | A file to read per-user ignore patterns from. This file should be | |
1177 | in the same format as a repository-wide .hgignore file. This |
|
1189 | in the same format as a repository-wide .hgignore file. This | |
1178 | option supports hook syntax, so if you want to specify multiple |
|
1190 | option supports hook syntax, so if you want to specify multiple | |
1179 | ignore files, you can do so by setting something like |
|
1191 | ignore files, you can do so by setting something like | |
1180 | ``ignore.other = ~/.hgignore2``. For details of the ignore file |
|
1192 | ``ignore.other = ~/.hgignore2``. For details of the ignore file | |
1181 | format, see the ``hgignore(5)`` man page. |
|
1193 | format, see the ``hgignore(5)`` man page. | |
1182 |
|
1194 | |||
1183 | ``interactive`` |
|
1195 | ``interactive`` | |
1184 | Allow to prompt the user. True or False. Default is True. |
|
1196 | Allow to prompt the user. True or False. Default is True. | |
1185 |
|
1197 | |||
1186 | ``logtemplate`` |
|
1198 | ``logtemplate`` | |
1187 | Template string for commands that print changesets. |
|
1199 | Template string for commands that print changesets. | |
1188 |
|
1200 | |||
1189 | ``merge`` |
|
1201 | ``merge`` | |
1190 | The conflict resolution program to use during a manual merge. |
|
1202 | The conflict resolution program to use during a manual merge. | |
1191 | For more information on merge tools see :hg:`help merge-tools`. |
|
1203 | For more information on merge tools see :hg:`help merge-tools`. | |
1192 | For configuring merge tools see the ``[merge-tools]`` section. |
|
1204 | For configuring merge tools see the ``[merge-tools]`` section. | |
1193 |
|
1205 | |||
1194 | ``portablefilenames`` |
|
1206 | ``portablefilenames`` | |
1195 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
1207 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. | |
1196 | Default is ``warn``. |
|
1208 | Default is ``warn``. | |
1197 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX |
|
1209 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX | |
1198 | platforms, if a file with a non-portable filename is added (e.g. a file |
|
1210 | platforms, if a file with a non-portable filename is added (e.g. a file | |
1199 | with a name that can't be created on Windows because it contains reserved |
|
1211 | with a name that can't be created on Windows because it contains reserved | |
1200 | parts like ``AUX``, reserved characters like ``:``, or would cause a case |
|
1212 | parts like ``AUX``, reserved characters like ``:``, or would cause a case | |
1201 | collision with an existing file). |
|
1213 | collision with an existing file). | |
1202 | If set to ``ignore`` (or ``false``), no warning is printed. |
|
1214 | If set to ``ignore`` (or ``false``), no warning is printed. | |
1203 | If set to ``abort``, the command is aborted. |
|
1215 | If set to ``abort``, the command is aborted. | |
1204 | On Windows, this configuration option is ignored and the command aborted. |
|
1216 | On Windows, this configuration option is ignored and the command aborted. | |
1205 |
|
1217 | |||
1206 | ``quiet`` |
|
1218 | ``quiet`` | |
1207 | Reduce the amount of output printed. True or False. Default is False. |
|
1219 | Reduce the amount of output printed. True or False. Default is False. | |
1208 |
|
1220 | |||
1209 | ``remotecmd`` |
|
1221 | ``remotecmd`` | |
1210 | remote command to use for clone/push/pull operations. Default is ``hg``. |
|
1222 | remote command to use for clone/push/pull operations. Default is ``hg``. | |
1211 |
|
1223 | |||
1212 | ``reportoldssl`` |
|
1224 | ``reportoldssl`` | |
1213 | Warn if an SSL certificate is unable to be due to using Python |
|
1225 | Warn if an SSL certificate is unable to be due to using Python | |
1214 | 2.5 or earlier. True or False. Default is True. |
|
1226 | 2.5 or earlier. True or False. Default is True. | |
1215 |
|
1227 | |||
1216 | ``report_untrusted`` |
|
1228 | ``report_untrusted`` | |
1217 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
1229 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
1218 | trusted user or group. True or False. Default is True. |
|
1230 | trusted user or group. True or False. Default is True. | |
1219 |
|
1231 | |||
1220 | ``slash`` |
|
1232 | ``slash`` | |
1221 | Display paths using a slash (``/``) as the path separator. This |
|
1233 | Display paths using a slash (``/``) as the path separator. This | |
1222 | only makes a difference on systems where the default path |
|
1234 | only makes a difference on systems where the default path | |
1223 | separator is not the slash character (e.g. Windows uses the |
|
1235 | separator is not the slash character (e.g. Windows uses the | |
1224 | backslash character (``\``)). |
|
1236 | backslash character (``\``)). | |
1225 | Default is False. |
|
1237 | Default is False. | |
1226 |
|
1238 | |||
1227 | ``ssh`` |
|
1239 | ``ssh`` | |
1228 | command to use for SSH connections. Default is ``ssh``. |
|
1240 | command to use for SSH connections. Default is ``ssh``. | |
1229 |
|
1241 | |||
1230 | ``strict`` |
|
1242 | ``strict`` | |
1231 | Require exact command names, instead of allowing unambiguous |
|
1243 | Require exact command names, instead of allowing unambiguous | |
1232 | abbreviations. True or False. Default is False. |
|
1244 | abbreviations. True or False. Default is False. | |
1233 |
|
1245 | |||
1234 | ``style`` |
|
1246 | ``style`` | |
1235 | Name of style to use for command output. |
|
1247 | Name of style to use for command output. | |
1236 |
|
1248 | |||
1237 | ``timeout`` |
|
1249 | ``timeout`` | |
1238 | The timeout used when a lock is held (in seconds), a negative value |
|
1250 | The timeout used when a lock is held (in seconds), a negative value | |
1239 | means no timeout. Default is 600. |
|
1251 | means no timeout. Default is 600. | |
1240 |
|
1252 | |||
1241 | ``traceback`` |
|
1253 | ``traceback`` | |
1242 | Mercurial always prints a traceback when an unknown exception |
|
1254 | Mercurial always prints a traceback when an unknown exception | |
1243 | occurs. Setting this to True will make Mercurial print a traceback |
|
1255 | occurs. Setting this to True will make Mercurial print a traceback | |
1244 | on all exceptions, even those recognized by Mercurial (such as |
|
1256 | on all exceptions, even those recognized by Mercurial (such as | |
1245 | IOError or MemoryError). Default is False. |
|
1257 | IOError or MemoryError). Default is False. | |
1246 |
|
1258 | |||
1247 | ``username`` |
|
1259 | ``username`` | |
1248 | The committer of a changeset created when running "commit". |
|
1260 | The committer of a changeset created when running "commit". | |
1249 | Typically a person's name and email address, e.g. ``Fred Widget |
|
1261 | Typically a person's name and email address, e.g. ``Fred Widget | |
1250 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If |
|
1262 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If | |
1251 | the username in hgrc is empty, it has to be specified manually or |
|
1263 | the username in hgrc is empty, it has to be specified manually or | |
1252 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set |
|
1264 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set | |
1253 | ``username =`` in the system hgrc). Environment variables in the |
|
1265 | ``username =`` in the system hgrc). Environment variables in the | |
1254 | username are expanded. |
|
1266 | username are expanded. | |
1255 |
|
1267 | |||
1256 | ``verbose`` |
|
1268 | ``verbose`` | |
1257 | Increase the amount of output printed. True or False. Default is False. |
|
1269 | Increase the amount of output printed. True or False. Default is False. | |
1258 |
|
1270 | |||
1259 |
|
1271 | |||
1260 | ``web`` |
|
1272 | ``web`` | |
1261 | ------- |
|
1273 | ------- | |
1262 |
|
1274 | |||
1263 | Web interface configuration. The settings in this section apply to |
|
1275 | Web interface configuration. The settings in this section apply to | |
1264 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
1276 | both the builtin webserver (started by :hg:`serve`) and the script you | |
1265 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
1277 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI | |
1266 | and WSGI). |
|
1278 | and WSGI). | |
1267 |
|
1279 | |||
1268 | The Mercurial webserver does no authentication (it does not prompt for |
|
1280 | The Mercurial webserver does no authentication (it does not prompt for | |
1269 | usernames and passwords to validate *who* users are), but it does do |
|
1281 | usernames and passwords to validate *who* users are), but it does do | |
1270 | authorization (it grants or denies access for *authenticated users* |
|
1282 | authorization (it grants or denies access for *authenticated users* | |
1271 | based on settings in this section). You must either configure your |
|
1283 | based on settings in this section). You must either configure your | |
1272 | webserver to do authentication for you, or disable the authorization |
|
1284 | webserver to do authentication for you, or disable the authorization | |
1273 | checks. |
|
1285 | checks. | |
1274 |
|
1286 | |||
1275 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
1287 | For a quick setup in a trusted environment, e.g., a private LAN, where | |
1276 | you want it to accept pushes from anybody, you can use the following |
|
1288 | you want it to accept pushes from anybody, you can use the following | |
1277 | command line:: |
|
1289 | command line:: | |
1278 |
|
1290 | |||
1279 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
1291 | $ hg --config web.allow_push=* --config web.push_ssl=False serve | |
1280 |
|
1292 | |||
1281 | Note that this will allow anybody to push anything to the server and |
|
1293 | Note that this will allow anybody to push anything to the server and | |
1282 | that this should not be used for public servers. |
|
1294 | that this should not be used for public servers. | |
1283 |
|
1295 | |||
1284 | The full set of options is: |
|
1296 | The full set of options is: | |
1285 |
|
1297 | |||
1286 | ``accesslog`` |
|
1298 | ``accesslog`` | |
1287 | Where to output the access log. Default is stdout. |
|
1299 | Where to output the access log. Default is stdout. | |
1288 |
|
1300 | |||
1289 | ``address`` |
|
1301 | ``address`` | |
1290 | Interface address to bind to. Default is all. |
|
1302 | Interface address to bind to. Default is all. | |
1291 |
|
1303 | |||
1292 | ``allow_archive`` |
|
1304 | ``allow_archive`` | |
1293 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
1305 | List of archive format (bz2, gz, zip) allowed for downloading. | |
1294 | Default is empty. |
|
1306 | Default is empty. | |
1295 |
|
1307 | |||
1296 | ``allowbz2`` |
|
1308 | ``allowbz2`` | |
1297 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
1309 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
1298 | revisions. |
|
1310 | revisions. | |
1299 | Default is False. |
|
1311 | Default is False. | |
1300 |
|
1312 | |||
1301 | ``allowgz`` |
|
1313 | ``allowgz`` | |
1302 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
1314 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
1303 | revisions. |
|
1315 | revisions. | |
1304 | Default is False. |
|
1316 | Default is False. | |
1305 |
|
1317 | |||
1306 | ``allowpull`` |
|
1318 | ``allowpull`` | |
1307 | Whether to allow pulling from the repository. Default is True. |
|
1319 | Whether to allow pulling from the repository. Default is True. | |
1308 |
|
1320 | |||
1309 | ``allow_push`` |
|
1321 | ``allow_push`` | |
1310 | Whether to allow pushing to the repository. If empty or not set, |
|
1322 | Whether to allow pushing to the repository. If empty or not set, | |
1311 | push is not allowed. If the special value ``*``, any remote user can |
|
1323 | push is not allowed. If the special value ``*``, any remote user can | |
1312 | push, including unauthenticated users. Otherwise, the remote user |
|
1324 | push, including unauthenticated users. Otherwise, the remote user | |
1313 | must have been authenticated, and the authenticated user name must |
|
1325 | must have been authenticated, and the authenticated user name must | |
1314 | be present in this list. The contents of the allow_push list are |
|
1326 | be present in this list. The contents of the allow_push list are | |
1315 | examined after the deny_push list. |
|
1327 | examined after the deny_push list. | |
1316 |
|
1328 | |||
1317 | ``allow_read`` |
|
1329 | ``allow_read`` | |
1318 | If the user has not already been denied repository access due to |
|
1330 | If the user has not already been denied repository access due to | |
1319 | the contents of deny_read, this list determines whether to grant |
|
1331 | the contents of deny_read, this list determines whether to grant | |
1320 | repository access to the user. If this list is not empty, and the |
|
1332 | repository access to the user. If this list is not empty, and the | |
1321 | user is unauthenticated or not present in the list, then access is |
|
1333 | user is unauthenticated or not present in the list, then access is | |
1322 | denied for the user. If the list is empty or not set, then access |
|
1334 | denied for the user. If the list is empty or not set, then access | |
1323 | is permitted to all users by default. Setting allow_read to the |
|
1335 | is permitted to all users by default. Setting allow_read to the | |
1324 | special value ``*`` is equivalent to it not being set (i.e. access |
|
1336 | special value ``*`` is equivalent to it not being set (i.e. access | |
1325 | is permitted to all users). The contents of the allow_read list are |
|
1337 | is permitted to all users). The contents of the allow_read list are | |
1326 | examined after the deny_read list. |
|
1338 | examined after the deny_read list. | |
1327 |
|
1339 | |||
1328 | ``allowzip`` |
|
1340 | ``allowzip`` | |
1329 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
1341 | (DEPRECATED) Whether to allow .zip downloading of repository | |
1330 | revisions. Default is False. This feature creates temporary files. |
|
1342 | revisions. Default is False. This feature creates temporary files. | |
1331 |
|
1343 | |||
1332 | ``archivesubrepos`` |
|
1344 | ``archivesubrepos`` | |
1333 | Whether to recurse into subrepositories when archiving. Default is |
|
1345 | Whether to recurse into subrepositories when archiving. Default is | |
1334 | False. |
|
1346 | False. | |
1335 |
|
1347 | |||
1336 | ``baseurl`` |
|
1348 | ``baseurl`` | |
1337 | Base URL to use when publishing URLs in other locations, so |
|
1349 | Base URL to use when publishing URLs in other locations, so | |
1338 | third-party tools like email notification hooks can construct |
|
1350 | third-party tools like email notification hooks can construct | |
1339 | URLs. Example: ``http://hgserver/repos/``. |
|
1351 | URLs. Example: ``http://hgserver/repos/``. | |
1340 |
|
1352 | |||
1341 | ``cacerts`` |
|
1353 | ``cacerts`` | |
1342 | Path to file containing a list of PEM encoded certificate |
|
1354 | Path to file containing a list of PEM encoded certificate | |
1343 | authority certificates. Environment variables and ``~user`` |
|
1355 | authority certificates. Environment variables and ``~user`` | |
1344 | constructs are expanded in the filename. If specified on the |
|
1356 | constructs are expanded in the filename. If specified on the | |
1345 | client, then it will verify the identity of remote HTTPS servers |
|
1357 | client, then it will verify the identity of remote HTTPS servers | |
1346 | with these certificates. |
|
1358 | with these certificates. | |
1347 |
|
1359 | |||
1348 | This feature is only supported when using Python 2.6 or later. If you wish |
|
1360 | This feature is only supported when using Python 2.6 or later. If you wish | |
1349 | to use it with earlier versions of Python, install the backported |
|
1361 | to use it with earlier versions of Python, install the backported | |
1350 | version of the ssl library that is available from |
|
1362 | version of the ssl library that is available from | |
1351 | ``http://pypi.python.org``. |
|
1363 | ``http://pypi.python.org``. | |
1352 |
|
1364 | |||
1353 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
1365 | To disable SSL verification temporarily, specify ``--insecure`` from | |
1354 | command line. |
|
1366 | command line. | |
1355 |
|
1367 | |||
1356 | You can use OpenSSL's CA certificate file if your platform has |
|
1368 | You can use OpenSSL's CA certificate file if your platform has | |
1357 | one. On most Linux systems this will be |
|
1369 | one. On most Linux systems this will be | |
1358 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
1370 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to | |
1359 | generate this file manually. The form must be as follows:: |
|
1371 | generate this file manually. The form must be as follows:: | |
1360 |
|
1372 | |||
1361 | -----BEGIN CERTIFICATE----- |
|
1373 | -----BEGIN CERTIFICATE----- | |
1362 | ... (certificate in base64 PEM encoding) ... |
|
1374 | ... (certificate in base64 PEM encoding) ... | |
1363 | -----END CERTIFICATE----- |
|
1375 | -----END CERTIFICATE----- | |
1364 | -----BEGIN CERTIFICATE----- |
|
1376 | -----BEGIN CERTIFICATE----- | |
1365 | ... (certificate in base64 PEM encoding) ... |
|
1377 | ... (certificate in base64 PEM encoding) ... | |
1366 | -----END CERTIFICATE----- |
|
1378 | -----END CERTIFICATE----- | |
1367 |
|
1379 | |||
1368 | ``cache`` |
|
1380 | ``cache`` | |
1369 | Whether to support caching in hgweb. Defaults to True. |
|
1381 | Whether to support caching in hgweb. Defaults to True. | |
1370 |
|
1382 | |||
1371 | ``collapse`` |
|
1383 | ``collapse`` | |
1372 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
1384 | With ``descend`` enabled, repositories in subdirectories are shown at | |
1373 | a single level alongside repositories in the current path. With |
|
1385 | a single level alongside repositories in the current path. With | |
1374 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
1386 | ``collapse`` also enabled, repositories residing at a deeper level than | |
1375 | the current path are grouped behind navigable directory entries that |
|
1387 | the current path are grouped behind navigable directory entries that | |
1376 | lead to the locations of these repositories. In effect, this setting |
|
1388 | lead to the locations of these repositories. In effect, this setting | |
1377 | collapses each collection of repositories found within a subdirectory |
|
1389 | collapses each collection of repositories found within a subdirectory | |
1378 | into a single entry for that subdirectory. Default is False. |
|
1390 | into a single entry for that subdirectory. Default is False. | |
1379 |
|
1391 | |||
1380 | ``comparisoncontext`` |
|
1392 | ``comparisoncontext`` | |
1381 | Number of lines of context to show in side-by-side file comparison. If |
|
1393 | Number of lines of context to show in side-by-side file comparison. If | |
1382 | negative or the value ``full``, whole files are shown. Default is 5. |
|
1394 | negative or the value ``full``, whole files are shown. Default is 5. | |
1383 | This setting can be overridden by a ``context`` request parameter to the |
|
1395 | This setting can be overridden by a ``context`` request parameter to the | |
1384 | ``comparison`` command, taking the same values. |
|
1396 | ``comparison`` command, taking the same values. | |
1385 |
|
1397 | |||
1386 | ``contact`` |
|
1398 | ``contact`` | |
1387 | Name or email address of the person in charge of the repository. |
|
1399 | Name or email address of the person in charge of the repository. | |
1388 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. |
|
1400 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. | |
1389 |
|
1401 | |||
1390 | ``deny_push`` |
|
1402 | ``deny_push`` | |
1391 | Whether to deny pushing to the repository. If empty or not set, |
|
1403 | Whether to deny pushing to the repository. If empty or not set, | |
1392 | push is not denied. If the special value ``*``, all remote users are |
|
1404 | push is not denied. If the special value ``*``, all remote users are | |
1393 | denied push. Otherwise, unauthenticated users are all denied, and |
|
1405 | denied push. Otherwise, unauthenticated users are all denied, and | |
1394 | any authenticated user name present in this list is also denied. The |
|
1406 | any authenticated user name present in this list is also denied. The | |
1395 | contents of the deny_push list are examined before the allow_push list. |
|
1407 | contents of the deny_push list are examined before the allow_push list. | |
1396 |
|
1408 | |||
1397 | ``deny_read`` |
|
1409 | ``deny_read`` | |
1398 | Whether to deny reading/viewing of the repository. If this list is |
|
1410 | Whether to deny reading/viewing of the repository. If this list is | |
1399 | not empty, unauthenticated users are all denied, and any |
|
1411 | not empty, unauthenticated users are all denied, and any | |
1400 | authenticated user name present in this list is also denied access to |
|
1412 | authenticated user name present in this list is also denied access to | |
1401 | the repository. If set to the special value ``*``, all remote users |
|
1413 | the repository. If set to the special value ``*``, all remote users | |
1402 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
1414 | are denied access (rarely needed ;). If deny_read is empty or not set, | |
1403 | the determination of repository access depends on the presence and |
|
1415 | the determination of repository access depends on the presence and | |
1404 | content of the allow_read list (see description). If both |
|
1416 | content of the allow_read list (see description). If both | |
1405 | deny_read and allow_read are empty or not set, then access is |
|
1417 | deny_read and allow_read are empty or not set, then access is | |
1406 | permitted to all users by default. If the repository is being |
|
1418 | permitted to all users by default. If the repository is being | |
1407 | served via hgwebdir, denied users will not be able to see it in |
|
1419 | served via hgwebdir, denied users will not be able to see it in | |
1408 | the list of repositories. The contents of the deny_read list have |
|
1420 | the list of repositories. The contents of the deny_read list have | |
1409 | priority over (are examined before) the contents of the allow_read |
|
1421 | priority over (are examined before) the contents of the allow_read | |
1410 | list. |
|
1422 | list. | |
1411 |
|
1423 | |||
1412 | ``descend`` |
|
1424 | ``descend`` | |
1413 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
1425 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
1414 | directly in the current path will be shown (other repositories are still |
|
1426 | directly in the current path will be shown (other repositories are still | |
1415 | available from the index corresponding to their containing path). |
|
1427 | available from the index corresponding to their containing path). | |
1416 |
|
1428 | |||
1417 | ``description`` |
|
1429 | ``description`` | |
1418 | Textual description of the repository's purpose or contents. |
|
1430 | Textual description of the repository's purpose or contents. | |
1419 | Default is "unknown". |
|
1431 | Default is "unknown". | |
1420 |
|
1432 | |||
1421 | ``encoding`` |
|
1433 | ``encoding`` | |
1422 | Character encoding name. Default is the current locale charset. |
|
1434 | Character encoding name. Default is the current locale charset. | |
1423 | Example: "UTF-8" |
|
1435 | Example: "UTF-8" | |
1424 |
|
1436 | |||
1425 | ``errorlog`` |
|
1437 | ``errorlog`` | |
1426 | Where to output the error log. Default is stderr. |
|
1438 | Where to output the error log. Default is stderr. | |
1427 |
|
1439 | |||
1428 | ``guessmime`` |
|
1440 | ``guessmime`` | |
1429 | Control MIME types for raw download of file content. |
|
1441 | Control MIME types for raw download of file content. | |
1430 | Set to True to let hgweb guess the content type from the file |
|
1442 | Set to True to let hgweb guess the content type from the file | |
1431 | extension. This will serve HTML files as ``text/html`` and might |
|
1443 | extension. This will serve HTML files as ``text/html`` and might | |
1432 | allow cross-site scripting attacks when serving untrusted |
|
1444 | allow cross-site scripting attacks when serving untrusted | |
1433 | repositories. Default is False. |
|
1445 | repositories. Default is False. | |
1434 |
|
1446 | |||
1435 | ``hidden`` |
|
1447 | ``hidden`` | |
1436 | Whether to hide the repository in the hgwebdir index. |
|
1448 | Whether to hide the repository in the hgwebdir index. | |
1437 | Default is False. |
|
1449 | Default is False. | |
1438 |
|
1450 | |||
1439 | ``ipv6`` |
|
1451 | ``ipv6`` | |
1440 | Whether to use IPv6. Default is False. |
|
1452 | Whether to use IPv6. Default is False. | |
1441 |
|
1453 | |||
1442 | ``logoimg`` |
|
1454 | ``logoimg`` | |
1443 | File name of the logo image that some templates display on each page. |
|
1455 | File name of the logo image that some templates display on each page. | |
1444 | The file name is relative to ``staticurl``. That is, the full path to |
|
1456 | The file name is relative to ``staticurl``. That is, the full path to | |
1445 | the logo image is "staticurl/logoimg". |
|
1457 | the logo image is "staticurl/logoimg". | |
1446 | If unset, ``hglogo.png`` will be used. |
|
1458 | If unset, ``hglogo.png`` will be used. | |
1447 |
|
1459 | |||
1448 | ``logourl`` |
|
1460 | ``logourl`` | |
1449 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` |
|
1461 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` | |
1450 | will be used. |
|
1462 | will be used. | |
1451 |
|
1463 | |||
1452 | ``maxchanges`` |
|
1464 | ``maxchanges`` | |
1453 | Maximum number of changes to list on the changelog. Default is 10. |
|
1465 | Maximum number of changes to list on the changelog. Default is 10. | |
1454 |
|
1466 | |||
1455 | ``maxfiles`` |
|
1467 | ``maxfiles`` | |
1456 | Maximum number of files to list per changeset. Default is 10. |
|
1468 | Maximum number of files to list per changeset. Default is 10. | |
1457 |
|
1469 | |||
1458 | ``maxshortchanges`` |
|
1470 | ``maxshortchanges`` | |
1459 | Maximum number of changes to list on the shortlog, graph or filelog |
|
1471 | Maximum number of changes to list on the shortlog, graph or filelog | |
1460 | pages. Default is 60. |
|
1472 | pages. Default is 60. | |
1461 |
|
1473 | |||
1462 | ``name`` |
|
1474 | ``name`` | |
1463 | Repository name to use in the web interface. Default is current |
|
1475 | Repository name to use in the web interface. Default is current | |
1464 | working directory. |
|
1476 | working directory. | |
1465 |
|
1477 | |||
1466 | ``port`` |
|
1478 | ``port`` | |
1467 | Port to listen on. Default is 8000. |
|
1479 | Port to listen on. Default is 8000. | |
1468 |
|
1480 | |||
1469 | ``prefix`` |
|
1481 | ``prefix`` | |
1470 | Prefix path to serve from. Default is '' (server root). |
|
1482 | Prefix path to serve from. Default is '' (server root). | |
1471 |
|
1483 | |||
1472 | ``push_ssl`` |
|
1484 | ``push_ssl`` | |
1473 | Whether to require that inbound pushes be transported over SSL to |
|
1485 | Whether to require that inbound pushes be transported over SSL to | |
1474 | prevent password sniffing. Default is True. |
|
1486 | prevent password sniffing. Default is True. | |
1475 |
|
1487 | |||
1476 | ``staticurl`` |
|
1488 | ``staticurl`` | |
1477 | Base URL to use for static files. If unset, static files (e.g. the |
|
1489 | Base URL to use for static files. If unset, static files (e.g. the | |
1478 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
1490 | hgicon.png favicon) will be served by the CGI script itself. Use | |
1479 | this setting to serve them directly with the HTTP server. |
|
1491 | this setting to serve them directly with the HTTP server. | |
1480 | Example: ``http://hgserver/static/``. |
|
1492 | Example: ``http://hgserver/static/``. | |
1481 |
|
1493 | |||
1482 | ``stripes`` |
|
1494 | ``stripes`` | |
1483 | How many lines a "zebra stripe" should span in multi-line output. |
|
1495 | How many lines a "zebra stripe" should span in multi-line output. | |
1484 | Default is 1; set to 0 to disable. |
|
1496 | Default is 1; set to 0 to disable. | |
1485 |
|
1497 | |||
1486 | ``style`` |
|
1498 | ``style`` | |
1487 | Which template map style to use. |
|
1499 | Which template map style to use. | |
1488 |
|
1500 | |||
1489 | ``templates`` |
|
1501 | ``templates`` | |
1490 | Where to find the HTML templates. Default is install path. |
|
1502 | Where to find the HTML templates. Default is install path. | |
1491 |
|
1503 | |||
1492 | ``websub`` |
|
1504 | ``websub`` | |
1493 | ---------- |
|
1505 | ---------- | |
1494 |
|
1506 | |||
1495 | Web substitution filter definition. You can use this section to |
|
1507 | Web substitution filter definition. You can use this section to | |
1496 | define a set of regular expression substitution patterns which |
|
1508 | define a set of regular expression substitution patterns which | |
1497 | let you automatically modify the hgweb server output. |
|
1509 | let you automatically modify the hgweb server output. | |
1498 |
|
1510 | |||
1499 | The default hgweb templates only apply these substitution patterns |
|
1511 | The default hgweb templates only apply these substitution patterns | |
1500 | on the revision description fields. You can apply them anywhere |
|
1512 | on the revision description fields. You can apply them anywhere | |
1501 | you want when you create your own templates by adding calls to the |
|
1513 | you want when you create your own templates by adding calls to the | |
1502 | "websub" filter (usually after calling the "escape" filter). |
|
1514 | "websub" filter (usually after calling the "escape" filter). | |
1503 |
|
1515 | |||
1504 | This can be used, for example, to convert issue references to links |
|
1516 | This can be used, for example, to convert issue references to links | |
1505 | to your issue tracker, or to convert "markdown-like" syntax into |
|
1517 | to your issue tracker, or to convert "markdown-like" syntax into | |
1506 | HTML (see the examples below). |
|
1518 | HTML (see the examples below). | |
1507 |
|
1519 | |||
1508 | Each entry in this section names a substitution filter. |
|
1520 | Each entry in this section names a substitution filter. | |
1509 | The value of each entry defines the substitution expression itself. |
|
1521 | The value of each entry defines the substitution expression itself. | |
1510 | The websub expressions follow the old interhg extension syntax, |
|
1522 | The websub expressions follow the old interhg extension syntax, | |
1511 | which in turn imitates the Unix sed replacement syntax:: |
|
1523 | which in turn imitates the Unix sed replacement syntax:: | |
1512 |
|
1524 | |||
1513 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
1525 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] | |
1514 |
|
1526 | |||
1515 | You can use any separator other than "/". The final "i" is optional |
|
1527 | You can use any separator other than "/". The final "i" is optional | |
1516 | and indicates that the search must be case insensitive. |
|
1528 | and indicates that the search must be case insensitive. | |
1517 |
|
1529 | |||
1518 | Examples:: |
|
1530 | Examples:: | |
1519 |
|
1531 | |||
1520 | [websub] |
|
1532 | [websub] | |
1521 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
1533 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i | |
1522 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
1534 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ | |
1523 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
1535 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ | |
1524 |
|
1536 | |||
1525 | ``worker`` |
|
1537 | ``worker`` | |
1526 | ---------- |
|
1538 | ---------- | |
1527 |
|
1539 | |||
1528 | Parallel master/worker configuration. We currently perform working |
|
1540 | Parallel master/worker configuration. We currently perform working | |
1529 | directory updates in parallel on Unix-like systems, which greatly |
|
1541 | directory updates in parallel on Unix-like systems, which greatly | |
1530 | helps performance. |
|
1542 | helps performance. | |
1531 |
|
1543 | |||
1532 | ``numcpus`` |
|
1544 | ``numcpus`` | |
1533 | Number of CPUs to use for parallel operations. Default is 4 or the |
|
1545 | Number of CPUs to use for parallel operations. Default is 4 or the | |
1534 | number of CPUs on the system, whichever is larger. A zero or |
|
1546 | number of CPUs on the system, whichever is larger. A zero or | |
1535 | negative value is treated as ``use the default``. |
|
1547 | negative value is treated as ``use the default``. |
@@ -1,89 +1,90 b'' | |||||
1 | Synopsis |
|
1 | Synopsis | |
2 | ======== |
|
2 | ======== | |
3 |
|
3 | |||
4 | The Mercurial system uses a file called ``.hgignore`` in the root |
|
4 | The Mercurial system uses a file called ``.hgignore`` in the root | |
5 | directory of a repository to control its behavior when it searches |
|
5 | directory of a repository to control its behavior when it searches | |
6 | for files that it is not currently tracking. |
|
6 | for files that it is not currently tracking. | |
7 |
|
7 | |||
8 | Description |
|
8 | Description | |
9 | =========== |
|
9 | =========== | |
10 |
|
10 | |||
11 | The working directory of a Mercurial repository will often contain |
|
11 | The working directory of a Mercurial repository will often contain | |
12 | files that should not be tracked by Mercurial. These include backup |
|
12 | files that should not be tracked by Mercurial. These include backup | |
13 | files created by editors and build products created by compilers. |
|
13 | files created by editors and build products created by compilers. | |
14 | These files can be ignored by listing them in a ``.hgignore`` file in |
|
14 | These files can be ignored by listing them in a ``.hgignore`` file in | |
15 | the root of the working directory. The ``.hgignore`` file must be |
|
15 | the root of the working directory. The ``.hgignore`` file must be | |
16 | created manually. It is typically put under version control, so that |
|
16 | created manually. It is typically put under version control, so that | |
17 | the settings will propagate to other repositories with push and pull. |
|
17 | the settings will propagate to other repositories with push and pull. | |
18 |
|
18 | |||
19 | An untracked file is ignored if its path relative to the repository |
|
19 | An untracked file is ignored if its path relative to the repository | |
20 | root directory, or any prefix path of that path, is matched against |
|
20 | root directory, or any prefix path of that path, is matched against | |
21 | any pattern in ``.hgignore``. |
|
21 | any pattern in ``.hgignore``. | |
22 |
|
22 | |||
23 | For example, say we have an untracked file, ``file.c``, at |
|
23 | For example, say we have an untracked file, ``file.c``, at | |
24 | ``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c`` |
|
24 | ``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c`` | |
25 | if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``. |
|
25 | if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``. | |
26 |
|
26 | |||
27 | In addition, a Mercurial configuration file can reference a set of |
|
27 | In addition, a Mercurial configuration file can reference a set of | |
28 | per-user or global ignore files. See the ``ignore`` configuration |
|
28 | per-user or global ignore files. See the ``ignore`` configuration | |
29 | key on the ``[ui]`` section of :hg:`help config` for details of how to |
|
29 | key on the ``[ui]`` section of :hg:`help config` for details of how to | |
30 | configure these files. |
|
30 | configure these files. | |
31 |
|
31 | |||
32 | To control Mercurial's handling of files that it manages, many |
|
32 | To control Mercurial's handling of files that it manages, many | |
33 | commands support the ``-I`` and ``-X`` options; see |
|
33 | commands support the ``-I`` and ``-X`` options; see | |
34 | :hg:`help <command>` and :hg:`help patterns` for details. |
|
34 | :hg:`help <command>` and :hg:`help patterns` for details. | |
35 |
|
35 | |||
36 | Files that are already tracked are not affected by .hgignore, even |
|
36 | Files that are already tracked are not affected by .hgignore, even | |
37 | if they appear in .hgignore. An untracked file X can be explicitly |
|
37 | if they appear in .hgignore. An untracked file X can be explicitly | |
38 | added with :hg:`add X`, even if X would be excluded by a pattern |
|
38 | added with :hg:`add X`, even if X would be excluded by a pattern | |
39 | in .hgignore. |
|
39 | in .hgignore. | |
40 |
|
40 | |||
41 | Syntax |
|
41 | Syntax | |
42 | ====== |
|
42 | ====== | |
43 |
|
43 | |||
44 | An ignore file is a plain text file consisting of a list of patterns, |
|
44 | An ignore file is a plain text file consisting of a list of patterns, | |
45 | with one pattern per line. Empty lines are skipped. The ``#`` |
|
45 | with one pattern per line. Empty lines are skipped. The ``#`` | |
46 | character is treated as a comment character, and the ``\`` character |
|
46 | character is treated as a comment character, and the ``\`` character | |
47 | is treated as an escape character. |
|
47 | is treated as an escape character. | |
48 |
|
48 | |||
49 | Mercurial supports several pattern syntaxes. The default syntax used |
|
49 | Mercurial supports several pattern syntaxes. The default syntax used | |
50 | is Python/Perl-style regular expressions. |
|
50 | is Python/Perl-style regular expressions. | |
51 |
|
51 | |||
52 | To change the syntax used, use a line of the following form:: |
|
52 | To change the syntax used, use a line of the following form:: | |
53 |
|
53 | |||
54 | syntax: NAME |
|
54 | syntax: NAME | |
55 |
|
55 | |||
56 | where ``NAME`` is one of the following: |
|
56 | where ``NAME`` is one of the following: | |
57 |
|
57 | |||
58 | ``regexp`` |
|
58 | ``regexp`` | |
59 | Regular expression, Python/Perl syntax. |
|
59 | Regular expression, Python/Perl syntax. | |
60 | ``glob`` |
|
60 | ``glob`` | |
61 | Shell-style glob. |
|
61 | Shell-style glob. | |
62 |
|
62 | |||
63 | The chosen syntax stays in effect when parsing all patterns that |
|
63 | The chosen syntax stays in effect when parsing all patterns that | |
64 | follow, until another syntax is selected. |
|
64 | follow, until another syntax is selected. | |
65 |
|
65 | |||
66 | Neither glob nor regexp patterns are rooted. A glob-syntax pattern of |
|
66 | Neither glob nor regexp patterns are rooted. A glob-syntax pattern of | |
67 | the form ``*.c`` will match a file ending in ``.c`` in any directory, |
|
67 | the form ``*.c`` will match a file ending in ``.c`` in any directory, | |
68 | and a regexp pattern of the form ``\.c$`` will do the same. To root a |
|
68 | and a regexp pattern of the form ``\.c$`` will do the same. To root a | |
69 | regexp pattern, start it with ``^``. |
|
69 | regexp pattern, start it with ``^``. | |
70 |
|
70 | |||
71 | .. note:: |
|
71 | .. note:: | |
|
72 | ||||
72 | Patterns specified in other than ``.hgignore`` are always rooted. |
|
73 | Patterns specified in other than ``.hgignore`` are always rooted. | |
73 | Please see :hg:`help patterns` for details. |
|
74 | Please see :hg:`help patterns` for details. | |
74 |
|
75 | |||
75 | Example |
|
76 | Example | |
76 | ======= |
|
77 | ======= | |
77 |
|
78 | |||
78 | Here is an example ignore file. :: |
|
79 | Here is an example ignore file. :: | |
79 |
|
80 | |||
80 | # use glob syntax. |
|
81 | # use glob syntax. | |
81 | syntax: glob |
|
82 | syntax: glob | |
82 |
|
83 | |||
83 | *.elc |
|
84 | *.elc | |
84 | *.pyc |
|
85 | *.pyc | |
85 | *~ |
|
86 | *~ | |
86 |
|
87 | |||
87 | # switch to regexp syntax. |
|
88 | # switch to regexp syntax. | |
88 | syntax: regexp |
|
89 | syntax: regexp | |
89 | ^\.pc/ |
|
90 | ^\.pc/ |
@@ -1,84 +1,85 b'' | |||||
1 | To merge files Mercurial uses merge tools. |
|
1 | To merge files Mercurial uses merge tools. | |
2 |
|
2 | |||
3 | A merge tool combines two different versions of a file into a merged |
|
3 | A merge tool combines two different versions of a file into a merged | |
4 | file. Merge tools are given the two files and the greatest common |
|
4 | file. Merge tools are given the two files and the greatest common | |
5 | ancestor of the two file versions, so they can determine the changes |
|
5 | ancestor of the two file versions, so they can determine the changes | |
6 | made on both branches. |
|
6 | made on both branches. | |
7 |
|
7 | |||
8 | Merge tools are used both for :hg:`resolve`, :hg:`merge`, :hg:`update`, |
|
8 | Merge tools are used both for :hg:`resolve`, :hg:`merge`, :hg:`update`, | |
9 | :hg:`backout` and in several extensions. |
|
9 | :hg:`backout` and in several extensions. | |
10 |
|
10 | |||
11 | Usually, the merge tool tries to automatically reconcile the files by |
|
11 | Usually, the merge tool tries to automatically reconcile the files by | |
12 | combining all non-overlapping changes that occurred separately in |
|
12 | combining all non-overlapping changes that occurred separately in | |
13 | the two different evolutions of the same initial base file. Furthermore, some |
|
13 | the two different evolutions of the same initial base file. Furthermore, some | |
14 | interactive merge programs make it easier to manually resolve |
|
14 | interactive merge programs make it easier to manually resolve | |
15 | conflicting merges, either in a graphical way, or by inserting some |
|
15 | conflicting merges, either in a graphical way, or by inserting some | |
16 | conflict markers. Mercurial does not include any interactive merge |
|
16 | conflict markers. Mercurial does not include any interactive merge | |
17 | programs but relies on external tools for that. |
|
17 | programs but relies on external tools for that. | |
18 |
|
18 | |||
19 | Available merge tools |
|
19 | Available merge tools | |
20 | ===================== |
|
20 | ===================== | |
21 |
|
21 | |||
22 | External merge tools and their properties are configured in the |
|
22 | External merge tools and their properties are configured in the | |
23 | merge-tools configuration section - see hgrc(5) - but they can often just |
|
23 | merge-tools configuration section - see hgrc(5) - but they can often just | |
24 | be named by their executable. |
|
24 | be named by their executable. | |
25 |
|
25 | |||
26 | A merge tool is generally usable if its executable can be found on the |
|
26 | A merge tool is generally usable if its executable can be found on the | |
27 | system and if it can handle the merge. The executable is found if it |
|
27 | system and if it can handle the merge. The executable is found if it | |
28 | is an absolute or relative executable path or the name of an |
|
28 | is an absolute or relative executable path or the name of an | |
29 | application in the executable search path. The tool is assumed to be |
|
29 | application in the executable search path. The tool is assumed to be | |
30 | able to handle the merge if it can handle symlinks if the file is a |
|
30 | able to handle the merge if it can handle symlinks if the file is a | |
31 | symlink, if it can handle binary files if the file is binary, and if a |
|
31 | symlink, if it can handle binary files if the file is binary, and if a | |
32 | GUI is available if the tool requires a GUI. |
|
32 | GUI is available if the tool requires a GUI. | |
33 |
|
33 | |||
34 | There are some internal merge tools which can be used. The internal |
|
34 | There are some internal merge tools which can be used. The internal | |
35 | merge tools are: |
|
35 | merge tools are: | |
36 |
|
36 | |||
37 | .. internaltoolsmarker |
|
37 | .. internaltoolsmarker | |
38 |
|
38 | |||
39 | Internal tools are always available and do not require a GUI but will by default |
|
39 | Internal tools are always available and do not require a GUI but will by default | |
40 | not handle symlinks or binary files. |
|
40 | not handle symlinks or binary files. | |
41 |
|
41 | |||
42 | Choosing a merge tool |
|
42 | Choosing a merge tool | |
43 | ===================== |
|
43 | ===================== | |
44 |
|
44 | |||
45 | Mercurial uses these rules when deciding which merge tool to use: |
|
45 | Mercurial uses these rules when deciding which merge tool to use: | |
46 |
|
46 | |||
47 | 1. If a tool has been specified with the --tool option to merge or resolve, it |
|
47 | 1. If a tool has been specified with the --tool option to merge or resolve, it | |
48 | is used. If it is the name of a tool in the merge-tools configuration, its |
|
48 | is used. If it is the name of a tool in the merge-tools configuration, its | |
49 | configuration is used. Otherwise the specified tool must be executable by |
|
49 | configuration is used. Otherwise the specified tool must be executable by | |
50 | the shell. |
|
50 | the shell. | |
51 |
|
51 | |||
52 | 2. If the ``HGMERGE`` environment variable is present, its value is used and |
|
52 | 2. If the ``HGMERGE`` environment variable is present, its value is used and | |
53 | must be executable by the shell. |
|
53 | must be executable by the shell. | |
54 |
|
54 | |||
55 | 3. If the filename of the file to be merged matches any of the patterns in the |
|
55 | 3. If the filename of the file to be merged matches any of the patterns in the | |
56 | merge-patterns configuration section, the first usable merge tool |
|
56 | merge-patterns configuration section, the first usable merge tool | |
57 | corresponding to a matching pattern is used. Here, binary capabilities of the |
|
57 | corresponding to a matching pattern is used. Here, binary capabilities of the | |
58 | merge tool are not considered. |
|
58 | merge tool are not considered. | |
59 |
|
59 | |||
60 | 4. If ui.merge is set it will be considered next. If the value is not the name |
|
60 | 4. If ui.merge is set it will be considered next. If the value is not the name | |
61 | of a configured tool, the specified value is used and must be executable by |
|
61 | of a configured tool, the specified value is used and must be executable by | |
62 | the shell. Otherwise the named tool is used if it is usable. |
|
62 | the shell. Otherwise the named tool is used if it is usable. | |
63 |
|
63 | |||
64 | 5. If any usable merge tools are present in the merge-tools configuration |
|
64 | 5. If any usable merge tools are present in the merge-tools configuration | |
65 | section, the one with the highest priority is used. |
|
65 | section, the one with the highest priority is used. | |
66 |
|
66 | |||
67 | 6. If a program named ``hgmerge`` can be found on the system, it is used - but |
|
67 | 6. If a program named ``hgmerge`` can be found on the system, it is used - but | |
68 | it will by default not be used for symlinks and binary files. |
|
68 | it will by default not be used for symlinks and binary files. | |
69 |
|
69 | |||
70 | 7. If the file to be merged is not binary and is not a symlink, then |
|
70 | 7. If the file to be merged is not binary and is not a symlink, then | |
71 | ``internal:merge`` is used. |
|
71 | ``internal:merge`` is used. | |
72 |
|
72 | |||
73 | 8. The merge of the file fails and must be resolved before commit. |
|
73 | 8. The merge of the file fails and must be resolved before commit. | |
74 |
|
74 | |||
75 | .. note:: |
|
75 | .. note:: | |
|
76 | ||||
76 | After selecting a merge program, Mercurial will by default attempt |
|
77 | After selecting a merge program, Mercurial will by default attempt | |
77 | to merge the files using a simple merge algorithm first. Only if it doesn't |
|
78 | to merge the files using a simple merge algorithm first. Only if it doesn't | |
78 | succeed because of conflicting changes Mercurial will actually execute the |
|
79 | succeed because of conflicting changes Mercurial will actually execute the | |
79 | merge program. Whether to use the simple merge algorithm first can be |
|
80 | merge program. Whether to use the simple merge algorithm first can be | |
80 | controlled by the premerge setting of the merge tool. Premerge is enabled by |
|
81 | controlled by the premerge setting of the merge tool. Premerge is enabled by | |
81 | default unless the file is binary or a symlink. |
|
82 | default unless the file is binary or a symlink. | |
82 |
|
83 | |||
83 | See the merge-tools and ui sections of hgrc(5) for details on the |
|
84 | See the merge-tools and ui sections of hgrc(5) for details on the | |
84 | configuration of merge tools. |
|
85 | configuration of merge tools. |
@@ -1,61 +1,62 b'' | |||||
1 | Mercurial accepts several notations for identifying one or more files |
|
1 | Mercurial accepts several notations for identifying one or more files | |
2 | at a time. |
|
2 | at a time. | |
3 |
|
3 | |||
4 | By default, Mercurial treats filenames as shell-style extended glob |
|
4 | By default, Mercurial treats filenames as shell-style extended glob | |
5 | patterns. |
|
5 | patterns. | |
6 |
|
6 | |||
7 | Alternate pattern notations must be specified explicitly. |
|
7 | Alternate pattern notations must be specified explicitly. | |
8 |
|
8 | |||
9 | .. note:: |
|
9 | .. note:: | |
|
10 | ||||
10 | Patterns specified in ``.hgignore`` are not rooted. |
|
11 | Patterns specified in ``.hgignore`` are not rooted. | |
11 | Please see :hg:`help hgignore` for details. |
|
12 | Please see :hg:`help hgignore` for details. | |
12 |
|
13 | |||
13 | To use a plain path name without any pattern matching, start it with |
|
14 | To use a plain path name without any pattern matching, start it with | |
14 | ``path:``. These path names must completely match starting at the |
|
15 | ``path:``. These path names must completely match starting at the | |
15 | current repository root. |
|
16 | current repository root. | |
16 |
|
17 | |||
17 | To use an extended glob, start a name with ``glob:``. Globs are rooted |
|
18 | To use an extended glob, start a name with ``glob:``. Globs are rooted | |
18 | at the current directory; a glob such as ``*.c`` will only match files |
|
19 | at the current directory; a glob such as ``*.c`` will only match files | |
19 | in the current directory ending with ``.c``. |
|
20 | in the current directory ending with ``.c``. | |
20 |
|
21 | |||
21 | The supported glob syntax extensions are ``**`` to match any string |
|
22 | The supported glob syntax extensions are ``**`` to match any string | |
22 | across path separators and ``{a,b}`` to mean "a or b". |
|
23 | across path separators and ``{a,b}`` to mean "a or b". | |
23 |
|
24 | |||
24 | To use a Perl/Python regular expression, start a name with ``re:``. |
|
25 | To use a Perl/Python regular expression, start a name with ``re:``. | |
25 | Regexp pattern matching is anchored at the root of the repository. |
|
26 | Regexp pattern matching is anchored at the root of the repository. | |
26 |
|
27 | |||
27 | To read name patterns from a file, use ``listfile:`` or ``listfile0:``. |
|
28 | To read name patterns from a file, use ``listfile:`` or ``listfile0:``. | |
28 | The latter expects null delimited patterns while the former expects line |
|
29 | The latter expects null delimited patterns while the former expects line | |
29 | feeds. Each string read from the file is itself treated as a file |
|
30 | feeds. Each string read from the file is itself treated as a file | |
30 | pattern. |
|
31 | pattern. | |
31 |
|
32 | |||
32 | All patterns, except for ``glob:`` specified in command line (not for |
|
33 | All patterns, except for ``glob:`` specified in command line (not for | |
33 | ``-I`` or ``-X`` options), can match also against directories: files |
|
34 | ``-I`` or ``-X`` options), can match also against directories: files | |
34 | under matched directories are treated as matched. |
|
35 | under matched directories are treated as matched. | |
35 |
|
36 | |||
36 | Plain examples:: |
|
37 | Plain examples:: | |
37 |
|
38 | |||
38 | path:foo/bar a name bar in a directory named foo in the root |
|
39 | path:foo/bar a name bar in a directory named foo in the root | |
39 | of the repository |
|
40 | of the repository | |
40 | path:path:name a file or directory named "path:name" |
|
41 | path:path:name a file or directory named "path:name" | |
41 |
|
42 | |||
42 | Glob examples:: |
|
43 | Glob examples:: | |
43 |
|
44 | |||
44 | glob:*.c any name ending in ".c" in the current directory |
|
45 | glob:*.c any name ending in ".c" in the current directory | |
45 | *.c any name ending in ".c" in the current directory |
|
46 | *.c any name ending in ".c" in the current directory | |
46 | **.c any name ending in ".c" in any subdirectory of the |
|
47 | **.c any name ending in ".c" in any subdirectory of the | |
47 | current directory including itself. |
|
48 | current directory including itself. | |
48 | foo/*.c any name ending in ".c" in the directory foo |
|
49 | foo/*.c any name ending in ".c" in the directory foo | |
49 | foo/**.c any name ending in ".c" in any subdirectory of foo |
|
50 | foo/**.c any name ending in ".c" in any subdirectory of foo | |
50 | including itself. |
|
51 | including itself. | |
51 |
|
52 | |||
52 | Regexp examples:: |
|
53 | Regexp examples:: | |
53 |
|
54 | |||
54 | re:.*\.c$ any name ending in ".c", anywhere in the repository |
|
55 | re:.*\.c$ any name ending in ".c", anywhere in the repository | |
55 |
|
56 | |||
56 | File examples:: |
|
57 | File examples:: | |
57 |
|
58 | |||
58 | listfile:list.txt read list from list.txt with one file pattern per line |
|
59 | listfile:list.txt read list from list.txt with one file pattern per line | |
59 | listfile0:list.txt read list from list.txt with null byte delimiters |
|
60 | listfile0:list.txt read list from list.txt with null byte delimiters | |
60 |
|
61 | |||
61 | See also :hg:`help filesets`. |
|
62 | See also :hg:`help filesets`. |
@@ -1,91 +1,94 b'' | |||||
1 | What are phases? |
|
1 | What are phases? | |
2 | ================ |
|
2 | ================ | |
3 |
|
3 | |||
4 | Phases are a system for tracking which changesets have been or should |
|
4 | Phases are a system for tracking which changesets have been or should | |
5 | be shared. This helps prevent common mistakes when modifying history |
|
5 | be shared. This helps prevent common mistakes when modifying history | |
6 | (for instance, with the mq or rebase extensions). |
|
6 | (for instance, with the mq or rebase extensions). | |
7 |
|
7 | |||
8 | Each changeset in a repository is in one of the following phases: |
|
8 | Each changeset in a repository is in one of the following phases: | |
9 |
|
9 | |||
10 | - public : changeset is visible on a public server |
|
10 | - public : changeset is visible on a public server | |
11 | - draft : changeset is not yet published |
|
11 | - draft : changeset is not yet published | |
12 | - secret : changeset should not be pushed, pulled, or cloned |
|
12 | - secret : changeset should not be pushed, pulled, or cloned | |
13 |
|
13 | |||
14 | These phases are ordered (public < draft < secret) and no changeset |
|
14 | These phases are ordered (public < draft < secret) and no changeset | |
15 | can be in a lower phase than its ancestors. For instance, if a |
|
15 | can be in a lower phase than its ancestors. For instance, if a | |
16 | changeset is public, all its ancestors are also public. Lastly, |
|
16 | changeset is public, all its ancestors are also public. Lastly, | |
17 | changeset phases should only be changed towards the public phase. |
|
17 | changeset phases should only be changed towards the public phase. | |
18 |
|
18 | |||
19 | How are phases managed? |
|
19 | How are phases managed? | |
20 | ======================= |
|
20 | ======================= | |
21 |
|
21 | |||
22 | For the most part, phases should work transparently. By default, a |
|
22 | For the most part, phases should work transparently. By default, a | |
23 | changeset is created in the draft phase and is moved into the public |
|
23 | changeset is created in the draft phase and is moved into the public | |
24 | phase when it is pushed to another repository. |
|
24 | phase when it is pushed to another repository. | |
25 |
|
25 | |||
26 | Once changesets become public, extensions like mq and rebase will |
|
26 | Once changesets become public, extensions like mq and rebase will | |
27 | refuse to operate on them to prevent creating duplicate changesets. |
|
27 | refuse to operate on them to prevent creating duplicate changesets. | |
28 | Phases can also be manually manipulated with the :hg:`phase` command |
|
28 | Phases can also be manually manipulated with the :hg:`phase` command | |
29 | if needed. See :hg:`help -v phase` for examples. |
|
29 | if needed. See :hg:`help -v phase` for examples. | |
30 |
|
30 | |||
31 | Phases and servers |
|
31 | Phases and servers | |
32 | ================== |
|
32 | ================== | |
33 |
|
33 | |||
34 | Normally, all servers are ``publishing`` by default. This means:: |
|
34 | Normally, all servers are ``publishing`` by default. This means:: | |
35 |
|
35 | |||
36 | - all draft changesets that are pulled or cloned appear in phase |
|
36 | - all draft changesets that are pulled or cloned appear in phase | |
37 | public on the client |
|
37 | public on the client | |
38 |
|
38 | |||
39 | - all draft changesets that are pushed appear as public on both |
|
39 | - all draft changesets that are pushed appear as public on both | |
40 | client and server |
|
40 | client and server | |
41 |
|
41 | |||
42 | - secret changesets are neither pushed, pulled, or cloned |
|
42 | - secret changesets are neither pushed, pulled, or cloned | |
43 |
|
43 | |||
44 | .. note:: |
|
44 | .. note:: | |
|
45 | ||||
45 | Pulling a draft changeset from a publishing server does not mark it |
|
46 | Pulling a draft changeset from a publishing server does not mark it | |
46 | as public on the server side due to the read-only nature of pull. |
|
47 | as public on the server side due to the read-only nature of pull. | |
47 |
|
48 | |||
48 | Sometimes it may be desirable to push and pull changesets in the draft |
|
49 | Sometimes it may be desirable to push and pull changesets in the draft | |
49 | phase to share unfinished work. This can be done by setting a |
|
50 | phase to share unfinished work. This can be done by setting a | |
50 | repository to disable publishing in its configuration file:: |
|
51 | repository to disable publishing in its configuration file:: | |
51 |
|
52 | |||
52 | [phases] |
|
53 | [phases] | |
53 | publish = False |
|
54 | publish = False | |
54 |
|
55 | |||
55 | See :hg:`help config` for more information on configuration files. |
|
56 | See :hg:`help config` for more information on configuration files. | |
56 |
|
57 | |||
57 | .. note:: |
|
58 | .. note:: | |
|
59 | ||||
58 | Servers running older versions of Mercurial are treated as |
|
60 | Servers running older versions of Mercurial are treated as | |
59 | publishing. |
|
61 | publishing. | |
60 |
|
62 | |||
61 | .. note:: |
|
63 | .. note:: | |
|
64 | ||||
62 | Changesets in secret phase are not exchanged with the server. This |
|
65 | Changesets in secret phase are not exchanged with the server. This | |
63 | applies to their content: file names, file contents, and changeset |
|
66 | applies to their content: file names, file contents, and changeset | |
64 | metadata. For technical reasons, the identifier (e.g. d825e4025e39) |
|
67 | metadata. For technical reasons, the identifier (e.g. d825e4025e39) | |
65 | of the secret changeset may be communicated to the server. |
|
68 | of the secret changeset may be communicated to the server. | |
66 |
|
69 | |||
67 |
|
70 | |||
68 | Examples |
|
71 | Examples | |
69 | ======== |
|
72 | ======== | |
70 |
|
73 | |||
71 | - list changesets in draft or secret phase:: |
|
74 | - list changesets in draft or secret phase:: | |
72 |
|
75 | |||
73 | hg log -r "not public()" |
|
76 | hg log -r "not public()" | |
74 |
|
77 | |||
75 | - change all secret changesets to draft:: |
|
78 | - change all secret changesets to draft:: | |
76 |
|
79 | |||
77 | hg phase --draft "secret()" |
|
80 | hg phase --draft "secret()" | |
78 |
|
81 | |||
79 | - forcibly move the current changeset and descendants from public to draft:: |
|
82 | - forcibly move the current changeset and descendants from public to draft:: | |
80 |
|
83 | |||
81 | hg phase --force --draft . |
|
84 | hg phase --force --draft . | |
82 |
|
85 | |||
83 | - show a list of changeset revision and phase:: |
|
86 | - show a list of changeset revision and phase:: | |
84 |
|
87 | |||
85 | hg log --template "{rev} {phase}\n" |
|
88 | hg log --template "{rev} {phase}\n" | |
86 |
|
89 | |||
87 | - resynchronize draft changesets relative to a remote repository:: |
|
90 | - resynchronize draft changesets relative to a remote repository:: | |
88 |
|
91 | |||
89 | hg phase -fd "outgoing(URL)" |
|
92 | hg phase -fd "outgoing(URL)" | |
90 |
|
93 | |||
91 | See :hg:`help phase` for more information on manually manipulating phases. |
|
94 | See :hg:`help phase` for more information on manually manipulating phases. |
@@ -1,142 +1,143 b'' | |||||
1 | Subrepositories let you nest external repositories or projects into a |
|
1 | Subrepositories let you nest external repositories or projects into a | |
2 | parent Mercurial repository, and make commands operate on them as a |
|
2 | parent Mercurial repository, and make commands operate on them as a | |
3 | group. |
|
3 | group. | |
4 |
|
4 | |||
5 | Mercurial currently supports Mercurial, Git, and Subversion |
|
5 | Mercurial currently supports Mercurial, Git, and Subversion | |
6 | subrepositories. |
|
6 | subrepositories. | |
7 |
|
7 | |||
8 | Subrepositories are made of three components: |
|
8 | Subrepositories are made of three components: | |
9 |
|
9 | |||
10 | 1. Nested repository checkouts. They can appear anywhere in the |
|
10 | 1. Nested repository checkouts. They can appear anywhere in the | |
11 | parent working directory. |
|
11 | parent working directory. | |
12 |
|
12 | |||
13 | 2. Nested repository references. They are defined in ``.hgsub``, which |
|
13 | 2. Nested repository references. They are defined in ``.hgsub``, which | |
14 | should be placed in the root of working directory, and |
|
14 | should be placed in the root of working directory, and | |
15 | tell where the subrepository checkouts come from. Mercurial |
|
15 | tell where the subrepository checkouts come from. Mercurial | |
16 | subrepositories are referenced like:: |
|
16 | subrepositories are referenced like:: | |
17 |
|
17 | |||
18 | path/to/nested = https://example.com/nested/repo/path |
|
18 | path/to/nested = https://example.com/nested/repo/path | |
19 |
|
19 | |||
20 | Git and Subversion subrepos are also supported:: |
|
20 | Git and Subversion subrepos are also supported:: | |
21 |
|
21 | |||
22 | path/to/nested = [git]git://example.com/nested/repo/path |
|
22 | path/to/nested = [git]git://example.com/nested/repo/path | |
23 | path/to/nested = [svn]https://example.com/nested/trunk/path |
|
23 | path/to/nested = [svn]https://example.com/nested/trunk/path | |
24 |
|
24 | |||
25 | where ``path/to/nested`` is the checkout location relatively to the |
|
25 | where ``path/to/nested`` is the checkout location relatively to the | |
26 | parent Mercurial root, and ``https://example.com/nested/repo/path`` |
|
26 | parent Mercurial root, and ``https://example.com/nested/repo/path`` | |
27 | is the source repository path. The source can also reference a |
|
27 | is the source repository path. The source can also reference a | |
28 | filesystem path. |
|
28 | filesystem path. | |
29 |
|
29 | |||
30 | Note that ``.hgsub`` does not exist by default in Mercurial |
|
30 | Note that ``.hgsub`` does not exist by default in Mercurial | |
31 | repositories, you have to create and add it to the parent |
|
31 | repositories, you have to create and add it to the parent | |
32 | repository before using subrepositories. |
|
32 | repository before using subrepositories. | |
33 |
|
33 | |||
34 | 3. Nested repository states. They are defined in ``.hgsubstate``, which |
|
34 | 3. Nested repository states. They are defined in ``.hgsubstate``, which | |
35 | is placed in the root of working directory, and |
|
35 | is placed in the root of working directory, and | |
36 | capture whatever information is required to restore the |
|
36 | capture whatever information is required to restore the | |
37 | subrepositories to the state they were committed in a parent |
|
37 | subrepositories to the state they were committed in a parent | |
38 | repository changeset. Mercurial automatically record the nested |
|
38 | repository changeset. Mercurial automatically record the nested | |
39 | repositories states when committing in the parent repository. |
|
39 | repositories states when committing in the parent repository. | |
40 |
|
40 | |||
41 | .. note:: |
|
41 | .. note:: | |
|
42 | ||||
42 | The ``.hgsubstate`` file should not be edited manually. |
|
43 | The ``.hgsubstate`` file should not be edited manually. | |
43 |
|
44 | |||
44 |
|
45 | |||
45 | Adding a Subrepository |
|
46 | Adding a Subrepository | |
46 | ====================== |
|
47 | ====================== | |
47 |
|
48 | |||
48 | If ``.hgsub`` does not exist, create it and add it to the parent |
|
49 | If ``.hgsub`` does not exist, create it and add it to the parent | |
49 | repository. Clone or checkout the external projects where you want it |
|
50 | repository. Clone or checkout the external projects where you want it | |
50 | to live in the parent repository. Edit ``.hgsub`` and add the |
|
51 | to live in the parent repository. Edit ``.hgsub`` and add the | |
51 | subrepository entry as described above. At this point, the |
|
52 | subrepository entry as described above. At this point, the | |
52 | subrepository is tracked and the next commit will record its state in |
|
53 | subrepository is tracked and the next commit will record its state in | |
53 | ``.hgsubstate`` and bind it to the committed changeset. |
|
54 | ``.hgsubstate`` and bind it to the committed changeset. | |
54 |
|
55 | |||
55 | Synchronizing a Subrepository |
|
56 | Synchronizing a Subrepository | |
56 | ============================= |
|
57 | ============================= | |
57 |
|
58 | |||
58 | Subrepos do not automatically track the latest changeset of their |
|
59 | Subrepos do not automatically track the latest changeset of their | |
59 | sources. Instead, they are updated to the changeset that corresponds |
|
60 | sources. Instead, they are updated to the changeset that corresponds | |
60 | with the changeset checked out in the top-level changeset. This is so |
|
61 | with the changeset checked out in the top-level changeset. This is so | |
61 | developers always get a consistent set of compatible code and |
|
62 | developers always get a consistent set of compatible code and | |
62 | libraries when they update. |
|
63 | libraries when they update. | |
63 |
|
64 | |||
64 | Thus, updating subrepos is a manual process. Simply check out target |
|
65 | Thus, updating subrepos is a manual process. Simply check out target | |
65 | subrepo at the desired revision, test in the top-level repo, then |
|
66 | subrepo at the desired revision, test in the top-level repo, then | |
66 | commit in the parent repository to record the new combination. |
|
67 | commit in the parent repository to record the new combination. | |
67 |
|
68 | |||
68 | Deleting a Subrepository |
|
69 | Deleting a Subrepository | |
69 | ======================== |
|
70 | ======================== | |
70 |
|
71 | |||
71 | To remove a subrepository from the parent repository, delete its |
|
72 | To remove a subrepository from the parent repository, delete its | |
72 | reference from ``.hgsub``, then remove its files. |
|
73 | reference from ``.hgsub``, then remove its files. | |
73 |
|
74 | |||
74 | Interaction with Mercurial Commands |
|
75 | Interaction with Mercurial Commands | |
75 | =================================== |
|
76 | =================================== | |
76 |
|
77 | |||
77 | :add: add does not recurse in subrepos unless -S/--subrepos is |
|
78 | :add: add does not recurse in subrepos unless -S/--subrepos is | |
78 | specified. However, if you specify the full path of a file in a |
|
79 | specified. However, if you specify the full path of a file in a | |
79 | subrepo, it will be added even without -S/--subrepos specified. |
|
80 | subrepo, it will be added even without -S/--subrepos specified. | |
80 | Git and Subversion subrepositories are currently silently |
|
81 | Git and Subversion subrepositories are currently silently | |
81 | ignored. |
|
82 | ignored. | |
82 |
|
83 | |||
83 | :archive: archive does not recurse in subrepositories unless |
|
84 | :archive: archive does not recurse in subrepositories unless | |
84 | -S/--subrepos is specified. |
|
85 | -S/--subrepos is specified. | |
85 |
|
86 | |||
86 | :commit: commit creates a consistent snapshot of the state of the |
|
87 | :commit: commit creates a consistent snapshot of the state of the | |
87 | entire project and its subrepositories. If any subrepositories |
|
88 | entire project and its subrepositories. If any subrepositories | |
88 | have been modified, Mercurial will abort. Mercurial can be made |
|
89 | have been modified, Mercurial will abort. Mercurial can be made | |
89 | to instead commit all modified subrepositories by specifying |
|
90 | to instead commit all modified subrepositories by specifying | |
90 | -S/--subrepos, or setting "ui.commitsubrepos=True" in a |
|
91 | -S/--subrepos, or setting "ui.commitsubrepos=True" in a | |
91 | configuration file (see :hg:`help config`). After there are no |
|
92 | configuration file (see :hg:`help config`). After there are no | |
92 | longer any modified subrepositories, it records their state and |
|
93 | longer any modified subrepositories, it records their state and | |
93 | finally commits it in the parent repository. |
|
94 | finally commits it in the parent repository. | |
94 |
|
95 | |||
95 | :diff: diff does not recurse in subrepos unless -S/--subrepos is |
|
96 | :diff: diff does not recurse in subrepos unless -S/--subrepos is | |
96 | specified. Changes are displayed as usual, on the subrepositories |
|
97 | specified. Changes are displayed as usual, on the subrepositories | |
97 | elements. Git and Subversion subrepositories are currently |
|
98 | elements. Git and Subversion subrepositories are currently | |
98 | silently ignored. |
|
99 | silently ignored. | |
99 |
|
100 | |||
100 | :forget: forget currently only handles exact file matches in subrepos. |
|
101 | :forget: forget currently only handles exact file matches in subrepos. | |
101 | Git and Subversion subrepositories are currently silently ignored. |
|
102 | Git and Subversion subrepositories are currently silently ignored. | |
102 |
|
103 | |||
103 | :incoming: incoming does not recurse in subrepos unless -S/--subrepos |
|
104 | :incoming: incoming does not recurse in subrepos unless -S/--subrepos | |
104 | is specified. Git and Subversion subrepositories are currently |
|
105 | is specified. Git and Subversion subrepositories are currently | |
105 | silently ignored. |
|
106 | silently ignored. | |
106 |
|
107 | |||
107 | :outgoing: outgoing does not recurse in subrepos unless -S/--subrepos |
|
108 | :outgoing: outgoing does not recurse in subrepos unless -S/--subrepos | |
108 | is specified. Git and Subversion subrepositories are currently |
|
109 | is specified. Git and Subversion subrepositories are currently | |
109 | silently ignored. |
|
110 | silently ignored. | |
110 |
|
111 | |||
111 | :pull: pull is not recursive since it is not clear what to pull prior |
|
112 | :pull: pull is not recursive since it is not clear what to pull prior | |
112 | to running :hg:`update`. Listing and retrieving all |
|
113 | to running :hg:`update`. Listing and retrieving all | |
113 | subrepositories changes referenced by the parent repository pulled |
|
114 | subrepositories changes referenced by the parent repository pulled | |
114 | changesets is expensive at best, impossible in the Subversion |
|
115 | changesets is expensive at best, impossible in the Subversion | |
115 | case. |
|
116 | case. | |
116 |
|
117 | |||
117 | :push: Mercurial will automatically push all subrepositories first |
|
118 | :push: Mercurial will automatically push all subrepositories first | |
118 | when the parent repository is being pushed. This ensures new |
|
119 | when the parent repository is being pushed. This ensures new | |
119 | subrepository changes are available when referenced by top-level |
|
120 | subrepository changes are available when referenced by top-level | |
120 | repositories. Push is a no-op for Subversion subrepositories. |
|
121 | repositories. Push is a no-op for Subversion subrepositories. | |
121 |
|
122 | |||
122 | :status: status does not recurse into subrepositories unless |
|
123 | :status: status does not recurse into subrepositories unless | |
123 | -S/--subrepos is specified. Subrepository changes are displayed as |
|
124 | -S/--subrepos is specified. Subrepository changes are displayed as | |
124 | regular Mercurial changes on the subrepository |
|
125 | regular Mercurial changes on the subrepository | |
125 | elements. Subversion subrepositories are currently silently |
|
126 | elements. Subversion subrepositories are currently silently | |
126 | ignored. |
|
127 | ignored. | |
127 |
|
128 | |||
128 | :update: update restores the subrepos in the state they were |
|
129 | :update: update restores the subrepos in the state they were | |
129 | originally committed in target changeset. If the recorded |
|
130 | originally committed in target changeset. If the recorded | |
130 | changeset is not available in the current subrepository, Mercurial |
|
131 | changeset is not available in the current subrepository, Mercurial | |
131 | will pull it in first before updating. This means that updating |
|
132 | will pull it in first before updating. This means that updating | |
132 | can require network access when using subrepositories. |
|
133 | can require network access when using subrepositories. | |
133 |
|
134 | |||
134 | Remapping Subrepositories Sources |
|
135 | Remapping Subrepositories Sources | |
135 | ================================= |
|
136 | ================================= | |
136 |
|
137 | |||
137 | A subrepository source location may change during a project life, |
|
138 | A subrepository source location may change during a project life, | |
138 | invalidating references stored in the parent repository history. To |
|
139 | invalidating references stored in the parent repository history. To | |
139 | fix this, rewriting rules can be defined in parent repository ``hgrc`` |
|
140 | fix this, rewriting rules can be defined in parent repository ``hgrc`` | |
140 | file or in Mercurial configuration. See the ``[subpaths]`` section in |
|
141 | file or in Mercurial configuration. See the ``[subpaths]`` section in | |
141 | hgrc(5) for more details. |
|
142 | hgrc(5) for more details. | |
142 |
|
143 |
General Comments 0
You need to be logged in to leave comments.
Login now