[svk-commit] r2350 - in trunk: t

nobody at bestpractical.com nobody at bestpractical.com
Wed Mar 21 11:48:08 EDT 2007


Author: stig
Date: Wed Mar 21 11:48:06 2007
New Revision: 2350

Added:
   trunk/t/07smerge-rename3.t
Modified:
   trunk/lib/SVK/Command/Smerge.pm

Log:
Smerge tracks renames _only the first time_. For subsequent smerges changes to
the original is original. Hopefully somebody can sprinkle some magic pixie dust
over the code and make it pass without the TODO mark.

Modified: trunk/lib/SVK/Command/Smerge.pm
==============================================================================
--- trunk/lib/SVK/Command/Smerge.pm	(original)
+++ trunk/lib/SVK/Command/Smerge.pm	Wed Mar 21 11:48:06 2007
@@ -58,7 +58,7 @@
 
 sub options {
     ($_[0]->SUPER::options,
-     'B|baseless'	=> 'baseless',
+     'B|baseless'       => 'baseless',
      'b|base=s'         => 'merge_base',
      'baserev=i'        => 'rev',
     );

Added: trunk/t/07smerge-rename3.t
==============================================================================
--- (empty file)
+++ trunk/t/07smerge-rename3.t	Wed Mar 21 11:48:06 2007
@@ -0,0 +1,81 @@
+#!/usr/bin/perl -w
+
+#
+# Tests that smerge handles updates after renames have been made
+#
+
+use Test::More tests => 4;
+use strict;
+use File::Path;
+use Cwd;
+use SVK::Test;
+
+my ($xd, $svk) = build_test();
+our $output;
+my ($co_trunk_rpath, $co_trunk_path) = get_copath ('smerge-rename3-trunk');
+my ($co_branch_rpath, $co_branch_path) = get_copath ('smerge-rename3-branch');
+my ($repospath, undef, $repos) = $xd->find_repos ('//', 1);
+my $uuid = $repos->fs->get_uuid;
+
+# Setup the trunk
+$svk->mkdir ('-m', 'trunk', '//trunk');
+$svk->checkout ('//trunk', $co_trunk_path);
+
+# Create some data in trunk
+chdir($co_trunk_path);
+$svk->mkdir('module');
+overwrite_file('module/test.txt', '1');
+$svk->add('module/test.txt');
+$svk->ci(-m => "test 1");
+
+# Make a copy
+$svk->mkdir ('-m', 'trunk', '//branches');
+$svk->cp(-m => 'newbranch', '//trunk', '//branches/newbranch');
+$svk->checkout ('//branches/newbranch', $co_branch_path);
+is_file_content("$co_branch_path/module/test.txt", '1');
+
+# Rename the module in the branch
+chdir($co_branch_path);
+$svk->move('module', 'module2');
+$svk->commit(-m => "renamed");
+
+# Make a change to trunk
+chdir($co_trunk_path);
+overwrite_file('module/test.txt', '2');
+$svk->ci(-m => "test 2");
+
+# Merge changes w/rename from trunk to branch
+$svk->smerge('//trunk', '//branches/newbranch', '--track-rename', '-m', 'merge 1');
+warn $output;
+
+# Update the branch
+chdir($co_branch_path);
+$svk->update();
+is_file_content('module2/test.txt', '2');
+
+# Make another change to trunk
+chdir($co_trunk_path);
+overwrite_file('module/test.txt', '3');
+$svk->ci(-m => "test 3");
+
+# Merge changes w/rename from trunk to branch
+$svk->smerge('//trunk', '//branches/newbranch', '--track-rename', '-m', 'merge 2');
+
+# Update the branch
+chdir($co_branch_path);
+$svk->update();
+{ local $TODO = 'should merge in a second time too';
+is_file_content('module2/test.txt', '3');
+}
+
+overwrite_file('module2/test.txt', '4');
+$svk->ci(-m => "test 4");
+
+# Merge changes w/rename from trunk to branch
+$svk->smerge('//branches/newbranch', '//trunk', '--track-rename', '-m', 'merge back');
+
+chdir($co_trunk_path);
+$svk->update();
+{ local $TODO = 'should merge things back too';
+is_file_content('module/test.txt', '4');
+}


More information about the svk-commit mailing list