Index: update_translations =================================================================== --- update_translations +++ update_translations @@ -18,6 +18,91 @@ diff -q -I^\"POT-Creation-Date: -I^\"Content-T -I^\"Language-Team: $1 $2 > /dev/null } +update_module() +{ + i=$1 + vcs=`get_vcs $i` + if test -n "$NOUPDATE"; then + if test "$vcs" = git; then + branch=`get_branch $i` + i=`get_path $i` + if ! (cd $i && git reset $SVNQUIETFLAG --hard origin/$branch); then + echo "ERROR: failed to switch to $branch in $i" + fi + fi + continue + fi + test -z "$VERBOSE1" || echo "updating $i" + + modname=$i + i=`get_path $i` + if test ! -d $i; then + case "$vcs" in + svn) + mkdir -p $i + svn co -q $SVNROOT/$i $i || echo "ERROR: checking out $i has failed!" + ;; + git) + git clone -v --no-checkout $SVNQUIETFLAG `get_url $modname` $i || echo "ERROR: checking out $i has failed!" + ;; + *) + echo "ERROR: unexpected VCS type?!" + exit 1 + ;; + esac + fi + + if cd $i; then + if test "$vcs" = "git"; then + # cleanup the old branches + git remote prune origin || echo "ERROR: pruning $i has failed!" + git fetch $SVNQUIETFLAG || echo "ERROR: fetching $i has failed!" + branch=`get_branch $modname` + fi + ### TODO: perhaps we could combine cleanup/svn-clean/revert (One svn stat -u, if it fails cleanup and revert are called, otherwise only svn-cleanup is done.) + if test -z "$NO_INITIAL_CLEANUP"; then + case "$vcs" in + svn) + svn cleanup . + perl $kdesdkscriptsdir/svn-clean -f | fgrep -v "Subversion working directory" | grep -v '^F' + test -z "$VERBOSE1" || echo + # revert all changes, so that the following "svn update" is without conflicts + svn revert $SVNQUIETFLAG -R . + ### TODO: do we need to revert the external directories of l10n too? (Are we modifying them at all?) + ;; + git) + git clean -dxf $SVNQUIETFLAG + ;; + *) + echo "ERROR: unexpected VCS type?!" + exit 1 + ;; + esac + fi # test -z $NO_INITIAL_CLEANUP + + test -z "$VERBOSE1" || echo + case "$vcs" in + svn) + svn update $SVNQUIETFLAG || echo "ERROR: module $i was not correctly updated" + ;; + git) + if ! git reset $SVNQUIETFLAG --hard origin/$branch; then + echo "ERROR: failed to switch to branch $branch for module $modname." + #FIXME I'd rather gracefully skip this module. but how? + #perhaps I could filter $releases. findfiles could be trouble though. + fi + ;; + *) + echo "ERROR: unexpected VCS type?!" + exit 1 + ;; + esac + cd $BASEDIR + else + echo "ERROR: could not enter directory $i ! The module's update is SKIPPED!" + fi +} + update_translations() { echo "@@@ Processing branch $transmod ..." test -z "$TIMING1" || date @@ -31,86 +116,7 @@ fi # no kde_qt in kf5 for i in $releases l10n; do - vcs=`get_vcs $i` - if test -n "$NOUPDATE"; then - if test "$vcs" = git; then - branch=`get_branch $i` - i=`get_path $i` - if ! (cd $i && git reset $SVNQUIETFLAG --hard origin/$branch); then - echo "ERROR: failed to switch to $branch in $i" - fi - fi - continue - fi - test -z "$VERBOSE1" || echo "updating $i" - - modname=$i - i=`get_path $i` - if test ! -d $i; then - case "$vcs" in - svn) - mkdir -p $i - svn co -q $SVNROOT/$i $i || echo "ERROR: checking out $i has failed!" - ;; - git) - git clone -v --no-checkout $SVNQUIETFLAG `get_url $modname` $i || echo "ERROR: checking out $i has failed!" - ;; - *) - echo "ERROR: unexpected VCS type?!" - exit 1 - ;; - esac - fi - - if cd $i; then - if test "$vcs" = "git"; then - # cleanup the old branches - git remote prune origin || echo "ERROR: pruning $i has failed!" - git fetch $SVNQUIETFLAG || echo "ERROR: fetching $i has failed!" - branch=`get_branch $modname` - fi - ### TODO: perhaps we could combine cleanup/svn-clean/revert (One svn stat -u, if it fails cleanup and revert are called, otherwise only svn-cleanup is done.) - if test -z "$NO_INITIAL_CLEANUP"; then - case "$vcs" in - svn) - svn cleanup . - perl $kdesdkscriptsdir/svn-clean -f | fgrep -v "Subversion working directory" | grep -v '^F' - test -z "$VERBOSE1" || echo - # revert all changes, so that the following "svn update" is without conflicts - svn revert $SVNQUIETFLAG -R . - ### TODO: do we need to revert the external directories of l10n too? (Are we modifying them at all?) - ;; - git) - git clean -dxf $SVNQUIETFLAG - ;; - *) - echo "ERROR: unexpected VCS type?!" - exit 1 - ;; - esac - fi # test -z $NO_INITIAL_CLEANUP - - test -z "$VERBOSE1" || echo - case "$vcs" in - svn) - svn update $SVNQUIETFLAG || echo "ERROR: module $i was not correctly updated" - ;; - git) - if ! git reset $SVNQUIETFLAG --hard origin/$branch; then - echo "ERROR: failed to switch to branch $branch for module $modname." - #FIXME I'd rather gracefully skip this module. but how? - #perhaps I could filter $releases. findfiles could be trouble though. - fi - ;; - *) - echo "ERROR: unexpected VCS type?!" - exit 1 - ;; - esac - cd $BASEDIR - else - echo "ERROR: could not enter directory $i ! The module's update is SKIPPED!" - fi + update_module $1 done test -z "$VERBOSE1" || echo "finished updating"