[svk-commit] r2837 - trunk/lib/SVK/Command

nobody at bestpractical.com nobody at bestpractical.com
Thu May 8 10:30:23 EDT 2008


Author: clsung
Date: Thu May  8 10:30:21 2008
New Revision: 2837

Modified:
   trunk/lib/SVK/Command/Branch.pm

Log:
- for http://task.hm/ECMW
  - test case is required

Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm	(original)
+++ trunk/lib/SVK/Command/Branch.pm	Thu May  8 10:30:21 2008
@@ -717,6 +717,7 @@
 	my $dst = $self->arg_depotpath($self->{go_smerge});
 	
 	$self->{message} = "- Merged from local";
+	$self->{log} = 1;
 	$self->SVK::Command::Smerge::run($target->source, $dst);
 
 	$dst->refresh_revision;
@@ -750,14 +751,37 @@
 sub run {
     my ($self, $target, $branch_name) = @_;
 
+    die loc ("Current branch already offline\n")
+	if ($target->_to_pclass("/local")->subsumes($target->path));
+
+    my $proj = $self->load_project($target);
     if (!$branch_name) { # no branch_name means using current branch(trunk) as src
-	my $proj = $self->load_project($target);
 	$branch_name = $proj->branch_name($target->path);
 	$self->{from} = $branch_name;
     }
     $self->{local} = 1;
     $self->{switch} = 1;
-    $self->SUPER::run($target, $branch_name);
+
+    # check existence of local branch
+    my $local = $self->arg_depotpath(
+	$proj->branch_path($branch_name, $self->{local})
+    );
+    if ($SVN::Node::none != $local->root->check_path($local->path)  and
+	$target->related_to($local)) {
+
+	$self->{message} = "- Merged to local";
+	# XXX: Following copy from ::online, maybe need refactoring
+	$self->{log} = 1;
+	$self->SVK::Command::Smerge::run($target->source, $local);
+
+	$local->refresh_revision;
+
+	# XXX: we have a little conflict in private hash argname.
+	$self->{rev} = undef;
+	$self->SVK::Command::Switch::run($local, $target) if $target->isa('SVK::Path::Checkout');
+    } else {
+	$self->SUPER::run($target, $branch_name);
+    }
 }
 
 1;


More information about the svk-commit mailing list