[svk-commit] r2637 - in branches/bm: t/bm

nobody at bestpractical.com nobody at bestpractical.com
Sun Dec 16 02:19:23 EST 2007


Author: clsung
Date: Sun Dec 16 02:19:23 2007
New Revision: 2637

Modified:
   branches/bm/lib/SVK/Command/Branch.pm
   branches/bm/t/bm/merge.t

Log:
- branch --merge foo . should try to merge to copath, not ->source of .
- add 3 tests merge.t
  ==> merge from one branch to another branch

Modified: branches/bm/lib/SVK/Command/Branch.pm
==============================================================================
--- branches/bm/lib/SVK/Command/Branch.pm	(original)
+++ branches/bm/lib/SVK/Command/Branch.pm	Sun Dec 16 02:19:23 2007
@@ -320,7 +320,7 @@
 package SVK::Command::Branch::merge;
 use base qw( SVK::Command::Smerge SVK::Command::Branch);
 use SVK::I18N;
-use SVK::Util qw( is_uri );
+use SVK::Util qw( is_uri abs_path );
 
 use constant narg => 1;
 
@@ -356,10 +356,13 @@
 
     # try to get checkout from copath (if dst is specified PATH)
     # if failed (SVN::Node::none), get from depotpath
-    $dst = $self->arg_copath($dst);
-    $dst = $dst->source;
-    $dst = $self->arg_depotpath($dst_branch_path)
-        if $SVN::Node::none == $dst->root->check_path($dst->path);
+    if (-e $dst) {
+	my $copath = abs_path($dst);
+	my ($entry, @where) = $self->{xd}{checkout}->get($copath, 1);
+	$dst = $self->arg_depotpath($entry->{depotpath});
+    } else {
+	$dst = $self->arg_depotpath($dst_branch_path)
+    }
 
     # see also check_only in incmrental smerge.  this should be a
     # better api in svk::path

Modified: branches/bm/t/bm/merge.t
==============================================================================
--- branches/bm/t/bm/merge.t	(original)
+++ branches/bm/t/bm/merge.t	Sun Dec 16 02:19:23 2007
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use Test::More tests => 17;
+use Test::More tests => 20;
 use SVK::Test;
 use File::Path;
 
@@ -135,3 +135,28 @@
      'Merge back committed as revision 20.', "Syncing $uri",
      'Retrieving log information from 20 to 20',
      'Committed revision 21 from revision 20.']);
+
+$svk->branch ('--create', 'merge/foo2', '--switch-to');
+append_file ('B/S/Q/qu', "\nappend CBA on foo2\n");
+$svk->commit ('-m', 'commit message here (r20)','');
+$svk->branch ('--switch', 'merge/foo');
+$branch_foo = '/mirror/MyProject/branches/merge/foo';
+my $branch_foo2 = '/mirror/MyProject/branches/merge/foo2';
+is_output ($svk, 'branch', ['--merge', '-C', 'merge/foo2', 'merge/foo'],
+    ["Auto-merging (0, 23) $branch_foo2 to $branch_foo (base $branch_foo:20).",
+     "Checking locally against mirror source $uri.", 'U   B/S/Q/qu',
+     qr'New merge ticket: [\w\d-]+:/branches/merge/foo2:22',
+     qr'New merge ticket: [\w\d-]+:/trunk:20']);
+is_output ($svk, 'branch', ['--merge', '-C', 'merge/foo2', '.'], 
+    ["Auto-merging (0, 23) $branch_foo2 to $branch_foo (base $branch_foo:20).",
+     "Checking locally against mirror source $uri.", 'U   B/S/Q/qu',
+     qr'New merge ticket: [\w\d-]+:/branches/merge/foo2:22',
+     qr'New merge ticket: [\w\d-]+:/trunk:20']);
+is_output ($svk, 'branch', ['--merge', 'merge/foo2', '.'], 
+    ["Auto-merging (0, 23) $branch_foo2 to $branch_foo (base $branch_foo:20).",
+     "Merging back to mirror source $uri.", 'U   B/S/Q/qu',
+     qr'New merge ticket: [\w\d-]+:/branches/merge/foo2:22',
+     qr'New merge ticket: [\w\d-]+:/trunk:20',
+     'Merge back committed as revision 23.', "Syncing $uri",
+     'Retrieving log information from 23 to 23',
+     'Committed revision 24 from revision 23.']);


More information about the svk-commit mailing list