Imported Upstream version 17.7.0
[platform/upstream/libzypp.git] / po / PotfileUpadte.sh
1 #! /bin/bash
2 set -e
3
4 function errexit() {
5   echo "$0: $@" >&2
6   exit 1
7 }
8
9 function currentBranch()
10 { git rev-parse --abbrev-ref HEAD; }
11
12 test "$(currentBranch)" == "master"     || errexit "Not on master branch."
13 test "$(basename "$PWD")" == "po"       || errexit "Cd to the po directory."
14
15 test "$(git status --porcelain 2>/dev/null| grep '^[^ !?]' | wc -l)" == 0 || errexit "Index not clean: wont't commit"
16
17 BINDIR="${1}"
18 test -z "$BINDIR" && errexit "Missing argument: BINDIR"
19 test -d "$BINDIR" || errexit "Not a directory: BINDIR '$BINDIR'"
20 echo "Updating .pot .po files from $BINDIR..."
21 for F in *.pot *.po; do
22   if [ -f "$BINDIR/$F" ]; then
23     cp "$BINDIR/$F" .
24   else
25     errexit "Missing file $BINDIR/$F (touch CMakeLists.txt?)"
26   fi
27 done
28
29 git add -A *.pot *.po
30 git commit -m 'Translation: updated .pot file'