Code

Remove $Id: ..$ $Header: ..$ etc from +ko and +k files during import
authorJason McMullan <mcmullan@netapp.com>
Wed, 5 Dec 2007 17:16:56 +0000 (12:16 -0500)
committerSimon Hausmann <simon@lst.de>
Sun, 3 Feb 2008 18:18:33 +0000 (19:18 +0100)
This patch removes the '$Keyword: ...$' '...' data, so that files
don't have spurious megre conflicts between branches.

Handles both +ko and +k styles, and leaves the '$Foo$' in
the original file.

Signed-off-by: Simon Hausmann <simon@lst.de>
contrib/fast-import/git-p4

index c80a6da2522b690e15f84fedf52a132078cd265a..31c5501d113d9668f6fd74d9c2c1557e7719f712 100755 (executable)
@@ -964,9 +964,13 @@ class P4Sync(Command):
             stat = filedata[j]
             j += 1
             text = ''
-            while j < len(filedata) and filedata[j]['code'] in ('text',
-                                                                'binary'):
-                text += filedata[j]['data']
+            while j < len(filedata) and filedata[j]['code'] in ('text', 'unicode', 'binary'):
+                tmp = filedata[j]['data']
+                if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
+                    tmp = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', tmp)
+                elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
+                    tmp = re.sub(r'(?i)\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', tmp)
+                text += tmp
                 j += 1