summaryrefslogtreecommitdiff
path: root/contrib/fast-import
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2011-10-16 14:46:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-10-18 03:46:49 (GMT)
commitcb585a9cda70320647cc5d69e71bedc929244189 (patch)
tree2afb56758290b5ee2cbe9738adc21c1ebc669222 /contrib/fast-import
parent97a21ca50ef893a171a50c863fe21a924935fd2a (diff)
downloadgit-cb585a9cda70320647cc5d69e71bedc929244189.zip
git-cb585a9cda70320647cc5d69e71bedc929244189.tar.gz
git-cb585a9cda70320647cc5d69e71bedc929244189.tar.bz2
git-p4: keyword flattening fixes
Join the text before looking for keywords. There is nothing to prevent the p4 output marshaller from splitting in the middle of a keyword, although it has never been known to happen. Also remove the (?i) regexp modifier; perforce keywords are documented as case-sensitive. Remove the "\n" end-character match. I don't know why that is in there, and every keyword in a fairly large production p4 repository always ends with a $. Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/fast-import')
-rwxr-xr-xcontrib/fast-import/git-p48
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 6b91595..55b1667 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -1285,9 +1285,13 @@ class P4Sync(Command, P4UserMap):
# even though in theory somebody may want that.
if type_base in ("text", "unicode", "binary"):
if "ko" in type_mods:
- contents = map(lambda text: re.sub(r'(?i)\$(Id|Header):[^$]*\$', r'$\1$', text), contents)
+ text = ''.join(contents)
+ text = re.sub(r'\$(Id|Header):[^$]*\$', r'$\1$', text)
+ contents = [ text ]
elif "k" in type_mods:
- contents = map(lambda text: re.sub(r'\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$\n]*\$', r'$\1$', text), contents)
+ text = ''.join(contents)
+ text = re.sub(r'\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$', r'$\1$', text)
+ contents = [ text ]
self.gitStream.write("M %s inline %s\n" % (git_mode, relPath))