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

nobody at bestpractical.com nobody at bestpractical.com
Thu May 8 01:35:22 EDT 2008


Author: clsung
Date: Thu May  8 01:35:22 2008
New Revision: 2831

Modified:
   trunk/lib/SVK/Command/Branch.pm
   trunk/t/bm/online-offline.t

Log:
- br --online exit with message when the branch is online-ed

Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm	(original)
+++ trunk/lib/SVK/Command/Branch.pm	Thu May  8 01:35:22 2008
@@ -690,12 +690,16 @@
 sub parse_arg {
     my ($self, $arg) = @_;
     my $target = $self->arg_co_maybe($arg || '');
-    # XXX: make sure we are a local branch
     $self->{switch} = 1 if $target->isa('SVK::Path::Checkout');
     # XXX: if the remote branch of the same name already exists, do a
     # smerge instead
     $self->{branch_name} = $target->_to_pclass($target->path)->dir_list(-1);
 
+    # XXX: should we verbose the branch_name here?
+#    die loc ("Current branch '%1' already online\n", $self->{branch_name})
+    die loc ("Current branch already online\n")
+	if (!$target->_to_pclass("/local")->subsumes($target->path));
+
     return ($target, $self->{branch_name}, $target->depotpath);
 }
 

Modified: trunk/t/bm/online-offline.t
==============================================================================
--- trunk/t/bm/online-offline.t	(original)
+++ trunk/t/bm/online-offline.t	Thu May  8 01:35:22 2008
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 use SVK::Test;
-plan tests => 5;
+plan tests => 9;
 our $output;
 
 my ($xd, $svk) = build_test('test');
@@ -45,7 +45,6 @@
 is_ancestor($svk, '//mirror/MyProject/branches/foo', '/mirror/MyProject/trunk', 6);
 
 
-exit;
 TODO: {
 # should online need an argument ?
 
@@ -58,6 +57,9 @@
 is_output_like ($svk, 'info', [],
    qr|Depot Path: //mirror/MyProject/branches/feature/foobar|);
 
+is_output ($svk, 'branch', ['--online'],
+    ["Current branch already online"]);
+
 # future should be is_output_like
 $svk->br('--offline'); # offline the feature/foobar branch
 


More information about the svk-commit mailing list