@matheusbsbs / matheus-bagliano / commits / b1ce944726
Fork 0

thinko: really ignore deleted files.

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

Han-Wen Nienhuys committed May 23, 2007 at 18:49 UTC b1ce94472684957cd5aba759f495a889f154a9a2
1 file changed +18 -10
contrib/fast-import/git-p4
+18 -10
@@ -173,13 +173,18 @@ class P4Debug(Command):
173 def __init__(self):
174 Command.__init__(self)
175 self.options = [
176 - optparse.make_option("--verbose", dest="verbose", action="store_true"),
176 + optparse.make_option("--verbose", dest="verbose", action="store_true",
177 + default=False),
178 ]
179 self.description = "A tool to debug the output of p4 -G."
180 self.needsGit = False
181 + self.verbose = False
182
183 def run(self, args):
184 + j = 0
185 for output in p4CmdList(" ".join(args)):
186 + print 'Element: %d' % j
187 + j += 1
188 print output
189 return True
190
@@ -676,24 +681,27 @@ class P4Sync(Command):
681
682 ## Should move this out, doesn't use SELF.
683 def readP4Files(self, files):
679 - specs = [(f['path'] + "#" + f['rev'], f) for f in files
684 + files = [f for f in files
685 if f['action'] != 'delete']
686
682 - if not specs:
687 + if not files:
688 return
689
685 - filedata = p4CmdList('print %s' % ' '.join(['"%s"' % path
686 - for (path, info) in specs]))
690 + filedata = p4CmdList('print %s' % ' '.join(['"%s#%s"' % (f['path'],
691 + f['rev'])
692 + for f in files]))
693
694 j = 0;
695 contents = {}
690 - while filedata[j:]:
696 + while j < len(filedata):
697 stat = filedata[j]
692 - text = filedata[j+1]
693 - j += 2
698 + j += 1
699 + text = ''
700 + while j < len(filedata) and filedata[j]['code'] == 'text':
701 + text += filedata[j]['data']
702 + j += 1
703
695 - assert stat['code'] == 'stat' and text['code'] == 'text'
696 - contents[stat['depotFile']] = text['data']
704 + contents[stat['depotFile']] = text
705
706 for f in files:
707 assert not f.has_key('data')