[svk-commit] r2176 - in branches/svk-logging: . lib/SVK
lib/SVK/Command lib/SVK/Editor lib/SVK/Mirror/Backend
lib/SVK/Path t t/mirror
stig at bestpractical.com
stig at bestpractical.com
Sat Nov 18 17:23:17 EST 2006
Author: stig
Date: Sat Nov 18 17:23:15 2006
New Revision: 2176
Added:
branches/svk-logging/t/07smerge-branch-renamed.t
branches/svk-logging/t/mirror/relocate.t
Modified:
branches/svk-logging/ (props changed)
branches/svk-logging/MANIFEST
branches/svk-logging/lib/SVK/Command.pm
branches/svk-logging/lib/SVK/Command/Checkout.pm
branches/svk-logging/lib/SVK/Command/Depotmap.pm
branches/svk-logging/lib/SVK/Command/Ignore.pm
branches/svk-logging/lib/SVK/Command/Info.pm
branches/svk-logging/lib/SVK/Command/List.pm
branches/svk-logging/lib/SVK/Command/Merge.pm
branches/svk-logging/lib/SVK/Command/Propget.pm
branches/svk-logging/lib/SVK/Command/Proplist.pm
branches/svk-logging/lib/SVK/Command/Propset.pm
branches/svk-logging/lib/SVK/Command/Sync.pm
branches/svk-logging/lib/SVK/Command/Update.pm
branches/svk-logging/lib/SVK/Editor/XD.pm
branches/svk-logging/lib/SVK/Mirror/Backend/SVNRa.pm
branches/svk-logging/lib/SVK/Path.pm
branches/svk-logging/lib/SVK/Path/View.pm
branches/svk-logging/lib/SVK/Root/Checkout.pm
branches/svk-logging/lib/SVK/Test.pm
branches/svk-logging/lib/SVK/Util.pm
branches/svk-logging/lib/SVK/XD.pm
branches/svk-logging/t/01depotmap.t
branches/svk-logging/t/11checkout.t
branches/svk-logging/t/12copy.t
branches/svk-logging/t/32list.t
branches/svk-logging/t/33prop.t
branches/svk-logging/t/74view-mirror.t
Log:
r2157 at figleaf (orig r2153): glasser | 2006-11-17 06:19:16 +0000
Don't use the user's .subversion/config during tests. This fixes
the "some MIME-related tests fail for some people" issue.
(Brought to you by "Dave can't take a plane flight without
hacking on SVK".)
(There appears to be an UNEXPECTED PASS in 12copy.t now; will
investigate in next revision.)
* lib/SVK/Test.pm: Set $ENV{SVKNOSVNCONFIG} when module is loaded.
r2158 at figleaf (orig r2154): glasser | 2006-11-17 06:23:24 +0000
* t/12copy.t: un-TODO a test which passes as of r2114.
r2159 at figleaf (orig r2155): clkao | 2006-11-17 23:10:12 +0000
Disallow up -N, as it doesn't update the DH state correctly.
r2160 at figleaf (orig r2156): clkao | 2006-11-18 01:00:35 +0000
Port xd::do_propset to use create_xd_root in path::checkout.
r2161 at figleaf (orig r2157): clkao | 2006-11-18 01:08:11 +0000
Retire SVK::XD::xdroot.
r2162 at figleaf (orig r2158): clkao | 2006-11-18 01:29:02 +0000
Add a test for relocating copath to its parent.
r2163 at figleaf (orig r2159): clkao | 2006-11-18 01:47:32 +0000
Fix error messages in depot --relocate.
r2164 at figleaf (orig r2160): clkao | 2006-11-18 02:10:51 +0000
Support merge -c -rev at .
r2165 at figleaf (orig r2161): clkao | 2006-11-18 03:30:34 +0000
Don't exit with 0 when sync has failures.
r2166 at figleaf (orig r2162): clkao | 2006-11-18 04:15:57 +0000
When doing incremental merge, really don't cross the copies,
even if they are renames.
r2167 at figleaf (orig r2163): clkao | 2006-11-18 05:15:47 +0000
In url autovivification:
* don't hold the giant lock.
* Report failure and tell users what to do.
r2168 at figleaf (orig r2164): clkao | 2006-11-18 05:18:11 +0000
Make co --relocate do the right thing with sticky entries.
r2169 at figleaf (orig r2165): clkao | 2006-11-18 05:41:36 +0000
Check source_path when doing relocate.
r2170 at figleaf (orig r2166): clkao | 2006-11-18 06:31:36 +0000
Refactor svk list and make it display single file when ls is
given a single file.
r2171 at figleaf (orig r2167): clkao | 2006-11-18 06:54:37 +0000
Move run_command_recursively into SVK::Command.
r2172 at figleaf (orig r2168): clkao | 2006-11-18 07:07:07 +0000
Fix a bug in Root::Checkout about unknown entries.
r2173 at figleaf (orig r2169): clkao | 2006-11-18 07:21:02 +0000
svk pg -R.
r2174 at figleaf (orig r2170): clkao | 2006-11-18 07:45:29 +0000
Fix the recursive and depth sematics. also svk pl -R.
r2175 at figleaf (orig r2171): clkao | 2006-11-18 07:47:48 +0000
svk info -R.
r2176 at figleaf (orig r2172): clkao | 2006-11-18 07:50:35 +0000
fix a bug that svk info blows up on checkout added with history.
r2177 at figleaf (orig r2173): mndrix | 2006-11-18 15:09:54 +0000
Stop a warning during t/72sign.t ("Prototype mismatch: sub SVK::Util::max:
none vs (@)") by adding the appropriate prototype to 'autouse'.
r2178 at figleaf (orig r2174): clkao | 2006-11-18 20:52:44 +0000
Move error and pool handling into run_command_recursively
r2179 at figleaf (orig r2175): clkao | 2006-11-18 21:24:12 +0000
more todo tests for view.
Modified: branches/svk-logging/MANIFEST
==============================================================================
--- branches/svk-logging/MANIFEST (original)
+++ branches/svk-logging/MANIFEST Sat Nov 18 17:23:15 2006
@@ -192,6 +192,7 @@
t/07smerge-anchor.t
t/07smerge-baseless.t
t/07smerge-bidi-inc.t
+t/07smerge-branch-renamed.t
t/07smerge-copy-co.t
t/07smerge-copy.t
t/07smerge-delete.t
@@ -267,6 +268,7 @@
t/copy-escape.t
t/copy-replace.t
t/mirror/dav-authz.t
+t/mirror/relocate.t
t/mirror/sync-crazy-replace.t
t/mirror/sync-empty.t
t/mirror/sync-escape.t
Modified: branches/svk-logging/lib/SVK/Command.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command.pm (original)
+++ branches/svk-logging/lib/SVK/Command.pm Sat Nov 18 17:23:15 2006
@@ -367,6 +367,9 @@
die loc ("URI not allowed here: %1.\n", $no_new_mirror)
if $no_new_mirror;
+ # this is going to take a while, release giant lock
+ $self->{xd}->giant_unlock;
+
$logger->info(loc("New URI encountered: %1\n", $uri));
my $depots = join('|', map quotemeta, sort keys %$map);
@@ -459,6 +462,8 @@
$answer = 'a';
}
+ eval {
+
$self->command(
sync => {
skip_to => (
@@ -470,7 +475,16 @@
}
)->run ($target);
+ $self->{xd}->giant_lock;
+
+ };
+
my $depotpath = length ($rel_uri) ? $target->depotpath."/$rel_uri" : $target->depotpath;
+ if (my $err = $@) {
+ print loc("Unable to complete initial sync: %1", $err);
+ die loc("Run svk sync %1, and run the %2 command again.\n", $depotpath, lc((ref($self) =~ m/::([^:]*)$/)[0]));
+ }
+
return $self->arg_depotpath($depotpath);
}
@@ -995,6 +1009,54 @@
return $path;
}
+
+=head3 run_command_recursively($target, $code)
+
+Traverse C<$target> and and invoke C<$code> with each node.
+
+=cut
+
+sub _run_code {
+ my ($self, $target, $code, $level, $errs, $kind) = @_;
+ eval { $code->( $target, $kind, $level ) };
+ if ($@) {
+ print $@;
+ push @$errs, "$@";
+ }
+}
+
+sub run_command_recursively {
+ my ( $self, $target, $code, $errs, $newline, $level ) = @_;
+ my $root = $target->root;
+ my $kind = $root->check_path( $target->path_anchor );
+ $self->_run_code($target, $code, -1, $errs, $kind);
+ $self->_descend_with( $target, $code, $errs, 1 )
+ if $kind == $SVN::Node::dir
+ && $self->{recursive}
+ && ( !$self->{depth} || 0 < $self->{depth} );
+ print "\n" if $newline;
+}
+
+sub _descend_with {
+ my ($self, $target, $code, $errs, $level) = @_;
+ my $root = $target->root;
+ my $entries = $root->dir_entries ($target->path_anchor);
+ my $pool = SVN::Pool->new_default;
+ for (sort keys %$entries) {
+ $pool->clear;
+ my $kind = $entries->{$_}->kind;
+ next if $kind == $SVN::Node::unknown;
+ my $child = $target->new->descend($_);
+
+ $self->_run_code($child, $code, $level, $errs, $kind);
+ my $isdir = ($kind == $SVN::Node::dir);
+ if ($isdir && $self->{recursive} && (!$self->{'depth'} || ( $level < $self->{'depth'}))) {
+ $self->_descend_with($child, $code, $errs, $level+1);
+ }
+ }
+}
+
+
## Resolve the correct revision numbers given by "-c"
sub resolve_chgspec {
my ($self,$target) = @_;
@@ -1013,7 +1075,13 @@
else {
eval { $torev = $self->resolve_revision($target,$_); };
die loc("Change spec %1 not recognized.\n", $_) if($@);
- $fromrev = $torev - 1;
+ if ($torev < 0) {
+ $fromrev = -$torev;
+ $torev = $fromrev - 1;
+ }
+ else {
+ $fromrev = $torev - 1;
+ }
}
push @revlist , [$fromrev, $torev];
}
@@ -1069,12 +1137,13 @@
} elsif ($revstr =~ /\{(\d\d\d\d-\d\d-\d\d)\}/) {
my $date = $1; $date =~ s/-//g;
$rev = $self->find_date_rev($target,$date);
- } elsif ((my ($rrev) = $revstr =~ m'^(\d+)@$')) {
+ } elsif ((my ($minus, $rrev) = $revstr =~ m'^(-)?(\d+)@$')) {
if (my $m = $target->is_mirrored) {
- $rev = $m->find_local_rev ($rrev);
+ $rev = $m->find_local_rev($rrev);
}
die loc ("Can't find local revision for %1 on %2.\n", $rrev, $target->path)
unless defined $rev;
+ $rev *= $minus ? -1 : 1;
} elsif ($revstr =~ /^-\d+$/) {
$rev = $self->find_head_rev($target) + $revstr;
} elsif ($revstr =~ /\D/) {
Modified: branches/svk-logging/lib/SVK/Command/Checkout.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Checkout.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Checkout.pm Sat Nov 18 17:23:15 2006
@@ -205,19 +205,25 @@
}
# Manually relocate all paths
- my $map = $self->{xd}{checkout}{hash};
+ my $hmap = $self->{xd}{checkout}{hash};
my $abs_path = abs_path($path);
- if ($map->{$abs_path} and -d $abs_path) {
+ if ($hmap->{$abs_path} and -d $abs_path) {
move_path($path => $report);
$target = abs_path ($report);
}
my $prefix = $copath[0].$SEP;
my $length = length($copath[0]);
- foreach my $key (sort grep { index("$_$SEP", $prefix) == 0 } keys %$map) {
- $map->{$target . substr($key, $length)} = delete $map->{$key};
- }
+ my $relocate = sub {
+ my $map = shift;
+ for my $key ( sort grep { index( "$_$SEP", $prefix ) == 0 }
+ keys %$map ) {
+ $map->{ $target . substr( $key, $length ) } = delete $map->{$key};
+ }
+ };
+ $relocate->($hmap);
+ $relocate->($self->{xd}{checkout}{sticky});
print loc("Checkout '%1' relocated to '%2'.\n", $path, $target);
Modified: branches/svk-logging/lib/SVK/Command/Depotmap.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Depotmap.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Depotmap.pm Sat Nov 18 17:23:15 2006
@@ -25,10 +25,11 @@
return undef
unless $self->{add} or $self->{detach} or $self->{relocate};
- @arg or die loc("Need to specify a depot name");
+ @arg or die loc("Need to specify a depot name.\n");
my $depot = shift(@arg);
- @arg or die loc("Need to specify a path name") unless $self->{detach};
+ @arg or die loc("Need to specify a path name for depot.\n")
+ unless $self->{detach};
my $map = $self->{xd}{depotmap};
my $path = $depot;
Modified: branches/svk-logging/lib/SVK/Command/Ignore.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Ignore.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Ignore.pm Sat Nov 18 17:23:15 2006
@@ -42,8 +42,7 @@
$svn_ignore .= "$filename\n";
$self->{xd}->do_propset
- (
- $target->for_checkout_delta,
+ ( $target,
propname => 'svn:ignore',
propvalue => $svn_ignore,
);
Modified: branches/svk-logging/lib/SVK/Command/Info.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Info.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Info.pm Sat Nov 18 17:23:15 2006
@@ -3,6 +3,7 @@
use SVK::Version; our $VERSION = $SVK::VERSION;
use base qw( SVK::Command );
+use constant opt_recursive => 0;
use SVK::XD;
use SVK::Merge;
use SVK::I18N;
@@ -19,19 +20,17 @@
}
sub run {
- my ($self, @arg) = @_;
- my $exception='';
- my $pool = SVN::Pool->new_default;
- for my $target (@arg) {
- $pool->clear;
- eval { $self->_do_info($target) };
- if($@) {
- $exception .= "$@";
- $exception .= "\n" unless $exception =~ m/\n$/;
- next;
- }
- }
- die($exception) if($exception);
+ my ( $self, @arg ) = @_;
+ my $exception = '';
+ my $errs = [];
+ $self->run_command_recursively(
+ $_,
+ sub {
+ $self->_do_info( $_[0] );
+ }, $errs, $#arg,
+ ) for @arg;
+
+ return scalar @$errs;
}
sub _do_info {
@@ -81,7 +80,7 @@
=head1 OPTIONS
- None
+ -R [--recursive] : descend recursively
=head1 DESCRIPTION
Modified: branches/svk-logging/lib/SVK/Command/List.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/List.pm (original)
+++ branches/svk-logging/lib/SVK/Command/List.pm Sat Nov 18 17:23:15 2006
@@ -25,65 +25,62 @@
my ($self, @arg) = @_;
my $exception = '';
- while (my $arg = shift @arg) {
- $arg = $arg->as_depotpath;
- eval { _do_list($self, 0, $self->apply_revision($arg));
- print "\n" if @arg };
- $exception .= "$@" if $@;
+ my $enc = get_encoder;
+ if ( $self->{recursive} ) {
+ $self->{depth}++ if $self->{depth};
+ } else {
+ $self->{recursive}++;
+ $self->{depth} = 1;
}
+ my $errs = [];
+ $self->run_command_recursively(
+ $self->apply_revision($_),
+ sub {
+ my ( $target, $kind, $level ) = @_;
+ if ( $level == -1 ) {
+ return if $kind == $SVN::Node::dir;
+ die loc( "Path %1 is not versioned.\n", $target->path_anchor )
+ unless $kind == $SVN::Node::file;
+ }
+ $self->_print_item( $target, $kind, $level, $enc );
+ }, $errs, $#arg
+ ) for map { $_->as_depotpath } @arg;
- die($exception) if($exception);
+ return scalar @$errs;
}
-sub _do_list {
- my ($self, $level, $target) = @_;
- my $pool = SVN::Pool->new_default;
+sub _print_item {
+ my ( $self, $target, $kind, $level, $enc ) = @_;
my $root = $target->root;
- unless ((my $kind = $root->check_path ($target->path_anchor)) == $SVN::Node::dir) {
- die loc("Path %1 is not a versioned directory\n", $target->path_anchor)
- unless $kind == $SVN::Node::file;
- return;
+ if ( $self->{verbose} ) {
+ my $rev = $root->node_created_rev( $target->path );
+ my $fs = $target->repos->fs;
+
+ my $svn_date = $fs->revision_prop( $rev, 'svn:date' );
+
+ # The author name may be undef
+ no warnings 'uninitialized';
+
+ # Additional fields for verbose: revision author size datetime
+ printf "%7ld %-8.8s %10s %12s ", $rev,
+ $fs->revision_prop( $rev, 'svn:author' ),
+ ($kind == $SVN::Node::dir) ? "" : $root->file_length( $target->path ),
+ reformat_svn_date( "%b %d %H:%M", $svn_date );
}
- my $entries = $root->dir_entries ($target->path_anchor);
- my $enc = get_encoder;
- for (sort keys %$entries) {
- my $isdir = ($entries->{$_}->kind == $SVN::Node::dir);
-
- if ($self->{verbose}) {
- my $rev = $root->node_created_rev ($target->path."/$_");
- my $fs = $target->repos->fs;
-
- my $svn_date =
- $fs->revision_prop ($rev, 'svn:date');
-
- # The author name may be undef
- no warnings 'uninitialized';
-
- # Additional fields for verbose: revision author size datetime
- printf "%7ld %-8.8s %10s %12s ", $rev,
- $fs->revision_prop ($rev, 'svn:author'),
- ($isdir) ? "" : $root->file_length ($target->path."/$_"),
- reformat_svn_date("%b %d %H:%M", $svn_date);
- }
-
- if ($self->{'fullpath'}) {
- my $dpath = $target->path_anchor;
- to_native ($dpath, 'path', $enc);
- $dpath .= '/' unless $dpath eq '/';
- print '/'.$target->depotname.$dpath;
- } else {
- print " " x ($level);
- }
- my $path = $_;
- to_native ($path, 'path', $enc);
- print $path.($isdir ? '/' : '')."\n";
-
- if ($isdir && ($self->{recursive}) &&
- (!$self->{'depth'} ||( $level < $self->{'depth'} ))) {
- _do_list($self, $level+1, $target->new->descend($_));
- }
+ my $output_path;
+ if ( $self->{'fullpath'} ) {
+ $output_path = $target->report;
}
+ else {
+ print " " x ($level-1);
+ $output_path = Path::Class::File->new_foreign( 'Unix', $target->path )
+ ->basename;
+ }
+ to_native( $output_path, 'path', $enc );
+ print $output_path;
+ print( ( $kind == $SVN::Node::dir ? '/' : '' ) . "\n" );
+
}
1;
Modified: branches/svk-logging/lib/SVK/Command/Merge.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Merge.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Merge.pm Sat Nov 18 17:23:15 2006
@@ -152,7 +152,7 @@
traverse_history (
root => $src->root,
path => $src->path_anchor,
- cross => 0,
+ cross => -1,
callback => sub {
my $rev = $_[1];
return 0 if $rev <= $merge->{fromrev}; # last
Modified: branches/svk-logging/lib/SVK/Command/Propget.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Propget.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Propget.pm Sat Nov 18 17:23:15 2006
@@ -21,18 +21,24 @@
}
sub run {
- my ($self, $pname, @targets) = @_;
+ my ( $self, $pname, @targets ) = @_;
- foreach my $target (@targets) {
- my $proplist = $self->_proplist($target);
- exists $proplist->{$pname} or next;
-
- print $target->report, ' - ' if @targets > 1 and !$self->{strict};
- print $proplist->{$pname};
- print "\n" if !$self->{strict};
- }
+ my $errs = [];
+ $self->run_command_recursively(
+ $_,
+ sub {
+ my $target = shift;
+ my $proplist = $self->_proplist($target);
+ exists $proplist->{$pname} or return;
+
+ print $target->report, ' - '
+ if !$self->{strict} && ( $self->{recursive} || @targets > 1 );
+ print $proplist->{$pname};
+ print "\n" if !$self->{strict};
+ }, $errs, 0,
+ ) for @targets;
- return;
+ return scalar @$errs;
}
1;
Modified: branches/svk-logging/lib/SVK/Command/Proplist.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Proplist.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Proplist.pm Sat Nov 18 17:23:15 2006
@@ -22,24 +22,31 @@
}
sub run {
- my ($self, @arg) = @_;
- die loc ("Revision required.\n")
- if $self->{revprop} && !defined $self->{rev};
-
- for my $target (@arg) {
- if ($self->{revprop}) {
- $self->_show_props
- ( $target,
- $target->repos->fs->revision_proplist($self->{rev}),
- $self->{rev}
- );
- next;
+ my ( $self, @arg ) = @_;
+ if ( $self->{revprop} ) {
+ die loc("Revision required.\n")
+ unless defined $self->{rev};
+
+ for my $target (@arg) {
+ $self->_show_props( $target,
+ $target->repos->fs->revision_proplist( $self->{rev} ),
+ $self->{rev} );
}
+ return;
- $target = $target->as_depotpath ($self->{rev}) if defined $self->{rev};
- $self->_show_props( $target, $target->root->node_proplist($target->path) );
}
+ $self->run_command_recursively(
+ $_,
+ sub {
+ my $target = shift;
+ $target = $target->as_depotpath( $self->{rev} )
+ if defined $self->{rev};
+ $self->_show_props( $target,
+ $target->root->node_proplist( $target->path ) );
+ }
+ ) for @arg;
+
return;
}
Modified: branches/svk-logging/lib/SVK/Command/Propset.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Propset.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Propset.pm Sat Nov 18 17:23:15 2006
@@ -106,7 +106,7 @@
}
$self->{xd}->do_propset
- ( $target->for_checkout_delta,
+ ( $target,
propname => $pname,
propvalue => $pvalue,
quiet => $self->{quiet},
Modified: branches/svk-logging/lib/SVK/Command/Sync.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Sync.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Sync.pm Sat Nov 18 17:23:15 2006
@@ -52,6 +52,7 @@
@mirrors = map { $_->mirror->get( $_->path ) } @arg;
}
+ my $error;
for my $m (@mirrors) {
my $run_sync = sub {
$m->sync_snapshot($self->{skip_to}) if $self->{skip_to};
@@ -62,6 +63,7 @@
$logger->info(loc( "Starting to synchronize %1", $m->get_svkpath->depotpath ));
eval { $run_sync->() };
if ($@) {
+ ++$error;
warn $@;
last if ( $@ =~ /^Interrupted\.$/m );
}
@@ -71,7 +73,7 @@
$run_sync->();
}
}
- return;
+ return $error ? 1 : 0;
}
1;
Modified: branches/svk-logging/lib/SVK/Command/Update.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Command/Update.pm (original)
+++ branches/svk-logging/lib/SVK/Command/Update.pm Sat Nov 18 17:23:15 2006
@@ -38,6 +38,9 @@
die loc ("--revision cannot be used in conjunction with --sync or --merge.\n")
if defined $self->{rev} && ($self->{merge} || $self->{sync});
+ die loc("Non-recursive update not supported.\n")
+ unless $self->{recursive};
+
for my $target (@arg) {
my $update_target = $target->source->new;
$update_target->path($self->{update_target_path})
Modified: branches/svk-logging/lib/SVK/Editor/XD.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Editor/XD.pm (original)
+++ branches/svk-logging/lib/SVK/Editor/XD.pm Sat Nov 18 17:23:15 2006
@@ -248,11 +248,17 @@
if $name eq 'svn:executable';
}
else {
- $self->{xd}->do_propset ( quiet => 1,
- copath => $copath,
- propname => $name,
- propvalue => $value,
- );
+ $self->{get_path}($path);
+ $self->{xd}->do_propset(
+ $self->{xd}->create_path_object(
+ copath_anchor => $copath,
+ path => $path,
+ repos => $self->{repos}
+ ),
+ quiet => 1,
+ propname => $name,
+ propvalue => $value,
+ );
}
}
Modified: branches/svk-logging/lib/SVK/Mirror/Backend/SVNRa.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Mirror/Backend/SVNRa.pm (original)
+++ branches/svk-logging/lib/SVK/Mirror/Backend/SVNRa.pm Sat Nov 18 17:23:15 2006
@@ -173,6 +173,15 @@
my $mirror = $self->mirror;
die loc("Mirror source UUIDs differ.\n")
unless $ra_uuid eq $mirror->server_uuid;
+ my $source_root = $ra->get_repos_root;
+ my $source_path = $source;
+ die "source url not under source root"
+ if substr($source_path, 0, length($source_root), '') ne $source_root;
+
+ die loc( "Can't relocate: mirror subdirectory changed from %1 to %2.\n",
+ $self->source_path, $source_path )
+ unless $self->source_path eq $source_path;
+
$self->source_root( $ra->get_repos_root );
$mirror->url($source);
Modified: branches/svk-logging/lib/SVK/Path.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Path.pm (original)
+++ branches/svk-logging/lib/SVK/Path.pm Sat Nov 18 17:23:15 2006
@@ -321,7 +321,7 @@
sub descend {
my ($self, $entry) = @_;
- $self->{path} .= "/$entry";
+ $self->{path} .= $self->{path} eq '/' ? $entry : "/$entry";
return $self;
}
Modified: branches/svk-logging/lib/SVK/Path/View.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Path/View.pm (original)
+++ branches/svk-logging/lib/SVK/Path/View.pm Sat Nov 18 17:23:15 2006
@@ -99,4 +99,10 @@
return '/'.$self->depotname.$self->view->spec;
}
+sub universal { $_[0]->source->universal }
+
+sub normalize { # SVK::Path normalize is not view safe
+ return $_[0];
+}
+
1;
Modified: branches/svk-logging/lib/SVK/Root/Checkout.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Root/Checkout.pm (original)
+++ branches/svk-logging/lib/SVK/Root/Checkout.pm Sat Nov 18 17:23:15 2006
@@ -68,7 +68,7 @@
my $kind = $entry->{'.schedule'};
return $root->copied_from($path, $pool) unless $kind eq 'add';
- my ($source_path, $source_rev) = SVK::XD::_copy_source($entry, $copath);
+ my ($source_path, $source_rev) = $self->path->xd->_copy_source($entry, $copath);
return ($source_rev, $source_path);
}
@@ -106,7 +106,7 @@
else {
# Do we know about the node?
$coentries->{$_} = SVK::Root::Checkout::Entry->new
- ({ kind => $self->path->xd->{checkout}->get($copath, 1)->{'.schedule'} ?
+ ({ kind => $self->path->xd->{checkout}->get("$copath/$_", 1)->{'.schedule'} ?
$kind : $SVN::Node::unknown });
}
}
Modified: branches/svk-logging/lib/SVK/Test.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Test.pm (original)
+++ branches/svk-logging/lib/SVK/Test.pm Sat Nov 18 17:23:15 2006
@@ -1,5 +1,10 @@
package SVK::Test;
use strict;
+
+# When running tests, don't let the user's .subversion/config
+# affect results.
+BEGIN { $ENV{SVKNOSVNCONFIG} = 1; }
+
use SVK::Version; our $VERSION = $SVK::VERSION;
use base 'Exporter';
Modified: branches/svk-logging/lib/SVK/Util.pm
==============================================================================
--- branches/svk-logging/lib/SVK/Util.pm (original)
+++ branches/svk-logging/lib/SVK/Util.pm Sat Nov 18 17:23:15 2006
@@ -37,7 +37,7 @@
use autouse 'File::Basename' => qw(dirname);
use autouse 'File::Spec::Functions' =>
qw(catdir catpath splitpath splitdir tmpdir);
-
+use autouse 'List::Util' => qw( max(@) );
=head1 NAME
@@ -786,8 +786,9 @@
Traverse the history of $path in $fs_root backwards until the first
copy, unless $cross is true. We do cross renames regardless of the
-value of $cross. We invoke $cb for each $path, $revision we
-encounter. If cb returns a nonzero value we stop traversing as well.
+value of $cross being non-zero, but not -1. We invoke $cb for each
+$path, $revision we encounter. If cb returns a nonzero value we stop
+traversing as well.
=cut
@@ -813,7 +814,7 @@
while (1) {
my $ohist = $hist;
- $hist = $hist->prev(($args{cross} || 0), $new_pool);
+ $hist = $hist->prev(max(0, $args{cross} || 0), $new_pool);
if (!$hist) {
last if $args{cross};
last unless $hist = $ohist->prev((1), $new_pool);
Modified: branches/svk-logging/lib/SVK/XD.pm
==============================================================================
--- branches/svk-logging/lib/SVK/XD.pm (original)
+++ branches/svk-logging/lib/SVK/XD.pm Sat Nov 18 17:23:15 2006
@@ -589,63 +589,6 @@
return $path;
}
-sub xdroot {
- SVK::XD::Root->new (create_xd_root (@_));
-}
-
-sub create_xd_root {
- my ($self, %arg) = @_;
- Carp::confess unless $arg{repos};
- my ($fs, $copath) = ($arg{repos}->fs, $arg{copath});
- $copath = File::Spec::Unix->catdir($copath, $arg{copath_target})
- if defined $arg{copath_target};
- my ($txn, $root);
-
- my @paths = $self->{checkout}->find ($copath, {revision => qr'.*'});
-
- # In the simple case - only one revision entry found, it can be
- # for some descendents. If so we actually need to construct
- # txnroot.
- my ($simple, @bases) = $self->{checkout}->get($paths[0] || $copath, 1);
- # XXX this isn't really right: we aren't guaranteed that $revbase
- # actually has the revision, it might just have a lock or
- # something
- my $revbase = $bases[-1];
- unshift @paths, $revbase unless $revbase eq $copath;
- return (undef, $fs->revision_root($simple->{revision}))
- if $#paths <= 0;
-
- my $pool = SVN::Pool->new;
- for (@paths) {
- my $cinfo = $self->{checkout}->get ($_, 1);
- my $path = abs2rel($_, $copath => $arg{path}, '/');
- unless ($root) {
- my $base_rev = $cinfo->{revision};
- $txn = $fs->begin_txn ($base_rev, $arg{pool});
- $root = $txn->root($arg{pool});
- if ($base_rev == 0) {
- # for interrupted checkout, the anchor will be at rev 0
- my @path = ();
- for my $dir (File::Spec::Unix->splitdir($path)) {
- push @path, $dir;
- next unless length $dir;
- $root->make_dir(File::Spec::Unix->catdir(@path));
- }
- }
- next;
- }
- my ($parent) = get_anchor(0, $path);
- next if $cinfo->{revision} == $root->node_created_rev($parent, $pool);
- $root->delete ($path, $pool)
- if eval { $root->check_path ($path, $pool) != $SVN::Node::none };
- SVN::Fs::revision_link ($fs->revision_root ($cinfo->{revision}, $pool),
- $root, $path, $pool)
- unless $cinfo->{'.deleted'};
- $pool->clear;
- }
- return ($txn, $root);
-}
-
=head2 Checkout handling
=over
@@ -787,34 +730,35 @@
}
sub do_propset {
- my ($self, %arg) = @_;
- my ($xdroot, %values);
- my ($entry, $schedule) = $self->get_entry($arg{copath});
+ my ($self, $target, %arg) = @_;
+ my ($entry, $schedule) = $self->get_entry($target->copath);
$entry->{'.newprop'} ||= {};
- unless ($schedule eq 'add' || !$arg{repos}) {
- $xdroot = $self->xdroot (%arg);
- my ($source_path, $source_root) = $self->_copy_source ($entry, $arg{copath}, $xdroot);
- $source_path ||= $arg{path}; $source_root ||= $xdroot;
- die loc("%1 is not under version control.\n", $arg{report})
- if $xdroot->check_path ($source_path) == $SVN::Node::none;
+ unless ( $schedule eq 'add' ) {
+ my $xdroot = $target->create_xd_root;
+ my ( $source_path, $source_root )
+ = $self->_copy_source( $entry, $target->copath, $xdroot );
+ $source_path ||= $target->path_anchor;
+ $source_root ||= $xdroot;
+ die loc( "%1 is not under version control.\n", $target->report )
+ if $xdroot->check_path($source_path) == $SVN::Node::none;
}
#XXX: support working on multiple paths and recursive
- die loc("%1 is already scheduled for delete.\n", $arg{report})
+ die loc("%1 is already scheduled for delete.\n", $target->report)
if $schedule eq 'delete';
- %values = %{$entry->{'.newprop'}}
+ my %values = %{$entry->{'.newprop'}}
if exists $entry->{'.schedule'};
my $pvalue = defined $arg{propvalue} ? $arg{propvalue} : \undef;
- $self->{checkout}->store ($arg{copath},
+ $self->{checkout}->store ($target->copath,
{ '.schedule' => $schedule || 'prop',
'.newprop' => {%values,
$arg{propname} => $pvalue
}});
- print " M $arg{report}\n" unless $arg{quiet};
+ print " M ".$target->report."\n" unless $arg{quiet};
- $self->fix_permission ($arg{copath}, $arg{propvalue})
+ $self->fix_permission($target->copath, $arg{propvalue})
if $arg{propname} eq 'svn:executable';
}
Modified: branches/svk-logging/t/01depotmap.t
==============================================================================
--- branches/svk-logging/t/01depotmap.t (original)
+++ branches/svk-logging/t/01depotmap.t Sat Nov 18 17:23:15 2006
@@ -3,7 +3,7 @@
use SVK::Util qw( catdir tmpdir );
use File::Spec;
use SVK::Test;
-plan tests => 17;
+plan tests => 18;
our ($answer, $output, @TOCLEAN);
my $xd = SVK::XD->new (depotmap => {},
@@ -51,6 +51,9 @@
is_output ($svk, 'depotmap', ['//', $repospath],
["Depot '' already exists; use 'svk depotmap --detach' to remove it first."], 'depotpath - add again');
+is_output ($svk, 'depotmap', ['--relocate', '//'],
+ ["Need to specify a path name for depot."]);
+
$answer = 'n';
is_output ($svk, 'depotmap', ['--relocate', '//', "$repospath.new"],
[__("Depot '' relocated to '$repospath.new'.")], 'depotpath - relocate');
Added: branches/svk-logging/t/07smerge-branch-renamed.t
==============================================================================
--- (empty file)
+++ branches/svk-logging/t/07smerge-branch-renamed.t Sat Nov 18 17:23:15 2006
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+use Test::More tests => 1;
+use strict;
+use File::Path;
+use Cwd;
+use SVK::Test;
+
+my ($xd, $svk) = build_test();
+our $output;
+my ($copath, $corpath) = get_copath ('smerge-copy');
+$svk->mkdir ('-m', 'trunk', '//trunk');
+my $tree = create_basic_tree ($xd, '//trunk');
+$svk->cp ('-m', 'branch', '//trunk', '//local');
+
+$svk->mkdir(-m => 'somedir', '//local/somedir');
+$svk->mv(-m => 'rename local to local-foo', '//local', '//local-foo');
+
+is_output($svk, 'push', ['//local-foo'],
+ ['Auto-merging (0, 6) /local-foo to /trunk (base /trunk:3).',
+ '===> Auto-merging (0, 6) /local-foo to /trunk (base /trunk:3).',
+ 'A somedir',
+ qr'New merge ticket: .*:/local-foo:6',
+ 'Committed revision 7.']);
Modified: branches/svk-logging/t/11checkout.t
==============================================================================
--- branches/svk-logging/t/11checkout.t (original)
+++ branches/svk-logging/t/11checkout.t Sat Nov 18 17:23:15 2006
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-use Test::More tests => 65;
+use Test::More tests => 69;
use strict;
use SVK::Test;
our($output, $answer);
@@ -39,6 +39,9 @@
is_output ($svk, 'update', ['foo/bar/oz'], ["Path //V-3.1/A/oz does not exist."]);
is_output ($svk, 'update', ['foo/bar'], ["Syncing //V-3.1/A(/V-3.1/A) in ".__"$corpath/foo/bar to 6."]);
+is_output ($svk, 'update', [-N => -r5 => 'foo/bar/P'],
+ ['Non-recursive update not supported.']);
+
is_output ($svk, 'update', [-r5 => 'foo/bar/P'],
["Syncing //V-3.1/A/P(/V-3.1/A/P) in ".__"$corpath/foo/bar/P to 5.",
__('A foo/bar/P/pe'),
@@ -331,3 +334,21 @@
__("Checkout path '$corpath/Q' detached."),
__("Checkout path '$corpath/3.1' detached."),
]);
+
+chdir("$corpath/co-root-deep/there");
+$svk->mkdir("newdir");
+is_output($svk, 'st', [], ['A newdir']);
+
+chdir($corpath);
+rename("$corpath/co-root-deep/there", "$corpath/tmp");
+unlink("$corpath/co-root-deep");
+rename("$corpath/tmp", "$corpath/co-root-deep");
+
+is_output ($svk, 'checkout', ['--relocate', __("$corpath/co-root-deep/there"), __("$corpath/co-root-deep")], [
+ __("Checkout '$corpath/co-root-deep/there' relocated to '$corpath/co-root-deep'."),
+ ]);
+
+chdir("$corpath/co-root-deep");
+is_output($svk, 'st', [], ['A newdir']);
+
+
Modified: branches/svk-logging/t/12copy.t
==============================================================================
--- branches/svk-logging/t/12copy.t (original)
+++ branches/svk-logging/t/12copy.t Sat Nov 18 17:23:15 2006
@@ -263,8 +263,6 @@
'Retrieving log information from 7 to 7',
'Committed revision 23 from revision 7.']);
-TODO: {
-local $TODO = 'BUG - fix copy with -r 2@';
is_output ($svk, 'cp', ['-m', 'copy for remote', -r => '2@', '//foo-remote/me', '//foo-remote/me-rcopied-wr'],
[
"Merging back to mirror source $uri.",
@@ -272,7 +270,6 @@
"Syncing $uri",
'Retrieving log information from 8 to 8',
'Committed revision 24 from revision 8.']);
-}
is_output($svk, 'rm', ["$copath/B/fe"],
[__("D $copath/B/fe")]);
Modified: branches/svk-logging/t/32list.t
==============================================================================
--- branches/svk-logging/t/32list.t (original)
+++ branches/svk-logging/t/32list.t Sat Nov 18 17:23:15 2006
@@ -24,23 +24,23 @@
is_output ($svk, 'ls', [], ['A/']);
is_output ($svk, 'ls', ['-r1', 'A'], ['foo']);
- is_output ($svk, 'ls', ['A/foo'], []);
+ is_output ($svk, 'ls', ['A/foo'], ['foo']);
is_output ($svk, 'ls', ['-R', 'A'], ['B/', ' foo', 'foo']);
is_output ($svk, 'ls', ['-R', '-d1'], ['A/', ' B/', ' foo']);
- is_output ($svk, 'ls', ['-f','A/foo'], []);
+ is_output ($svk, 'ls', ['-f','A/foo'], ["/$depot/A/foo"]);
is_output ($svk, 'ls', ["/$depot/"], ['A/']);
is_output ($svk, 'ls', ['-f',"/$depot/"], ["/$depot/A/"]);
is_output ($svk, 'ls', ['-f',"/$depot/A"], ["/$depot/A/B/", "/$depot/A/foo"]);
is_output ($svk, 'ls', ['-f',"/$depot/A/"],
["/$depot/A/B/","/$depot/A/foo"]);
is_output ($svk, 'ls', ['-f','-R',"/$depot/A/"], ["/$depot/A/B/","/$depot/A/B/foo", "/$depot/A/foo"]);
- is_output ($svk, 'ls', ['-f',"/$depot/crap/"], ['Path /crap is not a versioned directory']);
+ is_output ($svk, 'ls', ['-f',"/$depot/crap/"], ['Path /crap is not versioned.']);
ok ($svk->ls ('-f', "/$depot/crap/") == 1, "ls -f /$depot/crap/ [exit status]");
is_output ($svk, 'ls', ['-f',"/$depot/", "/$depot/A"],
- ["/$depot/A/", '', "/$depot/A/B/","/$depot/A/foo"]);
+ ["/$depot/A/", '', "/$depot/A/B/","/$depot/A/foo", '']);
ok ($svk->ls ('-f', "/$depot/", "/$depot/A") == 0, "ls -f /$depot/ /$depot/A [exit status]");
is_output ($svk, 'ls', ['-f',"/$depot/A", "/$depot/crap/"],
- ["/$depot/A/B/","/$depot/A/foo", '', 'Path /crap is not a versioned directory']);
+ ["/$depot/A/B/","/$depot/A/foo", '', 'Path /crap is not versioned.', '']);
ok ($svk->ls ('-f', "/$depot/A", "/$depot/crap/") == 1, "ls -f /$depot/A /$depot/crap/ [exit status]");
use POSIX qw( strftime );
@@ -51,7 +51,8 @@
[qr" 2 $re_user $re_date A/"]);
is_output ($svk, 'ls', ['-v', '-r1'],
[qr" 1 $re_user $re_date A/"]);
- is_output ($svk, 'ls', ['-v', 'A/foo'], []);
+ is_output ($svk, 'ls', ['-v', 'A/foo'],
+ [qr" 1 $re_user $size $re_date foo"]);
is_output ($svk, 'ls', ['-v', '-r1', '-R'],
[qr" 1 $re_user $re_date A/",
qr" 1 $re_user $size $re_date foo"]);
@@ -66,7 +67,8 @@
qr" 1 $re_user $size $re_date foo"]);
is_output ($svk, 'ls', ['-v', '-f'],
[qr" 2 $re_user $re_date /$depot/A/"]);
- is_output ($svk, 'ls', ['-v', '-f', 'A/foo'], []);
+ is_output ($svk, 'ls', ['-v', '-f', 'A/foo'],
+ [qr" 1 $re_user $size $re_date /$depot/A/foo"]);
is_output ($svk, 'ls', ['-v', '-f', "/$depot/"],
[qr" 2 $re_user $re_date /$depot/A/"]);
is_output ($svk, 'ls', ['-v', '-f', "/$depot/A/"],
@@ -77,19 +79,19 @@
qr" 2 $re_user $size $re_date /$depot/A/B/foo",
qr" 1 $re_user $size $re_date /$depot/A/foo"]);
is_output ($svk, 'ls', ['-v', '-f',"/$depot/crap/"],
- ['Path /crap is not a versioned directory']);
+ ['Path /crap is not versioned.']);
ok ($svk->ls ('-v', '-f', "/$depot/crap/") == 1, "ls -v -f /$depot/crap/ [exit status]");
is_output ($svk, 'ls', ['-v', '-f', "/$depot/", "/$depot/A/"],
[qr" 2 $re_user $re_date /$depot/A/",
'',
qr" 2 $re_user $re_date /$depot/A/B/",
- qr" 1 $re_user $size $re_date /$depot/A/foo"]);
+ qr" 1 $re_user $size $re_date /$depot/A/foo", '']);
ok ($svk->ls ('-v', '-f', "/$depot/", "/$depot/A") == 0, "ls -v -f /$depot/ /$depot/A [exit status]");
is_output ($svk, 'ls', ['-v', '-f', "/$depot/A/", "/$depot/crap/"],
[qr" 2 $re_user $re_date /$depot/A/B/",
qr" 1 $re_user $size $re_date /$depot/A/foo",
'',
- 'Path /crap is not a versioned directory']);
+ 'Path /crap is not versioned.', '']);
ok ($svk->ls ('-v', '-f', "/$depot/A", "/$depot/crap/") == 1, "ls -f /$depot/A /$depot/crap/ [exit status]");
chdir("..");
Modified: branches/svk-logging/t/33prop.t
==============================================================================
--- branches/svk-logging/t/33prop.t (original)
+++ branches/svk-logging/t/33prop.t Sat Nov 18 17:23:15 2006
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-use Test::More tests => 54;
+use Test::More tests => 55;
use strict;
use File::Temp;
use SVK::Test;
@@ -58,6 +58,8 @@
is_output ($svk, 'pg', ['myprop', "$copath/A"],
['myvalue']);
+is_output ($svk, 'pg', [-R => 'myprop', "$copath"],
+ ['t/checkout/prop/A - myvalue']);
$svk->commit ('-m', 'commit', $copath);
Modified: branches/svk-logging/t/74view-mirror.t
==============================================================================
--- branches/svk-logging/t/74view-mirror.t (original)
+++ branches/svk-logging/t/74view-mirror.t Sat Nov 18 17:23:15 2006
@@ -2,7 +2,7 @@
use strict;
use SVK::Test;
-plan tests => 19;
+plan tests => 22;
our $output;
# build another tree to be mirrored ourself
@@ -17,12 +17,12 @@
$svk->ps ('-m', 'my view', 'svk:view:myview',
'&:/project/trunk
-*
- S S
- V V
- K K
+ s S
+ v V
+ k K
', '/test/project/trunk');
is_output($svk, 'ls', ['/test/^project/trunk/myview'],
- ['K/', 'S/', 'V/']);
+ ['k/', 's/', 'v/']);
my ($srepospath, $spath, $srepos) =$xd->find_repos('/test/project', 1);
my $suuid = $srepos->fs->get_uuid;
@@ -32,7 +32,7 @@
$svk->sync('//prj');
is_output($svk, 'ls', ['//^prj/trunk/myview'],
- ['K/', 'S/', 'V/']);
+ ['k/', 's/', 'v/']);
is_output($svk, 'co', ['//^prj/trunk/myview', $copath],
['Syncing //prj/trunk(/prj/trunk) in '.__($corpath).' to 27.',
@@ -42,14 +42,14 @@
"A $copath/$_/Q",
"A $copath/$_/Q/qu",
"A $copath/$_/Q/qz",
- "A $copath/$_/be") } qw(S V K)),
+ "A $copath/$_/be") } qw(s v k)),
" U $copath",
]);
-is_output($svk, 'rm', ["$copath/K/Q/qu"],
- [__("D $copath/K/Q/qu")]);
+is_output($svk, 'rm', ["$copath/k/Q/qu"],
+ [__("D $copath/k/Q/qu")]);
-is_output($svk, 'ci', [-m => 'kill Q', "$copath/K/Q"],
+is_output($svk, 'ci', [-m => 'kill Q', "$copath/k/Q"],
['Commit into mirrored path: merging back directly.',
"Merging back to mirror source $uri/project.",
'Merge back committed as revision 27.',
@@ -64,18 +64,17 @@
$svk->ps ('-m', 'my local view', 'svk:view:viewA',
'/prj/trunk
-*
- S S
- V V
- K K
+ s S
+ v V
+ k K
', '//');
is_output($svk, 'switch', ["//^viewA", $copath],
['Syncing //^prj/trunk/myview at 28(/prj/trunk) in '.__($corpath).' to 29.']);
+is_output($svk, 'rm', ["$copath/k/Q/qz"],
+ [__("D $copath/k/Q/qz")]);
-is_output($svk, 'rm', ["$copath/K/Q/qz"],
- [__("D $copath/K/Q/qz")]);
-
-is_output($svk, 'ci', [-m => 'kill Q', "$copath/K/Q"],
+is_output($svk, 'ci', [-m => 'kill Q', "$copath/k/Q"],
['Commit into mirrored path: merging back directly.',
"Merging back to mirror source $uri/project.",
'Merge back committed as revision 28.',
@@ -86,20 +85,20 @@
$svk->ps ('-m', 'swap V & K', 'svk:view:viewA',
'/prj/trunk
-*
- S S
- V K
- K V
+ s S
+ v K
+ k V
', '//');
is_output($svk, 'up', [$copath],
['Syncing //^viewA at 29(/prj/trunk) in '.__($corpath).' to 31.',
map { __($_) }
- "D $copath/V/Q/qu",
- "D $copath/V/Q/qz",
- "A $copath/K/Q/qu",
- "A $copath/K/Q/qz"]);
+ "D $copath/v/Q/qu",
+ "D $copath/v/Q/qz",
+ "A $copath/k/Q/qu",
+ "A $copath/k/Q/qz"]);
-append_file("$copath/K/Q/qu", "commit from view/K");
+append_file("$copath/k/Q/qu", "commit from view/K");
is_output($svk, 'ci', [-m => 'foo', $copath],
['Commit into mirrored path: merging back directly.',
@@ -109,7 +108,7 @@
'Retrieving log information from 29 to 29',
'Committed revision 32 from revision 29.']);
-append_file("$copath/V/be", "commit from view/V");
+append_file("$copath/v/be", "commit from view/V");
is_output($svk, 'ci', [-m => 'modify V', $copath],
['Commit into mirrored path: merging back directly.',
@@ -124,23 +123,23 @@
$svk->ps ('-m', 'use local K for V', 'svk:view:viewA',
'/prj/trunk
-*
- S S
- V //local/K
- K V
+ s S
+ v //local/K
+ k V
', '//');
is_output($svk, 'up', [$copath],
['Syncing //^viewA at 31(/prj/trunk) in '.__($corpath).' to 35.']);
-append_file("$copath/V/be", "local\n");
+append_file("$copath/v/be", "local\n");
-append_file("$copath/S/be", "mirrored\n");
+append_file("$copath/s/be", "mirrored\n");
#$svk->diff($copath);
is_output($svk, 'ci', [-m => 'booo', $copath],
["Can't commit a view with changes in multiple mirror sources."]);
-is_output($svk, 'ci', [-m => 'booo', "$copath/S/be"],
+is_output($svk, 'ci', [-m => 'booo', "$copath/s/be"],
['Commit into mirrored path: merging back directly.',
"Merging back to mirror source $uri/project.",
'Merge back committed as revision 31.',
@@ -150,20 +149,25 @@
]);
is_output($svk, 'st', [$copath],
- [__("M $copath/V/be")]);
+ [__("M $copath/v/be")]);
TODO: {
local $TODO = 'fix _commit_callback wrapper';
is_output($svk, 'ci', [-m => 'should be on local', $copath],
['Committed revision 37.']);
}
-is_output($svk, 'st', [$copath], []);
-__END__
+is_output($svk, 'st', [$copath], []);
-append_file("$copath/K/be", "mirrored as well\n");
+is_output($svk, 'mv', ["$copath/v/be", "$copath/v/be2"],
+ [__("A $copath/v/be2"),
+ __("D $copath/v/be")]);
+TODO: {
+local $TODO = 'checkout after mv is broken';
+is_output($svk, 'st', [$copath],
+ [__("A + $copath/v/be2"),
+ __("D $copath/v/be")]);
-append_file("$copath/S/be", "mirrored\n");
+is_output($svk, 'ci', [$copath], ['Committed revision 38.']);
-warn "===> mixed?";
-$svk->ci(-m => 'booo', $copath);
+}
Added: branches/svk-logging/t/mirror/relocate.t
==============================================================================
--- (empty file)
+++ branches/svk-logging/t/mirror/relocate.t Sat Nov 18 17:23:15 2006
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More;
+use SVK::Test;
+use SVK::Util qw(HAS_SYMLINK);
+
+plan(skip_all => 'symlink not supported') if !HAS_SYMLINK;
+plan tests => 3;
+
+my ($xd, $svk) = build_test('test', 'test2');
+my ($copath, $corpath) = get_copath ('sync-replicate');
+
+our $output;
+
+my $tree = create_basic_tree ($xd, '/test/');
+
+my ($srepospath, $spath, $srepos) = $xd->find_repos('/test/A', 1);
+my ($srepospath2) = $xd->find_repos('/test2/A', 1);
+rmtree [$srepospath2];
+symlink($srepospath, $srepospath2);
+
+my $uri = uri($srepospath.($spath eq '/' ? '' : $spath));
+my $uri2 = uri($srepospath);
+
+is_output($svk, mirror => ['//m', $uri],
+ ["Mirror initialized. Run svk sync //m to start mirroring."]);
+
+is_output($svk, 'mirror', ['--relocate', '//m', "$uri2/B"],
+ ["Can't relocate: mirror subdirectory changed from /A to /B."]);
+
+is_output($svk, 'mirror', ['--relocate', '//m', "$uri2/A"],
+ ['Mirror relocated.']);
More information about the svk-commit
mailing list