{"thread":{"id":"15524","subject":"[PATCH] 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","startedAt":"2008-09-15T04:16:47Z","lastAt":"2008-09-15T04:16:47Z","messageCount":1,"participants":["Dhruva Krishnamurthy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"90703","messageId":"1221452207-27495-1-git-send-email-dhruva@ymail.com","threadId":"15524","inReplyTo":null,"subject":"[PATCH] 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","fromName":"Dhruva Krishnamurthy","fromEmail":"dhruva@ymail.com","sentAt":"2008-09-15T04:16:47Z","receivedAt":"2008-09-15T04:16:47Z","isPatch":true,"sender":{"key":"dhruva@ymail.com","avatar":null},"body":"\nSigned-off-by: Dhruva Krishnamurthy <dhruva@ymail.com>\n---\n contrib/fast-import/git-p4 |   17 ++++++++++++++++-\n 1 files changed, 16 insertions(+), 1 deletions(-)\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+\t\tpass\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+\tkwval = 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-- \n1.6.0.1.454.g63d55\n"}]}