[svk-commit] r2938 - in trunk: lib/SVK t/bm
nobody at bestpractical.com
nobody at bestpractical.com
Sat Jun 28 07:28:55 EDT 2008
Author: clsung
Date: Sat Jun 28 07:28:53 2008
New Revision: 2938
Modified:
trunk/lib/SVK/Command/Branch.pm
trunk/lib/SVK/Project.pm
trunk/t/bm/create-nocheckout.t
trunk/t/bm/create.t
Log:
- implement --from-tag with its tests
- only for --create so far
- ref: http://task.hm/FFAZ
- add missing tag_name() in Project.pm (for dst_name in Branch.pm)
Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm (original)
+++ trunk/lib/SVK/Command/Branch.pm Sat Jun 28 07:28:53 2008
@@ -70,6 +70,7 @@
'all' => 'all',
'export' => 'export',
'from=s' => 'from',
+ 'from-tag=s' => 'fromtag',
'local' => 'local',
'project=s' => 'project',
'switch-to' => 'switch',
@@ -270,9 +271,18 @@
);
return;
}
+ if ($self->{from} and $self->{fromtag}) {
+ $logger->info(
+ loc("You can not specify both --from and --fromtag")
+ );
+ return;
+ }
delete $self->{from} if $self->{from} and $self->{from} eq 'trunk';
- my $src_path = $proj->branch_path($self->{from} ? $self->{from} : 'trunk');
+ delete $self->{fromtag} if $self->{fromtag} and $self->{fromtag} eq 'trunk';
+ my $src_path = $self->{fromtag} ?
+ $proj->tag_path($self->{fromtag}) :
+ $proj->branch_path($self->{from} ? $self->{from} : 'trunk');
my $newbranch_path = $self->dst_path($proj, $branch_name);
my $src = $self->arg_uri_maybe($src_path, 'New mirror site not allowed here');
@@ -292,7 +302,8 @@
$self->{tag} ? "tag" : "branch",
$branch_name,
$self->{local} ? ' (in local)' : '',
- $self->{from} ? " (from $self->{from})" : '',
+ $self->{fromtag} ? " (from tag $self->{fromtag})" :
+ $self->{from} ? " (from branch $self->{from})" : '',
)
);
# call SVK::Command::Switch here if --switch-to
@@ -951,7 +962,7 @@
branch --create BRANCH [DEPOTPATH]
branch --list [--all]
- branch --create BRANCH [--tag] [--local] [--switch-to] [DEPOTPATH]
+ branch --create BRANCH [--tag] [--local] [--switch-to] [--from|--from-tag BRANCH|TAG] [DEPOTPATH]
branch --move BRANCH1 BRANCH2
branch --merge BRANCH1 BRANCH2 ... TARGET
branch --checkout BRANCH [PATH] [DEPOTPATH]
Modified: trunk/lib/SVK/Project.pm
==============================================================================
--- trunk/lib/SVK/Project.pm (original)
+++ trunk/lib/SVK/Project.pm Sat Jun 28 07:28:53 2008
@@ -341,6 +341,14 @@
return $branch_path;
}
+sub tag_name {
+ my ($self, $bpath) = @_;
+ return 'trunk' if (dir($self->trunk)->subsumes($bpath));
+ my $tag_location = $self->tag_location;
+ $bpath =~ s{^\Q$tag_location\E/}{};
+ return $bpath;
+}
+
sub tag_path {
my ($self, $tname) = @_;
my $tag_path = ($tname ne 'trunk' ? $self->tag_location . "/$tname" : $self->trunk);
Modified: trunk/t/bm/create-nocheckout.t
==============================================================================
--- trunk/t/bm/create-nocheckout.t (original)
+++ trunk/t/bm/create-nocheckout.t Sat Jun 28 07:28:53 2008
@@ -36,7 +36,7 @@
"Syncing $uri",
'Retrieving log information from 7 to 7',
'Committed revision 8 from revision 7.',
- "Project branch created: feature/foobar (from feature/foo)"]);
+ "Project branch created: feature/foobar (from branch feature/foo)"]);
is_output ($svk, 'info',['//mirror/MyProject/branches/feature/foobar'],
["Depot Path: //mirror/MyProject/branches/feature/foobar",
Modified: trunk/t/bm/create.t
==============================================================================
--- trunk/t/bm/create.t (original)
+++ trunk/t/bm/create.t Sat Jun 28 07:28:53 2008
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 7;
+use Test::More tests => 10;
use SVK::Test;
use File::Path;
@@ -50,7 +50,7 @@
"Syncing $uri",
'Retrieving log information from 9 to 9',
'Committed revision 12 from revision 9.',
- "Project branch created: feature/foobar (from feature/bar)"]);
+ "Project branch created: feature/foobar (from branch feature/bar)"]);
is_output ($svk, 'info',['//mirror/MyProject/branches/feature/foobar'],
["Depot Path: //mirror/MyProject/branches/feature/foobar",
@@ -70,3 +70,34 @@
'Retrieving log information from 10 to 10',
'Committed revision 13 from revision 10.',
"Project branch created: feature/footrunk"]);
+
+is_output ($svk, 'branch',
+ ['--create', 'release-1', '--tag', '--from', 'feature/bar'],
+ ["Merging back to mirror source $uri.",
+ "Merge back committed as revision 11.",
+ "Syncing $uri",
+ 'Retrieving log information from 11 to 11',
+ 'Committed revision 14 from revision 11.',
+ "Project tag created: release-1 (from branch feature/bar)"]);
+
+is_output ($svk, 'branch',
+ ['--create', 'bug-in-release-1', '--from-tag', 'release-1'],
+ ["Merging back to mirror source $uri.",
+ "Merge back committed as revision 12.",
+ "Syncing $uri",
+ 'Retrieving log information from 12 to 12',
+ 'Committed revision 15 from revision 12.',
+ "Project branch created: bug-in-release-1 (from tag release-1)"]);
+
+#$svk->br("--info", "bug-in-release-10"
+is_output ($svk, 'info',['//mirror/MyProject/branches/bug-in-release-1'],
+ ["Depot Path: //mirror/MyProject/branches/bug-in-release-1",
+ "Revision: 15", "Last Changed Rev.: 15",
+ qr/Last Changed Date: \d{4}-\d{2}-\d{2}/,
+ "Mirrored From: $uri, Rev. 12",
+ "Copied From: /mirror/MyProject/tags/release-1, Rev. 14",
+ "Copied From: /mirror/MyProject/branches/feature/bar, Rev. 9",
+ "Copied From: /mirror/MyProject/trunk, Rev. 6",
+ "Merged From: /mirror/MyProject/tags/release-1, Rev. 14",
+ "Merged From: /mirror/MyProject/branches/feature/bar, Rev. 9",
+ "Merged From: /mirror/MyProject/trunk, Rev. 6",'']);
More information about the svk-commit
mailing list