barnowl_perlaimdebianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change
on this file since ee0574c was
51f45d1,
checked in by Nelson Elhage <nelhage@mit.edu>, 17 years ago
|
Make `svkversion' handle exported trees better
|
-
Property mode set to
100755
|
File size:
827 bytes
|
Rev | Line | |
---|
[95e60d6] | 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 | |
---|
[51f45d1] | 17 | my @lines = `svk info $p 2>&1`; |
---|
| 18 | if($! || $lines[0] =~ "not a checkout path") { |
---|
| 19 | print "exported$newline"; |
---|
| 20 | exit; |
---|
| 21 | } |
---|
[95e60d6] | 22 | my @merged = grep {/^Merged From: /} @lines; |
---|
| 23 | |
---|
| 24 | unless (@merged) { |
---|
| 25 | @merged = grep {/^Revision: /} @lines; |
---|
| 26 | my ($version) = $merged[0] =~ /^Revision: (\d+)/; |
---|
| 27 | print "$version$newline"; |
---|
| 28 | exit; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | my ($path, $rev) = $merged[0] =~ /^Merged From: (\S+), Rev. (\d+)/; |
---|
| 32 | |
---|
| 33 | my @log = `svk log -l1 -r$rev /$path`; |
---|
| 34 | @log = grep {/\(orig r\d+\)/} @log; |
---|
| 35 | |
---|
| 36 | if (@log and $log[0] =~ /\(orig r(\d+)\)/) { |
---|
| 37 | print "$1$newline"; |
---|
| 38 | } else { |
---|
| 39 | print "$rev$newline"; |
---|
| 40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.