[svk-devel] smerge/pull with renames

Jason Dillon jason at planet57.com
Tue Mar 20 20:52:05 EDT 2007

This isn't really complete... but it might be close:

#!/usr/bin/perl -w

# Tests that smerge handles updates after renames have been made

use Test::More tests => 1;
use strict;
use File::Path;
use Cwd;
use SVK::Test;

my ($xd, $svk) = build_test();
our $output;
my ($co_trunk_path, $co_trunk_rpath) = get_copath ('smerge-rename3- 
my ($co_branch_path, $co_branch_rpath) = get_copath ('smerge-rename3- 
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
overwrite_file('module/test.txt', '1');
$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);

# TODO: Verify that newbranch/module/test.txt == '1'

# Rename the module in the branch
$svk->move('module', 'module2');
$svk->commit(-m => "renamed");

# Make a change to trunk
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')

# Update the branch

# TODO: Verify that newbranch/module2/text == '2'

# Make another change to trunk
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')

# Update the branch

# TODO: Verify that newbranch/module2/text == '3'

I've no idea how to hook up text validation of content to the  
framework, so I just put in a TODO that states what it should do.

The problem is for all changes to trunk/* which are made after the  
first smerge --track-rename.  The first smerge --track-rename appears  
to do the right thing after svk up in the branch, but when new  
changes are made to the trunk, no combination of smerge (w/and w/o -- 
track-rename) or svk pull, or svk up will get the new changes from  
trunk into the correct files in the branch.  They always end up in  
the skip list.

  * * *

BTW... why is --track-rename optional?  IMO this should always be  
on... I can't think of a reason why I would want to smerge from one  
tree to another, when the target has renamed files or directories  
when I would want to not have it merge the contents of the source  
files into the new locations of the target files.

Please have a look, let me know if this .t is helpful... if you need  
more input I can provide that... as I really want/need to get this  
functionality working so I can start on the huge reorganization of  
the Geronimo server/trunk tree (with out impacting other developers  
while its going on).

If you can help me figure out how to run this .t too and provide some  
hints on how to replace the TODO comments with code then I can work  
on updating this testcase too.

Thanks a ton... I know you are busy, but I hope you can find some  
free cycles to help me out.



On Mar 20, 2007, at 2:48 AM, Chia-Liang Kao wrote:

> Hi Jason,
> On 20/03/07, Jason Dillon <jason at planet57.com> wrote:
>> FYI, I did get --track-rename to work *once*... but all changes  
>> made to the
>> file after I renamed its parent directory in my branch have never  
>> made it.
> Sorry I haven't had much time for this lately.  If you can create a .t
> file which contains how to reproduce the problem and the expected
> behaviour, it'd help a lot.  see any other .t file from the
> distribution as example.  Meanwhile, there was a recent fix about copy
> tracking at r2323.  See if that fixes your problem.
> Cheers,
> _______________________________________________
> svk-devel mailing list
> svk-devel at bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/svk-devel

More information about the svk-devel mailing list