[svk-commit] r2610 - branches/bm/lib/SVK/Command
nobody at bestpractical.com
nobody at bestpractical.com
Sun Nov 18 20:28:56 EST 2007
Author: clsung
Date: Sun Nov 18 20:28:55 2007
New Revision: 2610
Modified:
branches/bm/lib/SVK/Command/Branch.pm
Log:
- use load_project() to load project,
- sub load_project() {} to take care the procedure of loading specified project
Modified: branches/bm/lib/SVK/Command/Branch.pm
==============================================================================
--- branches/bm/lib/SVK/Command/Branch.pm (original)
+++ branches/bm/lib/SVK/Command/Branch.pm Sun Nov 18 20:28:55 2007
@@ -95,11 +95,7 @@
return;
}
-package SVK::Command::Branch::list;
-use base qw(SVK::Command::Branch);
-use SVK::I18N;
-
-sub run {
+sub load_project {
my ($self, $target) = @_;
my $proj = SVK::Project->load($target) if $target->isa('SVK::Path');
@@ -109,6 +105,18 @@
$target->path
) unless $proj;
+ return $proj;
+}
+
+package SVK::Command::Branch::list;
+use base qw(SVK::Command::Branch);
+use SVK::I18N;
+
+sub run {
+ my ($self, $target) = @_;
+
+ my $proj = $self->load_project($target);
+
if (!$proj) {
print loc("No project branch founded.\n");
return;
@@ -146,12 +154,7 @@
sub run {
my ($self, $target, $branch_path) = @_;
- my $proj = SVK::Project->load($target) if $target->isa('SVK::Path');
- my $source = $target->source;
- $proj = SVK::Project->create_from_path(
- $source->depot,
- $source->path
- ) unless $proj;
+ my $proj = $self->load_project($target);
my $trunk_path = '/'.$proj->depot->depotname.'/'.$proj->trunk;
my $newbranch_path = '/'.$proj->depot->depotname.'/'.
@@ -206,12 +209,7 @@
sub run {
my ($self, $target, $dst, $src) = @_;
- my $proj = SVK::Project->load($target) if $target->isa('SVK::Path');
- my $source = $target->source;
- $proj = SVK::Project->create_from_path(
- $source->depot,
- $source->path
- ) unless $proj;
+ my $proj = $self->load_project($target);
my $branch_path = '/'.$proj->depot->depotname.'/'.$proj->branch_location;
my $src_branch_path = $branch_path.'/'.$src.'/';
@@ -277,12 +275,7 @@
sub run {
my ($self, $target, $dst_path) = @_;
- my $proj = SVK::Project->load($target) if $target->isa('SVK::Path');
- my $source = $target->source;
- $proj = SVK::Project->create_from_path(
- $source->depot,
- $source->path
- ) unless $proj;
+ my $proj = $self->load_project($target);
my $target_path = '/'.$proj->depot->depotname.'/'.
($self->{local} ?
@@ -335,12 +328,7 @@
sub run {
my ($self, $target, $dst, @srcs) = @_;
- my $proj = SVK::Project->load($target) if $target->isa('SVK::Path');
- my $source = $target->source;
- $proj = SVK::Project->create_from_path(
- $source->depot,
- $source->path
- ) unless $proj;
+ my $proj = $self->load_project($target);
@srcs = map { $self->expand_branch($proj, $_) } @srcs;
@@ -397,12 +385,7 @@
sub run {
my ($self, $target, $new_path) = @_;
- my $proj = SVK::Project->load($target) if $target->isa('SVK::Path');
- my $source = $target->source;
- $proj = SVK::Project->create_from_path(
- $source->depot,
- $source->path
- ) unless $proj;
+ my $proj = $self->load_project($target);
my $newtarget_path = '/'.$proj->depot->depotname.'/'.
($self->{local} ?
More information about the svk-commit
mailing list