changeset 9474:6ea653272c09

convert: fix marshalling in P4 convert extension to use a binary stream The Perforce convert extension uses the p4 -G command line option and marshal.load to obtain information about the history of a Perforce depot. The method marshal.load must be provided with a binary stream (mode='rb') in order to function reliably. Certain changelist descriptions or other elements in a depot history could trigger a premature EOFError, causing the conversion process to fail. This may resolve the issue discussed in the following thread: http://www.selenic.com/pipermail/mercurial/2009-July/026813.html
author Peter Ingebretson <pingebre@yahoo.com>
date Wed, 23 Sep 2009 15:36:51 +0200
parents ba75830d17a9
children c295a82a020b
files hgext/convert/p4.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/p4.py	Sat Sep 19 13:52:54 2009 +0200
+++ b/hgext/convert/p4.py	Wed Sep 23 15:36:51 2009 +0200
@@ -53,7 +53,7 @@
     def _parse_view(self, path):
         "Read changes affecting the path"
         cmd = 'p4 -G changes -s submitted "%s"' % path
-        stdout = util.popen(cmd)
+        stdout = util.popen(cmd, mode='rb')
         for d in loaditer(stdout):
             c = d.get("change", None)
             if c:
@@ -72,7 +72,7 @@
                 views = {"//": ""}
         else:
             cmd = 'p4 -G client -o "%s"' % path
-            clientspec = marshal.load(util.popen(cmd))
+            clientspec = marshal.load(util.popen(cmd, mode='rb'))
 
             views = {}
             for client in clientspec:
@@ -105,7 +105,7 @@
         lastid = None
         for change in self.p4changes:
             cmd = "p4 -G describe %s" % change
-            stdout = util.popen(cmd)
+            stdout = util.popen(cmd, mode='rb')
             d = marshal.load(stdout)
 
             desc = self.recode(d["desc"])
@@ -147,7 +147,7 @@
 
     def getfile(self, name, rev):
         cmd = 'p4 -G print "%s#%s"' % (self.depotname[name], rev)
-        stdout = util.popen(cmd)
+        stdout = util.popen(cmd, mode='rb')
 
         mode = None
         contents = ""