ca, fr, fr_CA, and it updates
[adiumx.git] / Utilities / svkRevNum.pl
blobdb71eb5c6bf809020b7e0dca6fe3e28dbd5da25a
1 #!/usr/bin/perl
3 use strict;
5 my $dirToFigure = ".";
6 my $line;
7 my @currentDirInfo;
8 my $depot;
9 my @mirrorPaths;
10 my $mirrorPath;
11 my $currentRev;
12 my $upstreamRev = 0;
13 my @mirrorDirInfo;
14 my $isMirrorDir = 0;
15 my $foundMirror=0;
17 $dirToFigure = $ARGV[0] if (scalar(@ARGV) > 0);
18 @currentDirInfo = `svk info $dirToFigure`;
21 foreach $line (@currentDirInfo) {
22 if ($line =~ m%Depot Path: /([^/]*)/.*%) {
23 $depot = $1;
25 if ($line =~ m%Revision: ([0-9]*)%) {
26 $currentRev = $1;
28 if ($line =~ m%Merged From: (/.*), Rev. ([0-9]*)%) {
29 if ( $upstreamRev == 0 || $2 > $upstreamRev ) {
30 push(@mirrorPaths,$1);
31 $upstreamRev = $2;
36 foreach $mirrorPath (@mirrorPaths) {
37 if ($foundMirror == 0) {
38 @mirrorDirInfo = `svk info /$depot/$mirrorPath`;
39 foreach $line (@mirrorDirInfo) {
40 if ($line =~ m%Mirrored From:%) {
41 $isMirrorDir = 1;
45 if ($isMirrorDir) {
46 @mirrorDirInfo = `svk log -r $upstreamRev /$depot/$mirrorPath`;
47 foreach $line ( @mirrorDirInfo ) {
48 if ($line =~ m/r[0-9].*orig r([0-9]*).*/) {
49 $upstreamRev = $1;
50 $foundMirror=1;
57 print $upstreamRev . ", r" . $currentRev ."@".`hostname | sed 's/.local//'`;