Package: mr
Version: 1.08

With the addition of VCS_dir_test, VCS detection is short-circuiting as soon
as a recognized directory is found.  This repo dirs like git-svn from being
properly detected.

Signed-off-by: James McCoy <james...@debian.org>
---
 mr |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/mr b/mr
index 23178a5..fcce98e 100755
--- a/mr
+++ b/mr
@@ -612,24 +612,12 @@ sub vcs_test {
                return $vcs{$dir};
        }
 
-       my $test="";
        my $dir_test="";
-       foreach my $vcs_test (
-                       sort {
-                               length $a <=> length $b 
-                                         ||
-                                      $a cmp $b
-                       } grep { /_test$/ } keys %{$config{$topdir}{$subdir}}) {
-               if ($vcs_test =~ /(.*)_dir_test/) {
-                       my $vcs=$1;
-                       if (! defined $vcs_dir_test{$vcs}) {
-                               
$dir_test.=$config{$topdir}{$subdir}{$vcs_test}."\n";
-                       }
-                       next;
+       foreach my $vcs_test (grep { /_dir_test$/ } keys 
%{$config{$topdir}{$subdir}}) {
+               my ($vcs)=$vcs_test =~ /(.*)_dir_test/;
+               if (! defined $vcs_dir_test{$vcs}) {
+                       $dir_test.=$config{$topdir}{$subdir}{$vcs_test}."\n";
                }
-               my ($vcs)=$vcs_test =~ /(.*)_test/;
-               $test="my_$vcs_test() 
{\n$config{$topdir}{$subdir}{$vcs_test}\n}\n".$test;
-               $test.="if my_$vcs_test; then echo $vcs; fi\n";
        }
 
        if (length $dir_test) {
@@ -643,12 +631,26 @@ sub vcs_test {
                }
        }
 
+       my $test_qr=qr/(?<!_dir)_test$/;
        foreach my $vcs (keys %vcs_dir_test) {
                if (-d "$ENV{MR_REPO}/$vcs_dir_test{$vcs}") {
-                       return $vcs{$dir}=$vcs;
+                       $test_qr=qr/^$vcs.*(?<!_dir)_test$/;
+                       last;
                }
        }
 
+       my $test="";
+       foreach my $vcs_test (
+                       sort {
+                               length $a <=> length $b 
+                                         ||
+                                      $a cmp $b
+                       } grep { /$test_qr/ } keys 
%{$config{$topdir}{$subdir}}) {
+               my ($vcs)=$vcs_test =~ /(.*)_test/;
+               $test="my_$vcs_test() 
{\n$config{$topdir}{$subdir}{$vcs_test}\n}\n".$test;
+               $test.="if my_$vcs_test; then echo $vcs; fi\n";
+       }
+
        my $vcs=runshpipe "vcs test", $topdir, $subdir, $test, [];
        if ($vcs=~/\n/s) {
                $vcs=~s/\n/, /g;
-- 
1.7.7.3


-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <james...@debian.org>

Attachment: signature.asc
Description: Digital signature

Reply via email to