[svk-commit] r2860 - trunk/lib/SVK/Command

nobody at bestpractical.com nobody at bestpractical.com
Mon May 12 03:45:36 EDT 2008


Author: clsung
Date: Mon May 12 03:45:36 2008
New Revision: 2860

Modified:
   trunk/lib/SVK/Command/Branch.pm

Log:
- grep depotname for every depot via a specified project_name
  - need refactoring in future
  - ref: http://task.hm/EC3J
  - ref: http://task.hm/EDJN

Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm	(original)
+++ trunk/lib/SVK/Command/Branch.pm	Mon May 12 03:45:36 2008
@@ -90,7 +90,15 @@
     };
     if ($@) { # then it means we need to find the project
 	my $project_name = $self->{project} || pop @arg;
-	$target = $self->arg_depotpath('//');
+	my @depots =  sort keys %{ $self->{xd}{depotmap} };
+	my $proj;
+	foreach my $depot (@depots) {
+	    $depot =~ s{/}{}g;
+	    $target = eval { $self->arg_depotpath("/$depot/") };
+	    next if ($@);
+	    $proj = SVK::Project->create_from_prop($target, $project_name);
+	    last if ($proj) ;
+	}
     }
 #    if ($arg[0] eq 'push') {
 #	shift @arg;
@@ -605,8 +613,16 @@
 	$target = $self->arg_co_maybe('');
     };
     if ($@) { # then it means we must have a project
-	$target = $self->arg_depotpath('//'); # XXX: what if /abc/mirror/ ?
-	$proj = SVK::Project->create_from_prop($target, $project_name);
+	my $project_name = $self->{project} || pop @arg;
+	my @depots =  sort keys %{ $self->{xd}{depotmap} };
+	my $proj;
+	foreach my $depot (@depots) {
+	    $depot =~ s{/}{}g;
+	    $target = eval { $self->arg_depotpath("/$depot/") };
+	    next if ($@);
+	    $proj = SVK::Project->create_from_prop($target, $project_name);
+	    last if ($proj) ;
+	}
     } else {
 	$proj = $self->load_project($target, $self->{project});
     }
@@ -641,8 +657,16 @@
 	$target = $self->arg_co_maybe($arg[0]);
     };
     if ($@) { # then it means we must have a project
-	$target = $self->arg_depotpath('//'); # XXX: what if /abc/mirror/ ?
-	$proj = SVK::Project->create_from_prop($target, $project_name);
+	my $project_name = $self->{project} || pop @arg;
+	my @depots =  sort keys %{ $self->{xd}{depotmap} };
+	my $proj;
+	foreach my $depot (@depots) {
+	    $depot =~ s{/}{}g;
+	    $target = eval { $self->arg_depotpath("/$depot/") };
+	    next if ($@);
+	    $proj = SVK::Project->create_from_prop($target, $project_name);
+	    last if ($proj) ;
+	}
     } else {
 	$proj = $self->load_project($target, $self->{project});
     }


More information about the svk-commit mailing list