[svk-commit] r2830 - in trunk: lib/SVK t/bm
nobody at bestpractical.com
nobody at bestpractical.com
Wed May 7 23:39:36 EDT 2008
Author: clsung
Date: Wed May 7 23:39:35 2008
New Revision: 2830
Modified:
trunk/lib/SVK/Command/Branch.pm
trunk/lib/SVK/Project.pm
trunk/t/bm/move.t
Log:
- when move src to dst, and src is the current checkout, also switch to dst
- fix bug of previous commit
Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm (original)
+++ trunk/lib/SVK/Command/Branch.pm Wed May 7 23:39:35 2008
@@ -263,9 +263,10 @@
}
package SVK::Command::Branch::move;
-use base qw( SVK::Command::Move SVK::Command::Copy SVK::Command::Smerge SVK::Command::Delete SVK::Command::Branch );
+use base qw( SVK::Command::Move SVK::Command::Smerge SVK::Command::Delete SVK::Command::Branch::create );
use SVK::I18N;
use SVK::Util qw( is_uri );
+use Path::Class;
sub lock { $_[0]->lock_coroot ($_[1]); };
@@ -292,7 +293,7 @@
my $proj = $self->load_project($target);
my $depot_root = '/'.$proj->depot->depotname;
- my $branch_path = $depot_root.'/'.$proj->branch_location;
+ my $branch_path = $depot_root.$proj->branch_location;
my $dst_branch_path = $dst_path;
$dst_branch_path = $branch_path.'/'.$dst_path.'/'
unless $dst_path =~ m#^$depot_root/#;
@@ -332,10 +333,17 @@
$self->SVK::Command::Smerge::run($src, $dst);
$self->{message} = "- Delete branch $src_branch_path, because it move to $dst_branch_path";
$self->SVK::Command::Delete::run($src, $target);
+ $dst->refresh_revision;
} else {
$self->{message} = "- Move branch $src_branch_path to $dst_branch_path";
my $ret = $self->SVK::Command::Move::run($src, $dst);
}
+ $self->{rev} = $dst->revision; # required by Command::Switch
+ $self->SVK::Command::Switch::run(
+ $self->arg_uri_maybe($dst_branch_path),
+ $target
+ ) if $target->_to_pclass($target->path) eq $target->_to_pclass($src_branch_path)
+ and !$self->{check_only};
}
return;
}
Modified: trunk/lib/SVK/Project.pm
==============================================================================
--- trunk/lib/SVK/Project.pm (original)
+++ trunk/lib/SVK/Project.pm Wed May 7 23:39:35 2008
@@ -233,8 +233,8 @@
if ($path_obj->_to_pclass("/local")->subsumes($current_path)) { # guess if in local branch
# should only be 1 entry
- $project_name = $path_obj->_to_pclass($current_path)->dir_list(2);
$current_path = ($path_obj->copy_ancestors)[0]->[0];
+ $path_obj = $path_obj->copied_from;
}
# Finding inverse layout first
Modified: trunk/t/bm/move.t
==============================================================================
--- trunk/t/bm/move.t (original)
+++ trunk/t/bm/move.t Wed May 7 23:39:35 2008
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 18;
+use Test::More tests => 17;
use SVK::Test;
use File::Path;
@@ -77,10 +77,8 @@
'Auto-merging (0, 12) /local/MyProject/localfoo to /mirror/MyProject/branches/feature/remotebar (base /mirror/MyProject/trunk:6).',
'===> Auto-merging (0, 12) /local/MyProject/localfoo to /mirror/MyProject/branches/feature/remotebar (base /mirror/MyProject/trunk:6).',
"Merging back to mirror source $uri.",'Empty merge.',
- "Committed revision 14."]);
-
-is_output ($svk, 'branch', ['--switch', 'feature/remotebar'],
- ["Syncing //local/MyProject/localfoo(/local/MyProject/localfoo) in ".
+ "Committed revision 14.",
+ "Syncing //local/MyProject/localfoo(/local/MyProject/localfoo) in ".
__($corpath)." to 14."]);
is_output ($svk, 'branch', ['--list'],
More information about the svk-commit
mailing list