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

nobody at bestpractical.com nobody at bestpractical.com
Tue Nov 13 02:05:20 EST 2007


Author: clsung
Date: Tue Nov 13 02:05:19 2007
New Revision: 2603

Added:
   branches/bm/t/bm/switch.t
Modified:
   branches/bm/lib/SVK/Command/Branch.pm
   branches/bm/t/bm/move.t

Log:
- add t/bm/switch.t
- fix bug in SVK::Command::Branch::move,
  now both (in local/remote) works well
- add local move test in bm/move.t

Modified: branches/bm/lib/SVK/Command/Branch.pm
==============================================================================
--- branches/bm/lib/SVK/Command/Branch.pm	(original)
+++ branches/bm/lib/SVK/Command/Branch.pm	Tue Nov 13 02:05:19 2007
@@ -178,7 +178,7 @@
 }
 
 package SVK::Command::Branch::move;
-use base qw( SVK::Command::Copy SVK::Command::Smerge SVK::Command::Move SVK::Command::Delete SVK::Command::Branch );
+use base qw( SVK::Command::Move SVK::Command::Copy SVK::Command::Smerge SVK::Command::Delete SVK::Command::Branch );
 use SVK::I18N;
 use SVK::Util qw( is_uri );
 
@@ -229,6 +229,10 @@
 	$self->{rev} = $which_rev_we_branch;
 	$src = $self->arg_uri_maybe('/'.$proj->depot->depotname.'/'.$proj->trunk);
 	$self->{message} = "- Create branch $src_branch_path to $dst_branch_path";
+	local *handle_direct_item = sub {
+	    my $self = shift;
+	    $self->SVK::Command::Copy::handle_direct_item(@_);
+	};
 	$self->SVK::Command::Copy::run($src, $dst);
 	# now we do sm -I
 	$src = $self->arg_uri_maybe($src_branch_path);
@@ -413,7 +417,7 @@
  branch --create [BRANCH]
 
  branch --list [BRANCH...]
- branch --create BRANCH [--switch-to]
+ branch --create BRANCH [--local] [--switch-to]
  branch --move BRANCH1 BRANCH2
 
 =head1 OPTIONS
@@ -421,6 +425,7 @@
  -l [--list]            : list mirrored paths
  -C [--check-only]      : try operation but make no changes
  --create               : create a new branch
+ --local                : targets in local branch
  --switch-to            : also switch to another branch
  --merge                : automatically merge all changes between branches
 

Modified: branches/bm/t/bm/move.t
==============================================================================
--- branches/bm/t/bm/move.t	(original)
+++ branches/bm/t/bm/move.t	Tue Nov 13 02:05:19 2007
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use Test::More tests => 6;
+use Test::More tests => 8;
 use SVK::Test;
 use File::Path;
 
@@ -30,3 +30,12 @@
 is_output_like ($svk, 'branch', ['--create', 'feature/moo'], qr'Project branch created: feature/moo');
 $svk->br('--move', 'feature/moo', 'feature/mar');
 is_output_unlike ($svk, 'branch', ['--list'], qr'feature/moo');
+
+# create to local and move back
+is_output_like ($svk, 'branch', ['--create', 'localfoo', '--local', '--switch-to'],
+    qr'Project branch created: localfoo \(in local\)');
+
+$svk->br('--move', 'feature/remotebar');
+$svk->br('--switch', 'feature/remotebar');
+is_output_like ($svk, 'branch', ['--list'], qr'feature/remotebar',
+    'Move localfoo to remotebar, cross depot move');

Added: branches/bm/t/bm/switch.t
==============================================================================
--- (empty file)
+++ branches/bm/t/bm/switch.t	Tue Nov 13 02:05:19 2007
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More tests => 5;
+use SVK::Test;
+use File::Path;
+
+my ($xd, $svk) = build_test('test');
+our $output;
+$svk->mkdir(-m => 'trunk', '/test/trunk');
+$svk->mkdir(-m => 'trunk', '/test/branches');
+$svk->mkdir(-m => 'trunk', '/test/tags');
+my $tree = create_basic_tree($xd, '/test/trunk');
+
+my $depot = $xd->find_depot('test');
+my $uri = uri($depot->repospath);
+
+$svk->mirror('//mirror/MyProject', $uri);
+$svk->sync('//mirror/MyProject');
+
+my ($copath, $corpath) = get_copath ('MyProject');
+$svk->checkout('//mirror/MyProject/trunk',$copath);
+chdir($copath);
+
+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');
+is_output_like ($svk, 'info', [], qr'Depot Path: //mirror/MyProject/branches/feature/bar');
+
+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