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