[svk-commit] r2162 - in trunk: lib/SVK lib/SVK/Command t

clkao at bestpractical.com clkao at bestpractical.com
Fri Nov 17 23:15:56 EST 2006


Author: clkao
Date: Fri Nov 17 23:15:56 2006
New Revision: 2162

Added:
   trunk/t/07smerge-branch-renamed.t
Modified:
   trunk/MANIFEST
   trunk/lib/SVK/Command/Merge.pm
   trunk/lib/SVK/Util.pm

Log:
When doing incremental merge, really don't cross the copies,
even if they are renames.

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	(original)
+++ trunk/MANIFEST	Fri Nov 17 23:15:56 2006
@@ -191,6 +191,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

Modified: trunk/lib/SVK/Command/Merge.pm
==============================================================================
--- trunk/lib/SVK/Command/Merge.pm	(original)
+++ trunk/lib/SVK/Command/Merge.pm	Fri Nov 17 23:15:56 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: trunk/lib/SVK/Util.pm
==============================================================================
--- trunk/lib/SVK/Util.pm	(original)
+++ trunk/lib/SVK/Util.pm	Fri Nov 17 23:15:56 2006
@@ -36,7 +36,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
 
@@ -784,8 +784,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
 
@@ -811,7 +812,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);

Added: trunk/t/07smerge-branch-renamed.t
==============================================================================
--- (empty file)
+++ trunk/t/07smerge-branch-renamed.t	Fri Nov 17 23:15:56 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.']);


More information about the svk-commit mailing list