git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dhruva Krishnamurthy <dhruva@ymail.com>
To: GIT SCM <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	Dhruva Krishnamurthy <dhruva@ymail.com>
Subject: [PATCH] Optional shrinking of RCS keywords in git-p4
Date: Mon, 15 Sep 2008 11:28:51 +0530	[thread overview]
Message-ID: <1221458331-8804-1-git-send-email-dhruva@ymail.com> (raw)

Modifying RCS keywords prevents submitting to p4 from git due to missing hunks.
New option git-p4.kwstrip set to true or false controls the behavior.

Signed-off-by: Dhruva Krishnamurthy <dhruva@ymail.com>
---
 contrib/fast-import/git-p4 |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 2216cac..ac8b7f7 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -16,6 +16,9 @@ from sets import Set;
 
 verbose = False
 
+# Handling of RCS keyowrds. To ensure backward compatibility, the default
+# is to strip keywords. Default behavior is controlled here
+kwstrip = True
 
 def p4_build_cmd(cmd):
     """Build a suitable p4 command line.
@@ -975,7 +978,9 @@ class P4Sync(Command):
                 sys.stderr.write("p4 print fails with: %s\n" % repr(stat))
                 continue
 
-            if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
+            if not kwstrip:
+		pass
+            elif 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'\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', text)
@@ -1850,6 +1855,16 @@ def main():
         (cmd, args) = parser.parse_args(sys.argv[2:], cmd);
     global verbose
     verbose = cmd.verbose
+
+    global kwstrip
+    kwval = gitConfig("git-p4.kwstrip")
+    if len(kwval) > 0:
+	kwval = kwval.lower();
+        if kwval == "false":
+            kwstrip = False
+        elif kwval == "true":
+            kwstrip = True
+
     if cmd.needsGit:
         if cmd.gitdir == None:
             cmd.gitdir = os.path.abspath(".git")
-- 
1.6.0.1.454.g63d55

             reply	other threads:[~2008-09-15  6:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-15  5:58 Dhruva Krishnamurthy [this message]
2008-09-15  6:09 ` [PATCH] Optional shrinking of RCS keywords in git-p4 David Brown
2008-09-15  6:17 ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2008-09-15  6:26 dhruva
2008-09-15  6:35 ` David Brown
2008-09-15  7:43   ` Junio C Hamano
2008-09-15 11:02     ` Tor Arvid Lund
2008-09-15 19:22     ` Daniel Barkalow
2008-09-16  4:12       ` David Brown
2008-09-16 12:58         ` Jing Xue
2008-09-16 17:12         ` Daniel Barkalow
2008-09-16 17:32           ` Daniel Barkalow
2008-09-15  6:31 dhruva
2008-09-15  7:21 dhruva
2008-09-15 11:46 dhruva
2008-09-15 15:27 ` Tor Arvid Lund
2008-09-16  2:51 dhruva
2008-09-16  4:53 dhruva
2008-09-16 17:26 ` Daniel Barkalow
2008-09-16 13:33 dhruva
2008-09-19  2:56 dhruva

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=1221458331-8804-1-git-send-email-dhruva@ymail.com \
    --to=dhruva@ymail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).