barnowl_perlaimdebianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change
on this file since 18fb3d4f was
95e60d6,
checked in by Alex Vandiver <alexmv@mit.edu>, 18 years ago
|
Hacky first pass at svkversion, which is svnversion for svk as well
|
-
Property mode set to
100755
|
File size:
733 bytes
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | |
---|
6 | if (-e ".svn") { |
---|
7 | exec("svnversion",@ARGV); |
---|
8 | } |
---|
9 | |
---|
10 | use Getopt::Long; |
---|
11 | my $no_newline = 0; |
---|
12 | GetOptions("no-newline|n!" => \$no_newline); |
---|
13 | my $newline = $no_newline ? "" : "\n"; |
---|
14 | my $p = shift @ARGV; |
---|
15 | $p ||= "."; |
---|
16 | |
---|
17 | my @lines = `svk info $p`; |
---|
18 | my @merged = grep {/^Merged From: /} @lines; |
---|
19 | |
---|
20 | unless (@merged) { |
---|
21 | @merged = grep {/^Revision: /} @lines; |
---|
22 | my ($version) = $merged[0] =~ /^Revision: (\d+)/; |
---|
23 | print "$version$newline"; |
---|
24 | exit; |
---|
25 | } |
---|
26 | |
---|
27 | my ($path, $rev) = $merged[0] =~ /^Merged From: (\S+), Rev. (\d+)/; |
---|
28 | |
---|
29 | my @log = `svk log -l1 -r$rev /$path`; |
---|
30 | @log = grep {/\(orig r\d+\)/} @log; |
---|
31 | |
---|
32 | if (@log and $log[0] =~ /\(orig r(\d+)\)/) { |
---|
33 | print "$1$newline"; |
---|
34 | } else { |
---|
35 | print "$rev$newline"; |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.