diff hgext/convert/git.py @ 10987:b3af02b1f19f stable

convert/git: check status when reading output stream
author Patrick Mezard <pmezard@gmail.com>
date Sun, 25 Apr 2010 23:07:46 +0200
parents 610f047326b9
children 33010ff1fd6f
line wrap: on
line diff
--- a/hgext/convert/git.py	Sun Apr 25 22:59:50 2010 +0200
+++ b/hgext/convert/git.py	Sun Apr 25 23:07:46 2010 +0200
@@ -94,6 +94,8 @@
                 self.modecache[(f, h)] = (p and "x") or (s and "l") or ""
                 changes.append((f, h))
             entry = None
+        if fh.close():
+            raise util.Abort(_('cannot read changes in %s') % version)
         return (changes, {})
 
     def getcommit(self, version):
@@ -144,6 +146,8 @@
                 continue
             tag = tag[len(prefix):-3]
             tags[tag] = node
+        if fh.close():
+            raise util.Abort(_('cannot read tags from %s') % self.path)
 
         return tags
 
@@ -156,11 +160,11 @@
                     continue
                 m, f = l[:-1].split("\t")
                 changes.append(f)
-            fh.close()
         else:
             fh = self.gitopen('git diff-tree --name-only --root -r %s "%s^%s" --'
                              % (version, version, i + 1))
             changes = [f.rstrip('\n') for f in fh]
-            fh.close()
+        if fh.close():
+            raise util.Abort(_('cannot read changes in %s') % version)
 
         return changes