##// END OF EJS Templates
dispatch: change indentation level in _dispatch()...
Arun Kulshreshtha -
r30005:dfd97e60 default
parent child Browse files
Show More
@@ -844,60 +844,63 b' def _dispatch(req):'
844 844 elif not cmd:
845 845 return commands.help_(ui, 'shortlist')
846 846
847 repo = None
848 cmdpats = args[:]
849 if not _cmdattr(ui, cmd, func, 'norepo'):
850 # use the repo from the request only if we don't have -R
851 if not rpath and not cwd:
852 repo = req.repo
847 if True:
848 repo = None
849 cmdpats = args[:]
850 if not _cmdattr(ui, cmd, func, 'norepo'):
851 # use the repo from the request only if we don't have -R
852 if not rpath and not cwd:
853 repo = req.repo
853 854
854 if repo:
855 # set the descriptors of the repo ui to those of ui
856 repo.ui.fin = ui.fin
857 repo.ui.fout = ui.fout
858 repo.ui.ferr = ui.ferr
859 else:
860 try:
861 repo = hg.repository(ui, path=path)
862 if not repo.local():
863 raise error.Abort(_("repository '%s' is not local") % path)
864 repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo')
865 except error.RequirementError:
866 raise
867 except error.RepoError:
868 if rpath and rpath[-1]: # invalid -R path
855 if repo:
856 # set the descriptors of the repo ui to those of ui
857 repo.ui.fin = ui.fin
858 repo.ui.fout = ui.fout
859 repo.ui.ferr = ui.ferr
860 else:
861 try:
862 repo = hg.repository(ui, path=path)
863 if not repo.local():
864 raise error.Abort(_("repository '%s' is not local")
865 % path)
866 repo.ui.setconfig("bundle", "mainreporoot", repo.root,
867 'repo')
868 except error.RequirementError:
869 869 raise
870 if not _cmdattr(ui, cmd, func, 'optionalrepo'):
871 if (_cmdattr(ui, cmd, func, 'inferrepo') and
872 args and not path):
873 # try to infer -R from command args
874 repos = map(cmdutil.findrepo, args)
875 guess = repos[0]
876 if guess and repos.count(guess) == len(repos):
877 req.args = ['--repository', guess] + fullargs
878 return _dispatch(req)
879 if not path:
880 raise error.RepoError(_("no repository found in '%s'"
881 " (.hg not found)")
882 % os.getcwd())
883 raise
884 if repo:
885 ui = repo.ui
886 if options['hidden']:
887 repo = repo.unfiltered()
888 args.insert(0, repo)
889 elif rpath:
890 ui.warn(_("warning: --repository ignored\n"))
870 except error.RepoError:
871 if rpath and rpath[-1]: # invalid -R path
872 raise
873 if not _cmdattr(ui, cmd, func, 'optionalrepo'):
874 if (_cmdattr(ui, cmd, func, 'inferrepo') and
875 args and not path):
876 # try to infer -R from command args
877 repos = map(cmdutil.findrepo, args)
878 guess = repos[0]
879 if guess and repos.count(guess) == len(repos):
880 req.args = ['--repository', guess] + fullargs
881 return _dispatch(req)
882 if not path:
883 raise error.RepoError(_("no repository found in"
884 " '%s' (.hg not found)")
885 % os.getcwd())
886 raise
887 if repo:
888 ui = repo.ui
889 if options['hidden']:
890 repo = repo.unfiltered()
891 args.insert(0, repo)
892 elif rpath:
893 ui.warn(_("warning: --repository ignored\n"))
891 894
892 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
893 ui.log("command", '%s\n', msg)
894 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
895 try:
896 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
897 cmdpats, cmdoptions)
898 finally:
899 if repo and repo != req.repo:
900 repo.close()
895 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
896 ui.log("command", '%s\n', msg)
897 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
898 try:
899 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
900 cmdpats, cmdoptions)
901 finally:
902 if repo and repo != req.repo:
903 repo.close()
901 904
902 905 def _runcommand(ui, options, cmd, cmdfunc):
903 906 """Run a command function, possibly with profiling enabled."""
General Comments 0
You need to be logged in to leave comments. Login now