[svk-commit] r2563 - in branches/bm: t

nobody at bestpractical.com nobody at bestpractical.com
Thu Oct 25 04:18:05 EDT 2007


Author: clsung
Date: Thu Oct 25 04:18:04 2007
New Revision: 2563

Modified:
   branches/bm/lib/SVK/Command/Branch.pm
   branches/bm/t/81branch.t

Log:
- implement --local

Modified: branches/bm/lib/SVK/Command/Branch.pm
==============================================================================
--- branches/bm/lib/SVK/Command/Branch.pm	(original)
+++ branches/bm/lib/SVK/Command/Branch.pm	Thu Oct 25 04:18:04 2007
@@ -146,7 +146,9 @@
     );
 
     my $trunk_path = '//'.$proj->depot->depotname.'/'.$proj->trunk;
-    my $newbranch_path = '//'.$proj->depot->depotname.'/'.$proj->branch_location."/".$branch_path."/";
+    my $newbranch_path = '//'.$proj->depot->depotname.'/'.
+	( $self->{local} ? $proj->local_root : $proj->branch_location ).
+	'/'.$branch_path.'/';
     # XXX if $self->{local};
 
     my $src = $self->arg_uri_maybe($trunk_path);
@@ -157,7 +159,8 @@
     my $ret = $self->SUPER::run($src, $dst);
 
     if (!$ret) {
-	print loc("Project branch created: %1.\n",$branch_path);
+	print loc("Project branch created: %1 %2\n",
+	    $branch_path, $self->{local} ? '(in local)' : '');
 	# call SVK::Command::Switch here if --switch-to
 	$self->SVK::Command::Switch::run(
 	    $self->arg_uri_maybe($newbranch_path),

Modified: branches/bm/t/81branch.t
==============================================================================
--- branches/bm/t/81branch.t	(original)
+++ branches/bm/t/81branch.t	Thu Oct 25 04:18:04 2007
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use Test::More tests => 3;
+use Test::More tests => 5;
 use SVK::Test;
 use File::Path;
 
@@ -21,9 +21,18 @@
 $svk->checkout('//mirror/MyProject/trunk',$copath);
 chdir($copath);
 
-is_output_like ($svk, 'branch', ['--create', 'feature/foo'], qr'Project branch created: feature/foo.');
+is_output_like ($svk, 'branch', ['--create', 'feature/foo'], qr'Project branch created: feature/foo');
 $svk->branch('--list');
 is_output_like ($svk, 'branch',
     ['--create', 'feature/bar', '--switch-to'],
-    qr'Project branch created: feature/bar.');
+    qr'Project branch created: feature/bar');
 is_output_like ($svk, 'info', [], qr'Depot Path: //mirror/MyProject/branches/feature/bar');
+
+#is_output_like ($svk, 'switch', ['//mirror/MyProject/trunk'], qr'.*');
+#$svk->info();
+#warn $output;
+
+is_output_like ($svk, 'branch', ['--create', 'feature/foobar', '--switch-to', '--local'],
+    qr'Project branch created: feature/foobar \(in local\)');
+is_output_like ($svk, 'info', [], qr'Copied From: /mirror/MyProject/trunk, Rev. \d+');
+


More information about the svk-commit mailing list