source: branches/profile/SOURCE_TOOLS/touch_modified.pl

Last change on this file was 10857, checked in by westram, 11 years ago
  • accept changed rootdir mergeinfo
  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5# use diagnostics;
6
7# --------------------------------------------------------------------------------
8
9my $ARBHOME = $ENV{ARBHOME};
10if (not defined $ARBHOME) { die "Environmentvariable ARBHOME has be defined"; }
11if (not -d $ARBHOME) { die "ARBHOME ('$ARBHOME') does not point to a valid directory"; }
12
13
14sub main() {
15  print "Touching modified files:\n";
16
17  my $svn_status = "svn status";
18  open(STATUS, $svn_status.'|') || die "can't execute '$svn_status' (Reason: $!)";
19  foreach my $line (<STATUS>) {
20    chomp($line);
21    my $handled = 0;
22    if ($line =~ /^([^\s]+)[\s+]+(.*)$/) {
23      my ($st,$file) = ($1,$2);
24      my $touch         = 0;
25
26      if (($st eq 'M') or ($st eq 'R') or ($st eq 'A')) { # touch modified, replaced and added files
27        $touch = 1;
28      }
29      elsif (($st eq '?') or ($st eq 'D')) { # ignore unknown and deleted files
30        $handled = 1;
31      }
32
33      if ($touch==1) {
34        if (-d $file) {
35          $handled = 1;
36        }
37        else {
38          if (not -f $file) { die "File '$file' not found (statusline='$line')" }
39
40          my $touch_cmd = "touch '$file'";
41          print '['.$touch_cmd."]\n";
42          system($touch_cmd);
43          $handled = 1;
44        }
45      }
46    }
47    elsif ($line =~ /^\s+M\s+\.$/) { # accept changed merge-info for rootdir
48      $handled = 1;
49    }
50    if ($handled==0) { die "Can't handle status line '$line'"; }
51  }
52  close(STATUS);
53}
54
55main();
Note: See TracBrowser for help on using the repository browser.