Skip to content

Instantly share code, notes, and snippets.

@flodolo
Last active March 14, 2018 15:41
Show Gist options
  • Save flodolo/a575bdb4814f5a223233c99b113175b2 to your computer and use it in GitHub Desktop.
Save flodolo/a575bdb4814f5a223233c99b113175b2 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
# virtualenv venv
# source venv/bin/activate
# pip install mercurial python-hglib
# sh ./ftl_migration.sh
function interrupt_code()
# This code runs if user hits control-c
{
echo "\n*** Operation interrupted ***\n"
exit $?
}
# Trap keyboard interrupt (control-c)
trap interrupt_code SIGINT
# Add third_party/python/ to $PYTHONPATH
mozilla_unified_path="/Users/flodolo/mozilla/mercurial/mozilla-unified"
l10n_clones_path="/Users/flodolo/mozilla/mercurial/l10n_clones/locales"
python_fluent_path="/Users/flodolo/mozilla/mercurial/python-fluent/"
compare_locales_path="/Users/flodolo/mozilla/mercurial/compare-locales/"
export PYTHONPATH="${python_fluent_path}:${compare_locales_path}:${PYTHONPATH}:${mozilla_unified_path}/python/l10n/fluent_migrations/"
cd ${l10n_clones_path}
test=( "it" )
#for locale in $test
for locale in */
do
# Remove trailing slash from $locale
locale=${locale%/}
echo "Locale: ${locale}"
# Pull from hg server
hg --cwd ${l10n_clones_path}/${locale} pull -u -r default
# Run migration
# Add --dry-run to not commit
python ${python_fluent_path}/tools/migrate/migrate-l10n.py \
--lang ${locale} \
--reference-dir ${mozilla_unified_path} \
--localization-dir ${l10n_clones_path}/${locale} \
bug_1435912_preferences_general_xul \
bug_1432338_sync_brand \
bug_1424682_preferences_chrome \
bug_1424683_brand_short_name \
bug_1411012_preferences_do_not_track
# Push to hg server
hg --cwd ${l10n_clones_path}/${locale} push
done
@flodolo
Copy link
Author

flodolo commented Feb 4, 2018

Update based on https://gist.github.com/zbraniecki/cf8c495910a233a893d43c129f7f9fdb

Removed dependency on python-fluent in mozilla-unified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment