Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Avoid calling fstat for every imported file (slow!) and instead read the file data first into the python process and use the length of the bytes read for the size field of git fast-import.
author
Simon Hausmann
<hausmann@kde.org>
Wed, 31 Jan 2007 21:38:07 +0000
(22:38 +0100)
committer
Simon Hausmann
<hausmann@kde.org>
Wed, 31 Jan 2007 21:38:07 +0000
(22:38 +0100)
Signed-off-by: Simon Hausmann <hausmann@kde.org>
contrib/fast-import/p4-fast-export.py
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
0dd0b9d
)
diff --git
a/contrib/fast-import/p4-fast-export.py
b/contrib/fast-import/p4-fast-export.py
index 45d5157961f0e094586ca0da319e4f0f0eb7f726..133447c4e7a8c367a9e311649cde4756afd4d88b 100644
(file)
--- a/
contrib/fast-import/p4-fast-export.py
+++ b/
contrib/fast-import/p4-fast-export.py
@@
-57,9
+57,6
@@
def p4Cmd(cmd):
result.update(entry)
return result;
result.update(entry)
return result;
-def p4FileSize(path):
- return int(p4Cmd("fstat -Ol \"%s\"" % path)["fileSize"])
-
def getUserMap():
users = {}
def getUserMap():
users = {}
@@
-121,14
+118,15
@@
def getUserMap():
if action == "delete":
gitStream.write("D %s\n" % relPath)
else:
if action == "delete":
gitStream.write("D %s\n" % relPath)
else:
- fileSize = p4FileSize(depotPath)
mode = 644
if description["type%s" % fnum].startswith("x"):
mode = 755
mode = 644
if description["type%s" % fnum].startswith("x"):
mode = 755
+ data = os.popen("p4 print -q \"%s\"" % depotPath, "rb").read()
+
gitStream.write("M %s inline %s\n" % (mode, relPath))
gitStream.write("M %s inline %s\n" % (mode, relPath))
- gitStream.write("data %s\n" %
fileSize
)
- gitStream.write(
os.popen("p4 print -q \"%s\"" % depotPath).read()
)
+ gitStream.write("data %s\n" %
len(data)
)
+ gitStream.write(
data
)
gitStream.write("\n")
fnum = fnum + 1
gitStream.write("\n")
fnum = fnum + 1