[svk-commit] r2619 - in branches/bm: t/bm
nobody at bestpractical.com
nobody at bestpractical.com
Fri Dec 7 01:45:20 EST 2007
Author: clsung
Date: Fri Dec 7 01:45:20 2007
New Revision: 2619
Modified:
branches/bm/lib/SVK/Command/Branch.pm
branches/bm/t/bm/remove.t
Log:
- now it supports wildcard '*'
Modified: branches/bm/lib/SVK/Command/Branch.pm
==============================================================================
--- branches/bm/lib/SVK/Command/Branch.pm (original)
+++ branches/bm/lib/SVK/Command/Branch.pm Fri Dec 7 01:45:20 2007
@@ -104,6 +104,13 @@
return $proj;
}
+sub expand_branch {
+ my ($self, $proj, $arg) = @_;
+ return $arg unless $arg =~ m/\*/;
+ my $match = SVK::XD::compile_apr_fnmatch($arg);
+ return grep { m/$match/ } @{ $proj->branches };
+}
+
package SVK::Command::Branch::list;
use base qw(SVK::Command::Branch);
use SVK::I18N;
@@ -270,11 +277,13 @@
sub run {
- my ($self, $target, @dst_paths) = @_;
+ my ($self, $target, @dsts) = @_;
my $proj = $self->load_project($target);
- for my $dst (@dst_paths) {
+ @dsts = map { $self->expand_branch($proj, $_) } @dsts;
+
+ for my $dst (@dsts) {
my $target_path = '/'.$proj->depot->depotname.'/'.
($self->{local} ?
$proj->local_root."/$dst"
@@ -303,13 +312,6 @@
sub lock { $_[0]->lock_target ($_[1]) if $_[1]; };
-sub expand_branch {
- my ($self, $proj, $arg) = @_;
- return $arg unless $arg =~ m/\*/;
- my $match = SVK::XD::compile_apr_fnmatch($arg);
- return grep { m/$match/ } @{ $proj->branches };
-}
-
sub parse_arg {
my ($self, @arg) = @_;
return if $#arg < 1;
Modified: branches/bm/t/bm/remove.t
==============================================================================
--- branches/bm/t/bm/remove.t (original)
+++ branches/bm/t/bm/remove.t Fri Dec 7 01:45:20 2007
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
use SVK::Test;
-plan tests => 5;
+plan tests => 7;
our $output;
my ($xd, $svk) = build_test('test');
@@ -41,3 +41,16 @@
$svk->branch('--remove', 'bugfix/*');
is_output($svk, 'br', ['-l', '//mirror/MyProject'], []);
+
+$svk->branch('--create', 'foobar');
+$svk->branch('--create', 'foobar2');
+$svk->branch('--create', 'feature/foobar3');
+$svk->branch('--create', 'bugfix/foobar4');
+
+is_output($svk, 'br', ['-l', '//mirror/MyProject'],
+ ['bugfix/foobar4', 'feature/foobar3', 'foobar', 'foobar2']);
+
+$svk->branch('--remove', '*');
+
+is_output($svk, 'br', ['-l', '//mirror/MyProject'], []);
+
More information about the svk-commit
mailing list