Mercurial > hg-stable
changeset 4554:9dbabb9d466c
dispatch: use the repo path found by early parsing
This lets us simplify things a bit.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 11 Jun 2007 21:09:24 -0500 |
parents | 741f64dfc04d |
children | 1843d31bfdbf |
files | mercurial/cmdutil.py tests/test-ssh.out |
diffstat | 2 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Mon Jun 11 21:09:24 2007 -0500 +++ b/mercurial/cmdutil.py Mon Jun 11 21:09:24 2007 -0500 @@ -256,11 +256,11 @@ ui.addreadhook(extensions.loadall) # read the local extension info into a local ui object - rcpath = earlygetopt(["-R", "--repository"], args) or localrepo.findrepo() - if rcpath: + path = earlygetopt(["-R", "--repository"], args) or localrepo.findrepo() or "" + if path: try: lui = commands.ui.ui(parentui=ui) - lui.readconfig(os.path.join(rcpath, ".hg", "hgrc")) + lui.readconfig(os.path.join(path, ".hg", "hgrc")) except IOError: pass @@ -287,11 +287,6 @@ not options["noninteractive"], options["traceback"], parseconfig(options["config"])) - path = ui.expandpath(options["repository"]) or "" - repo = path and hg.repository(ui, path=path) or None - if repo and not repo.local(): - raise util.Abort(_("repository '%s' is not local") % path) - if options['help']: return commands.help_(ui, cmd, options['version']) elif options['version']: @@ -300,10 +295,12 @@ return commands.help_(ui, 'shortlist') if cmd not in commands.norepo.split(): + repo = None try: - if not repo: - repo = hg.repository(ui, path=path) - ui = repo.ui + repo = hg.repository(ui, path=path) + #ui = repo.ui + if not repo.local(): + raise util.Abort(_("repository '%s' is not local") % path) except hg.RepoError: if cmd not in commands.optionalrepo.split(): raise
--- a/tests/test-ssh.out Mon Jun 11 21:09:24 2007 -0500 +++ b/tests/test-ssh.out Mon Jun 11 21:09:24 2007 -0500 @@ -1,6 +1,6 @@ # creating 'remote' # repo not found error -remote: abort: repository nonexistent not found! +remote: abort: There is no Mercurial repository here (.hg not found)! abort: no suitable response from remote hg! # clone remote via stream streaming all changes