[Bps-public-commit] r10048 - SVKUI/trunk/lib/SVKUI/Model

clsung at bestpractical.com clsung at bestpractical.com
Sun Dec 23 22:32:30 EST 2007


Author: clsung
Date: Sun Dec 23 22:32:30 2007
New Revision: 10048

Modified:
   SVKUI/trunk/lib/SVKUI/Model/Project.pm

Log:
- smartly use user specified url to detect project

Modified: SVKUI/trunk/lib/SVKUI/Model/Project.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI/Model/Project.pm	(original)
+++ SVKUI/trunk/lib/SVKUI/Model/Project.pm	Sun Dec 23 22:32:30 2007
@@ -113,23 +113,25 @@
     my $repos_root = $ra->get_repos_root();
     $ra->reparent($repos_root);
     my ($uri_path) = $self->url =~ m/^$repos_root(.*)$/;
-    warn $uri_path;
 
     my %prop = %{ ($ra->get_file('',$ra->get_latest_revnum, undef))[1] };
 
     # if found projects, then mirror from it
     # if uri_path exists, we can use it to determine which project it is
     if (grep { $_ =~ /^svk:project/ } keys %prop) {
-	warn 'Has project';
 	my %projects =
 	    map { $_ => 1 }
 	    grep { $_ =~ s/^svk:project:([^:]+):.*$/$1/ } keys %prop;
 	my @projs = keys %projects;
+	my $matched_project;
 	for my $proj (@projs) {
 	    $projects{$proj} = $prop{'svk:project:'.$proj.':path-trunk'};
 	    $projects{$proj} =~ s{/[^/]+$}{};
+	    $matched_project = $proj if 
+		grep { $prop{'svk:project:'.$proj.':'.$_} =~ m/^$uri_path/; }
+		    ('path-trunk', 'path-branches', 'path-tags');
 	}
-	$path = '//mirror'.$projects{$projs[0]};
+	$path = '//mirror'.$projects{$matched_project ? $matched_project : $projs[0]};
 	warn $path . " is changed";
 	$self->_set(column => 'url', value => $repos_root.$projects{$projs[0]});
     }



More information about the Bps-public-commit mailing list