[svk-commit] r2997 - in trunk: lib/SVK t t/deleted

nobody at bestpractical.com nobody at bestpractical.com
Thu Jul 17 15:20:13 EDT 2008


Author: clkao
Date: Thu Jul 17 15:20:12 2008
New Revision: 2997

Added:
   trunk/t/deleted/
   trunk/t/deleted/basics.t
      - copied, changed from r2989, /trunk/t/32list-deleted.t
   trunk/t/deleted/complex.t
   trunk/t/deleted/copy-anchor-delete.t
   trunk/t/deleted/delete-copy-anchor.t
Removed:
   trunk/t/32list-deleted.t
Modified:
   trunk/   (props changed)
   trunk/lib/SVK/Path.pm
   trunk/t/31cat.t

Log:
- Merge //mirror/svk/branches/seek_deleted_to to //mirror/svk/trunk

Modified: trunk/lib/SVK/Path.pm
==============================================================================
--- trunk/lib/SVK/Path.pm	(original)
+++ trunk/lib/SVK/Path.pm	Thu Jul 17 15:20:12 2008
@@ -54,7 +54,8 @@
 use SVK::I18N;
 use autouse 'SVK::Util' => qw( get_anchor catfile abs2rel
 			       IS_WIN32 get_depot_anchor
-			       uri_escape );
+			       uri_escape traverse_history );
+
 use Class::Autouse qw(SVK::Editor::Dynamic SVK::Editor::TxnCleanup SVK::Editor::Tee);
 
 use SVN::Delta;
@@ -771,15 +772,76 @@
 sub seek_to {
     my ($self, $revision) = @_;
 
-    if ($revision < $self->revision) {
-	while (my ($toroot, $fromroot, $path) = $self->nearest_copy) {
-	    last if $toroot->revision_root_revision <= $revision;
-	    $self = $self->mclone( path => $path,
-				   revision => $fromroot->revision_root_revision );
-	}
+    return $self->mclone( revision => $revision )
+        if $revision >= $self->revision;
+
+    # if the path not exist then we should trace back history and watch copies
+    # and descedants
+    if ( $self->root->check_path( $self->path ) == $SVN::Node::none ) {
+        # find a parent that exist
+        my $tmp = $self->mclone( path_anchor => $self->path, targets => undef );
+        while ( $tmp->root->check_path( $tmp->path_anchor ) == $SVN::Node::none ) {
+            $tmp->anchorify;
+        }
+        my $res = $tmp->_seek_to_by_anchor( $revision );
+        return $res if $res;
     }
 
-    return $self->mclone( revision => $revision );
+    while (my ($toroot, $fromroot, $path) = $self->nearest_copy) {
+        last if $toroot->revision_root_revision <= $revision;
+        $self = $self->mclone( path => $path,
+                               revision => $fromroot->revision_root_revision );
+    }
+    return $self->mclone( revision => $revision )
+}
+
+sub _seek_to_by_anchor {
+    my ($self, $revision) = @_;
+
+    my $anchor = $self->path_anchor;
+
+    my ($found_at_rev, $switch_to) = (undef, undef);
+    traverse_history (
+        root  => $self->root,
+        path  => $anchor,
+        cross => 1,
+        callback => sub {
+            my ($path, $rev) = @_;
+            if ($path ne $anchor) {
+                $anchor = $self->path_anchor( $path );
+            }
+
+            if ( $self->as_depotpath( $rev )->root->check_path( $self->path ) != $SVN::Node::none ) {
+                $found_at_rev = $rev < $revision? $revision : $rev;
+                return 0;
+            }
+            return 0 if $rev < $revision;
+            
+            my @target = split m{/}, $self->path_target;
+            return 1 if @target < 2;
+
+            my @left = (shift @target);
+            my @right = (@target);
+
+            while ( @right >= 1 ) {
+                my $deanchored = $self->mclone(
+                    path_anchor => $self->path_anchor .'/'. join( '/', @left ),
+                    targets     => [ join '/', @right ],
+                    revision    => $rev,
+                    _root       => undef,
+                );
+                if ( $deanchored->root->check_path( $deanchored->path_anchor ) == $SVN::Node::none ) {
+                    last;
+                }
+                $switch_to = $deanchored;
+                push @left, shift @right;
+            }
+            return $switch_to? 0 : 1;
+        },
+    );
+    return $switch_to->_seek_to_by_anchor( $revision ) if $switch_to;
+    return $self->mclone( path => $self->path, targets => undef, revision => $found_at_rev )->seek_to( $revision )
+        if defined $found_at_rev;
 }
 
 *path_anchor = __PACKAGE__->make_accessor('path');

Modified: trunk/t/31cat.t
==============================================================================
--- trunk/t/31cat.t	(original)
+++ trunk/t/31cat.t	Thu Jul 17 15:20:12 2008
@@ -35,6 +35,6 @@
 is_output ($svk, 'cat', ['-r1', '//A/foo.new'], ['foobar'],
 	   "cat -rN depotpath peg'ed");
 
-is_output_like($svk, 'cat', ['-r1', '//A/foo'], qr'not found');
+is_output($svk, 'cat', ['-r1', '//A/foo'], ['foobar']);
 
 is_output ($svk, 'cat', ['-r1', '//A/foo at 2'], ['foobar']);

Copied: trunk/t/deleted/basics.t (from r2989, /trunk/t/32list-deleted.t)
==============================================================================
--- /trunk/t/32list-deleted.t	(original)
+++ trunk/t/deleted/basics.t	Thu Jul 17 15:20:12 2008
@@ -2,7 +2,7 @@
 
 use strict;
 
-use Test::More tests => 11;
+use Test::More tests => 17;
 use File::Path;
 use Cwd;
 use SVK::Test;
@@ -54,6 +54,22 @@
     ]
 );
 
+is_output($svk, 'cat', ['//trunk/A/Q/qu'],
+    [
+        'first line in qu',
+        '2nd line in qu',
+    ]
+);
+
+is_output($svk, 'ann', ['//trunk/A/Q/qu'],
+    [
+        'Annotations for /trunk/A/Q/qu (1 active revisions):',
+        '****************',
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\tfirst line in qu},
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\t2nd line in qu},
+    ]
+);
+
 is_output($svk, 'ls', ['-R', '-r', '3', '//trunk/A'],
     [
         'Q/',
@@ -63,6 +79,22 @@
     ]
 );
 
+is_output($svk, 'cat', ['-r', '3', '//trunk/A/Q/qu'],
+    [
+        'first line in qu',
+        '2nd line in qu',
+    ]
+);
+
+is_output($svk, 'ann', ['-r', '3', '//trunk/A/Q/qu'],
+    [
+        'Annotations for /trunk/A/Q/qu (1 active revisions):',
+        '****************',
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\tfirst line in qu},
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\t2nd line in qu},
+    ]
+);
+
 is_output($svk, 'rm', ['-m', 'remove //trunk/A', '//trunk/A'],
     [
         'Committed revision 4.',
@@ -146,3 +178,19 @@
     ]
 );
 
+is_output($svk, 'cat', ['-r', '3', '//trunk/A/Q/qu'],
+    [
+        'first line in qu',
+        '2nd line in qu',
+    ]
+);
+
+is_output($svk, 'ann', ['-r', '3', '//trunk/A/Q/qu'],
+    [
+        'Annotations for /trunk/A/Q/qu (1 active revisions):',
+        '****************',
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\tfirst line in qu},
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\t2nd line in qu},
+    ]
+);
+

Added: trunk/t/deleted/complex.t
==============================================================================
--- (empty file)
+++ trunk/t/deleted/complex.t	Thu Jul 17 15:20:12 2008
@@ -0,0 +1,510 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Test::More tests => 82;
+use File::Path;
+use Cwd;
+use SVK::Test;
+
+my ($xd, $svk) = build_test();
+our $output;
+my ($copath, $corpath) = get_copath ('smerge');
+my (undef, undef, $repos) = $xd->find_repos ('//', 1);
+my $uuid = $repos->fs->get_uuid;
+
+$svk->mkdir ('-m', 'trunk', '//trunk');
+my $tree = create_basic_tree ($xd, '//trunk');
+
+$svk->checkout ('//trunk', $copath);
+chdir $copath;
+
+overwrite_file('A/Q/qu', "trunk A/Q/qu\n");
+overwrite_file('A/be', "trunk A/be\n");
+is_output($svk, 'ci', ['-m', 'set files'], ['Committed revision 4.']);
+
+is_output($svk, 'cp', ['-m', 'copy //local from //trunk', '//trunk', '//local'],
+    ['Committed revision 5.']
+);
+
+is_output($svk, 'switch', ['//local'],
+    [__"Syncing //trunk(/trunk) in $corpath to 5."]
+);
+overwrite_file('A/Q/ql', "local A/Q/ql\n");
+$svk->add('A/Q/ql');
+overwrite_file('A/Q/qu', "local A/Q/qu\n");
+overwrite_file('A/be', "local A/be\n");
+is_output($svk, 'ci', ['-m', 'set files'], ['Committed revision 6.']);
+
+is_output($svk, 'cp', ['-m', 'copy //local-another from //trunk', '//trunk', '//local-another'],
+    ['Committed revision 7.']
+);
+
+is_output($svk, 'switch', ['//local-another'],
+    [
+        __"Syncing //local(/local) in $corpath to 7.",
+        __"U   A/Q/qu",
+        __"D   A/Q/ql",
+        __"U   A/be",
+    ]
+);
+overwrite_file('A/Q/qu', "local-another A/Q/qu\n");
+overwrite_file('A/be', "local-another A/be\n");
+is_output($svk, 'ci', ['-m', 'set files'],
+    ['Committed revision 8.']
+);
+
+# here is trick: delete A/Q/ql on //local, then replace A/Q in //local-another
+# branch with A/Q from //local branch, then delete Q/, delete A/
+# and try to ls/cat A/Q/qu, A/Q/ql and A/be using different revisions
+
+is_output($svk, 'rm', [ '-m', 'remove A/Q/ql in //local', '//local/A/Q/ql'],
+    ['Committed revision 9.']
+);
+
+is_output($svk, 'rm', ['A/Q'],
+    [
+        __"D   A/Q",
+        __"D   A/Q/qu",
+        __"D   A/Q/qz",
+    ]
+);
+is_output($svk, 'cp', ['//local/A/Q', 'A/'],
+    [
+        __"A   A/Q",
+        __"A   A/Q/qu",
+        __"A   A/Q/qz",
+    ]
+);
+is_output($svk, 'st', [],
+    ['R + A/Q']
+);
+is_output($svk, 'ci', ['-m', 'replace A/Q'],
+    ['Committed revision 10.']
+);
+is_output($svk, 'rm', ['-m', 'remove', '//local-another/A'],
+    ['Committed revision 11.']
+);
+
+# head (rev 11)
+{
+    is_output($svk, 'ls', ['//local-another'],
+        [
+            'B/',
+            'C/',
+            'D/',
+            'me',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '//local-another'],
+        [
+            '//local-another/B/',
+            '//local-another/C/',
+            '//local-another/D/',
+            '//local-another/me',
+        ]
+    );
+    is_output_like($svk, 'ls', ['//local-another/A'], qr/is not versioned/);
+    is_output_like($svk, 'cat', ['//local-another/A/Q/qu'], qr/not found/);
+    is_output_like($svk, 'cat', ['//local-another/A/Q/ql'], qr/not found/);
+    is_output_like($svk, 'cat', ['//local-another/A/be'], qr/not found/);
+}
+
+# -r 10
+{
+    is_output($svk, 'ls', ['-r', '10', '//local-another'],
+        [
+            'A/',
+            'B/',
+            'C/',
+            'D/',
+            'me',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '10', '//local-another'],
+        [
+            '//local-another/A/',
+            '//local-another/B/',
+            '//local-another/C/',
+            '//local-another/D/',
+            '//local-another/me',
+        ]
+    );
+    is_output($svk, 'ls', ['-r', '10', '//local-another/A/'],
+        [
+            'Q/',
+            'be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '10', '//local-another/A/'],
+        [
+            '//local-another/A/Q/',
+            '//local-another/A/be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '10', '//local-another/A/Q/qu'],
+        [
+            '//local-another/A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '10', '//local-another/A/Q/qu'],
+        [
+            'local A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '10', '//local-another/A/be'],
+        [
+            'local-another A/be',
+        ]
+    );
+    is_output_like($svk, 'ls', ['-f', '-r', '10', '//local-another/A/Q/ql'],
+        qr/not found/
+    );
+    is_output_like($svk, 'cat', ['-r', '10', '//local-another/A/Q/ql'],
+        qr/not found/
+    );
+}
+
+# -r 9 
+{
+    is_output($svk, 'ls', ['-r', '9', '//local-another'],
+        [
+            'A/',
+            'B/',
+            'C/',
+            'D/',
+            'me',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '9', '//local-another'],
+        [
+            '//local-another/A/',
+            '//local-another/B/',
+            '//local-another/C/',
+            '//local-another/D/',
+            '//local-another/me',
+        ]
+    );
+    is_output($svk, 'ls', ['-r', '9', '//local-another/A/'],
+        [
+            'Q/',
+            'be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '9', '//local-another/A/'],
+        [
+            '//local-another/A/Q/',
+            '//local-another/A/be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '9', '//local-another/A/Q/qu'],
+        [
+            '//local/A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '9', '//local-another/A/Q/qu'],
+        [
+            'local A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '9', '//local-another/A/be'],
+        [
+            'local-another A/be',
+        ]
+    );
+    is_output_like($svk, 'ls', ['-f', '-r', '9', '//local-another/A/Q/ql'],
+        qr/is not versioned/
+    );
+    is_output_like($svk, 'cat', ['-r', '9', '//local-another/A/Q/ql'],
+        qr/not found/
+    );
+}
+
+# PATH at 9
+{
+    is_output($svk, 'ls', ['//local-another at 9'],
+        [
+            'A/',
+            'B/',
+            'C/',
+            'D/',
+            'me',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '//local-another at 9'],
+        [
+            '//local-another/A/',
+            '//local-another/B/',
+            '//local-another/C/',
+            '//local-another/D/',
+            '//local-another/me',
+        ]
+    );
+    is_output($svk, 'ls', ['//local-another/A/@9'],
+        [
+            'Q/',
+            'be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '//local-another/A/@9'],
+        [
+            '//local-another/A/Q/',
+            '//local-another/A/be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '//local-another/A/Q/qu at 9'],
+        [
+            '//local-another/A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['//local-another/A/Q/qu at 9'],
+        [
+            'local-another A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['//local-another/A/be at 9'],
+        [
+            'local-another A/be',
+        ]
+    );
+    is_output_like($svk, 'ls', ['-f', '//local-another/A/Q/ql at 9'],
+        qr/is not versioned/
+    );
+    is_output_like($svk, 'cat', ['//local-another/A/Q/ql at 9'],
+        qr/not found/
+    );
+}
+
+# -r 8
+{
+    is_output($svk, 'ls', ['-r', '8', '//local-another'],
+        [
+            'A/',
+            'B/',
+            'C/',
+            'D/',
+            'me',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '8', '//local-another'],
+        [
+            '//local-another/A/',
+            '//local-another/B/',
+            '//local-another/C/',
+            '//local-another/D/',
+            '//local-another/me',
+        ]
+    );
+    is_output($svk, 'ls', ['-r', '8', '//local-another/A/'],
+        [
+            'Q/',
+            'be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '8', '//local-another/A/'],
+        [
+            '//local-another/A/Q/',
+            '//local-another/A/be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '8', '//local-another/A/Q/qu'],
+        [
+            '//local/A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '8', '//local-another/A/Q/qu'],
+        [
+            'local A/Q/qu',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '8', '//local-another/A/be'],
+        [
+            '//local-another/A/be',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '8', '//local-another/A/be'],
+        [
+            'local-another A/be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '8', '//local-another/A/Q/ql'],
+        [
+            '//local/A/Q/ql',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '8', '//local-another/A/Q/ql'],
+        [
+            'local A/Q/ql',
+        ]
+    );
+}
+
+# -r 7 PATH at 8
+{
+    is_output($svk, 'ls', ['-r', '7', '//local-another at 8'],
+        [
+            'A/',
+            'B/',
+            'C/',
+            'D/',
+            'me',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '7', '//local-another at 8'],
+        [
+            '//local-another/A/',
+            '//local-another/B/',
+            '//local-another/C/',
+            '//local-another/D/',
+            '//local-another/me',
+        ]
+    );
+    is_output($svk, 'ls', ['-r', '7', '//local-another/A/@8'],
+        [
+            'Q/',
+            'be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '7', '//local-another/A/@8'],
+        [
+            '//local-another/A/Q/',
+            '//local-another/A/be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '7', '//local-another/A/Q/qu at 8'],
+        [
+            '//local-another/A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '7', '//local-another/A/Q/qu at 8'],
+        [
+            'trunk A/Q/qu',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '7', '//local-another/A/be at 8'],
+        [
+            '//local-another/A/be',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '7', '//local-another/A/be at 8'],
+        [
+            'trunk A/be',
+        ]
+    );
+    is_output_like($svk, 'ls', ['-f', '-r', '7', '//local-another/A/Q/ql at 8'],
+        qr/not found/
+    );
+    is_output_like($svk, 'cat', ['-r', '7', '//local-another/A/Q/ql at 8'],
+        qr/not found/
+    );
+}
+
+
+# revision 6
+{
+    is_output($svk, 'ls', ['-r', '6', '//local-another'],
+        [
+            'A/',
+            'B/',
+            'C/',
+            'D/',
+            'me',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '6', '//local-another'],
+        [
+            '//trunk/A/',
+            '//trunk/B/',
+            '//trunk/C/',
+            '//trunk/D/',
+            '//trunk/me',
+        ]
+    );
+    is_output($svk, 'ls', ['-r', '6', '//local-another/A/'],
+        [
+            'Q/',
+            'be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '6', '//local-another/A/'],
+        [
+            '//trunk/A/Q/',
+            '//trunk/A/be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '6', '//local-another/A/Q/qu'],
+        [
+            '//local/A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '6', '//local-another/A/Q/qu'],
+        [
+            'local A/Q/qu',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '6', '//local-another/A/be'],
+        [
+            '//trunk/A/be',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '6', '//local-another/A/be'],
+        [
+            'trunk A/be',
+        ]
+    );
+}
+
+# revision 6 PATH at 8
+{
+    is_output($svk, 'ls', ['-r', '6', '//local-another at 8'],
+        [
+            'A/',
+            'B/',
+            'C/',
+            'D/',
+            'me',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '6', '//local-another at 8'],
+        [
+            '//trunk/A/',
+            '//trunk/B/',
+            '//trunk/C/',
+            '//trunk/D/',
+            '//trunk/me',
+        ]
+    );
+    is_output($svk, 'ls', ['-r', '6', '//local-another/A/@8'],
+        [
+            'Q/',
+            'be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '6', '//local-another/A/@8'],
+        [
+            '//trunk/A/Q/',
+            '//trunk/A/be',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '6', '//local-another/A/Q/qu at 8'],
+        [
+            '//trunk/A/Q/qu',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '6', '//local-another/A/Q/qu at 8'],
+        [
+            'trunk A/Q/qu',
+        ]
+    );
+    is_output($svk, 'ls', ['-f', '-r', '6', '//local-another/A/be at 8'],
+        [
+            '//trunk/A/be',
+        ]
+    );
+    is_output($svk, 'cat', ['-r', '6', '//local-another/A/be at 8'],
+        [
+            'trunk A/be',
+        ]
+    );
+}
+

Added: trunk/t/deleted/copy-anchor-delete.t
==============================================================================
--- (empty file)
+++ trunk/t/deleted/copy-anchor-delete.t	Thu Jul 17 15:20:12 2008
@@ -0,0 +1,202 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Test::More tests => 18;
+use File::Path;
+use Cwd;
+use SVK::Test;
+
+my ($xd, $svk) = build_test();
+our $output;
+my ($copath, $corpath) = get_copath ('smerge');
+my (undef, undef, $repos) = $xd->find_repos ('//', 1);
+my $uuid = $repos->fs->get_uuid;
+
+$svk->mkdir ('-m', 'trunk', '//trunk');
+my $tree = create_basic_tree ($xd, '//trunk');
+is_output($svk, 'ls', ['//trunk/'],
+    [
+        'A/',
+        'B/',
+        'C/',
+        'D/',
+        'me',
+    ]
+);
+is_output($svk, 'ls', ['//trunk/A'],
+    [
+        'Q/',
+        'be',
+    ]
+);
+is_output($svk, 'ls', ['-R', '//trunk/'],
+    [
+        'A/',
+        ' Q/',
+        '  qu',
+        '  qz',
+        ' be',
+        'B/',
+        ' S/',
+        '  P/',
+        '   pe',
+        '  Q/',
+        '   qu',
+        '   qz',
+        '  be',
+        ' fe',
+        'C/',
+        ' R/',
+        'D/',
+        ' de',
+        'me',
+    ]
+);
+
+is_output($svk, 'cat', ['//trunk/A/Q/qu'],
+    [
+        'first line in qu',
+        '2nd line in qu',
+    ]
+);
+
+is_output($svk, 'ann', ['//trunk/A/Q/qu'],
+    [
+        'Annotations for /trunk/A/Q/qu (1 active revisions):',
+        '****************',
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\tfirst line in qu},
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\t2nd line in qu},
+    ]
+);
+
+is_output($svk, 'ls', ['-R', '-r', '3', '//trunk/A'],
+    [
+        'Q/',
+        ' qu',
+        ' qz',
+        'be',
+    ]
+);
+
+is_output($svk, 'cat', ['-r', '3', '//trunk/A/Q/qu'],
+    [
+        'first line in qu',
+        '2nd line in qu',
+    ]
+);
+
+is_output($svk, 'ann', ['-r', '3', '//trunk/A/Q/qu'],
+    [
+        'Annotations for /trunk/A/Q/qu (1 active revisions):',
+        '****************',
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\tfirst line in qu},
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\t2nd line in qu},
+    ]
+);
+
+is_output($svk, 'cp', ['-m', 'copy //local from //trunk', '//trunk', '//local'],
+    [
+        'Committed revision 4.',
+    ]
+);
+
+is_output($svk, 'rm', ['-m', 'remove //local/A', '//local/A'],
+    [
+        'Committed revision 5.',
+    ]
+);
+
+is_output($svk, 'ls', ['//local/'],
+    [
+        'B/',
+        'C/',
+        'D/',
+        'me',
+    ]
+);
+is_output($svk, 'ls', ['-R', '//local/'],
+    [
+        'B/',
+        ' S/',
+        '  P/',
+        '   pe',
+        '  Q/',
+        '   qu',
+        '   qz',
+        '  be',
+        ' fe',
+        'C/',
+        ' R/',
+        'D/',
+        ' de',
+        'me',
+    ]
+);
+
+is_output($svk, 'ls', ['-r', '3', '//local/'],
+    [
+        'A/',
+        'B/',
+        'C/',
+        'D/',
+        'me',
+    ]
+);
+
+is_output($svk, 'ls', ['-r', '3', '//local/A'],
+    [
+        'Q/',
+        'be',
+    ]
+);
+
+is_output($svk, 'ls', ['-R', '-r', '3', '//local/'],
+    [
+        'A/',
+        ' Q/',
+        '  qu',
+        '  qz',
+        ' be',
+        'B/',
+        ' S/',
+        '  P/',
+        '   pe',
+        '  Q/',
+        '   qu',
+        '   qz',
+        '  be',
+        ' fe',
+        'C/',
+        ' R/',
+        'D/',
+        ' de',
+        'me',
+    ]
+);
+
+is_output($svk, 'ls', ['-R', '-r', '3', '//local/A'],
+    [
+        'Q/',
+        ' qu',
+        ' qz',
+        'be',
+    ]
+);
+
+is_output($svk, 'cat', ['-r', '3', '//local/A/Q/qu'],
+    [
+        'first line in qu',
+        '2nd line in qu',
+    ]
+);
+
+is_output($svk, 'ann', ['-r', '3', '//local/A/Q/qu'],
+    [
+        'Annotations for /trunk/A/Q/qu (1 active revisions):',
+        '****************',
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\tfirst line in qu},
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\t2nd line in qu},
+    ]
+);
+

Added: trunk/t/deleted/delete-copy-anchor.t
==============================================================================
--- (empty file)
+++ trunk/t/deleted/delete-copy-anchor.t	Thu Jul 17 15:20:12 2008
@@ -0,0 +1,202 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Test::More tests => 18;
+use File::Path;
+use Cwd;
+use SVK::Test;
+
+my ($xd, $svk) = build_test();
+our $output;
+my ($copath, $corpath) = get_copath ('smerge');
+my (undef, undef, $repos) = $xd->find_repos ('//', 1);
+my $uuid = $repos->fs->get_uuid;
+
+$svk->mkdir ('-m', 'trunk', '//trunk');
+my $tree = create_basic_tree ($xd, '//trunk');
+is_output($svk, 'ls', ['//trunk/'],
+    [
+        'A/',
+        'B/',
+        'C/',
+        'D/',
+        'me',
+    ]
+);
+is_output($svk, 'ls', ['//trunk/A'],
+    [
+        'Q/',
+        'be',
+    ]
+);
+is_output($svk, 'ls', ['-R', '//trunk/'],
+    [
+        'A/',
+        ' Q/',
+        '  qu',
+        '  qz',
+        ' be',
+        'B/',
+        ' S/',
+        '  P/',
+        '   pe',
+        '  Q/',
+        '   qu',
+        '   qz',
+        '  be',
+        ' fe',
+        'C/',
+        ' R/',
+        'D/',
+        ' de',
+        'me',
+    ]
+);
+
+is_output($svk, 'cat', ['//trunk/A/Q/qu'],
+    [
+        'first line in qu',
+        '2nd line in qu',
+    ]
+);
+
+is_output($svk, 'ann', ['//trunk/A/Q/qu'],
+    [
+        'Annotations for /trunk/A/Q/qu (1 active revisions):',
+        '****************',
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\tfirst line in qu},
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\t2nd line in qu},
+    ]
+);
+
+is_output($svk, 'ls', ['-R', '-r', '3', '//trunk/A'],
+    [
+        'Q/',
+        ' qu',
+        ' qz',
+        'be',
+    ]
+);
+
+is_output($svk, 'cat', ['-r', '3', '//trunk/A/Q/qu'],
+    [
+        'first line in qu',
+        '2nd line in qu',
+    ]
+);
+
+is_output($svk, 'ann', ['-r', '3', '//trunk/A/Q/qu'],
+    [
+        'Annotations for /trunk/A/Q/qu (1 active revisions):',
+        '****************',
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\tfirst line in qu},
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\t2nd line in qu},
+    ]
+);
+
+is_output($svk, 'rm', ['-m', 'remove //trunk/A', '//trunk/A'],
+    [
+        'Committed revision 4.',
+    ]
+);
+
+is_output($svk, 'cp', ['-m', 'copy //local from //trunk', '//trunk', '//local'],
+    [
+        'Committed revision 5.',
+    ]
+);
+
+is_output($svk, 'ls', ['//local/'],
+    [
+        'B/',
+        'C/',
+        'D/',
+        'me',
+    ]
+);
+is_output($svk, 'ls', ['-R', '//local/'],
+    [
+        'B/',
+        ' S/',
+        '  P/',
+        '   pe',
+        '  Q/',
+        '   qu',
+        '   qz',
+        '  be',
+        ' fe',
+        'C/',
+        ' R/',
+        'D/',
+        ' de',
+        'me',
+    ]
+);
+
+is_output($svk, 'ls', ['-r', '3', '//local/'],
+    [
+        'A/',
+        'B/',
+        'C/',
+        'D/',
+        'me',
+    ]
+);
+
+is_output($svk, 'ls', ['-r', '3', '//local/A'],
+    [
+        'Q/',
+        'be',
+    ]
+);
+
+is_output($svk, 'ls', ['-R', '-r', '3', '//local/'],
+    [
+        'A/',
+        ' Q/',
+        '  qu',
+        '  qz',
+        ' be',
+        'B/',
+        ' S/',
+        '  P/',
+        '   pe',
+        '  Q/',
+        '   qu',
+        '   qz',
+        '  be',
+        ' fe',
+        'C/',
+        ' R/',
+        'D/',
+        ' de',
+        'me',
+    ]
+);
+
+is_output($svk, 'ls', ['-R', '-r', '3', '//local/A'],
+    [
+        'Q/',
+        ' qu',
+        ' qz',
+        'be',
+    ]
+);
+
+is_output($svk, 'cat', ['-r', '3', '//local/A/Q/qu'],
+    [
+        'first line in qu',
+        '2nd line in qu',
+    ]
+);
+
+is_output($svk, 'ann', ['-r', '3', '//local/A/Q/qu'],
+    [
+        'Annotations for /trunk/A/Q/qu (1 active revisions):',
+        '****************',
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\tfirst line in qu},
+        qr{     2\t\(     \w+ \d{4}-\d{2}-\d{2}\):\t\t2nd line in qu},
+    ]
+);
+


More information about the svk-commit mailing list