Removed unused p4cat function and added helper function for the perforce python interface (p4Cmd).
Signed-off-by: Simon Hausmann <hausmann@kde.org>
Simon Hausmann committed
Jan 31, 2007 at 20:48 UTC
3f2ddd47c7f311516dc7092b0a89b46291e40271
1 file changed
+13
-3
contrib/fast-import/p4-fast-export.py
+13
-3
@@ -14,6 +14,7 @@
14
# - don't hardcode the import to master
15
#
16
import os, string, sys, time
17
+import marshal
18
19
if len(sys.argv) != 2:
20
sys.stderr.write("usage: %s //depot/path[@revRange]\n" % sys.argv[0]);
@@ -37,6 +38,18 @@ except ValueError:
38
if not prefix.endswith("/"):
39
prefix += "/"
40
41
+def p4Cmd(cmd):
42
+ pipe = os.popen("p4 -G %s" % cmd, "rb")
43
+ result = {}
44
+ try:
45
+ while True:
46
+ entry = marshal.load(pipe)
47
+ result.update(entry)
48
+ except EOFError:
49
+ pass
50
+ pipe.close()
51
+ return result
52
+
53
def describe(change):
54
output = os.popen("p4 describe %s" % change).readlines()
55
@@ -88,9 +101,6 @@ def describe(change):
101
102
return author, log, epoch, changed, removed
103
91
-def p4cat(path):
92
- return os.popen("p4 print -q \"%s\"" % path).read()
93
-
104
def p4Stat(path):
105
output = os.popen("p4 fstat -Ol \"%s\"" % path).readlines()
106
fileSize = 0