[PATCH] give better error message when cwd doesn't exist (issue2293)
Mads Kiilerich
mads at kiilerich.com
Mon Jul 19 13:38:31 CDT 2010
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1279564696 -7200
# Node ID 7188e91800dad219404367fd9b29f72d3d0b7e7a
# Parent 8fba8ae8577d8a40bc3e68e52e69b8c57155851f
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
$
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -376,7 +376,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:
More information about the Mercurial-devel
mailing list