[svk-commit] r2124 - in branches/mirror-pipeline: . lib/SVK/Command
t
clkao at bestpractical.com
clkao at bestpractical.com
Tue Nov 7 00:21:50 EST 2006
Author: clkao
Date: Tue Nov 7 00:21:48 2006
New Revision: 2124
Modified:
branches/mirror-pipeline/ (props changed)
branches/mirror-pipeline/Makefile.PL
branches/mirror-pipeline/lib/SVK/Command/Copy.pm
branches/mirror-pipeline/lib/SVK/Command/Delete.pm
branches/mirror-pipeline/lib/SVK/Command/Merge.pm
branches/mirror-pipeline/lib/SVK/Path.pm
branches/mirror-pipeline/lib/SVK/Test.pm
branches/mirror-pipeline/t/05svm-rm.t
branches/mirror-pipeline/t/10switch.t
branches/mirror-pipeline/t/12copy.t
branches/mirror-pipeline/t/21delete.t
Log:
r4604 at ubuntu (orig r2110): glasser | 2006-11-04 23:25:14 +0000
Update SVK to use Data::Hierarchy 0.40. SVK now no longer relies on
the internal implementation of the hierarchy object, which makes it
possible to use a more efficient internal representation.
SVK now calls ->save and ->load on the XD's D::H "checkout" before and
after serializing it. If it is reading in a D::H saved with pre-0.40
D::H, it won't call the (nonexistent) load on it, but D::H's
"_autoupgrade" will rebless it as a Data::Hierarchy::Savable and then
load it implicitly.
* Makefile.PL
Require Data::Hierarchy 0.40.
* lib/SVK/Command/Checkout.pm
(_find_copath): Use the ->defines and ->find methods on the checkout.
(list::run): Use ->find on the checkout.
(relocate::run): Use ->defines and ->move on the checkout.
(purge::run): Use ->find and ->get on the checkout.
* lib/SVK/Command/Pull.pm
(run): Use ->find on the checkout.
* lib/SVK/XD.pm
(_savify_checkout, _loadify_checkout): New methods to deal with
converting a Data::Hierarchy to and from either a
Data::Hierarchy::Relative or a Data::Hierarchy::Savable.
(load, store): Call _loadify_checkout.
(_store_config): Call _savify_checkout.
r7233 at ubuntu (orig r2111): clkao | 2006-11-06 09:11:25 +0000
r7227 at ubuntu: clkao | 2006-11-06 05:16:45 +0000
get rid of Clone.
r7234 at ubuntu (orig r2112): clkao | 2006-11-06 09:11:34 +0000
r7228 at ubuntu: clkao | 2006-11-06 05:18:53 +0000
document sm --summary.
r7235 at ubuntu (orig r2113): clkao | 2006-11-06 09:11:43 +0000
r7229 at ubuntu: clkao | 2006-11-06 05:36:05 +0000
When trying to copy across mirrors, suggests sm -IB for publish.
r7236 at ubuntu (orig r2114): clkao | 2006-11-06 09:11:52 +0000
r7230 at ubuntu: clkao | 2006-11-06 05:48:05 +0000
Make -r N@ work with copy.
r7237 at ubuntu (orig r2115): clkao | 2006-11-06 09:12:01 +0000
r7231 at ubuntu: clkao | 2006-11-06 06:24:07 +0000
* Fix same_source logic. (OMG this never worked)
r7238 at ubuntu (orig r2116): clkao | 2006-11-06 09:12:09 +0000
r7232 at ubuntu: clkao | 2006-11-06 06:40:07 +0000
support rm multiple depotpath.
r7245 at ubuntu (orig r2121): clkao | 2006-11-07 04:45:57 +0000
Revert r2110 for the incompatible changes regarding data::hierarchy.
This will be moved to a branch until trunk and 1.0 are both happy with
the compatibility.
Modified: branches/mirror-pipeline/Makefile.PL
==============================================================================
--- branches/mirror-pipeline/Makefile.PL (original)
+++ branches/mirror-pipeline/Makefile.PL Tue Nov 7 00:21:48 2006
@@ -40,7 +40,6 @@
);
build_requires(
'Test::More' => '0.42',
- 'Clone' => 0,
);
features(
'Localized messages' => [
Modified: branches/mirror-pipeline/lib/SVK/Command/Copy.pm
==============================================================================
--- branches/mirror-pipeline/lib/SVK/Command/Copy.pm (original)
+++ branches/mirror-pipeline/lib/SVK/Command/Copy.pm Tue Nov 7 00:21:48 2006
@@ -8,7 +8,7 @@
sub options {
($_[0]->SUPER::options,
'q|quiet' => 'quiet',
- 'r|revision=i' => 'rev');
+ 'r|revision=s' => 'rev');
}
sub parse_arg {
@@ -140,8 +140,8 @@
sub check_src {
my ($self, @src) = @_;
for my $src (@src) {
- # XXX: respect copath rev
- $src->revision($self->{rev}) if defined $self->{rev};
+ $src->revision($self->resolve_revision($src, $self->{rev})) if defined $self->{rev};
+ $self->apply_revision($src);
next unless $src->isa('SVK::Path::Checkout');
$self->_unmodified ($src->new);
}
@@ -151,10 +151,15 @@
my ($self, @src) = @_;
my $dst = pop @src;
- return loc("Different depots.\n") unless $dst->same_repos (@src);
- my $m = $self->under_mirror ($dst);
- return loc("Different sources.\n")
- if $m && !$dst->same_source (@src);
+ return loc("Different depots.\n") unless $dst->same_repos(@src);
+ my $m = $self->under_mirror($dst);
+ if ( $m && !$dst->same_source(@src) ) {
+ print loc("You are trying to copy across different mirrors.\n");
+ die loc( "Try create an empty directory %1, and run smerge --baseless %2 %3.\n",
+ $dst->report, $src[0]->report, $dst->report )
+ if $#src == 0 && $dst->isa('SVK::Path');
+ return 1;
+ }
$self->check_src (@src);
# XXX: check dst to see if the copy is obstructured or missing parent
my $fs = $dst->repos->fs;
Modified: branches/mirror-pipeline/lib/SVK/Command/Delete.pm
==============================================================================
--- branches/mirror-pipeline/lib/SVK/Command/Delete.pm (original)
+++ branches/mirror-pipeline/lib/SVK/Command/Delete.pm Tue Nov 7 00:21:48 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: branches/mirror-pipeline/lib/SVK/Command/Merge.pm
==============================================================================
--- branches/mirror-pipeline/lib/SVK/Command/Merge.pm (original)
+++ branches/mirror-pipeline/lib/SVK/Command/Merge.pm Tue Nov 7 00:21:48 2006
@@ -217,6 +217,7 @@
-s [--sync] : synchronize mirrored sources before operation
-t [--to] : merge to the specified path
-f [--from] : merge from the specified path
+ --summary : display related logs in this merge
--verbatim : verbatim merge log without indents and header
--no-ticket : do not record this merge point
--track-rename : track changes made to renamed node
Modified: branches/mirror-pipeline/lib/SVK/Path.pm
==============================================================================
--- branches/mirror-pipeline/lib/SVK/Path.pm (original)
+++ branches/mirror-pipeline/lib/SVK/Path.pm Tue Nov 7 00:21:48 2006
@@ -99,7 +99,7 @@
for (@other) {
my $m = $_->is_mirrored;
return 0 if $m xor $mself;
- return 0 if $m && $m->path ne $m->path;
+ return 0 if $m && $mself->path ne $m->path;
}
return 1;
}
Modified: branches/mirror-pipeline/lib/SVK/Test.pm
==============================================================================
--- branches/mirror-pipeline/lib/SVK/Test.pm (original)
+++ branches/mirror-pipeline/lib/SVK/Test.pm Tue Nov 7 00:21:48 2006
@@ -44,7 +44,6 @@
use SVK::Util qw( dirname catdir tmpdir can_run abs_path $SEP $EOL IS_WIN32 HAS_SVN_MIRROR );
require Storable;
use SVK::Path::Checkout;
-use Clone;
# Fake standard input
our $answer = [];
Modified: branches/mirror-pipeline/t/05svm-rm.t
==============================================================================
--- branches/mirror-pipeline/t/05svm-rm.t (original)
+++ branches/mirror-pipeline/t/05svm-rm.t Tue Nov 7 00:21:48 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: branches/mirror-pipeline/t/10switch.t
==============================================================================
--- branches/mirror-pipeline/t/10switch.t (original)
+++ branches/mirror-pipeline/t/10switch.t Tue Nov 7 00:21:48 2006
@@ -12,8 +12,8 @@
my ($copath, $corpath) = get_copath ('switch');
is_output_like ($svk, 'switch', [], qr'SYNOPSIS');
-$svk->cp ('-r1m', 'copy', '//A', '//A-branch');
+$svk->cp ('-r1', '-m', 'copy', '//A', '//A-branch');
$svk->checkout ('//A-branch', $copath);
is_output_like ($svk, 'switch', ['//A-branch', '.', 'foo'], qr'SYNOPSIS');
Modified: branches/mirror-pipeline/t/12copy.t
==============================================================================
--- branches/mirror-pipeline/t/12copy.t (original)
+++ branches/mirror-pipeline/t/12copy.t Tue Nov 7 00:21:48 2006
@@ -129,7 +129,8 @@
$svk->update ($copath);
is_output ($svk, 'cp', ['//V/new', '//foo-remote/new'],
- ['Different sources.']);
+ ['You are trying to copy across different mirrors.',
+ 'Try create an empty directory //foo-remote/new, and run smerge --baseless //V/new //foo-remote/new.']);
is_output ($svk, 'cp', ['-m', 'copy directly', '//V/me', '//V/me-dcopied'],
['Committed revision 15.']);
@@ -151,7 +152,7 @@
$svk->checkout ('//foo-remote', $copath);
is_output ($svk, 'cp', ['//V/me', "$copath/me-rcopied"],
- ['Different sources.']);
+ ['You are trying to copy across different mirrors.']);
$svk->copy ('-m', 'from co', "$copath/me", '//foo-remote/me-rcopied.again');
is_copied_from ("//foo-remote/me-rcopied.again", '/foo-remote/me', 14);
is_copied_from ("/foo/me-rcopied.again", '/me', 2);
Modified: branches/mirror-pipeline/t/21delete.t
==============================================================================
--- branches/mirror-pipeline/t/21delete.t (original)
+++ branches/mirror-pipeline/t/21delete.t Tue Nov 7 00:21:48 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