Show More
@@ -42,6 +42,16 b' HGRCPATH' | |||||
42 | - if it's a directory, all files ending with .rc are added |
|
42 | - if it's a directory, all files ending with .rc are added | |
43 | - otherwise, the file itself will be added |
|
43 | - otherwise, the file itself will be added | |
44 |
|
44 | |||
|
45 | HGPLAIN | |||
|
46 | When set, this disables any options in .hgrc that might change | |||
|
47 | Mercurial's default output. This includes encoding, defaults, | |||
|
48 | verbose mode, debug mode, quiet mode, tracebacks, and | |||
|
49 | localization. This can be useful when scripting against Mercurial | |||
|
50 | in the face of existing user configuration. | |||
|
51 | ||||
|
52 | Equivalent options set via command line flags or environment | |||
|
53 | variables are not overridden. | |||
|
54 | ||||
45 | HGUSER |
|
55 | HGUSER | |
46 | This is the string used as the author of a commit. If not set, |
|
56 | This is the string used as the author of a commit. If not set, | |
47 | available values will be considered in this order: |
|
57 | available values will be considered in this order: |
@@ -48,5 +48,8 b' def gettext(message):' | |||||
48 | # An unknown encoding results in a LookupError. |
|
48 | # An unknown encoding results in a LookupError. | |
49 | return message |
|
49 | return message | |
50 |
|
50 | |||
|
51 | if 'HGPLAIN' in os.environ: | |||
|
52 | _ = lambda message: message | |||
|
53 | else: | |||
51 | _ = gettext |
|
54 | _ = gettext | |
52 |
|
55 |
@@ -79,6 +79,14 b' class ui(object):' | |||||
79 | raise |
|
79 | raise | |
80 | self.warn(_("Ignored: %s\n") % str(inst)) |
|
80 | self.warn(_("Ignored: %s\n") % str(inst)) | |
81 |
|
81 | |||
|
82 | if self.plain(): | |||
|
83 | for k in ('debug', 'fallbackencoding', 'quiet', 'traceback', | |||
|
84 | 'verbose'): | |||
|
85 | if k in cfg['ui']: | |||
|
86 | del cfg['ui'][k] | |||
|
87 | for k, v in cfg.items('defaults'): | |||
|
88 | del cfg['defaults'][k] | |||
|
89 | ||||
82 | if trusted: |
|
90 | if trusted: | |
83 | self._tcfg.update(cfg) |
|
91 | self._tcfg.update(cfg) | |
84 | self._tcfg.update(self._ocfg) |
|
92 | self._tcfg.update(self._ocfg) | |
@@ -169,6 +177,9 b' class ui(object):' | |||||
169 | for name, value in self.configitems(section, untrusted): |
|
177 | for name, value in self.configitems(section, untrusted): | |
170 | yield section, name, str(value).replace('\n', '\\n') |
|
178 | yield section, name, str(value).replace('\n', '\\n') | |
171 |
|
179 | |||
|
180 | def plain(self): | |||
|
181 | return 'HGPLAIN' in os.environ | |||
|
182 | ||||
172 | def username(self): |
|
183 | def username(self): | |
173 | """Return default username to be used in commits. |
|
184 | """Return default username to be used in commits. | |
174 |
|
185 |
@@ -25,3 +25,22 b' hg showconfig foo' | |||||
25 |
|
25 | |||
26 | echo '%include /no-such-file' > $HGRCPATH |
|
26 | echo '%include /no-such-file' > $HGRCPATH | |
27 | hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|" |
|
27 | hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|" | |
|
28 | ||||
|
29 | # HGPLAIN | |||
|
30 | cd .. | |||
|
31 | p=`pwd` | |||
|
32 | echo "[ui]" > $HGRCPATH | |||
|
33 | echo "debug=true" >> $HGRCPATH | |||
|
34 | echo "fallbackencoding=ASCII" >> $HGRCPATH | |||
|
35 | echo "quiet=true" >> $HGRCPATH | |||
|
36 | echo "traceback=true" >> $HGRCPATH | |||
|
37 | echo "verbose=true" >> $HGRCPATH | |||
|
38 | echo "[defaults]" >> $HGRCPATH | |||
|
39 | echo "identify=-n" >> $HGRCPATH | |||
|
40 | ||||
|
41 | echo '% customized hgrc' | |||
|
42 | hg showconfig | sed -e "s:$p:...:" | |||
|
43 | ||||
|
44 | echo '% plain hgrc' | |||
|
45 | HGPLAIN=; export HGPLAIN | |||
|
46 | hg showconfig --config ui.traceback=True --debug | sed -e "s:$p:...:" |
@@ -10,3 +10,15 b" hg: config error at $HGRCPATH:2: ' x = " | |||||
10 | foo.bar=a\nb\nc\nde\nfg |
|
10 | foo.bar=a\nb\nc\nde\nfg | |
11 | foo.baz=bif cb |
|
11 | foo.baz=bif cb | |
12 | hg: config error at $HGRCPATH:1: cannot include /no-such-file (No such file or directory) |
|
12 | hg: config error at $HGRCPATH:1: cannot include /no-such-file (No such file or directory) | |
|
13 | % customized hgrc | |||
|
14 | .../.hgrc:8: defaults.identify=-n | |||
|
15 | .../.hgrc:2: ui.debug=true | |||
|
16 | .../.hgrc:3: ui.fallbackencoding=ASCII | |||
|
17 | .../.hgrc:4: ui.quiet=true | |||
|
18 | .../.hgrc:5: ui.traceback=true | |||
|
19 | .../.hgrc:6: ui.verbose=true | |||
|
20 | % plain hgrc | |||
|
21 | none: ui.traceback=True | |||
|
22 | none: ui.verbose=False | |||
|
23 | none: ui.debug=True | |||
|
24 | none: ui.quiet=False |
General Comments 0
You need to be logged in to leave comments.
Login now