# HG changeset patch # User Matt Mackall # Date 1181614164 18000 # Node ID 9dbabb9d466c57f649cdbbc0be158abee44a9da5 # Parent 741f64dfc04d14eb764f087dbcdeb26d644c2c8f dispatch: use the repo path found by early parsing This lets us simplify things a bit. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -256,11 +256,11 @@ def dispatch(ui, args): 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 @@ def dispatch(ui, args): 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 @@ def dispatch(ui, args): 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 diff --git a/tests/test-ssh.out b/tests/test-ssh.out --- a/tests/test-ssh.out +++ b/tests/test-ssh.out @@ -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