+ ## Should move this out, doesn't use SELF.
+ def readP4Files(self, files):
+ specs = [(f['path'] + "#" + f['rev'], f) for f in files]
+
+ data = read_pipe('p4 print %s' % ' '.join(['"%s"' % spec
+ for (spec, info) in specs]))
+
+ idx = 0
+ for j in range(0, len(specs)):
+ filespec, info = specs[j]
+
+ assert idx < len(data)
+ if data[idx:idx + len(filespec)] != filespec:
+ assert False
+ idx = data.find ('\n', idx)
+ assert idx > 0
+ idx += 1
+
+ start = idx
+
+ end = -1
+ if j < len(specs)-1:
+ next_spec, next_info = specs[j+1]
+ end = data.find(next_spec, start)
+
+ assert end >= 0
+ else:
+ end = len(specs)
+
+
+ info['data'] = data[start:end]
+ idx = end
+