In a git repo, LastChangedRevision is not updated in the xml files. In this
case, try to determine it from the revision log when checking for out-of-date
translations.
This is not perfect, as it doesn't work for files with modifications which
have not been committed to svn.
git-svn-id: https://svn.apache.org/repos/asf/httpd/docs-build/trunk@1169794 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/metafile.pl b/lib/metafile.pl
index f072cd8..a389f2a 100644
--- a/lib/metafile.pl
+++ b/lib/metafile.pl
@@ -29,6 +29,7 @@
# against fat fingers
use strict;
+use warnings;
# for file operations
use FindBin;
@@ -152,6 +153,7 @@
}
} # for (@files)
+my $no_git;
# get revision of the english original
sub reven($$) {
my $dirname = shift;
@@ -176,6 +178,22 @@
$revs{"$dirname$basename"} = $rev;
}
+ unless ($rev || $no_git) {
+ # LastChangedRevision is not available with git-svn or a git checkout
+ # from git.apache.org. Try to get the revision from the log.
+ my $curpath = docpath("$dirname$basename.xml");
+ # XXX: This does not work if there has been a local commit
+ my $log = qx{git log -1 $curpath 2> /dev/null};
+ if ($? == 0) {
+ if ( $log =~ /git-svn-id:[^\@]+\@(\d+)\s/ ) {
+ $revs{"$dirname$basename"} = $rev = $1;
+ }
+ }
+ else {
+ # no git repo
+ $no_git = 1;
+ }
+ }
return $rev;
}