Mercurial > hg-stable
changeset 30009:dfd97e60044c
dispatch: change indentation level in _dispatch()
Add an if True: placeholder for a profiling context manager that
will be added in the next commit, for the purpose of reducing size
of the diff due to trivial indentation changes.
This change should be a no-op.
author | Arun Kulshreshtha <kulshrax@fb.com> |
---|---|
date | Thu, 22 Sep 2016 12:19:48 -0700 |
parents | 5aaa3d6b7e92 |
children | b19c2679289c |
files | mercurial/dispatch.py |
diffstat | 1 files changed, 54 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Thu Sep 22 20:59:24 2016 +0900 +++ b/mercurial/dispatch.py Thu Sep 22 12:19:48 2016 -0700 @@ -844,60 +844,63 @@ elif not cmd: return commands.help_(ui, 'shortlist') - repo = None - cmdpats = args[:] - if not _cmdattr(ui, cmd, func, 'norepo'): - # use the repo from the request only if we don't have -R - if not rpath and not cwd: - repo = req.repo + if True: + repo = None + cmdpats = args[:] + if not _cmdattr(ui, cmd, func, 'norepo'): + # use the repo from the request only if we don't have -R + if not rpath and not cwd: + repo = req.repo - if repo: - # set the descriptors of the repo ui to those of ui - repo.ui.fin = ui.fin - repo.ui.fout = ui.fout - repo.ui.ferr = ui.ferr - else: - try: - repo = hg.repository(ui, path=path) - if not repo.local(): - raise error.Abort(_("repository '%s' is not local") % path) - repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo') - except error.RequirementError: - raise - except error.RepoError: - if rpath and rpath[-1]: # invalid -R path + if repo: + # set the descriptors of the repo ui to those of ui + repo.ui.fin = ui.fin + repo.ui.fout = ui.fout + repo.ui.ferr = ui.ferr + else: + try: + repo = hg.repository(ui, path=path) + if not repo.local(): + raise error.Abort(_("repository '%s' is not local") + % path) + repo.ui.setconfig("bundle", "mainreporoot", repo.root, + 'repo') + except error.RequirementError: raise - if not _cmdattr(ui, cmd, func, 'optionalrepo'): - if (_cmdattr(ui, cmd, func, 'inferrepo') and - args and not path): - # try to infer -R from command args - repos = map(cmdutil.findrepo, args) - guess = repos[0] - if guess and repos.count(guess) == len(repos): - req.args = ['--repository', guess] + fullargs - return _dispatch(req) - if not path: - raise error.RepoError(_("no repository found in '%s'" - " (.hg not found)") - % os.getcwd()) - raise - if repo: - ui = repo.ui - if options['hidden']: - repo = repo.unfiltered() - args.insert(0, repo) - elif rpath: - ui.warn(_("warning: --repository ignored\n")) + except error.RepoError: + if rpath and rpath[-1]: # invalid -R path + raise + if not _cmdattr(ui, cmd, func, 'optionalrepo'): + if (_cmdattr(ui, cmd, func, 'inferrepo') and + args and not path): + # try to infer -R from command args + repos = map(cmdutil.findrepo, args) + guess = repos[0] + if guess and repos.count(guess) == len(repos): + req.args = ['--repository', guess] + fullargs + return _dispatch(req) + if not path: + raise error.RepoError(_("no repository found in" + " '%s' (.hg not found)") + % os.getcwd()) + raise + if repo: + ui = repo.ui + if options['hidden']: + repo = repo.unfiltered() + args.insert(0, repo) + elif rpath: + ui.warn(_("warning: --repository ignored\n")) - msg = ' '.join(' ' in a and repr(a) or a for a in fullargs) - ui.log("command", '%s\n', msg) - d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) - try: - return runcommand(lui, repo, cmd, fullargs, ui, options, d, - cmdpats, cmdoptions) - finally: - if repo and repo != req.repo: - repo.close() + msg = ' '.join(' ' in a and repr(a) or a for a in fullargs) + ui.log("command", '%s\n', msg) + d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) + try: + return runcommand(lui, repo, cmd, fullargs, ui, options, d, + cmdpats, cmdoptions) + finally: + if repo and repo != req.repo: + repo.close() def _runcommand(ui, options, cmd, cmdfunc): """Run a command function, possibly with profiling enabled."""