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

nobody at bestpractical.com nobody at bestpractical.com
Wed Oct 31 05:19:10 EDT 2007


Author: clsung
Date: Wed Oct 31 05:19:07 2007
New Revision: 2578

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

Log:
- implement --merge (not including -C) 
  - but fails the last test

Modified: branches/bm/lib/SVK/Command/Branch.pm
==============================================================================
--- branches/bm/lib/SVK/Command/Branch.pm	(original)
+++ branches/bm/lib/SVK/Command/Branch.pm	Wed Oct 31 05:19:07 2007
@@ -214,7 +214,7 @@
 }
 
 package SVK::Command::Branch::merge;
-use base qw( SVK::Command::Merge SVK::Command::Switch SVK::Command::Branch);
+use base qw( SVK::Command::Smerge SVK::Command::Switch SVK::Command::Branch);
 use SVK::I18N;
 use SVK::Util qw( is_uri traverse_history );
 
@@ -257,21 +257,6 @@
 	$src = $self->arg_depotpath($src_branch_path);
 	# extract the fromrev and torev from src
 
-	my ($m) = $src->is_mirrored;
-	my $N = $src->root->node_created_rev( $src->path );
-
-	my $M = $m->fromrev;
-	traverse_history (
-	    root        => $src->root,
-	    path        => $src->path,
-	    cross       => 0,
-	    callback    => sub {
-		my $rev = $_[1];
-		$M = $rev if $rev < $M;
-	    },
-	);
-
-	$self->{revspec} = ["$N:$M"];
 	$self->{message} ||= "- Merge $src_branch_path to $dst_branch_path";
 	my $ret = $self->SUPER::run($src, $dst);
     }

Modified: branches/bm/t/bm/merge.t
==============================================================================
--- branches/bm/t/bm/merge.t	(original)
+++ branches/bm/t/bm/merge.t	Wed Oct 31 05:19:07 2007
@@ -28,11 +28,20 @@
 $svk->propset ('someprop', 'propvalue', 'A/be');
 $svk->diff();
 $svk->commit ('-m', 'commit message here (r8)','');
-is_output ($svk, 'merge',
-    ['-C', '-rHEAD:7', '//mirror/MyProject/branches/feature/foo', '//mirror/MyProject/trunk'], 
-    [ "Checking locally against mirror source $uri.", 'gg  A/be']);
+
+my $branch_foo = '/mirror/MyProject/branches/feature/foo';
+my $branch_bar = '/mirror/MyProject/branches/feature/bar';
+my $trunk = '/mirror/MyProject/trunk';
+
+is_output ($svk, 'smerge',
+    ['-C', '//mirror/MyProject/branches/feature/foo', '//mirror/MyProject/trunk'], 
+    ["Auto-merging (0, 8) $branch_foo to $trunk (base $trunk:6).",
+     "Checking locally against mirror source $uri.", 'UU  A/be',
+     qr'New merge ticket: [\w\d-]+:/branches/feature/foo:7']);
 is_output ($svk, 'branch', ['--merge', '-C', 'feature/foo', 'trunk'], 
-    [ "Checking locally against mirror source $uri.", 'gg  A/be']);
+    ["Auto-merging (0, 8) $branch_foo to $trunk (base $trunk:6).",
+     "Checking locally against mirror source $uri.", 'UU  A/be',
+     qr'New merge ticket: [\w\d-]+:/branches/feature/foo:7']);
 
 # another branch
 is_output_like ($svk, 'branch', ['--create', 'feature/bar','--switch-to'], qr'Project branch created: feature/bar');
@@ -40,18 +49,30 @@
 $svk->diff();
 $svk->commit ('-m', 'commit message here (r10)','');
 is_output ($svk, 'branch', ['--merge', '-C', 'feature/bar', 'trunk'], 
-    [ "Checking locally against mirror source $uri.", 'g   A/Q/qu']);
+    ["Auto-merging (0, 10) $branch_bar to $trunk (base $trunk:6).",
+     "Checking locally against mirror source $uri.", 'U   A/Q/qu',
+     qr'New merge ticket: [\w\d-]+:/branches/feature/bar:9']);
 
 is_output ($svk, 'branch', ['--merge', '-C', 'feature/foo', 'trunk'], 
-    [ "Checking locally against mirror source $uri.", 'gg  A/be']);
+    ["Auto-merging (0, 8) $branch_foo to $trunk (base $trunk:6).",
+     "Checking locally against mirror source $uri.", 'UU  A/be',
+     qr'New merge ticket: [\w\d-]+:/branches/feature/foo:7']);
 
 is_output ($svk, 'branch', ['--merge', '-C', 'feature/bar', 'feature/foo', 'trunk'], 
-    [ "Checking locally against mirror source $uri.", 'g   A/Q/qu',
-      "Checking locally against mirror source $uri.", 'gg  A/be']);
+    ["Auto-merging (0, 10) $branch_bar to $trunk (base $trunk:6).",
+     "Checking locally against mirror source $uri.", 'U   A/Q/qu',
+     qr'New merge ticket: [\w\d-]+:/branches/feature/bar:9',
+     "Auto-merging (0, 8) $branch_foo to $trunk (base $trunk:6).",
+     "Checking locally against mirror source $uri.", 'UU  A/be',
+     qr'New merge ticket: [\w\d-]+:/branches/feature/foo:7']);
 
 is_output_like ($svk, 'branch', ['--merge', 'feature/bar', 'feature/foo', 'trunk'], 
-    qr/Committed revision 13 from revision 11./);
+    qr/Committed revision 12 from revision 11./);
 
 $svk->switch ('//mirror/MyProject/trunk');
-is_file_content ('A/Q/qu', "\nonly a bar\nzz\n");
-is_file_content ('A/be', "\nsome more foobar\nzz\n");
+is_file_content ('A/Q/qu', "\nonly a bar\nzz\n", 'is the file actually merge?');
+is_file_content ('A/be', "\nsome more foobar\nzz\n", 'is the file actually merge?');
+is_output_like ($svk, 'info', [],
+    qr/Merged From: $branch_foo, Rev. 8/);
+is_output_like ($svk, 'info', [],
+    qr/Merged From: $branch_bar, Rev. 10/);


More information about the svk-commit mailing list