forked from AFPy/python-docs-fr
more robust parsing of git blame
This commit is contained in:
parent
90060d9eef
commit
e10705d13d
|
@ -48,23 +48,25 @@ if [ ${LAUNCH_EDIT} -eq 1 ]; then
|
|||
fi
|
||||
|
||||
while read line ; do
|
||||
epoch=${line:0:10}
|
||||
sha=${line:11:9}
|
||||
author=${line:23}
|
||||
echo "Comparing with: "$(date --date=@${epoch})" - ${author}"
|
||||
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 --invert-match \
|
||||
--regexp='^#:' \
|
||||
--regexp='^"PO' > ${TMP_DIR}/${sha}.po
|
||||
--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}/${sha}.po ${TMP_DIR}/current.po
|
||||
done <<< $(git blame -t ${PO_FILE} | \
|
||||
grep '#, fuzzy$' | \
|
||||
awk 'BEGIN {FIELDWIDTHS="10 32 10"} {print $3, $1, $2}' | \
|
||||
"${DIFFTOOL}" "${TMP_DIR}/${gdh}.po" ${TMP_DIR}/current.po
|
||||
done <<< $(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)
|
||||
|
||||
# clean up temp directory
|
||||
|
|
Loading…
Reference in New Issue
Block a user