From: Pete Wyckoff <pw@padd•com>
To: git@vger•kernel.org
Cc: Junio C Hamano <gitster@pobox•com>,
Luke Diamand <luke@diamand•org>, Chris Li <git@chrisli•org>
Subject: [PATCH 5/6] git-p4: keyword flattening fixes
Date: Sat, 15 Oct 2011 12:00:19 -0400 [thread overview]
Message-ID: <20111015160019.GF29436@arf.padd.com> (raw)
In-Reply-To: <20111015155358.GA29436@arf.padd.com>
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>
---
contrib/fast-import/git-p4 | 8 ++++++--
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))
--
1.7.6.3
next prev parent reply other threads:[~2011-10-15 16:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-15 15:53 [PATCH v2 0/6] git-p4 tests, filetypes, shell metacharacters Pete Wyckoff
2011-10-15 15:55 ` [PATCH 1/6] git-p4 tests: refactor and cleanup Pete Wyckoff
2011-10-16 9:38 ` Stefano Lattarini
2011-10-16 9:54 ` Stefano Lattarini
2011-10-16 14:35 ` Pete Wyckoff
2011-10-15 15:56 ` [PATCH 2/6] git-p4: handle utf16 filetype properly Pete Wyckoff
2011-10-16 9:52 ` Stefano Lattarini
2011-10-16 14:38 ` Pete Wyckoff
2011-10-15 15:57 ` [PATCH 3/6] git-p4: recognize all p4 filetypes Pete Wyckoff
2011-10-15 15:59 ` [PATCH 4/6] git-p4: stop ignoring apple filetype Pete Wyckoff
2011-10-15 16:00 ` Pete Wyckoff [this message]
2011-10-15 16:02 ` [PATCH 6/6] git-p4: handle files with shell metacharacters Pete Wyckoff
2011-10-15 20:00 ` [PATCH v2 0/6] git-p4 tests, filetypes, " Luke Diamand
-- strict thread matches above, loose matches on Subject: below --
2011-10-16 14:42 [PATCH v3 " Pete Wyckoff
2011-10-16 14:46 ` [PATCH 5/6] git-p4: keyword flattening fixes Pete Wyckoff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111015160019.GF29436@arf.padd.com \
--to=pw@padd$(echo .)com \
--cc=git@chrisli$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=luke@diamand$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox