dispatch: use the repo path found by early parsing
This lets us simplify things a bit.
--- 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