Skip to content

Commit

Permalink
Commit files if changes are found
Browse files Browse the repository at this point in the history
  • Loading branch information
hakan42 committed Jun 20, 2013
1 parent ed20e43 commit b6b23f1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions transifex-commit-translations.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#! /usr/bin/perl -w


use File::Basename;
use Git::Wrapper;


our $pofile;

our $user_name = "Hakan Tandogan";
Expand Down Expand Up @@ -32,13 +36,41 @@ sub obtain_translator
$user_name =~ s/\s+$//g;

$user_email = $foo[1];

# Fix for polish umlaits (Sorry, Michal)
if ( $user_email eq "gatkowski.michal\@gmail.com" )
{
$user_name = "Michal Gatkowski";
}
}
}
}
close (PO);
}


sub commit_if_necessary
{
$repodir = dirname($pofile);
# print "Repo is in " . $repodir . "\n";
my $git = Git::Wrapper->new($repodir);
# print "Git wrapper is " . $git . "\n";
$git->config('user.name', $user_name);
$git->config('user.email', $user_email);

$filename = fileparse($pofile);
$git->add($filename);

$message = $pofile;
$message =~ s/^\.\///;
$message =~ s/^scripts\///;
$message =~ s/^\.\.\///;
$message = "Translated " . $message . " on transifex.com";
# print "Message: '" . $message . "'\n"
$git->commit({ message => $message });
}



if ($#ARGV > -1)
{
Expand All @@ -48,5 +80,7 @@ sub obtain_translator
obtain_translator();

print $pofile . " - '" . $user_name . "' - '" . $user_email . "'\n";

commit_if_necessary();
}
}

0 comments on commit b6b23f1

Please sign in to comment.