]> granicus.if.org Git - postgis/commitdiff
Do not override postgis_svn_revision.h if revision didn't change
authorSandro Santilli <strk@keybit.net>
Mon, 13 Feb 2012 09:58:13 +0000 (09:58 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 13 Feb 2012 09:58:13 +0000 (09:58 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9159 b70326c6-7e19-0410-871a-916f4a2858ee

utils/svn_repo_revision.pl

index 392b35f8736cd1c5f0313bc9f41e72834e567133..82b79e7d1dcb1ff2a18942f52c76ded08f76206c 100755 (executable)
@@ -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 = <IN>;
+    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";
 }