From: Sandro Santilli Date: Mon, 13 Feb 2012 09:58:13 +0000 (+0000) Subject: Do not override postgis_svn_revision.h if revision didn't change X-Git-Tag: 2.0.0alpha5~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ae7a609b2473b7323bb96c7908ea5bd9f5d3e6c;p=postgis Do not override postgis_svn_revision.h if revision didn't change git-svn-id: http://svn.osgeo.org/postgis/trunk@9159 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/utils/svn_repo_revision.pl b/utils/svn_repo_revision.pl index 392b35f87..82b79e7d1 100755 --- a/utils/svn_repo_revision.pl +++ b/utils/svn_repo_revision.pl @@ -112,8 +112,26 @@ sub read_rev_svn { sub write_defn { my $rev = shift; + my $oldrev = 0; + + # Do not override the file if new detected + # revision isn't different from the existing one + if ( -f $rev_file ) { + open(IN, "<$rev_file"); + my $oldrevline = ; + if ( $oldrevline =~ /POSTGIS_SVN_REVISION (.*)/ ) { + $oldrev = $1; + } + close(IN); + if ( $rev == $oldrev ) { + print STDERR "Not updating existing rev file at $rev\n"; + return; + } + } + my $string = "#define POSTGIS_SVN_REVISION $rev\n"; open(OUT,">$rev_file"); print OUT $string; close(OUT); + print STDERR "Wrote rev file at $rev\n"; }