git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Hausmann <simon@lst.de>
To: dhruva <dhruva@ymail.com>
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: Wed, 10 Sep 2008 21:18:52 +0200	[thread overview]
Message-ID: <200809102119.01630.simon@lst.de> (raw)
In-Reply-To: <646617.59689.qm@web95011.mail.in2.yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]

On Wednesday 10 September 2008 08:29:56 dhruva wrote:
> Hi,
>  Incorporated the style tip, sure makes it look cleaner.
>
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index 2216cac..3e72e43 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 "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.

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.


Simon

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

       reply	other threads:[~2008-09-10 19:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <646617.59689.qm@web95011.mail.in2.yahoo.com>
2008-09-10 19:18 ` Simon Hausmann [this message]
2008-09-11  9:18 PATCH: git-p4 optional handling of RCS keywords dhruva
  -- strict thread matches above, loose matches on Subject: below --
2008-09-11  7:13 dhruva
2008-09-11  4:06 dhruva
2008-09-11  6:33 ` Tor Arvid Lund
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=200809102119.01630.simon@lst.de \
    --to=simon@lst.de \
    --cc=dhruva@ymail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jingxue@digizenstudio.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).