Created
December 26, 2020 14:35
-
-
Save yzgyyang/36f0003c97958737fbd12fd96e8094be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
DOC_TREE="/usr/home/guangyuan/fbrepo/freebsd-doc/zh_TW.UTF-8" #/zh_CN.UTF-8 | |
echo "Doc tree defined as ${DOC_TREE}." | |
cd ${DOC_TREE} | |
FILES_CVT=$(ag --files-with-matches "Original [Rr]evision: r[0-9]*\s") | |
echo $(echo ${FILES_CVT} | wc -w) files | |
for filename in ${FILES_CVT}; do | |
svn_rev=$(sed -n -e 's/.*Original [Rr]evision: r\([0-9]*\).*/\1/p' ${filename}) | |
git_hash=$(git log --grep revision=${svn_rev} | head -n1 | cut -d' ' -f2 | head -c10) | |
sed -i '' "s/\(.*Original \)[Rr]\(evision: \)r\([0-9]*\)\(.*\)/\1R\2${git_hash} (r\3)\4/g" ${filename} | |
echo ${svn_rev} ${git_hash} ${filename} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment