Last change
on this file was
18915,
checked in by westram, 3 years ago
|
- use uniform variable name 'cmd'.
|
-
Property svn:executable set to
*
|
File size:
1.5 KB
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | # use diagnostics; |
---|
6 | |
---|
7 | # -------------------------------------------------------------------------------- |
---|
8 | |
---|
9 | my $ARBHOME = $ENV{ARBHOME}; |
---|
10 | if (not defined $ARBHOME) { die "Environmentvariable ARBHOME has be defined"; } |
---|
11 | if (not -d $ARBHOME) { die "ARBHOME ('$ARBHOME') does not point to a valid directory"; } |
---|
12 | |
---|
13 | |
---|
14 | sub main() { |
---|
15 | print "Touching modified files:\n"; |
---|
16 | |
---|
17 | my $cmd = "svn status"; |
---|
18 | open(STATUS, $cmd.'|') || die "failed to fork '$cmd' (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) || die "failed to execute '$cmd' (Reason: $! exitcode=$?)"; |
---|
53 | } |
---|
54 | |
---|
55 | main(); |
---|
Note: See
TracBrowser
for help on using the repository browser.