author | llornkcor <llornkcor> | 2005-08-12 01:48:55 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-08-12 01:48:55 (UTC) |
commit | a1b3e5bac75575be3e22b7361d7a4820761403c1 (patch) (unidiff) | |
tree | 26cbeaf4a4bf8d36f450c84bf23a4a537ecca0ec /scripts/cvslastchange | |
parent | f0790abc938501893be9b6fdaf49d7009ac9c11f (diff) | |
download | opie-a1b3e5bac75575be3e22b7361d7a4820761403c1.zip opie-a1b3e5bac75575be3e22b7361d7a4820761403c1.tar.gz opie-a1b3e5bac75575be3e22b7361d7a4820761403c1.tar.bz2 |
fix with import from kdescripts
-rw-r--r-- | scripts/cvslastchange | 161 |
1 files changed, 150 insertions, 11 deletions
diff --git a/scripts/cvslastchange b/scripts/cvslastchange index ca77297..4c0e37a 100644 --- a/scripts/cvslastchange +++ b/scripts/cvslastchange | |||
@@ -1,25 +1,164 @@ | |||
1 | #!/usr/bin/perl | 1 | !/usr/bin/perl |
2 | 2 | ||
3 | use File::Basename; | 3 | use File::Basename; |
4 | 4 | ||
5 | die "need a filename!" if (!length($ARGV[0])); | 5 | sub usage() |
6 | { | ||
7 | print "Usage:\n"; | ||
8 | print " $0 [ <filename > | <filename> <rev> | \n" . | ||
9 | " M +<digits> -<digits> <filename <rev> ]\n"; | ||
10 | print "\n"; | ||
11 | |||
12 | exit 5; | ||
13 | } | ||
14 | |||
15 | my $filename; | ||
16 | |||
17 | my $argc = scalar @ARGV; | ||
18 | |||
19 | if ($argc > 0 and $argc < 3 ) { | ||
20 | $filename = $ARGV[0]; | ||
21 | $cvsversion= dirname($0) . "/cvsversion"; | ||
22 | $version=`$cvsversion $filename`; | ||
23 | chomp $version; | ||
24 | $version=$ARGV[1] if ($argc > 1 and $ARGV[1] =~ /^[\d\.]{3,}$/); | ||
25 | } elsif ($argc == 5) { | ||
26 | $filename=$ARGV[3] if (-f $ARGV[3]); | ||
27 | $version=$ARGV[4] if ($ARGV[4] =~ /^[\d\.]{3,}$/); | ||
28 | } else { | ||
29 | &usage(); | ||
30 | } | ||
31 | |||
32 | die "$0: filename expected" if(!length($filename)); | ||
33 | die "$filename: $!\n" if (! -f $filename); | ||
34 | |||
35 | my $vold = $version; | ||
36 | my $vnew = $version; | ||
37 | |||
38 | if ($version=~/^.*\.1$/) { | ||
39 | $vold = $1 if ($version=~/^(\d+\.\d+(?:\.\d+\.\d+)*)\.\d+\.1$/); | ||
40 | } | ||
41 | else { | ||
42 | if ($version=~/^(.*)\.([^.]*)$/) { $v1 = $1; $v2 = $2 } | ||
43 | $v2old = ${v2}-1; | ||
44 | $vold = $v1 . '.' . $v2old; | ||
45 | } | ||
46 | my $base = basename($filename); | ||
47 | my $dir = dirname($filename); | ||
48 | my $cmd = "cd $dir; cvs -f log -N -r$vnew $base"; | ||
49 | print "$cmd\n"; | ||
50 | system("$cmd"); | ||
51 | my $whitespace = ""; | ||
52 | $whitespace = "-b" unless (defined $ENV{"CVSLASTCHANGE_KEEP_WHITESPACE"}); | ||
53 | $cmd = "cd $dir; cvs -f diff -kk $whitespace -p -u -r$vold -r$vnew $base"; | ||
54 | print "$cmd\n"; | ||
55 | !/usr/bin/perl | ||
56 | |||
57 | use File::Basename; | ||
58 | |||
59 | sub usage() | ||
60 | { | ||
61 | print "Usage:\n"; | ||
62 | print " $0 [ <filename > | <filename> <rev> | \n" . | ||
63 | " M +<digits> -<digits> <filename <rev> ]\n"; | ||
64 | print "\n"; | ||
65 | |||
66 | exit 5; | ||
67 | } | ||
68 | |||
69 | my $filename; | ||
70 | |||
71 | my $argc = scalar @ARGV; | ||
72 | |||
73 | if ($argc > 0 and $argc < 3 ) { | ||
74 | $filename = $ARGV[0]; | ||
75 | $cvsversion= dirname($0) . "/cvsversion"; | ||
76 | $version=`$cvsversion $filename`; | ||
77 | chomp $version; | ||
78 | $version=$ARGV[1] if ($argc > 1 and $ARGV[1] =~ /^[\d\.]{3,}$/); | ||
79 | } elsif ($argc == 5) { | ||
80 | $filename=$ARGV[3] if (-f $ARGV[3]); | ||
81 | $version=$ARGV[4] if ($ARGV[4] =~ /^[\d\.]{3,}$/); | ||
82 | } else { | ||
83 | &usage(); | ||
84 | } | ||
85 | |||
86 | die "$0: filename expected" if(!length($filename)); | ||
87 | die "$filename: $!\n" if (! -f $filename); | ||
88 | |||
89 | my $vold = $version; | ||
90 | my $vnew = $version; | ||
91 | |||
92 | if ($version=~/^.*\.1$/) { | ||
93 | $vold = $1 if ($version=~/^(\d+\.\d+(?:\.\d+\.\d+)*)\.\d+\.1$/); | ||
94 | } | ||
95 | else { | ||
96 | if ($version=~/^(.*)\.([^.]*)$/) { $v1 = $1; $v2 = $2 } | ||
97 | $v2old = ${v2}-1; | ||
98 | $vold = $v1 . '.' . $v2old; | ||
99 | } | ||
100 | my $base = basename($filename); | ||
101 | my $dir = dirname($filename); | ||
102 | my $cmd = "cd $dir; cvs -f log -N -r$vnew $base"; | ||
103 | print "$cmd\n"; | ||
104 | system("$cmd"); | ||
105 | my $whitespace = ""; | ||
106 | $whitespace = "-b" unless (defined $ENV{"CVSLASTCHANGE_KEEP_WHITESPACE"}); | ||
107 | $cmd = "cd $dir; cvs -f diff -kk $whitespace -p -u -r$vold -r$vnew $base"; | ||
108 | print "$cmd\n"; | ||
109 | sy | ||
110 | !/usr/bin/perl | ||
111 | |||
112 | use File::Basename; | ||
113 | |||
114 | sub usage() | ||
115 | { | ||
116 | print "Usage:\n"; | ||
117 | print " $0 [ <filename > | <filename> <rev> | \n" . | ||
118 | " M +<digits> -<digits> <filename <rev> ]\n"; | ||
119 | print "\n"; | ||
120 | |||
121 | exit 5; | ||
122 | } | ||
123 | |||
124 | my $filename; | ||
125 | |||
126 | my $argc = scalar @ARGV; | ||
127 | |||
128 | if ($argc > 0 and $argc < 3 ) { | ||
129 | $filename = $ARGV[0]; | ||
130 | $cvsversion= dirname($0) . "/cvsversion"; | ||
131 | $version=`$cvsversion $filename`; | ||
132 | chomp $version; | ||
133 | $version=$ARGV[1] if ($argc > 1 and $ARGV[1] =~ /^[\d\.]{3,}$/); | ||
134 | } elsif ($argc == 5) { | ||
135 | $filename=$ARGV[3] if (-f $ARGV[3]); | ||
136 | $version=$ARGV[4] if ($ARGV[4] =~ /^[\d\.]{3,}$/); | ||
137 | } else { | ||
138 | &usage(); | ||
139 | } | ||
6 | 140 | ||
7 | $cvsversion= dirname($0) . "/cvsversion"; | 141 | die "$0: filename expected" if(!length($filename)); |
8 | $version=`$cvsversion $ARGV[0]`; | 142 | die "$filename: $!\n" if (! -f $filename); |
9 | 143 | ||
10 | chop $version; | ||
11 | my $vold = $version; | 144 | my $vold = $version; |
12 | my $vnew = $version; | 145 | my $vnew = $version; |
13 | 146 | ||
14 | if ($version=~/^(.*)\.1$/) { | 147 | if ($version=~/^.*\.1$/) { |
15 | $vold = $1 if ($version=~/^([^.]\.[^.])\.[^.]\.[^.]$/); | 148 | $vold = $1 if ($version=~/^(\d+\.\d+(?:\.\d+\.\d+)*)\.\d+\.1$/); |
16 | } | 149 | } |
17 | else { | 150 | else { |
18 | if ($version=~/^(.*)\.([^.]*)$/) { $v1 = $1; $v2 = $2 } | 151 | if ($version=~/^(.*)\.([^.]*)$/) { $v1 = $1; $v2 = $2 } |
19 | $v2old = ${v2}-1; | 152 | $v2old = ${v2}-1; |
20 | $vold = $v1 . '.' . $v2old; | 153 | $vold = $v1 . '.' . $v2old; |
21 | } | 154 | } |
22 | print "cvs -f log -N -r$vnew $ARGV[0]\n"; | 155 | my $base = basename($filename); |
23 | system("cvs -f log -N -r$vnew $ARGV[0]"); | 156 | my $dir = dirname($filename); |
24 | print "cvs -f diff -bp -u -r$vold -r$vnew $ARGV[0]\n"; | 157 | my $cmd = "cd $dir; cvs -f log -N -r$vnew $base"; |
25 | system("cvs -f diff -bp -u -r$vold -r$vnew $ARGV[0]"); | 158 | print "$cmd\n"; |
159 | system("$cmd"); | ||
160 | my $whitespace = ""; | ||
161 | $whitespace = "-b" unless (defined $ENV{"CVSLASTCHANGE_KEEP_WHITESPACE"}); | ||
162 | $cmd = "cd $dir; cvs -f diff -kk $whitespace -p -u -r$vold -r$vnew $base"; | ||
163 | print "$cmd\n"; | ||
164 | system("$cmd"); | ||