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

nobody at bestpractical.com nobody at bestpractical.com
Wed Sep 10 06:12:12 EDT 2008


Author: clsung
Date: Wed Sep 10 06:12:11 2008
New Revision: 3085

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

Log:
- fix http://task.hm/GJ5J
  - not switch when current dir is not a wc
  - br --checkout will append --local when the project_path is /local

Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm	(original)
+++ trunk/lib/SVK/Command/Branch.pm	Wed Sep 10 06:12:11 2008
@@ -304,7 +304,7 @@
 
 sub run {
     my ($self, $proj, $target, $branch_name) = @_;
-    return unless $proj;
+
     unless ($branch_name) {
 	$logger->info(
 	    loc("To create a branch, please specify svk branch --create <name>")
@@ -358,10 +358,18 @@
 	  )
 	);
 	# call SVK::Command::Switch here if --switch-to
-	$self->SVK::Command::Switch::run(
-	    $self->arg_uri_maybe($newbranch_path),
-	    $target
-	) if $self->{switch} and !$self->{check_only};
+        if ($self->{switch} and !$self->{check_only}) {
+            $dst = $self->arg_uri_maybe($newbranch_path);
+            if ($target->related_to($dst)) {
+                $self->SVK::Command::Switch::run(
+                    $dst, $target
+                );
+            } else {
+                $logger->info(
+                    loc("Can't switch to the branch because current dir is not a working copy.")
+                );
+            }
+        }
     }
     return;
 }
@@ -684,6 +692,8 @@
 
     die loc("Project not found. use 'svk branch --setup mirror_path' to initialize one.\n",$msg)
 	unless $proj;
+    $self->{local}++
+        if $project_path and ($target->_to_pclass("/local")->subsumes($project_path));
     $branch_name = $proj->name."-trunk"
 	if ($branch_name eq 'trunk' and $self->{local}) ;
     $checkout_path = $branch_name unless $checkout_path;


More information about the svk-commit mailing list