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

nobody at bestpractical.com nobody at bestpractical.com
Fri May 2 10:50:27 EDT 2008


Author: clsung
Date: Fri May  2 10:50:15 2008
New Revision: 2785

Added:
   trunk/t/bm/create-nocheckout.t
Modified:
   trunk/lib/SVK/Command/Branch.pm

Log:
- support svk br --create branch1 //mirror/projectX
- shoule we hint user to specify a project when he use
  % svk br --create branch1 
  without a checkout?
  currently it will die in XD.pm

Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm	(original)
+++ trunk/lib/SVK/Command/Branch.pm	Fri May  2 10:50:15 2008
@@ -85,11 +85,17 @@
     my ($self, @arg) = @_;
     @arg = ('') if $#arg < 0;
 
+#    if ($arg[0] eq 'push') {
+#	shift @arg;
+#	local *$self->run = sub SVK::Command::Smerge::run;
+#	return SVK::Command::Branch::push::parse_arg($self, at arg);
+#    }
     return map {$self->arg_co_maybe ($_)} @arg;
 }
 
 sub run {
     my ( $self, $target, @options ) = @_;
+#    return SVK::Command::Branch::push::run($self, at options) if $target eq 'push';
 
     my $proj = $self->load_project($target);
 
@@ -172,16 +178,18 @@
 
 sub parse_arg {
     my ($self, @arg) = @_;
-    return if $#arg < 0;
+    return if $#arg > 1;
 
-    my $dst = shift(@arg);
+    my $dst = shift (@arg);
     die loc ("Copy destination can't be URI.\n")
 	if is_uri ($dst);
 
-    die loc ("More than one URI found.\n")
-	if (grep {is_uri($_)} @arg) > 1;
+    @arg = ('') if $#arg < 0;
 
-    return ($self->arg_co_maybe (''), $dst);
+    die loc ("Copy source can't be URI.\n")
+	if is_uri ($arg[0]);
+
+    return ($self->arg_co_maybe ($arg[0]), $dst);
 }
 
 
@@ -607,10 +615,10 @@
 
 =head1 SYNOPSIS
 
- branch --create [BRANCH]
+ branch --create BRANCH [DEPOTPATH]
 
  branch --list [--all]
- branch --create BRANCH [--local] [--switch-to]
+ branch --create BRANCH [--local] [--switch-to] [DEPOTPATH]
  branch --move BRANCH1 BRANCH2
  branch --merge BRANCH1 BRANCH2 ... TARGET
  branch --delete BRANCH1

Added: trunk/t/bm/create-nocheckout.t
==============================================================================
--- (empty file)
+++ trunk/t/bm/create-nocheckout.t	Fri May  2 10:50:15 2008
@@ -0,0 +1,56 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More tests => 6;
+use SVK::Test;
+use File::Path;
+
+my ($xd, $svk) = build_test('test');
+our $output;
+$svk->mkdir(-m => 'trunk', '/test/trunk');
+$svk->mkdir(-m => 'trunk', '/test/branches');
+$svk->mkdir(-m => 'trunk', '/test/tags');
+my $tree = create_basic_tree($xd, '/test/trunk');
+
+my $depot = $xd->find_depot('test');
+my $uri = uri($depot->repospath);
+
+$svk->mirror('//mirror/MyProject', $uri);
+$svk->sync('//mirror/MyProject');
+
+my ($copath, $corpath) = get_copath ('MyProject');
+
+is_output ($svk, 'branch', ['--create', 'feature/foo'],
+    ['path /usr/home/clsung/svn/svk/trunk is not a checkout path.']);
+
+is_output_like ($svk, 'branch', ['--create', 'feature/foo', '//mirror/MyProject'],
+    qr'Project branch created: feature/foo');
+
+is_output ($svk, 'branch', ['--list', '//mirror/MyProject'],
+    ['feature/foo']);
+is_output ($svk, 'branch',
+    ['--create', 'feature/foobar', '--from', 'feature/foo', '//mirror/MyProject'],
+    ["Merging back to mirror source $uri.",
+     "Merge back committed as revision 7.",
+     "Syncing $uri",
+     'Retrieving log information from 7 to 7',
+     'Committed revision 8 from revision 7.',
+     "Project branch created: feature/foobar (from feature/foo)"]);
+
+is_output ($svk, 'info',['//mirror/MyProject/branches/feature/foobar'],
+    ["Depot Path: //mirror/MyProject/branches/feature/foobar",
+     "Revision: 8", "Last Changed Rev.: 8",
+     qr/Last Changed Date: \d{4}-\d{2}-\d{2}/,
+     "Mirrored From: $uri, Rev. 7",
+     "Copied From: /mirror/MyProject/branches/feature/foo, Rev. 7",
+     "Copied From: /mirror/MyProject/trunk, Rev. 6",
+     "Merged From: /mirror/MyProject/branches/feature/foo, Rev. 7",
+     "Merged From: /mirror/MyProject/trunk, Rev. 6",'']);
+
+is_output ($svk, 'branch',
+    ['--create', 'feature/footrunk', '--from', 'trunk', '//mirror/MyProject'],
+    ["Merging back to mirror source $uri.",
+     "Merge back committed as revision 8.",
+     "Syncing $uri",
+     'Retrieving log information from 8 to 8',
+     'Committed revision 9 from revision 8.',
+     "Project branch created: feature/footrunk"]);


More information about the svk-commit mailing list