You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm noticing that crowdin regularly somehow has its l10n_master have merge conflicts with our master branch. This requires some git gymnastics to resolve, since we want to merge but have all the PO files from 10n_master "win" in the merge.
The following Python script essentially automates this process:
importsysimportsubprocessMASTER='master'L10N_MASTER='l10n_master'LOCALES_DIR='locales/**/*.po'defgit(*args: str, ignore_errors: bool=False, expect_errors: bool=False):
ifexpect_errors:
ignore_errors=Truecmdline= ['git', *args]
print(f"Running \"{' '.join(cmdline)}\".")
retval=subprocess.call(cmdline)
ifretval:
ifignore_errors:
ifnotexpect_errors:
print(f"git exited abnormally, but ignoring errors.")
else:
print(f"git returned exit code {retval}, exiting.")
sys.exit(retval)
elifexpect_errors:
print(f"Expected git to exit abnormally but it didn't!")
sys.exit(1)
if__name__=='__main__':
git('checkout', MASTER)
git('pull')
print()
print(f"Deleting existing {L10N_MASTER} branch if it exists.")
git('branch', '-D', L10N_MASTER, ignore_errors=True)
print()
print(f"Checking out latest {L10N_MASTER} and merging {MASTER} into")
print(f"it, keeping files in {LOCALES_DIR} from {L10N_MASTER}.")
git('checkout', L10N_MASTER)
git('merge', MASTER, expect_errors=True)
git('checkout', '--ours', LOCALES_DIR)
git('add', LOCALES_DIR)
git('commit', '-m', f"Merge into {MASTER}.")
print()
print(f"Done. Run 'git push' to push the merged {L10N_MASTER}.")
But I'm not sure if regularly running this script is the best option, or if there's something far simpler that I'm somehow missing.
The text was updated successfully, but these errors were encountered:
toolness
added
the
code snippet
Temporary code that we only need to run once and don't need to merge for long-term use.
label
Oct 19, 2020
I'm noticing that crowdin regularly somehow has its
l10n_master
have merge conflicts with ourmaster
branch. This requires some git gymnastics to resolve, since we want to merge but have all the PO files from10n_master
"win" in the merge.The following Python script essentially automates this process:
But I'm not sure if regularly running this script is the best option, or if there's something far simpler that I'm somehow missing.
The text was updated successfully, but these errors were encountered: