[PATCH] qimport: report filename in case of IOError
Martin Geisler
mg at daimi.au.dk
Mon Aug 25 17:05:39 CDT 2008
# HG changeset patch
# User Martin Geisler <mg at daimi.au.dk>
# Date 1219701858 -7200
# Node ID 39083e3378479eae0fdbc0d92c400ff469cc1562
# Parent 3aa8ad0e03ba54ad926c10bb84a85baf68647368
qimport: report filename in case of IOError
The old behaviour was to say "abort: unable to read" since the
patchname variable was always None.
diff -r 3aa8ad0e03ba -r 39083e337847 hgext/mq.py
--- a/hgext/mq.py Mon Aug 25 01:26:08 2008 +0200
+++ b/hgext/mq.py Tue Aug 26 00:04:18 2008 +0200
@@ -1494,7 +1494,7 @@
else:
text = file(filename, 'rb').read()
except IOError:
- raise util.Abort(_("unable to read %s") % patchname)
+ raise util.Abort(_("unable to read %s") % filename)
if not patchname:
patchname = normname(os.path.basename(filename))
self.check_reserved_name(patchname)
diff -r 3aa8ad0e03ba -r 39083e337847 tests/test-mq-qimport
--- a/tests/test-mq-qimport Mon Aug 25 01:26:08 2008 +0200
+++ b/tests/test-mq-qimport Tue Aug 26 00:04:18 2008 +0200
@@ -21,9 +21,13 @@
echo "[diff]" >> $HGRCPATH
echo "git=1" >> $HGRCPATH
-echo % build diff with CRLF
hg init repo
cd repo
+
+echo % qimport non-existing-file
+hg qimport non-existing-file
+
+echo % build diff with CRLF
python ../writelines.py b 5 'a\n' 5 'a\r\n'
hg ci -Am addb
python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n'
diff -r 3aa8ad0e03ba -r 39083e337847 tests/test-mq-qimport.out
--- a/tests/test-mq-qimport.out Mon Aug 25 01:26:08 2008 +0200
+++ b/tests/test-mq-qimport.out Tue Aug 26 00:04:18 2008 +0200
@@ -1,3 +1,5 @@
+% qimport non-existing-file
+abort: unable to read non-existing-file
% build diff with CRLF
adding b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
More information about the Mercurial-devel
mailing list