@matheusbsbs / matheus-bagliano / commits / 982bb8a303
Fork 0

don't p4 print deleted files.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>

Han-Wen Nienhuys committed May 23, 2007 at 18:49 UTC 982bb8a30376d0024a1794426e6e2291a7a21294
1 file changed +13 -8
contrib/fast-import/git-p4
+13 -8
@@ -674,17 +674,18 @@ class P4Sync(Command):
674
675 ## Should move this out, doesn't use SELF.
676 def readP4Files(self, files):
677 - specs = [(f['path'] + "#" + f['rev'], f) for f in files]
677 + specs = [(f['path'] + "#" + f['rev'], f) for f in files
678 + if f['action'] != 'delete']
679
679 - data = read_pipe('p4 print %s' % ' '.join(['"%s"' % spec
680 - for (spec, info) in specs]))
680 + data = read_pipe('p4 print %s' % ' '.join(['"%s"' % path
681 + for (path, info) in specs]))
682
683 idx = 0
684 for j in range(0, len(specs)):
684 - filespec, info = specs[j]
685 + (pathrev, info) = specs[j]
686
687 assert idx < len(data)
687 - if data[idx:idx + len(filespec)] != filespec:
688 + if data[idx:idx + len(pathrev)] != pathrev:
689 assert False
690 idx = data.find ('\n', idx)
691 assert idx > 0
@@ -694,11 +695,15 @@ class P4Sync(Command):
695
696 end = -1
697 if j < len(specs)-1:
697 - next_spec, next_info = specs[j+1]
698 - end = data.find(next_spec, start)
698 + (next_pathrev, next_info) = specs[j+1]
699 + end = data.find(next_pathrev, start)
700
701 if end < 0:
701 - print spec, next_spec
702 + print 'j'
703 + print 'PATHREV', pathrev, specs[j]
704 + print 'nextpathrev', next_pathrev, specs[j+1]
705 + print 'start', start, len(data)
706 + print 'end', end
707
708 assert end >= 0
709 else: