diff options
author | Simon Hausmann <hausmann@kde.org> | 2007-01-31 20:48:39 +0100 |
---|---|---|
committer | Simon Hausmann <hausmann@kde.org> | 2007-01-31 20:48:39 +0100 |
commit | 3f2ddd47c7f311516dc7092b0a89b46291e40271 (patch) | |
tree | 3ac9eac2625a76749da59ec02fc9e7dde63985c4 /contrib | |
parent | Speed up the import of individual files from Perforce into git by passing the... (diff) | |
download | tgif-3f2ddd47c7f311516dc7092b0a89b46291e40271.tar.xz |
Removed unused p4cat function and added helper function for the perforce python interface (p4Cmd).
Signed-off-by: Simon Hausmann <hausmann@kde.org>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/fast-import/p4-fast-export.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/contrib/fast-import/p4-fast-export.py b/contrib/fast-import/p4-fast-export.py index 72a4fd70a5..e284b19502 100644 --- a/contrib/fast-import/p4-fast-export.py +++ b/contrib/fast-import/p4-fast-export.py @@ -14,6 +14,7 @@ # - don't hardcode the import to master # import os, string, sys, time +import marshal if len(sys.argv) != 2: sys.stderr.write("usage: %s //depot/path[@revRange]\n" % sys.argv[0]); @@ -37,6 +38,18 @@ except ValueError: if not prefix.endswith("/"): prefix += "/" +def p4Cmd(cmd): + pipe = os.popen("p4 -G %s" % cmd, "rb") + result = {} + try: + while True: + entry = marshal.load(pipe) + result.update(entry) + except EOFError: + pass + pipe.close() + return result + def describe(change): output = os.popen("p4 describe %s" % change).readlines() @@ -88,9 +101,6 @@ def describe(change): return author, log, epoch, changed, removed -def p4cat(path): - return os.popen("p4 print -q \"%s\"" % path).read() - def p4Stat(path): output = os.popen("p4 fstat -Ol \"%s\"" % path).readlines() fileSize = 0 |