[svk-commit] r2836 - in trunk: lib/SVK
nobody at bestpractical.com
nobody at bestpractical.com
Thu May 8 07:40:15 EDT 2008
Author: clsung
Date: Thu May 8 07:40:14 2008
New Revision: 2836
Modified:
trunk/lib/SVK/Project.pm
trunk/t/bm/prop.t
Log:
- now accept project properties set in local (//)
- useful for those we don't have permissions to commit (read only projects)
- modify t/bm/prop.t to reflect real cases
Modified: trunk/lib/SVK/Project.pm
==============================================================================
--- trunk/lib/SVK/Project.pm (original)
+++ trunk/lib/SVK/Project.pm Thu May 8 07:40:14 2008
@@ -138,18 +138,30 @@
last;
}
}
- my $allprops = $root->node_proplist($prop_path);
+ my $proj = $self->_create_from_prop($pathobj, $root, $prop_path, $pname);
+ return $proj if $proj;
+ return $self->_create_from_prop($pathobj, $root, $prop_path, $pname, 1);
+}
+
+sub _project_names {
+ my ($self, $allprops, $pname) = @_;
my ($depotroot) = '/';
- my %projnames =
- map { $_ => 1 }
+ return
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};
+}
+
+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);
+ 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 ( sort { $prop_path =~ m/$b$/ } keys %projnames) {
+ for my $project_name ( sort { $prop_path =~ m/$b$/ } @projnames) {
my %props =
# map { $_ => '/'.$allprops->{'svk:project:'.$project_name.':'.$_} }
map {
Modified: trunk/t/bm/prop.t
==============================================================================
--- trunk/t/bm/prop.t (original)
+++ trunk/t/bm/prop.t Thu May 8 07:40:14 2008
@@ -25,10 +25,10 @@
chdir($copath);
-my $proppath = { 'trunk' => '/mirror/MyProject/trunk',
- 'branches' => '/mirror/MyProject/branches',
- 'tags' => '/mirror/MyProject/tags',
- 'hooks' => '/mirror/MyProject/hooks',
+my $proppath = { 'trunk' => '/trunk',
+ 'branches' => '/branches',
+ 'tags' => '/tags',
+ 'hooks' => '/hooks',
};
$svk->propset('-m', "- project trunk path set", 'svk:project:MyProject:path-trunk',
More information about the svk-commit
mailing list