forked from AFPy/python-docs-fr
new logic
This commit is contained in:
parent
09978df9bf
commit
90060d9eef
|
@ -11,7 +11,7 @@ _usage() {
|
|||
|
||||
LAUNCH_EDIT=1
|
||||
if [ $# -eq 2 ]; then
|
||||
if [ "$1" -eq "-n" ] || [ "$1" -eq "--no-edit" ]; then
|
||||
if [ "$1" = "-n" ] || [ "$1" = "--no-edit" ]; then
|
||||
LAUNCH_EDIT=0
|
||||
else
|
||||
_usage
|
||||
|
@ -43,22 +43,29 @@ fi
|
|||
|
||||
PO_FILE=$1
|
||||
|
||||
# search for revs where fuzzy was added or suppressed
|
||||
# and filter where commit message contains 'merge'
|
||||
FUZZY_REVS=$(git log --oneline -S '#, fuzzy' ${PO_FILE} | \
|
||||
grep -i 'merge' | \
|
||||
awk '{ print $1 }')
|
||||
|
||||
if [ ${LAUNCH_EDIT} -eq 1 ]; then
|
||||
${PO_EDITOR} "${PO_FILE}" 2>/dev/null &
|
||||
fi
|
||||
|
||||
for sha in ${FUZZY_REVS} ; do
|
||||
while read line ; do
|
||||
epoch=${line:0:10}
|
||||
sha=${line:11:9}
|
||||
author=${line:23}
|
||||
echo "Comparing with: "$(date --date=@${epoch})" - ${author}"
|
||||
# filter files à la mode textconv
|
||||
git show ${sha}:${PO_FILE} | grep -v -e '^#:' -e '^"PO' > ${TMP_DIR}/right.po
|
||||
git show ${sha}^:${PO_FILE} | grep -v -e '^#:' -e '^"PO' > ${TMP_DIR}/left.po
|
||||
"${DIFFTOOL}" ${TMP_DIR}/left.po ${TMP_DIR}/right.po
|
||||
done
|
||||
git show ${sha}^:${PO_FILE} | \
|
||||
grep --invert-match \
|
||||
--regexp='^#:' \
|
||||
--regexp='^"PO' > ${TMP_DIR}/${sha}.po
|
||||
# reload current file every time as it may has been modified
|
||||
grep --invert-match \
|
||||
--regexp='^#:' \
|
||||
--regexp='^"PO' ${PO_FILE} > ${TMP_DIR}/current.po
|
||||
"${DIFFTOOL}" ${TMP_DIR}/${sha}.po ${TMP_DIR}/current.po
|
||||
done <<< $(git blame -t ${PO_FILE} | \
|
||||
grep '#, fuzzy$' | \
|
||||
awk 'BEGIN {FIELDWIDTHS="10 32 10"} {print $3, $1, $2}' | \
|
||||
sort --numeric-sort --unique --reverse)
|
||||
|
||||
# clean up temp directory
|
||||
rm --force --recursive "${TMP_DIR}"
|
||||
|
|
Loading…
Reference in New Issue