##// END OF EJS Templates
config: give a useful hint of source for the most common command line settings...
Mads Kiilerich -
r20788:f144928d default
parent child Browse files
Show More
@@ -40,7 +40,7 b' def dispatch(req):'
40 if not req.ui:
40 if not req.ui:
41 req.ui = uimod.ui()
41 req.ui = uimod.ui()
42 if '--traceback' in req.args:
42 if '--traceback' in req.args:
43 req.ui.setconfig('ui', 'traceback', 'on')
43 req.ui.setconfig('ui', 'traceback', 'on', '--traceback')
44
44
45 # set ui streams from the request
45 # set ui streams from the request
46 if req.fin:
46 if req.fin:
@@ -104,7 +104,7 b' def _runcatch(req):'
104 # copy configs that were passed on the cmdline (--config) to
104 # copy configs that were passed on the cmdline (--config) to
105 # the repo ui
105 # the repo ui
106 for cfg in cfgs:
106 for cfg in cfgs:
107 req.repo.ui.setconfig(*cfg)
107 req.repo.ui.setconfig(*cfg, source='--config')
108
108
109 # if we are in HGPLAIN mode, then disable custom debugging
109 # if we are in HGPLAIN mode, then disable custom debugging
110 debugger = ui.config("ui", "debugger")
110 debugger = ui.config("ui", "debugger")
@@ -518,7 +518,7 b' def _parseconfig(ui, config):'
518 section, name = name.split('.', 1)
518 section, name = name.split('.', 1)
519 if not section or not name:
519 if not section or not name:
520 raise IndexError
520 raise IndexError
521 ui.setconfig(section, name, value)
521 ui.setconfig(section, name, value, '--config')
522 configs.append((section, name, value))
522 configs.append((section, name, value))
523 except (IndexError, ValueError):
523 except (IndexError, ValueError):
524 raise util.Abort(_('malformed --config option: %r '
524 raise util.Abort(_('malformed --config option: %r '
@@ -735,19 +735,19 b' def _dispatch(req):'
735 for opt in ('verbose', 'debug', 'quiet'):
735 for opt in ('verbose', 'debug', 'quiet'):
736 val = str(bool(options[opt]))
736 val = str(bool(options[opt]))
737 for ui_ in uis:
737 for ui_ in uis:
738 ui_.setconfig('ui', opt, val)
738 ui_.setconfig('ui', opt, val, '--' + opt)
739
739
740 if options['traceback']:
740 if options['traceback']:
741 for ui_ in uis:
741 for ui_ in uis:
742 ui_.setconfig('ui', 'traceback', 'on')
742 ui_.setconfig('ui', 'traceback', 'on', '--traceback')
743
743
744 if options['noninteractive']:
744 if options['noninteractive']:
745 for ui_ in uis:
745 for ui_ in uis:
746 ui_.setconfig('ui', 'interactive', 'off')
746 ui_.setconfig('ui', 'interactive', 'off', '-y')
747
747
748 if cmdoptions.get('insecure', False):
748 if cmdoptions.get('insecure', False):
749 for ui_ in uis:
749 for ui_ in uis:
750 ui_.setconfig('web', 'cacerts', '')
750 ui_.setconfig('web', 'cacerts', '', '--insecure')
751
751
752 if options['version']:
752 if options['version']:
753 return commands.version_(ui)
753 return commands.version_(ui)
@@ -773,7 +773,7 b' def _dispatch(req):'
773 repo = hg.repository(ui, path=path)
773 repo = hg.repository(ui, path=path)
774 if not repo.local():
774 if not repo.local():
775 raise util.Abort(_("repository '%s' is not local") % path)
775 raise util.Abort(_("repository '%s' is not local") % path)
776 repo.ui.setconfig("bundle", "mainreporoot", repo.root)
776 repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo')
777 except error.RequirementError:
777 except error.RequirementError:
778 raise
778 raise
779 except error.RepoError:
779 except error.RepoError:
@@ -157,9 +157,9 b' class ui(object):'
157 self._tcfg.restore(data[1])
157 self._tcfg.restore(data[1])
158 self._ucfg.restore(data[2])
158 self._ucfg.restore(data[2])
159
159
160 def setconfig(self, section, name, value):
160 def setconfig(self, section, name, value, source=''):
161 for cfg in (self._ocfg, self._tcfg, self._ucfg):
161 for cfg in (self._ocfg, self._tcfg, self._ucfg):
162 cfg.set(section, name, value)
162 cfg.set(section, name, value, source)
163 self.fixconfig(section=section)
163 self.fixconfig(section=section)
164
164
165 def _data(self, untrusted):
165 def _data(self, untrusted):
@@ -141,7 +141,7 b' customized hgrc'
141 $ hg showconfig
141 $ hg showconfig
142 read config from: $TESTTMP/hgrc
142 read config from: $TESTTMP/hgrc
143 $TESTTMP/hgrc:13: alias.log=log -g
143 $TESTTMP/hgrc:13: alias.log=log -g
144 none: bundle.mainreporoot=$TESTTMP
144 repo: bundle.mainreporoot=$TESTTMP
145 $TESTTMP/hgrc:11: defaults.identify=-n
145 $TESTTMP/hgrc:11: defaults.identify=-n
146 $TESTTMP/hgrc:2: ui.debug=true
146 $TESTTMP/hgrc:2: ui.debug=true
147 $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII
147 $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII
@@ -157,11 +157,11 b' plain hgrc'
157 $ HGPLAIN=; export HGPLAIN
157 $ HGPLAIN=; export HGPLAIN
158 $ hg showconfig --config ui.traceback=True --debug
158 $ hg showconfig --config ui.traceback=True --debug
159 read config from: $TESTTMP/hgrc
159 read config from: $TESTTMP/hgrc
160 none: bundle.mainreporoot=$TESTTMP
160 repo: bundle.mainreporoot=$TESTTMP
161 none: ui.traceback=True
161 --config: ui.traceback=True
162 none: ui.verbose=False
162 --verbose: ui.verbose=False
163 none: ui.debug=True
163 --debug: ui.debug=True
164 none: ui.quiet=False
164 --quiet: ui.quiet=False
165
165
166 plain mode with exceptions
166 plain mode with exceptions
167
167
@@ -175,29 +175,29 b' plain mode with exceptions'
175 $ hg showconfig --config ui.traceback=True --debug
175 $ hg showconfig --config ui.traceback=True --debug
176 plain: True
176 plain: True
177 read config from: $TESTTMP/hgrc
177 read config from: $TESTTMP/hgrc
178 none: bundle.mainreporoot=$TESTTMP
178 repo: bundle.mainreporoot=$TESTTMP
179 $TESTTMP/hgrc:15: extensions.plain=./plain.py
179 $TESTTMP/hgrc:15: extensions.plain=./plain.py
180 none: ui.traceback=True
180 --config: ui.traceback=True
181 none: ui.verbose=False
181 --verbose: ui.verbose=False
182 none: ui.debug=True
182 --debug: ui.debug=True
183 none: ui.quiet=False
183 --quiet: ui.quiet=False
184 $ unset HGPLAIN
184 $ unset HGPLAIN
185 $ hg showconfig --config ui.traceback=True --debug
185 $ hg showconfig --config ui.traceback=True --debug
186 plain: True
186 plain: True
187 read config from: $TESTTMP/hgrc
187 read config from: $TESTTMP/hgrc
188 none: bundle.mainreporoot=$TESTTMP
188 repo: bundle.mainreporoot=$TESTTMP
189 $TESTTMP/hgrc:15: extensions.plain=./plain.py
189 $TESTTMP/hgrc:15: extensions.plain=./plain.py
190 none: ui.traceback=True
190 --config: ui.traceback=True
191 none: ui.verbose=False
191 --verbose: ui.verbose=False
192 none: ui.debug=True
192 --debug: ui.debug=True
193 none: ui.quiet=False
193 --quiet: ui.quiet=False
194 $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
194 $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
195 $ hg showconfig --config ui.traceback=True --debug
195 $ hg showconfig --config ui.traceback=True --debug
196 plain: True
196 plain: True
197 read config from: $TESTTMP/hgrc
197 read config from: $TESTTMP/hgrc
198 none: bundle.mainreporoot=$TESTTMP
198 repo: bundle.mainreporoot=$TESTTMP
199 $TESTTMP/hgrc:15: extensions.plain=./plain.py
199 $TESTTMP/hgrc:15: extensions.plain=./plain.py
200 none: ui.traceback=True
200 --config: ui.traceback=True
201 none: ui.verbose=False
201 --verbose: ui.verbose=False
202 none: ui.debug=True
202 --debug: ui.debug=True
203 none: ui.quiet=False
203 --quiet: ui.quiet=False
General Comments 0
You need to be logged in to leave comments. Login now