OT: sync your git repository with translationproject.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hi folks,

 maybe the following script will help to someone who is using git and
 translationproject.org.

    Karel



#!/bin/bash
#
# git-tp-sync - downloads the latest PO files from translationproject.org
#               and commits changes to your GIT repository.
#
# Features:
#             - commit per PO file (no more huge commits for all .po files)
#             - the commit "Author:" field is set from the Last-Translator
#
#
# Copyright (C) 2007 Karel Zak <kzak@xxxxxxxxxx>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#

if [ -z "$1" ]; then
	echo "Usage: $0 <project-name>"
	exit 1
fi

rsync  -Lrtvz  translationproject.org::tp/latest/"$1"/ po

PO_NEW=$(git-runstatus --untracked | gawk '/\#[[:blank:]]*po/ { sub("\\#[[:blank:]]*po/", ""); print $0 }' | sort)
PO_MOD=$(git ls-files --modified | gawk '/po\// { sub("po/", ""); print $0; }' | sort)

function get_author {
	echo $(gawk 'BEGIN { FS=": " } /Last-Translator/ { sub("\\\\n\"", ""); print $2 }' "$1")
}

function do_commit {
	local POFILE="$1"
	local MSG="$2"
	local AUTHOR=$(get_author "$POFILE")

	git commit --author "$AUTHOR" -m "$MSG" "$POFILE"
}

for f in $PO_MOD; do
	do_commit "po/$f" "po: update $f (from translationproject.org)"
done

for f in $PO_NEW; do
	git add "po/$f"
	do_commit "po/$f" "po: add $f (from translationproject.org)"
done

-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux