comparison mercurial/dispatch.py @ 14743:84a680daa4b2 stable

dispatch: pass the correct ui to runcommand For commands that take a repo, repo.ui is passed as the ui to runcommand. This restores that behaviour when the request has a repo.
author Idan Kamara <idankk86@gmail.com>
date Fri, 24 Jun 2011 19:36:44 +0300
parents d4b9d3b91ce7
children 23325c5ef6a7
comparison
equal deleted inserted replaced
14742:271424fdbeec 14743:84a680daa4b2
623 repo = req.repo 623 repo = req.repo
624 624
625 if not repo: 625 if not repo:
626 try: 626 try:
627 repo = hg.repository(ui, path=path) 627 repo = hg.repository(ui, path=path)
628 ui = repo.ui
629 if not repo.local(): 628 if not repo.local():
630 raise util.Abort(_("repository '%s' is not local") % path) 629 raise util.Abort(_("repository '%s' is not local") % path)
631 ui.setconfig("bundle", "mainreporoot", repo.root) 630 repo.ui.setconfig("bundle", "mainreporoot", repo.root)
632 except error.RequirementError: 631 except error.RequirementError:
633 raise 632 raise
634 except error.RepoError: 633 except error.RepoError:
635 if cmd not in commands.optionalrepo.split(): 634 if cmd not in commands.optionalrepo.split():
636 if args and not path: # try to infer -R from command args 635 if args and not path: # try to infer -R from command args
641 return _dispatch(req) 640 return _dispatch(req)
642 if not path: 641 if not path:
643 raise error.RepoError(_("no repository found in %r" 642 raise error.RepoError(_("no repository found in %r"
644 " (.hg not found)") % os.getcwd()) 643 " (.hg not found)") % os.getcwd())
645 raise 644 raise
645 if repo:
646 ui = repo.ui
646 args.insert(0, repo) 647 args.insert(0, repo)
647 elif rpath: 648 elif rpath:
648 ui.warn(_("warning: --repository ignored\n")) 649 ui.warn(_("warning: --repository ignored\n"))
649 650
650 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs) 651 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)