[svk-commit] r2722 - in trunk: t/bm

nobody at bestpractical.com nobody at bestpractical.com
Tue Apr 1 03:16:14 EDT 2008


Author: clsung
Date: Tue Apr  1 03:16:13 2008
New Revision: 2722

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

Log:
- implements br --push --from <branch_name>
- pass the test
- need to add tests for verifying if --from <tag_name> also work

Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm	(original)
+++ trunk/lib/SVK/Command/Branch.pm	Tue Apr  1 03:16:13 2008
@@ -419,6 +419,28 @@
 use base qw( SVK::Command::Push SVK::Command::Branch);
 use SVK::I18N;
 
+sub parse_arg {
+    my ($self, @arg) = @_;
+
+    if ($self->{from}) {
+	my $target = $self->arg_co_maybe ('');
+	$target = $target->source if $target->isa('SVK::Path::Checkout');
+	my $proj = $self->load_project($target);
+	my $depot_root = '/'.$proj->depot->depotname;
+	my $branch_path = $depot_root.'/'.$proj->branch_location;
+	my $from_path = $branch_path.'/'.$self->{from};
+	if ($SVN::Node::dir != $target->root->check_path($from_path)) {
+	    my $tag_path = $depot_root.'/'.$proj->tag_location;
+	    $from_path = $tag_path.'/'.$self->{from};
+	    die loc("No such branch/tag exists: %1\n", $self->{from})
+		if ($SVN::Node::dir != $target->root->check_path($from_path)) ;
+	}
+	$self->{from_path} = $from_path;
+    }
+
+    $self->SUPER::parse_arg (@arg);
+}
+
 package SVK::Command::Branch::switch;
 use base qw( SVK::Command::Switch SVK::Command::Branch );
 use SVK::I18N;

Modified: trunk/t/bm/merge.t
==============================================================================
--- trunk/t/bm/merge.t	(original)
+++ trunk/t/bm/merge.t	Tue Apr  1 03:16:13 2008
@@ -195,18 +195,14 @@
 append_file ('B/S/Q/qu', "\nappend CBA on foo3\n");
 $svk->commit ('-m', 'commit message here (r26)','');
 
+$svk->push('-C');
+my ($pushOutputs) = $output;
+
 $svk->branch ('--switch', 'trunk');
 is_output ($svk, 'branch', ['--merge', '-C', 'merge/foo3', '.'], 
     ["Auto-merging (0, 26) $branch_foo3 to $trunk (base $trunk:21).",
      "Checking locally against mirror source $uri.", 'U   B/S/Q/qu',
      qr'New merge ticket: [\w\d-]+:/branches/merge/foo3:25']);
-TODO: {
-local $TODO = 'in push, --from should specify branch(tag) name instead of depotpath';
+
 is_output ($svk, 'branch', ['--push', '-C', '--from', 'merge/foo3'],
-    ["Auto-merging (0, 26) $branch_foo3 to $trunk (base $trunk:21).",
-     "===> Auto-merging (0, 25) $branch_foo3 to $trunk (base $trunk:21).",
-     "Empty merge.",
-     "===> Auto-merging (25, 26) $branch_foo3 to $trunk (base $trunk:21).",
-     'U   B/S/Q/qu',
-     qr'New merge ticket: [\w\d-]+:/branches/merge/foo3:25']);
- }
+    [(split /\n/, $pushOutputs)]);


More information about the svk-commit mailing list