changeset 4654:e0e73ba37983

Fix dispatch error message when not in a repo
author Brendan Cully <brendan@kublai.com>
date Wed, 20 Jun 2007 20:13:31 -0700
parents ca023b63ba1f
children 120626e06409
files mercurial/cmdutil.py tests/test-dispatch tests/test-dispatch.out
diffstat 3 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Jun 20 19:20:37 2007 -0700
+++ b/mercurial/cmdutil.py	Wed Jun 20 20:13:31 2007 -0700
@@ -320,6 +320,9 @@
                 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:
--- a/tests/test-dispatch	Wed Jun 20 19:20:37 2007 -0700
+++ b/tests/test-dispatch	Wed Jun 20 20:13:31 2007 -0700
@@ -17,3 +17,9 @@
 EOF
 hg cat a
 
+echo '% no repo'
+cd ..
+hg cat
+
+exit 0
+ 
\ No newline at end of file
--- a/tests/test-dispatch.out	Wed Jun 20 19:20:37 2007 -0700
+++ b/tests/test-dispatch.out	Wed Jun 20 20:13:31 2007 -0700
@@ -28,3 +28,5 @@
 % [defaults]
 a
 a
+% no repo
+abort: There is no Mercurial repository here (.hg not found)!