[svk-commit] r2650 - in branches/bm: t/bm

nobody at bestpractical.com nobody at bestpractical.com
Tue Dec 18 20:07:12 EST 2007


Author: clsung
Date: Tue Dec 18 20:06:49 2007
New Revision: 2650

Modified:
   branches/bm/lib/SVK/Project.pm
   branches/bm/t/bm/prop-autoload.t
   branches/bm/t/bm/prop-multiproject.t
   branches/bm/t/bm/prop.t

Log:
- always use absoluate path in prop instead of relative path
- ensure current path matches one of project's branches/tags/trunk paths
- modify related tests

Modified: branches/bm/lib/SVK/Project.pm
==============================================================================
--- branches/bm/lib/SVK/Project.pm	(original)
+++ branches/bm/lib/SVK/Project.pm	Tue Dec 18 20:06:49 2007
@@ -126,35 +126,29 @@
     my $root            = $fs->revision_root( $fs->youngest_rev );
     my $allprops        = $root->node_proplist('/');
     my ($depotroot)     = '/';
-    my @projnames = 
-#	grep { $_ ne $project_name && (($project_name) = $_) }
+    my %projnames = 
+        map  { $_ => 1 }
 	grep { $_ =~ s/^svk:project:([^:]+):.*$/$1/ }
 	grep { $allprops->{$_} =~ /$depotroot/ } sort keys %{$allprops};
     
-    return undef unless @projnames;
+    for my $project_name (keys %projnames)  {
+	my %props = 
+	    map { $_ => $allprops->{'svk:project:'.$project_name.':'.$_} }
+		('path-trunk', 'path-branches', 'path-tags');
     
-    my $mirror_rootpath = $pathobj->mirror_source->path."/";
-    my ($relative_path) = $pathobj->path =~ m/^$mirror_rootpath\b(.*)/;
-    $relative_path ||= '/';
-    my ($project_name) = grep { $relative_path =~ /\b$_\b/} @projnames;
-    $project_name ||= $projnames[0];
-
-    my %props = 
-	map { $_ => $mirror_rootpath.$allprops->{'svk:project:'.$project_name.':'.$_} }
-	    ('path-trunk', 'path-branches', 'path-tags');
-    
-    # only the current path matches one of the branches/trunk/tags, the project
-    # is returned
-    for my $key (keys %props) {
-	return SVK::Project->new(
-	    {   
-		name            => $project_name,
-		depot           => $pathobj->depot,
-		trunk           => $props{'path-trunk'},
-		branch_location => $props{'path-branches'},
-		tag_location    => $props{'path-tags'},
-		local_root      => "/local/${project_name}",
-	    }) if $pathobj->path =~ m/^$props{$key}/;
+	# only the current path matches one of the branches/trunk/tags, the project
+	# is returned
+	for my $key (keys %props) {
+	    return SVK::Project->new(
+		{   
+		    name            => $project_name,
+		    depot           => $pathobj->depot,
+		    trunk           => $props{'path-trunk'},
+		    branch_location => $props{'path-branches'},
+		    tag_location    => $props{'path-tags'},
+		    local_root      => "/local/${project_name}",
+		}) if $pathobj->path =~ m/^$props{$key}/;
+	}
     }
     return undef;
 }

Modified: branches/bm/t/bm/prop-autoload.t
==============================================================================
--- branches/bm/t/bm/prop-autoload.t	(original)
+++ branches/bm/t/bm/prop-autoload.t	Tue Dec 18 20:06:49 2007
@@ -25,10 +25,10 @@
 
 chdir($copath);
 
-my $proppath = { 'trunk' => '/trunk', 
-    'branches' => '/branches',
-    'tags' => '/tags',
-    'hooks' => '/hooks',
+my $proppath = { 'trunk' => '/mirror/MyProject/trunk', 
+    'branches' => '/mirror/MyProject/branches',
+    'tags' => '/mirror/MyProject/tags',
+    'hooks' => '/mirror/MyProject/hooks',
 };
 
 $svk->propset('-m', "- project trunk path set", 'svk:project:MyProject:path-trunk',

Modified: branches/bm/t/bm/prop-multiproject.t
==============================================================================
--- branches/bm/t/bm/prop-multiproject.t	(original)
+++ branches/bm/t/bm/prop-multiproject.t	Tue Dec 18 20:06:49 2007
@@ -29,10 +29,10 @@
 my ($copath, $corpath) = get_copath('basic-trunk');
 
 # set prop for project A
-my $proppath = { 'trunk' => 'projectA/trunk', 
-    'branches' => 'projectA/branches',
-    'tags' => 'projectA/tags',
-    'hooks' => 'projectA/hooks',
+my $proppath = { 'trunk' => '/mirror/twoProject/projectA/trunk', 
+    'branches' => '/mirror/twoProject/projectA/branches',
+    'tags' => '/mirror/twoProject/projectA/tags',
+    'hooks' => '/mirror/twoProject/projectA/hooks',
 };
 
 $svk->propset('-m', "- projectA trunk path set", 'svk:project:projectA:path-trunk',

Modified: branches/bm/t/bm/prop.t
==============================================================================
--- branches/bm/t/bm/prop.t	(original)
+++ branches/bm/t/bm/prop.t	Tue Dec 18 20:06:49 2007
@@ -25,10 +25,10 @@
 
 chdir($copath);
 
-my $proppath = { 'trunk' => 'trunk', 
-    'branches' => 'branches',
-    'tags' => 'tags',
-    'hooks' => 'hooks',
+my $proppath = { 'trunk' => '/mirror/MyProject/trunk', 
+    'branches' => '/mirror/MyProject/branches',
+    'tags' => '/mirror/MyProject/tags',
+    'hooks' => '/mirror/MyProject/hooks',
 };
 
 $svk->propset('-m', "- project trunk path set", 'svk:project:MyProject:path-trunk',


More information about the svk-commit mailing list