Skip to content

Commit f3e9512

Browse files
Jason McMullantronical
authored andcommitted
Remove $Id: ..$ $Header: ..$ etc from +ko and +k files during import
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>
1 parent d8534ad commit f3e9512

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

contrib/fast-import/git-p4

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -964,9 +964,13 @@ class P4Sync(Command):
964964
stat = filedata[j]
965965
j += 1
966966
text = ''
967-
while j < len(filedata) and filedata[j]['code'] in ('text',
968-
'binary'):
969-
text += filedata[j]['data']
967+
while j < len(filedata) and filedata[j]['code'] in ('text', 'unicode', 'binary'):
968+
tmp = filedata[j]['data']
969+
if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
970+
tmp = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', tmp)
971+
elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
972+
tmp = re.sub(r'(?i)\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', tmp)
973+
text += tmp
970974
j += 1
971975

972976

0 commit comments

Comments
 (0)