From 7ae7a609b2473b7323bb96c7908ea5bd9f5d3e6c Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 13 Feb 2012 09:58:13 +0000 Subject: [PATCH] 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 --- utils/svn_repo_revision.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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"; } -- 2.40.0