[svk-commit] r2199 - in branches/2.0-releng: . t/diff

clkao at bestpractical.com clkao at bestpractical.com
Fri Nov 24 12:25:03 EST 2006


Author: clkao
Date: Fri Nov 24 12:25:02 2006
New Revision: 2199

Added:
   branches/2.0-releng/t/diff/
   branches/2.0-releng/t/diff/mixed-checkout.t
Modified:
   branches/2.0-releng/MANIFEST
   branches/2.0-releng/lib/SVK/Command/Diff.pm

Log:
Fix a diff regression on mixed revision checkout.


Modified: branches/2.0-releng/MANIFEST
==============================================================================
--- branches/2.0-releng/MANIFEST	(original)
+++ branches/2.0-releng/MANIFEST	Fri Nov 24 12:25:02 2006
@@ -270,6 +270,7 @@
 t/api/mirror.t
 t/copy-escape.t
 t/copy-replace.t
+t/diff/mixed-checkout.t
 t/mirror/dav-authz.t
 t/mirror/relocate.t
 t/mirror/sync-crazy-replace.t

Modified: branches/2.0-releng/lib/SVK/Command/Diff.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Command/Diff.pm	(original)
+++ branches/2.0-releng/lib/SVK/Command/Diff.pm	Fri Nov 24 12:25:02 2006
@@ -81,7 +81,7 @@
     my $yrev = $fs->youngest_rev;
     my ($cb_llabel, $report);
     my ($r1, $r2) = $self->resolve_revspec($target,$target2);
-
+    my $oldroot;
     # translate to target and target2
     if ($target2) {
 	if ($target->isa('SVK::Path::Checkout')) {
@@ -106,6 +106,8 @@
 	    $target = $target->as_depotpath;
 	    $target = $target->seek_to($r1) if $r1;
 	    $target2 = $target->as_depotpath->seek_to($r2) if $r2;
+	    # if no revision is specified, use the xdroot as target1's root
+	    $oldroot = $target2->create_xd_root unless $r1 || $r2;
 	    $cb_llabel =
 		sub { my ($rpath) = @_;
 		      'revision '.($self->{xd}{checkout}->get ($target2->copath ($rpath))->{revision}) } unless $r1;
@@ -135,7 +137,7 @@
 	  base_target => $target, base_root => $target->root,
 	);
 
-    my $oldroot = $target->root;
+    $oldroot ||= $target->root;
     my $kind = $oldroot->check_path($target->path_anchor);
     if ($target2->isa('SVK::Path::Checkout')) {
 	if ($kind != $SVN::Node::dir) {

Added: branches/2.0-releng/t/diff/mixed-checkout.t
==============================================================================
--- (empty file)
+++ branches/2.0-releng/t/diff/mixed-checkout.t	Fri Nov 24 12:25:02 2006
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+use Test::More tests => 2;
+use strict;
+use SVK::Test;
+our $output;
+my ($xd, $svk) = build_test();
+my ($copath, $corpath) = get_copath ('diff');
+my ($repospath, undef, $repos) = $xd->find_repos ('//', 1);
+$svk->checkout ('//', $copath);
+chdir ($copath);
+mkdir ('A');
+overwrite_file ("A/foo", "foobar\nfnord\n");
+overwrite_file ("A/bar", "foobar\n");
+overwrite_file ("A/nor", "foobar\n");
+$svk->add ('A');
+$svk->commit ('-m', 'init');
+
+append_file ("A/bar", "foobar\n");
+$svk->commit ('-m', 'change bar');
+$svk->up(-r1 => 'A/bar');
+is_output($svk, 'st', [], []);
+is_output($svk, 'diff', [], []);
+


More information about the svk-commit mailing list