convert.cvs: Initialize state variable and abort on cvs error
Fix as proposed by Frank Kingswood.
Avoids
UnboundLocalError: local variable 'mode' referenced before assignment
when cvs fails.
This alsa partially fixes
issue1592.
--- a/hgext/convert/cvs.py Thu Apr 01 00:02:12 2010 +0200
+++ b/hgext/convert/cvs.py Tue Mar 30 02:42:21 2010 +0200
@@ -227,6 +227,7 @@
self.writep.flush()
data = ""
+ mode = None
while 1:
line = self.readp.readline()
if line.startswith("Created ") or line.startswith("Updated "):
@@ -244,6 +245,8 @@
data = chunkedread(self.readp, count)
else:
if line == "ok\n":
+ if mode is None:
+ raise util.Abort(_('malformed response from CVS'))
return (data, "x" in mode and "x" or "")
elif line.startswith("E "):
self.ui.warn(_("cvs server: %s\n") % line[2:])