{"thread":{"id":"15487","subject":"Re: PATCH: git-p4 optional handling of RCS keywords","startedAt":"2008-09-11T04:06:34Z","lastAt":"2008-09-11T06:33:57Z","messageCount":2,"participants":["dhruva","Tor Arvid Lund"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"90410","messageId":"880457.35643.qm@web95006.mail.in2.yahoo.com","threadId":"15487","inReplyTo":null,"subject":"Re: PATCH: git-p4 optional handling of RCS keywords","fromName":"dhruva","fromEmail":"dhruva@ymail.com","sentAt":"2008-09-11T04:06:34Z","receivedAt":"2008-09-11T04:06:34Z","isPatch":false,"sender":{"key":"dhruva@ymail.com","avatar":null},"body":"Hello,\n\n\nCommit 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..\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex 2216cac..ac8b7f7 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -16,6 +16,9 @@ from sets import Set;\n\n verbose = False\n\n+# Handling of RCS keyowrds. To ensure backward compatibility, the default\n+# is to strip keywords. Default behavior is controlled here\n+kwstrip = True\n\n def p4_build_cmd(cmd):\n     \"\"\"Build a suitable p4 command line.\n@@ -975,7 +978,9 @@ class P4Sync(Command):\n                 sys.stderr.write(\"p4 print fails with: %s\\n\" % repr(stat))\n                 continue\n\n-            if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):\n+            if not kwstrip:\n+               pass\n+            elif stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):\n                 text = re.sub(r'(?i)\\$(Id|Header):[^$]*\\$',r'$\\1$', text)\n             elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):\n                 text = re.sub(r'\\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\\$',r'$\\1$', text)\n@@ -1850,6 +1855,16 @@ def main():\n         (cmd, args) = parser.parse_args(sys.argv[2:], cmd);\n     global verbose\n     verbose = cmd.verbose\n+\n+    global kwstrip\n+    kwval = gitConfig(\"git-p4.kwstrip\")\n+    if len(kwval) > 0:\n+       kwval = kwval.lower();\n+        if kwval == \"false\":\n+            kwstrip = False\n+        elif kwval == \"true\":\n+            kwstrip = True\n+\n     if cmd.needsGit:\n         if cmd.gitdir == None:\n             cmd.gitdir = os..path.abspath(\".git\")\n\n\n-dhruva\n\n\n----- Original Message ----\n> From: Simon Hausmann <simon@lst.de>\n> > +       kwval = kwval.lower();\n> > +        if \"false\" == kwval:\n> > +            kwstrip = False\n> > +        elif \"true\" == kwval:\n> > +            kwstrip = True\n> \n> I have another style nitpick, sorry :). Please use \"kwval == \"false\" instead \n> of the other way around.\n\nThere 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...\n \n> Otherwise your patch looks good to me, I think it's a very good option to add. \n> Please resend with commit message so that Junio can include it.\n\n\n      Add more friends to your messenger and enjoy! Go to http://in.messenger.yahoo.com/invite/\n"},{"id":"90417","messageId":"1a6be5fa0809102333j3218ada0xb905e3766c7697cd@mail.gmail.com","threadId":"15487","inReplyTo":"880457.35643.qm@web95006.mail.in2.yahoo.com","subject":"Re: PATCH: git-p4 optional handling of RCS keywords","fromName":"Tor Arvid Lund","fromEmail":"torarvid@gmail.com","sentAt":"2008-09-11T06:33:57Z","receivedAt":"2008-09-11T06:33:57Z","isPatch":false,"sender":{"key":"torarvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/439758?v=4"},"body":"On Thu, Sep 11, 2008 at 6:06 AM, dhruva <dhruva@ymail.com> wrote:\n> Hello,\n>\n>\n> 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..\n<snip away the diff>\n\nMe guesses that Junio (who gets loads of patches) would be happy if you do:\n\n1) Squash these changes down to one single commit\n2) Run git format-patch -1\n3) Send it to the list either with git send-email, or otherwise send\nthe 0001-<your-commit-summary>.patch to the list directly if your\nmailer supports it.\n\nThe reason is simply that the maintainer can simply use git am\n<your-raw-mail-message-file> to commit it, instead of having to\nmanually sift through the emails.\n\nOtherwise, this is nice work. Thanks.\n\n-Tor Arvid-\n"}]}