diff mercurial/dispatch.py @ 11675:f92f8921a5cc stable

dispatch: give better error message when cwd doesn't exist (issue2293) Previous behavior wasn't very helpful: $ hg st foo abort: No such file or directory Now we tell more about what failed: abort: error getting current working directory: No such file or directory
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 24 Jul 2010 00:38:08 +0200
parents 76454cbc11e4
children e4357c214bf1
line wrap: on
line diff
--- a/mercurial/dispatch.py	Thu Jul 22 23:18:38 2010 +0900
+++ b/mercurial/dispatch.py	Sat Jul 24 00:38:08 2010 +0200
@@ -366,7 +366,12 @@
         os.chdir(cwd[-1])
 
     # read the local repository .hgrc into a local ui object
-    path = cmdutil.findrepo(os.getcwd()) or ""
+    try:
+        wd = os.getcwd()
+    except OSError, e:
+        raise util.Abort(_("error getting current working directory: %s") % 
+                         e.strerror)
+    path = cmdutil.findrepo(wd) or ""
     if not path:
         lui = ui
     else: