[svk-commit] r2562 - in branches/bm: t
nobody at bestpractical.com
nobody at bestpractical.com
Thu Oct 25 03:39:48 EDT 2007
Author: clsung
Date: Thu Oct 25 03:39:48 2007
New Revision: 2562
Added:
branches/bm/t/81branch.t
Modified:
branches/bm/lib/SVK/Command/Branch.pm
Log:
- implement --switch-to
- a test for branch
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 03:39:48 2007
@@ -117,7 +117,7 @@
}
package SVK::Command::Branch::create;
-use base qw( SVK::Command::Copy SVK::Command::Branch );
+use base qw( SVK::Command::Copy SVK::Command::Switch SVK::Command::Branch );
use SVK::I18N;
use SVK::Util qw( is_uri );
@@ -158,8 +158,11 @@
if (!$ret) {
print loc("Project branch created: %1.\n",$branch_path);
- # call SVK::Command::Switch ?
- # XXX if $self->{switch};
+ # call SVK::Command::Switch here if --switch-to
+ $self->SVK::Command::Switch::run(
+ $self->arg_uri_maybe($newbranch_path),
+ $self->arg_copath('')
+ ) if $self->{switch};
}
return;
}
Added: branches/bm/t/81branch.t
==============================================================================
--- (empty file)
+++ branches/bm/t/81branch.t Thu Oct 25 03:39:48 2007
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More tests => 3;
+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');
More information about the svk-commit
mailing list