[svk-commit] r2116 - in trunk: lib/SVK/Command t
clkao at bestpractical.com
clkao at bestpractical.com
Mon Nov 6 04:12:10 EST 2006
Author: clkao
Date: Mon Nov 6 04:12:09 2006
New Revision: 2116
Modified:
trunk/ (props changed)
trunk/lib/SVK/Command/Delete.pm
trunk/t/05svm-rm.t
trunk/t/21delete.t
Log:
r7232 at ubuntu: clkao | 2006-11-06 06:40:07 +0000
support rm multiple depotpath.
Modified: trunk/lib/SVK/Command/Delete.pm
==============================================================================
--- trunk/lib/SVK/Command/Delete.pm (original)
+++ trunk/lib/SVK/Command/Delete.pm Mon Nov 6 04:12:09 2006
@@ -26,9 +26,6 @@
return $self->{xd}->target_condensed(@arg);
}
- die loc("Delete for more than one depotpath is not supported yet.\n")
- if scalar @arg > 1;
-
return @arg;
}
@@ -38,22 +35,28 @@
}
sub do_delete_direct {
- my ($self, $target) = @_;
- my $m = $self->under_mirror ($target);
- if ($m && $m->path eq $target->path) {
- $m->detach;
- $target->refresh_revision;
- undef $m;
+ my ( $self, @args ) = @_;
+ my $target = $args[0];
+ my $m = $self->under_mirror($target);
+ if ( $m && $m->path eq $target->path ) {
+ $m->detach;
+ $target->refresh_revision;
+ undef $m;
}
- $self->get_commit_message ();
+ $self->get_commit_message;
$target->normalize;
- my ($anchor, $editor) = $self->get_dynamic_editor ($target);
- my $rev = $target->revision;
- $rev = $m->find_remote_rev ($rev) if $m;
- $editor->delete_entry (abs2rel ($target->path, $anchor => undef, '/'), $rev, 0);
- $self->adjust_anchor ($editor);
- $self->finalize_dynamic_editor ($editor);
+ my ( $anchor, $editor ) = $self->get_dynamic_editor($target);
+ for (@args) {
+ my $rev = $target->revision;
+ $rev = $m->find_remote_rev($rev)
+ if
+ $m; # XXX: why do we need this? path->get_editor shuold do translation
+ $editor->delete_entry( abs2rel( $_->path, $anchor => undef, '/' ),
+ $rev, 0 );
+ $self->adjust_anchor($editor);
+ }
+ $self->finalize_dynamic_editor($editor);
}
sub _ensure_mirror {
@@ -69,16 +72,20 @@
}
sub run {
- my ($self, $target) = @_;
+ my ($self, @args) = @_;
- $self->_ensure_mirror($target);
- if ($target->isa('SVK::Path::Checkout')) {
+ if ($args[0]->isa('SVK::Path::Checkout')) {
+ my $target = $args[0]; # already condensed
+ $self->_ensure_mirror($target);
$self->{xd}->do_delete( $target, no_rm => $self->{keep},
'force_delete' => $self->{force} );
}
else {
- $self->do_delete_direct ( $target );
+ $self->_ensure_mirror($_) for @args;
+ die loc("Different source.\n") unless
+ $args[0]->same_source(@args);
+ $self->do_delete_direct( @args );
}
return;
Modified: trunk/t/05svm-rm.t
==============================================================================
--- trunk/t/05svm-rm.t (original)
+++ trunk/t/05svm-rm.t Mon Nov 6 04:12:09 2006
@@ -4,7 +4,7 @@
use SVK::Test;
eval { require SVN::Mirror; 1 } or plan skip_all => 'require SVN::Mirror';
-plan tests => 9;
+plan tests => 11;
# build another tree to be mirrored ourself
my ($xd, $svk) = build_test('svmrm');
@@ -51,3 +51,22 @@
is_output ($svk, 'propget', ['svm:mirror', '//'], []);
}
+
+# reset tests
+$svk->ps(-m => 'bandaid.', 'svm:mirror', '', '//');
+
+$svk->mirror('//rm/m2', "$uri/A");
+$svk->mirror('//rm/m1', "$uri/B");
+$svk->sync('-a');
+
+
+is_output($svk, 'rm', [-m => 'try delete', '//rm/m2/Q', '///rm/m1/S/P'],
+ ['Different source.']);
+
+is_output($svk, 'rm', [-m => 'try delete', '//rm/m2/Q/qu', '///rm/m2/Q/qz'],
+ ["Merging back to mirror source $uri/A.",
+ 'Merge back committed as revision 3.',
+ "Syncing $uri/A",
+ 'Retrieving log information from 3 to 3',
+ 'Committed revision 13 from revision 3.']);
+
Modified: trunk/t/21delete.t
==============================================================================
--- trunk/t/21delete.t (original)
+++ trunk/t/21delete.t Mon Nov 6 04:12:09 2006
@@ -236,8 +236,8 @@
is_output ($svk, 'rm', ['A/stalled'],
[__("A/stalled is not under version control; use '--force' to go ahead.")]);
-is_output ($svk, 'rm', ['//A/deep', '//A/bad'],
- [qr'not supported']);
+is_output ($svk, 'rm', [-m => 'fnord', '//A/something', '//A/bar'],
+ ['Committed revision 4.']);
is_output ($svk, 'rm', ['A/deep', '//A/bad'],
[qr'not supported']);
More information about the svk-commit
mailing list