Commits

Theo Schlossnagle committed 0baaaa7

fixes from mark@omniti.com to make error messages more clear for SCM over ssh access failures

Comments (0)

Files changed (1)

 # Hack the instance into the ini file if it is supplied
 my $instance = '';
 my $tryinstance = '';
+my $scmtype = '';
 if ($cmd =~ m/^git-(\S+)\s+'~([^\/]+)\/(\S+)'$/) {
   $tryinstance = $2;
   $cmd = "git-$1 '$3'";
+  $scmtype = 'git';
 }
 elsif ($cmd =~ m/^hg -R ~([^\/]+)\//) {
   $tryinstance = $1;
   $cmd =~ s/^hg -R ~[^\/]+\//hg -R /;
+  $scmtype = 'hg';
+} elsif ($cmd eq '') {
+  $scmtype = "ssh";
 }
 
 if($inifile =~ /\(instance:([^\)]*)\)/) {
     ($instance) = grep { $_ eq $tryinstance } (split /,/, $1);
   }
   if(!$instance) {
-    print STDERR "Error, repository request ~<instance>.\n";
-    print STDERR "Subversion can't support this, you need dedicated users.\n";
+    if ($scmtype eq 'ssh') {
+       print STDERR "Error: You can't SSH directly to mtrack\n";
+    } elsif ($scmtype eq 'git' || $scmtype eq 'hg') {
+       print STDERR "Error, repository request ~<instance>.\n";
+       print STDERR "Either you don't have permissions or you need to set up ";
+       print STDERR "your profile\n";
+    } else {
+       print STDERR "Error, repository request ~<instance>.\n";
+       print STDERR "Subversion can't support this, you need dedicated users.\n";
+    }
     exit;
   }
   $inifile =~ s/\(instance:[^\)]*\)/$instance/;