# HG changeset patch # User Brendan Cully # Date 2007-06-21 03:13:31 # Node ID e0e73ba3798368efae019d7fe12fac577804bbbe # Parent ca023b63ba1f3a847868000aa7911a92b7806c16 Fix dispatch error message when not in a repo diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -320,6 +320,9 @@ def dispatch(ui, args): raise util.Abort(_("repository '%s' is not local") % path) except hg.RepoError: if cmd not in commands.optionalrepo.split(): + if not path: + raise hg.RepoError(_("There is no Mercurial repository here" + " (.hg not found)")) raise d = lambda: func(ui, repo, *args, **cmdoptions) else: diff --git a/tests/test-dispatch b/tests/test-dispatch --- a/tests/test-dispatch +++ b/tests/test-dispatch @@ -17,3 +17,9 @@ cat = -v EOF hg cat a +echo '% no repo' +cd .. +hg cat + +exit 0 + \ No newline at end of file diff --git a/tests/test-dispatch.out b/tests/test-dispatch.out --- a/tests/test-dispatch.out +++ b/tests/test-dispatch.out @@ -28,3 +28,5 @@ use "hg -v help cat" to show global opti % [defaults] a a +% no repo +abort: There is no Mercurial repository here (.hg not found)!