Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 19639:09573ad59f7b
dispatch: move command line --config argument parsing to _runcatch()
Previously, command line parsing of --config arguments was done in
_dispatch. This means that it takes place after activating the debugger. In an
upcoming patch, we will add a ui.debugger setting so we need to have this
parsing done before _runcatch.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sat, 13 Jul 2013 16:33:07 -0500 |
parents | 41e39a0299cb |
children | 472fa3b782b1 |
comparison
equal
deleted
inserted
replaced
19638:20096384754f | 19639:09573ad59f7b |
---|---|
86 except ValueError: | 86 except ValueError: |
87 pass # happens if called in a thread | 87 pass # happens if called in a thread |
88 | 88 |
89 try: | 89 try: |
90 try: | 90 try: |
91 | |
92 # read --config before doing anything else | |
93 # (e.g. to change trust settings for reading .hg/hgrc) | |
94 cfgs = _parseconfig(req.ui, _earlygetopt(['--config'], req.args)) | |
95 | |
96 if req.repo: | |
97 # copy configs that were passed on the cmdline (--config) to | |
98 # the repo ui | |
99 for cfg in cfgs: | |
100 req.repo.ui.setconfig(*cfg) | |
101 | |
91 # enter the debugger before command execution | 102 # enter the debugger before command execution |
92 if '--debugger' in req.args: | 103 if '--debugger' in req.args: |
93 ui.warn(_("entering debugger - " | 104 ui.warn(_("entering debugger - " |
94 "type c to continue starting hg or h for help\n")) | 105 "type c to continue starting hg or h for help\n")) |
95 pdb.set_trace() | 106 pdb.set_trace() |
617 _loaded = set() | 628 _loaded = set() |
618 def _dispatch(req): | 629 def _dispatch(req): |
619 args = req.args | 630 args = req.args |
620 ui = req.ui | 631 ui = req.ui |
621 | 632 |
622 # read --config before doing anything else | |
623 # (e.g. to change trust settings for reading .hg/hgrc) | |
624 cfgs = _parseconfig(ui, _earlygetopt(['--config'], args)) | |
625 | |
626 # check for cwd | 633 # check for cwd |
627 cwd = _earlygetopt(['--cwd'], args) | 634 cwd = _earlygetopt(['--cwd'], args) |
628 if cwd: | 635 if cwd: |
629 os.chdir(cwd[-1]) | 636 os.chdir(cwd[-1]) |
630 | 637 |
696 | 703 |
697 uis = set([ui, lui]) | 704 uis = set([ui, lui]) |
698 | 705 |
699 if req.repo: | 706 if req.repo: |
700 uis.add(req.repo.ui) | 707 uis.add(req.repo.ui) |
701 | |
702 # copy configs that were passed on the cmdline (--config) to the repo ui | |
703 for cfg in cfgs: | |
704 req.repo.ui.setconfig(*cfg) | |
705 | 708 |
706 if options['verbose'] or options['debug'] or options['quiet']: | 709 if options['verbose'] or options['debug'] or options['quiet']: |
707 for opt in ('verbose', 'debug', 'quiet'): | 710 for opt in ('verbose', 'debug', 'quiet'): |
708 val = str(bool(options[opt])) | 711 val = str(bool(options[opt])) |
709 for ui_ in uis: | 712 for ui_ in uis: |