don't p4 print deleted files.
authorHan-Wen Nienhuys <hanwen@google.com>
Wed, 23 May 2007 21:49:35 +0000 (18:49 -0300)
committerHan-Wen Nienhuys <hanwen@google.com>
Wed, 30 May 2007 20:33:18 +0000 (17:33 -0300)
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
contrib/fast-import/git-p4
index d1989e613434a1c2a245a2508892518ba481ea00..63d7a4c995dfd27f599da409f94c3e2b9246e56c 100755 (executable)
@@ -674,17 +674,18 @@ class P4Sync(Command):
 
     ## Should move this out, doesn't use SELF.
     def readP4Files(self, files):
 
     ## Should move this out, doesn't use SELF.
     def readP4Files(self, files):
-        specs = [(f['path'] + "#" + f['rev'], f)  for f in files]
+        specs = [(f['path'] + "#" + f['rev'], f)  for f in files
+                 if f['action'] != 'delete']
 
 
-        data = read_pipe('p4 print %s' % ' '.join(['"%s"' % spec
-                                                   for (spec, info) in specs]))
+        data = read_pipe('p4 print %s' % ' '.join(['"%s"' % path
+                                                   for (path, info) in specs]))
 
         idx = 0
         for j in range(0, len(specs)):
 
         idx = 0
         for j in range(0, len(specs)):
-            filespec, info = specs[j]
+            (pathrev, info) = specs[j]
 
             assert idx < len(data)
 
             assert idx < len(data)
-            if data[idx:idx + len(filespec)] != filespec:
+            if data[idx:idx + len(pathrev)] != pathrev:
                 assert False
             idx = data.find ('\n', idx)
             assert idx > 0
                 assert False
             idx = data.find ('\n', idx)
             assert idx > 0
@@ -694,11 +695,15 @@ class P4Sync(Command):
 
             end = -1
             if j < len(specs)-1:
 
             end = -1
             if j < len(specs)-1:
-                next_spec, next_info = specs[j+1]
-                end = data.find(next_spec, start)
+                (next_pathrev, next_info) = specs[j+1]
+                end = data.find(next_pathrev, start)
 
                 if end < 0:
 
                 if end < 0:
-                    print spec, next_spec
+                    print 'j'
+                    print 'PATHREV', pathrev, specs[j]
+                    print 'nextpathrev', next_pathrev, specs[j+1]
+                    print 'start', start, len(data)
+                    print 'end', end
 
                 assert end >= 0
             else:
 
                 assert end >= 0
             else: