changeset 9587:d80a251baf9a

convert/svn: better error when hg cannot call itself (issue1838)
author Patrick Mezard <pmezard@gmail.com>
date Thu, 15 Oct 2009 23:15:30 +0200
parents d08099e74b81
children a9d1e7c8160e a981ddb16b80
files hgext/convert/subversion.py tests/test-convert-svn-branches tests/test-convert-svn-branches.out
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Thu Oct 15 23:15:30 2009 +0200
+++ b/hgext/convert/subversion.py	Thu Oct 15 23:15:30 2009 +0200
@@ -115,7 +115,11 @@
 
     def __iter__(self):
         while True:
-            entry = pickle.load(self._stdout)
+            try:
+                entry = pickle.load(self._stdout)
+            except EOFError:
+                raise util.Abort(_('Mercurial failed to run itself, check'
+                                   ' hg executable is in PATH'))
             try:
                 orig_paths, revnum, author, date, message = entry
             except:
--- a/tests/test-convert-svn-branches	Thu Oct 15 23:15:30 2009 +0200
+++ b/tests/test-convert-svn-branches	Thu Oct 15 23:15:30 2009 +0200
@@ -28,3 +28,7 @@
 hg branches | sed 's/:.*/:/'
 hg tags -q
 cd ..
+
+echo '% test hg failing to call itself'
+HG=foobar hg convert svn-repo B-hg 2>&1 | grep -v foobar
+
--- a/tests/test-convert-svn-branches.out	Thu Oct 15 23:15:30 2009 +0200
+++ b/tests/test-convert-svn-branches.out	Thu Oct 15 23:15:30 2009 +0200
@@ -48,3 +48,6 @@
 old                            9:
 old2                           8:
 tip
+% test hg failing to call itself
+initializing destination B-hg repository
+abort: Mercurial failed to run itself, check hg executable is in PATH