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

nobody at bestpractical.com nobody at bestpractical.com
Sun May 11 02:07:28 EDT 2008


Author: clsung
Date: Sun May 11 02:07:28 2008
New Revision: 2859

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

Log:
- implement br --info
  - ref: http://task.hm/EDUY

Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm	(original)
+++ trunk/lib/SVK/Command/Branch.pm	Sun May 11 02:07:28 2008
@@ -61,7 +61,7 @@
 our $fromProp;
 use constant narg => undef;
 
-my @SUBCOMMANDS = qw(merge move push remove|rm|del|delete checkout|co create diff setup online offline);
+my @SUBCOMMANDS = qw(merge move push remove|rm|del|delete checkout|co create diff info setup online offline);
 
 sub options {
     ('l|list'           => 'list',
@@ -626,6 +626,35 @@
     return ($target, $dst);
 }
 
+package SVK::Command::Branch::info;
+use base qw( SVK::Command::Info SVK::Command::Branch );
+use SVK::I18N;
+use SVK::Logger;
+
+sub parse_arg {
+    my ($self, @arg) = @_;
+    @arg = ('') if $#arg < 0;
+
+    my ($target, $proj, $dst);
+    my $project_name = $self->{project};
+    eval { # always try to eval current wc
+	$target = $self->arg_co_maybe($arg[0]);
+    };
+    if ($@) { # then it means we must have a project
+	$target = $self->arg_depotpath('//'); # XXX: what if /abc/mirror/ ?
+	$proj = SVK::Project->create_from_prop($target, $project_name);
+    } else {
+	$proj = $self->load_project($target, $self->{project});
+    }
+    if (!$proj) {
+	$logger->info( loc("Project not found."));
+	return ;
+    }
+
+    undef $self->{recursive};
+    return map {$self->arg_co_maybe ($proj->branch_path($_))} @arg;
+}
+
 package SVK::Command::Branch::setup;
 use base qw( SVK::Command::Propset SVK::Command::Branch );
 use SVK::I18N;


More information about the svk-commit mailing list