[svk-commit] r2857 - in trunk: lib/SVK

nobody at bestpractical.com nobody at bestpractical.com
Sat May 10 23:48:26 EDT 2008


Author: clsung
Date: Sat May 10 23:48:26 2008
New Revision: 2857

Modified:
   trunk/lib/SVK/Project.pm
   trunk/t/bm/prop-multiproject-sepcialpath.t

Log:
- fix mulit-project bug

Modified: trunk/lib/SVK/Project.pm
==============================================================================
--- trunk/lib/SVK/Project.pm	(original)
+++ trunk/lib/SVK/Project.pm	Sat May 10 23:48:26 2008
@@ -147,6 +147,7 @@
     my ($self, $allprops, $pname) = @_;
     my ($depotroot)     = '/';
     return
+        map  { $_ => 1}
 	grep { (1 and !$pname) or ($_ eq $pname)  } # if specified pname, the grep it only
 	grep { $_ =~ s/^svk:project:([^:]+):.*$/$1/ }
 	grep { $allprops->{$_} =~ /$depotroot/ } sort keys %{$allprops};
@@ -155,13 +156,14 @@
 sub _create_from_prop {
     my ($self, $pathobj, $root, $prop_path, $pname, $from_local) = @_;
     my $allprops        = $root->node_proplist($from_local ? '/' : $prop_path);
-    my @projnames = $self->_project_names($allprops, $pname);
-    return unless @projnames;
+    my %projnames = $self->_project_names($allprops, $pname);
+    return unless %projnames;
     
     # Given a lists of projects: 'rt32', 'rt34', 'rt38' in lexcialorder
     # if the suffix of prop_path matches $project_name like /mirror/rt38 matches rt38
     # then 'rt38' should be used to try before 'rt36', 'rt32'... 
-    for my $project_name ( @projnames)  {
+
+    for my $project_name ( sort { $prop_path =~ m/$b$/ } keys %projnames)  {
 	my %props = 
 #	    map { $_ => '/'.$allprops->{'svk:project:'.$project_name.':'.$_} }
 	    map {
@@ -331,7 +333,7 @@
     $logger->info ( loc("Project name: %1\n", $self->name));
     if ($target) {
 	my $where = "online";
-	my $bname;
+	my $bname = '';
 	if (dir($self->trunk)->subsumes($target->path)) {
 	    $bname = 'trunk';
 	} elsif (dir($self->branch_location)->subsumes($target->path)) {

Modified: trunk/t/bm/prop-multiproject-sepcialpath.t
==============================================================================
--- trunk/t/bm/prop-multiproject-sepcialpath.t	(original)
+++ trunk/t/bm/prop-multiproject-sepcialpath.t	Sat May 10 23:48:26 2008
@@ -64,11 +64,9 @@
 chdir('../../../');
 $svk->checkout('//mirror/projectB',$copathB);
 
-chdir($copathB);
-is_output ($svk, 'propget',
-    ['svk:project:projectB:path-trunk', ''],
-    [$props->{'svk:project:projectB:path-trunk'}]);
+chdir($copathB.'/trunk/projB');
 
+is_output_like ($svk, 'branch', [], qr'Project name: projectB');
 is_output_like ($svk, 'branch', ['--create', 'bar'], qr'Project branch created: bar');
 is_output ($svk, 'branch', ['--list'], ['bar']);
 #TODO: {


More information about the svk-commit mailing list