aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMarius Storm-Olsen <marius@trolltech.com>2008-03-03 13:42:47 +0100
committerSimon Hausmann <simon@lst.de>2008-03-13 08:57:29 +0100
commit8ff45f2af5b25b7581072ee7896f4285dfc034ea (patch)
treec3db50d7c2080dee6897cacb19bd0f0500fe1e20 /contrib
parenta6828f536119c3288b0be772e3870f1a464d017d (diff)
downloadgit-8ff45f2af5b25b7581072ee7896f4285dfc034ea.tar.gz
git-8ff45f2af5b25b7581072ee7896f4285dfc034ea.tar.xz
git-p4: Optimize the fetching of data from perforce.
Use shallow copies in loop, and join content at the end. Then do the substitution, if needed. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Simon Hausmann <simon@lst.de>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/fast-import/git-p416
1 files changed, 8 insertions, 8 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 650ea3417..539c5cda0 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -882,21 +882,21 @@ class P4Sync(Command):
while j < len(filedata):
stat = filedata[j]
j += 1
- text = ''
+ text = [];
while j < len(filedata) and filedata[j]['code'] in ('text', 'unicode', 'binary'):
- tmp = filedata[j]['data']
- if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
- tmp = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', tmp)
- elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
- tmp = re.sub(r'(?i)\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', tmp)
- text += tmp
+ text.append(filedata[j]['data'])
j += 1
-
+ text = ''.join(text)
if not stat.has_key('depotFile'):
sys.stderr.write("p4 print fails with: %s\n" % repr(stat))
continue
+ if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
+ text = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', text)
+ elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
+ text = re.sub(r'(?i)\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', text)
+
contents[stat['depotFile']] = text
for f in filesForCommit: