aboutsummaryrefslogtreecommitdiffstats
path: root/make-version.pl
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2012-09-10 16:00:58 +0000
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2012-09-10 16:00:58 +0000
commit8f4a2e5f28f241f2afb6004833528db20ff5e013 (patch)
tree44aabf7e37a11fb4ecae1c07dcfbd70e4d646bc6 /make-version.pl
parent0157f2f5e7eb17d7f22eea4f2683b20ed25203b6 (diff)
Update svnversion.h with (short) SHA-1 commit id and branch when use git repository
svn path=/trunk/; revision=44850
Diffstat (limited to 'make-version.pl')
-rwxr-xr-xmake-version.pl27
1 files changed, 27 insertions, 0 deletions
diff --git a/make-version.pl b/make-version.pl
index c6243d542f..fae429613c 100755
--- a/make-version.pl
+++ b/make-version.pl
@@ -182,6 +182,33 @@ sub read_svn_info {
}
close (CFGNMAKE);
}
+ if ($revision == 0) {
+
+ # Try git...
+ eval {
+ use warnings "all";
+ no warnings "all";
+ $svn_info_cmd = "(cd $srcdir; git log --format='commit: %h%ndate: %ad' -n 1 --date=iso)";
+ $line = qx{$svn_info_cmd};
+ if (defined($line)) {
+ if ($line =~ /date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
+ $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
+ }
+ if ($line =~ /commit: (\S+)/) {
+ $revision = $1;
+ }
+ }
+ $svn_info_cmd = "(cd $srcdir; git branch)";
+ $line = qx{$svn_info_cmd};
+ if (defined($line)) {
+ if ($line =~ /\* (\S+)/) {
+ $repo_path = $1;
+ }
+ }
+ 1;
+ };
+ }
+
# 'svn info' failed or the user really wants us to dig around in .svn/entries
if ($do_hack) {