source: svkversion @ 5f3168a

barnowl_perlaimdebianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 5f3168a 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
3use strict;
4use warnings;
5
6if (-e ".svn") {
7    exec("svnversion",@ARGV);
8}
9
10use Getopt::Long;
11my $no_newline = 0;
12GetOptions("no-newline|n!" => \$no_newline);
13my $newline = $no_newline ? "" : "\n";
14my $p = shift @ARGV;
15$p ||= ".";
16
17my @lines = `svk info $p`;
18my @merged = grep {/^Merged From: /} @lines;
19
20unless (@merged) {
21    @merged = grep {/^Revision: /} @lines;
22    my ($version) = $merged[0] =~ /^Revision: (\d+)/;
23    print "$version$newline";
24    exit;
25}
26
27my ($path, $rev) = $merged[0] =~ /^Merged From: (\S+), Rev. (\d+)/;
28
29my @log = `svk log -l1 -r$rev /$path`;
30@log = grep {/\(orig r\d+\)/} @log;
31
32if (@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.