From: Richard Heck Date: Thu, 16 Jun 2011 15:11:02 +0000 (+0000) Subject: More work on check-po.sh. I guess I'll get this working in branch first, X-Git-Tag: 2.0.1~173 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6ee45831bdedfbc3c02ed62b1b50d2b18d089579;p=features.git More work on check-po.sh. I guess I'll get this working in branch first, and then port to trunk later, rather than keep committing to both. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39102 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/development/tools/check-po.sh b/development/tools/check-po.sh index 59cc1cc551..a16c089f97 100644 --- a/development/tools/check-po.sh +++ b/development/tools/check-po.sh @@ -4,7 +4,14 @@ # 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 +45,11 @@ fi 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 @@ -59,6 +66,7 @@ make update-po >/dev/null 2>&1; echo echo Running make i18n.inc... +rm -f i18n.inc; make i18n.inc >/dev/null 2>&1; if [ -n "$TRUNK" ]; then mv i18n.inc i18n_trunk.inc @@ -67,13 +75,13 @@ else I18NFILE=i18n.inc; fi -if diff -w -q $I18NFILE $FARM/$I18NFILE >/dev/null; then +if diff -w -q $I18NFILE $FARM/$I18NFILE >/dev/null 2>&1; then # No differences found echo No string differences found. if [ "$VCS" = "svn" ]; then - svn revert *.po >/dev/null 2>&1; + svn revert *.po; else - git co *.po >/dev/null 2>&1; + git co *.po; fi exit 0; fi @@ -82,25 +90,31 @@ fi if [ "$VCS" = "svn" ]; then $DEBUG svn ci *.po; else + NOTSAFE=""; + if git status | grep -Pq 'Your branch is (?:ahead|behind)'; then + NOTSAFE="TRUE"; + fi $DEBUG git commit *.po -m "Remerge strings."; - $DEBUG git svn dcommit; + if [ -n "$NOTSAFE" ]; then + echo "You will need to push changes to po files manually." + else + git svn dcommit; + fi fi -exit 1; - if ! cd $FARM; then echo "Unable to cd to $FARM!"; exit 1; fi - echo echo Updating the www-user tree... -svn up +# note that we're assuming this one is svn. +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!