[svk-commit] r2872 - in trunk: t/bm

nobody at bestpractical.com nobody at bestpractical.com
Mon May 12 11:42:45 EDT 2008


Author: clsung
Date: Mon May 12 11:42:44 2008
New Revision: 2872

Modified:
   trunk/lib/SVK/Command/Branch.pm
   trunk/t/bm/prop-setup-inverse-layout.t
   trunk/t/bm/prop-setup.t

Log:
- TODO can_write_remote_proj_prop in --setup
- prompt for multi-project props
- modify related tests

Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm	(original)
+++ trunk/lib/SVK/Command/Branch.pm	Mon May 12 11:42:44 2008
@@ -733,26 +733,31 @@
 
     my $proj = $self->load_project($self->arg_depotpath('/'.$target->depot->depotname.$preceding_path));
 
+    my $ans = 'n';
     if ($proj && $fromProp) {
-	$logger->info( loc("Project already set in properties: %1\n", $target->depotpath));
 	$project_name = $proj->name;
-	my $proplist = $local_root->root->node_proplist('/');
-	if (!exists $proplist->{"svk:project:$project_name:path-trunk"}) {
-	    my $ans = lc (get_prompt(
-		loc("Would you like to pull the project '%1' settings? [Y/n]", $project_name)
-	    ) );
-	    if ($ans ne 'n') {
-		$self->{message} = "- Mirror properties for project $project_name";
-
-		$proplist = $local_root->root->node_proplist($preceding_path);
-		for my $p ( map {'svk:project:'.$project_name.':'.$_}
-		    ('path-trunk', 'path-branches', 'path-tags')) {
-		    $self->do_propset($p,$proplist->{$p}, $local_root);
-		}
-		$self->do_propset("svk:project:$project_name:root",$preceding_path, $local_root);
-	    }
-	}
-    } else {
+	$logger->info( loc("Project already set in properties: %1\n", $target->depotpath));
+	$ans = lc (get_prompt(
+	    loc("Is the project '%1' match? [Y/n]", $project_name)
+	) );
+    }
+#	my $proplist = $local_root->root->node_proplist('/');
+#	if (!exists $proplist->{"svk:project:$project_name:path-trunk"}) {
+#	    my $ans = lc (get_prompt(
+#		loc("Would you like to pull the project '%1' settings? [Y/n]", $project_name)
+#	    ) );
+#	    if ($ans ne 'n') {
+#		$self->{message} = "- Mirror properties for project $project_name";
+	#
+	#	$proplist = $local_root->root->node_proplist($preceding_path);
+	#	for my $p ( map {'svk:project:'.$project_name.':'.$_}
+	#	    ('path-trunk', 'path-branches', 'path-tags')) {
+	#	    $self->do_propset($p,$proplist->{$p}, $local_root);
+	#	}
+	#	$self->do_propset("svk:project:$project_name:root",$preceding_path, $local_root);
+	#    }
+	#}
+    if ($ans eq 'n') {
 	if (!$proj) {
 	    $logger->info( loc("New Project depotpath encountered: %1\n", $target->path));
 	} else {
@@ -766,7 +771,7 @@
 	    $tag_path =~ s{^/?$preceding_path}{};
 	}
 	{
-	    my $ans = get_prompt(
+	    $ans = get_prompt(
 		loc("Specify a project name (enter to use '%1'): ", $project_name),
 		qr/^(?:[A-Za-z][-+_A-Za-z0-9]*|$)/
 	    );
@@ -777,7 +782,7 @@
 	}
 	$trunk_path ||= $target->_to_pclass('/')->subdir('trunk');
 	{
-	    my $ans = get_prompt(
+	    $ans = get_prompt(
 		loc("What directory shall we use for the project's trunk? (Press ENTER to use %1)\n=>", $trunk_path),
 		qr/^(?:\/?[A-Za-z][-+.A-Za-z0-9]*|$)/
 
@@ -789,7 +794,7 @@
 	}
 	$branch_path ||= $target->_to_pclass($trunk_path)->parent->subdir('branches');
 	{
-	    my $ans = get_prompt(
+	    $ans = get_prompt(
 		loc("What directory shall we use for the project's branches? (Press ENTER to use %1)\n=>", $branch_path),
 		qr/^(?:\/?[A-Za-z][-+.A-Za-z0-9]*|^\/|$)/
 	    );
@@ -800,7 +805,7 @@
 	}
 	$tag_path ||= $target->_to_pclass($trunk_path)->parent->subdir('tags');
 	{
-	    my $ans = get_prompt(
+	    $ans = get_prompt(
 		loc("What directory shall we use for the project's tags? (Press ENTER to use %1, or 's' to skip)\n=>", $tag_path),
 		qr/^(?:\/?[A-Za-z][-+.A-Za-z0-9]*|$)/
 	    );
@@ -813,12 +818,12 @@
 	#XXX implement setting properties of project here
 	$self->{message} = "- Setup properties for project $project_name";
 	# always set to local first
-	$self->do_propset("svk:project:$project_name:path-trunk",$trunk_path, $local_root);
-	$self->do_propset("svk:project:$project_name:path-branches",$branch_path, $local_root);
-	$self->do_propset("svk:project:$project_name:path-tags",$tag_path, $local_root);
-	$self->do_propset("svk:project:$project_name:root",$preceding_path, $local_root);
+	#$self->do_propset("svk:project:$project_name:path-trunk",$trunk_path, $local_root);
+	#$self->do_propset("svk:project:$project_name:path-branches",$branch_path, $local_root);
+	#$self->do_propset("svk:project:$project_name:path-tags",$tag_path, $local_root);
+	#$self->do_propset("svk:project:$project_name:root",$preceding_path, $local_root);
 	my $root_depot = $self->arg_depotpath('/'.$target->depot->depotname.$preceding_path);
-	if (0) { # how do we ask user to push to remote?
+	if (1) { # how do we ask user to push to remote?
 	    $self->do_propset("svk:project:$project_name:path-trunk",$trunk_path, $root_depot);
 	    $self->do_propset("svk:project:$project_name:path-branches",$branch_path, $root_depot);
 	    $self->do_propset("svk:project:$project_name:path-tags",$tag_path, $root_depot);

Modified: trunk/t/bm/prop-setup-inverse-layout.t
==============================================================================
--- trunk/t/bm/prop-setup-inverse-layout.t	(original)
+++ trunk/t/bm/prop-setup-inverse-layout.t	Mon May 12 11:42:44 2008
@@ -35,6 +35,7 @@
 is_output_like ($svk, 'branch', ['--create','bar','--project','sushi','//mirror/nomeans'],
     qr'Project branch created: bar');
 is_output ($svk, 'branch', ['--list', '--project', 'sushi', '//mirror/nomeans'], ['bar']);
+$answer = [''];
 is_output ($svk, 'branch', ['--setup', '//mirror/nomeans/trunk/sushi'],
     ['Project already set in properties: //mirror/nomeans/trunk/sushi']);
 

Modified: trunk/t/bm/prop-setup.t
==============================================================================
--- trunk/t/bm/prop-setup.t	(original)
+++ trunk/t/bm/prop-setup.t	Mon May 12 11:42:44 2008
@@ -46,14 +46,16 @@
 is_output ($svk, 'branch', ['--list'], ['bar']);
 is_output ($svk, 'list', ['//mirror/nomeans/A-b/bar'],
     ['Q/' ,'be']);
+$answer = [''];
 is_output ($svk, 'branch', ['--setup', '//mirror/nomeans/A'],
     ['Project already set in properties: //mirror/nomeans/A']);
 
 chdir("..");
 is_output ($svk, 'branch', ['--list', '//mirror/nomeans/projectB'], []);
-$answer = ['', '','',''];
+$answer = ['n','', '','',''];
 is_output_like ($svk, 'branch', ['--setup', '//mirror/nomeans/projectB'],
     qr/Project detected in specified path./);
+$answer = [''];
 is_output ($svk, 'branch', ['--setup', '//mirror/nomeans/projectB'],
     ['Project already set in properties: //mirror/nomeans/projectB']);
 #}


More information about the svk-commit mailing list