20 lines
1.2 KiB
Python
20 lines
1.2 KiB
Python
# Row 125 r3: resolve the two --3way conflicts against post-164 base cfde62f9f (run from wt3; "ours" is 164's base text, "theirs" is 125's r2 text).
|
|
import re
|
|
def split(path):
|
|
s = open(path, encoding='utf-8').read().split('\n')
|
|
a = s.index('<<<<<<< ours'); m = s.index('=======', a); b = s.index('>>>>>>> theirs', m)
|
|
assert sum(l.startswith('<<<<<<<') for l in s) == 1
|
|
return s[:a], s[a+1:m], s[m+1:b], s[b+1:]
|
|
# kinds.test.mjs: theirs (125) title, ours (164) key list
|
|
p = 'packages/plugins/tests/kinds.test.mjs'
|
|
pre, ours, theirs, post = split(p)
|
|
assert len(ours) == 2 and len(theirs) == 2 and '"channel"' in ours[1] and 'row 125' in theirs[0]
|
|
open(p, 'w', encoding='utf-8').write('\n'.join(pre + [theirs[0], ours[1]] + post))
|
|
# README.md: 125's three lines + Limit checks section, then 164's section (ours from its blank line on)
|
|
p = 'packages/plugins/README.md'
|
|
pre, ours, theirs, post = split(p)
|
|
assert ours[3] == '' and ours[4] == '## Human project/thread channels', ours[:5]
|
|
assert theirs[3] == '' and theirs[4] == '## Limit checks (row 125)' and theirs[-1] != ''
|
|
open(p, 'w', encoding='utf-8').write('\n'.join(pre + theirs + ours[3:] + post))
|
|
print('resolved')
|