git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dhruva <dhruva@ymail.com>
To: Simon Hausmann <simon@lst.de>
Cc: Junio C Hamano <gitster@pobox.com>, GIT SCM <git@vger.kernel.org>,
	Jing Xue <jingxue@digizenstudio.com>
Subject: Re: PATCH: git-p4 optional handling of RCS keywords
Date: Thu, 11 Sep 2008 09:36:34 +0530 (IST)	[thread overview]
Message-ID: <880457.35643.qm@web95006.mail.in2.yahoo.com> (raw)

Hello,


Commit message: Modifying RCS keywords prevents submitting to p4 from git due to missing hunks. Optional shrinking of RCS keywords in git-p4. New option git-p4.kwstrip set to true or false controls the behavior..

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")


-dhruva


----- Original Message ----
> From: Simon Hausmann <simon@lst.de>
> > +       kwval = kwval.lower();
> > +        if "false" == kwval:
> > +            kwstrip = False
> > +        elif "true" == kwval:
> > +            kwstrip = True
> 
> I have another style nitpick, sorry :). Please use "kwval == "false" instead 
> of the other way around.

There was a reason for keeping the constant as lvalue to avoid typos like '=' instead from '==' from 'C' school, I realize that python throws an error when such things happen. Must say that programming languages are becoming smarter and taking away the charm of programming...
 
> Otherwise your patch looks good to me, I think it's a very good option to add. 
> Please resend with commit message so that Junio can include it.


      Add more friends to your messenger and enjoy! Go to http://in.messenger.yahoo.com/invite/

             reply	other threads:[~2008-09-11  4:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-11  4:06 dhruva [this message]
2008-09-11  6:33 ` PATCH: git-p4 optional handling of RCS keywords Tor Arvid Lund
  -- strict thread matches above, loose matches on Subject: below --
2008-09-11  9:18 dhruva
2008-09-11  7:13 dhruva
     [not found] <646617.59689.qm@web95011.mail.in2.yahoo.com>
2008-09-10 19:18 ` Simon Hausmann
2008-09-10  5:13 PATCH: git-p4 optional handling of RCS keywords [was: Re: git-p4 and keyword expansion] dhruva
2008-09-10  5:35 ` PATCH: git-p4 optional handling of RCS keywords Junio C Hamano

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=880457.35643.qm@web95006.mail.in2.yahoo.com \
    --to=dhruva@ymail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jingxue@digizenstudio.com \
    --cc=simon@lst.de \
    /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).