Author: rgheck
Date: Thu Jun 16 17:35:46 2011
New Revision: 39109
URL: http://www.lyx.org/trac/changeset/39109
Log:
Port changes to update-po.sh.
Added:
lyx-devel/trunk/development/tools/update-po.sh
- copied, changed from r39108,
lyx-devel/trunk/development/tools/check-po.sh
Deleted:
lyx-devel/trunk/development/tools/check-po.sh
Copied and modified: lyx-devel/trunk/development/tools/update-po.sh (from
r39108, lyx-devel/trunk/development/tools/check-po.sh)
==============================================================================
--- lyx-devel/trunk/development/tools/check-po.sh Thu Jun 16 17:35:42
2011 (r39108, copy source)
+++ lyx-devel/trunk/development/tools/update-po.sh Thu Jun 16 17:35:46
2011 (r39109)
@@ -1,10 +1,21 @@
#!/bin/sh
# 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
-# will provide it with the location of the LyX www tree.
+# The script expects an environment variable FARM that will provide
+# it with the location of the LyX www tree.
-DEBUG="echo";
+DEBUG="";
+
+while getopts ":dh" options $ARGS; do
+ case $options in
+ d) DEBUG="echo";;
+ h) echo "check-po.sh [-d]";
+ echo "You must also point the FARM variable to LyX's www tree.";
+ exit 0;;
+ esac
+done
if [ -z "$FARM" ]; then
echo "You must set the FARM variable to run this script, e.g.:";
@@ -38,11 +49,11 @@
VCS="";
if svn log >/dev/null 2>&1; then
VCS="svn";
-else if git diff >/dev/null 2>&1; then
+elif git diff >/dev/null 2>&1; then
VCS="git";
fi
-if [ -n "$VCS" ]; then
+if [ -z "$VCS" ]; then
echo "Unable to determine version control system!";
exit 1;
fi
@@ -58,48 +69,70 @@
make update-po >/dev/null 2>&1;
echo
-echo Running make i18n.inc...
-make i18n.inc >/dev/null 2>&1;
if [ -n "$TRUNK" ]; then
- mv i18n.inc i18n_trunk.inc
I18NFILE=i18n_trunk.inc;
else
I18NFILE=i18n.inc;
fi
-if diff -w -q $I18NFILE $FARM/$I18NFILE >/dev/null; then
- # No differences found
+# make sure things are clean
+rm -f i18n.inc;
+svn revert $FARM/$I18NFILE;
+
+echo Running make i18n.inc...
+make i18n.inc >/dev/null 2>&1;
+if [ -n "$TRUNK" ]; then
+ mv -f i18n.inc i18n_trunk.inc
+fi
+
+if diff -w -q $I18NFILE $FARM/$I18NFILE >/dev/null 2>&1; then
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
- svn revert *.po >/dev/null 2>&1;
+ svn revert *.po;
else
- git co *.po >/dev/null 2>&1;
+ git checkout *.po;
fi
exit 0;
fi
-# else
+# So there are differences.
if [ "$VCS" = "svn" ]; then
$DEBUG svn ci *.po;
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="";
+ if git status | grep -Pq 'Your branch is (?:ahead|behind)'; then
+ NOTSAFE="TRUE";
+ fi
$DEBUG git commit *.po -m "Remerge strings.";
- # I think probably we shouldn't try to push/commit to remote.
- echo "You will need to commit changes to po files manually."
+ if [ -z "$NOTSAFE" ]; then
+ $DEBUG git svn dcommit;
+ fi
fi
+echo
+
if ! cd $FARM; then
echo "Unable to cd to $FARM!";
exit 1;
fi
-echo
+
echo Updating the www-user tree...
# note that we're assuming this one is svn.
-svn up >/dev/null 2>&1;
+svn up;
-echo Copying $I18NFILE...;
-cp $LYXROOT/po/$I18NFILE .;
+echo Moving $I18NFILE...;
+mv $LYXROOT/po/$I18NFILE .;
echo Committing...;
-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