fuzzy_diff new logic (#204)
current version searches for commits where commit message states 'merge', indicating sync with original rst files. This version searches for fuzzy entries in current file and finds associated commits. It should reduce the number of files to compare current version to, and displays them in backward chronological order (i.e. newest first). Reviewed-on: #204 Reviewed-by: Julien Palard <julien@palard.fr> Co-authored-by: Christophe Nanteuil <christophe.nanteuil@gmail.com> Co-committed-by: Christophe Nanteuil <christophe.nanteuil@gmail.com>
This commit is contained in:
parent
357760d048
commit
927f924c15
1 changed files with 20 additions and 10 deletions
|
|
@ -43,21 +43,31 @@ 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
|
||||
git blame --line-porcelain ${PO_FILE} | \
|
||||
awk '/^[0-9a-f]{40} / { sha=$1 }
|
||||
/^author / {$1="" ; author=$0 }
|
||||
/^committer-time / { $1="" ; date=$0 }
|
||||
/^\s#, fuzzy/ { printf "%-10s %-40s %s\n", date, sha, author}' |
|
||||
sort --numeric-sort --unique --reverse |
|
||||
while read line ; do
|
||||
gdh=$(date --date=@${line:0:10})
|
||||
sha=${line:11:40}
|
||||
author=${line:52}
|
||||
echo "Comparing with: ${gdh} - ${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
|
||||
git show ${sha}^:${PO_FILE} | \
|
||||
grep --invert-match \
|
||||
--regexp='^#:' \
|
||||
--regexp='^"PO' > "${TMP_DIR}/${gdh}.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}/${gdh}.po" ${TMP_DIR}/current.po
|
||||
done
|
||||
|
||||
# clean up temp directory
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue