mercurial/dispatch.py
changeset 20788 f144928dd058
parent 20330 69a0d22b9677
child 20796 131f7fe06e9e
equal deleted inserted replaced
20787:be179da10d5f 20788:f144928dd058
    38 
    38 
    39     try:
    39     try:
    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:
    47             req.ui.fin = req.fin
    47             req.ui.fin = req.fin
    48         if req.fout:
    48         if req.fout:
   102 
   102 
   103             if req.repo:
   103             if req.repo:
   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")
   111             if not debugger or ui.plain():
   111             if not debugger or ui.plain():
   112                 debugger = 'pdb'
   112                 debugger = 'pdb'
   516         try:
   516         try:
   517             name, value = cfg.split('=', 1)
   517             name, value = cfg.split('=', 1)
   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 '
   525                                '(use --config section.name=value)') % cfg)
   525                                '(use --config section.name=value)') % cfg)
   526 
   526 
   733 
   733 
   734     if options['verbose'] or options['debug'] or options['quiet']:
   734     if options['verbose'] or options['debug'] or options['quiet']:
   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)
   754     if options['help']:
   754     if options['help']:
   755         return commands.help_(ui, cmd)
   755         return commands.help_(ui, cmd)
   771         else:
   771         else:
   772             try:
   772             try:
   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:
   780                 if cmd not in commands.optionalrepo.split():
   780                 if cmd not in commands.optionalrepo.split():
   781                     if (cmd in commands.inferrepo.split() and
   781                     if (cmd in commands.inferrepo.split() and