convert/svn: better error when hg cannot call itself (issue1838)
authorPatrick Mezard <pmezard@gmail.com>
Thu, 15 Oct 2009 23:15:30 +0200
changeset 9587 d80a251baf9a
parent 9586 d08099e74b81
child 9588 a9d1e7c8160e
child 9598 a981ddb16b80
convert/svn: better error when hg cannot call itself (issue1838)
hgext/convert/subversion.py
tests/test-convert-svn-branches
tests/test-convert-svn-branches.out
--- 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