print error message when p4 print fails (eg. due to permission problems)
[gitweb.git] / contrib / fast-import / git-p4
index 294c2ecfcaeb2feab7822d1f7a6d3a20416a4910..35c24c93e3e0705e6861838684c42853d5322e2d 100755 (executable)
@@ -697,10 +697,16 @@ class P4Sync(Command):
             stat = filedata[j]
             j += 1
             text = ''
-            while j < len(filedata) and filedata[j]['code'] == 'text':
+            while j < len(filedata) and filedata[j]['code'] in ('text',
+                                                                'binary'):
                 text += filedata[j]['data']
                 j += 1
 
+
+            if not stat.has_key('depotFile'):
+                sys.stderr.write("p4 print fails with: %s\n" % repr(stat))
+                continue
+
             contents[stat['depotFile']] = text
 
         for f in files:
@@ -773,7 +779,7 @@ class P4Sync(Command):
                 if self.isWindows and file["type"].endswith("text"):
                     data = data.replace("\r\n", "\n")
 
-                self.gitStream.write("M %s inline %s\n" % (mode, relPath))
+                self.gitStream.write("M %d inline %s\n" % (mode, relPath))
                 self.gitStream.write("data %s\n" % len(data))
                 self.gitStream.write(data)
                 self.gitStream.write("\n")