Final changes, I think, for the check-po script.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39106 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2011-06-16 15:32:23 +00:00
parent 236776593e
commit 6f6d6ff26a

View File

@ -1,15 +1,19 @@
#!/bin/sh #!/bin/sh
# A script to check whether there have been any string changes. # A script to check whether there have been any string changes.
# If it finds some, it commits the new po files and then updates
# the stats.
# The script expects an environment variable FARM that # The script expects an environment variable FARM that will provide
# will provide it with the location of the LyX www tree. # it with the location of the LyX www tree.
DEBUG=""; DEBUG="";
while getopts ":dh" options $ARGS; do while getopts ":dh" options $ARGS; do
case $options in case $options in
d) DEBUG="echo";; d) DEBUG="echo";;
h) echo "check-po.sh [-d]"; echo "You must also point the FARM variable to LyX's www tree."; exit 0;; h) echo "check-po.sh [-d]";
echo "You must also point the FARM variable to LyX's www tree.";
exit 0;;
esac esac
done done
@ -78,41 +82,45 @@ svn revert $FARM/$I18NFILE;
echo Running make i18n.inc... echo Running make i18n.inc...
make i18n.inc >/dev/null 2>&1; make i18n.inc >/dev/null 2>&1;
if [ -n "$TRUNK" ]; then if [ -n "$TRUNK" ]; then
mv i18n.inc i18n_trunk.inc mv -f i18n.inc i18n_trunk.inc
fi fi
if diff -w -q $I18NFILE $FARM/$I18NFILE >/dev/null 2>&1; then if diff -w -q $I18NFILE $FARM/$I18NFILE >/dev/null 2>&1; then
# No differences found
echo No string differences found. echo No string differences found.
# So we will revert the changes to po files, which are probably
# just dates and such.
if [ "$VCS" = "svn" ]; then if [ "$VCS" = "svn" ]; then
svn revert *.po; svn revert *.po;
else else
git co *.po; git checkout *.po;
fi fi
exit 0; exit 0;
fi fi
# else # So there are differences.
if [ "$VCS" = "svn" ]; then if [ "$VCS" = "svn" ]; then
$DEBUG svn ci *.po; $DEBUG svn ci *.po;
else else
# We need to make sure that we have a tree without any unpushed
# commits. Otherwise git svn dcommit would commit more than we
# want.
NOTSAFE=""; NOTSAFE="";
if git status | grep -Pq 'Your branch is (?:ahead|behind)'; then if git status | grep -Pq 'Your branch is (?:ahead|behind)'; then
NOTSAFE="TRUE"; NOTSAFE="TRUE";
fi fi
$DEBUG git commit *.po -m "Remerge strings."; $DEBUG git commit *.po -m "Remerge strings.";
if [ -n "$NOTSAFE" ]; then if [ -z "$NOTSAFE" ]; then
echo "You will need to push changes to po files manually." $DEBUG git svn dcommit;
else
git svn dcommit;
fi fi
fi fi
echo
if ! cd $FARM; then if ! cd $FARM; then
echo "Unable to cd to $FARM!"; echo "Unable to cd to $FARM!";
exit 1; exit 1;
fi fi
echo
echo Updating the www-user tree... echo Updating the www-user tree...
# note that we're assuming this one is svn. # note that we're assuming this one is svn.
svn up; svn up;
@ -123,4 +131,8 @@ mv $LYXROOT/po/$I18NFILE .;
echo Committing...; echo Committing...;
$DEBUG svn commit -m "* $I18NFILE: update stats" $I18NFILE; $DEBUG svn commit -m "* $I18NFILE: update stats" $I18NFILE;
echo DONE! if [ -n "$NOTSAFE" ]; then
echo
echo "Your LyX tree was not clean.";
echo "Your will need to push changes to po files manually."
fi