Created
April 9, 2021 18:27
-
-
Save bennuttall/0b57b7c2de52b9f5c7cd511a4c84c52a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mosromgr.mostypes import MosFile | |
from glob import glob | |
from git import Repo | |
files = glob('*.mos.xml') | |
ro, *mosfiles = sorted(MosFile.from_file(f) for f in files) | |
repo = Repo.init('.') | |
ro_id = ro.ro_id.replace(';', '_') | |
ro_file = f'{ro_id}.mos.xml' | |
filename = f'{ro.message_id}-roCreate.mos.xml' | |
with open(ro_file, 'w') as f: | |
f.write(str(ro)) | |
repo.index.add([ro_file]) | |
repo.index.commit(f"Add {filename}") | |
for mf in mosfiles: | |
ro += mf | |
filename = f'{mf.message_id}-{mf.base_tag_name}.mos.xml' | |
with open(ro_file, 'w') as f: | |
f.write(str(ro)) | |
repo.index.add([ro_file]) | |
repo.index.commit(f"Merge {filename}") |
Author
bennuttall
commented
May 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment