Show More
@@ -12,9 +12,10 b' import cmdutil, encoding' | |||
|
12 | 12 | import ui as uimod |
|
13 | 13 | |
|
14 | 14 | class request(object): |
|
15 | def __init__(self, args, ui=None): | |
|
15 | def __init__(self, args, ui=None, repo=None): | |
|
16 | 16 | self.args = args |
|
17 | 17 | self.ui = ui |
|
18 | self.repo = repo | |
|
18 | 19 | |
|
19 | 20 | def run(): |
|
20 | 21 | "run the command in sys.argv" |
@@ -592,26 +593,31 b' def _dispatch(req):' | |||
|
592 | 593 | repo = None |
|
593 | 594 | cmdpats = args[:] |
|
594 | 595 | if cmd not in commands.norepo.split(): |
|
595 | try: | |
|
596 | repo = hg.repository(ui, path=path) | |
|
597 |
|
|
|
598 | if not repo.local(): | |
|
599 | raise util.Abort(_("repository '%s' is not local") % path) | |
|
600 | ui.setconfig("bundle", "mainreporoot", repo.root) | |
|
601 | except error.RequirementError: | |
|
602 |
r |
|
|
603 | except error.RepoError: | |
|
604 | if cmd not in commands.optionalrepo.split(): | |
|
605 | if args and not path: # try to infer -R from command args | |
|
606 | repos = map(cmdutil.findrepo, args) | |
|
607 | guess = repos[0] | |
|
608 | if guess and repos.count(guess) == len(repos): | |
|
609 | req.args = ['--repository', guess] + fullargs | |
|
610 | return _dispatch(req) | |
|
611 | if not path: | |
|
612 | raise error.RepoError(_("no repository found in %r" | |
|
613 | " (.hg not found)") % os.getcwd()) | |
|
596 | # use the repo from the request only if we don't have -R | |
|
597 | if not rpath: | |
|
598 | repo = req.repo | |
|
599 | ||
|
600 | if not repo: | |
|
601 | try: | |
|
602 | repo = hg.repository(ui, path=path) | |
|
603 | ui = repo.ui | |
|
604 | if not repo.local(): | |
|
605 | raise util.Abort(_("repository '%s' is not local") % path) | |
|
606 | ui.setconfig("bundle", "mainreporoot", repo.root) | |
|
607 | except error.RequirementError: | |
|
614 | 608 | raise |
|
609 | except error.RepoError: | |
|
610 | if cmd not in commands.optionalrepo.split(): | |
|
611 | if args and not path: # try to infer -R from command args | |
|
612 | repos = map(cmdutil.findrepo, args) | |
|
613 | guess = repos[0] | |
|
614 | if guess and repos.count(guess) == len(repos): | |
|
615 | req.args = ['--repository', guess] + fullargs | |
|
616 | return _dispatch(req) | |
|
617 | if not path: | |
|
618 | raise error.RepoError(_("no repository found in %r" | |
|
619 | " (.hg not found)") % os.getcwd()) | |
|
620 | raise | |
|
615 | 621 | args.insert(0, repo) |
|
616 | 622 | elif rpath: |
|
617 | 623 | ui.warn(_("warning: --repository ignored\n")) |
General Comments 0
You need to be logged in to leave comments.
Login now