source: branches/port5/SOURCE_TOOLS/touch_modified.pl

Last change on this file was 5952, checked in by westram, 16 years ago
  • new target 'modified' rebuilds local modifications in svn workdir
  • Property svn:executable set to *
File size: 1.2 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 (not -f $file) { die "File '$file' not found (statusline='$line')" }
35
36        my $touch_cmd = "touch '$file'";
37        print '['.$touch_cmd."]\n";
38        system($touch_cmd);
39        $handled = 1;
40      }
41    }
42    if ($handled==0) { die "Can't handle status line '$line'"; }
43  }
44  close(STATUS);
45}
46
47main();
Note: See TracBrowser for help on using the repository browser.