Skip to content

Instantly share code, notes, and snippets.

@KangOl
Last active May 4, 2017 09:02
Show Gist options
  • Save KangOl/ae0f7e6076f6890d73fb to your computer and use it in GitHub Desktop.
Save KangOl/ae0f7e6076f6890d73fb to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e -x
pushd "$(git rev-parse --show-toplevel)"
# remove empty directories
find . \( -name "*.~?~" -or -name "*.pyc" -or -name "*.pyo" -or -name "*.orig" -or -name "*.rej" \) -delete
find . -not -path './.git/*' -a -type d -empty -delete
# remove po for removed modules
for D in addons openerp/addons odoo/addons .; do
find $D -maxdepth 1 -type d -and -not -name '.*' -exec bash -c "echo -ne '{} '; ls '{}' | wc -l" \; | awk '$NF==1 {print $1}' | xargs -rt -- git rm -rf --ignore-unmatch --
done;
#find addons -maxdepth 1 -type d -exec bash -c "echo -ne '{} '; ls '{}' | wc -l" \; | awk '$NF==1 {print $1}' | xargs -rt -- git rm -rf --ignore-unmatch --
#find openerp/addons -maxdepth 1 -type d -exec bash -c "echo -ne '{} '; ls '{}' | wc -l" \; | awk '$NF==1 {print $1}' | xargs -rt -- git rm -rf --ignore-unmatch --
#find . -maxdepth 1 -type d -and -not -name '.*' -exec bash -c "echo -ne '{} '; ls '{}' | wc -l" \; | awk '$NF==1 {print $1}' | xargs -rt -- git rm -rf --ignore-unmatch --
# re-add deleted po(t)
git status --porcelain | egrep "^DU .+\.pot?\$" | awk '{print $2}' | xargs -rt -- git add --
# keep merged modified po(t)
git status --porcelain | egrep "^UU .+\.pot?\$" | awk '{print $2}' | xargs -rt -- git checkout --theirs --
git status --porcelain | egrep "^UU .+\.pot?\$" | awk '{print $2}' | xargs -rt -- git add --
#!/usr/bin/env bash
set -e -x
shopt -s nullglob
pushd "$(git rev-parse --show-toplevel)"
git reset --quiet -- {{openerp/,odoo/,}addons/,}*/i18n/
git status --porcelain -uall | egrep "\?\? .+\.pot?\$" | awk '{print $2}' | xargs -r rm -f
find . -type d -name i18n -empty -delete
git checkout --quiet -- {{openerp/,odoo/,}addons/,}*/i18n/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment