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

nobody at bestpractical.com nobody at bestpractical.com
Thu Jul 10 10:53:30 EDT 2008


Author: clsung
Date: Thu Jul 10 10:53:27 2008
New Revision: 2986

Modified:
   trunk/lib/SVK/Project.pm
   trunk/t/bm/online-offline.t

Log:
- fix http://task.hm/FFAW
- also fix branch name problem
  - if there's a branche xxx/yyy,
    br info will only show Branch: xxx

Modified: trunk/lib/SVK/Project.pm
==============================================================================
--- trunk/lib/SVK/Project.pm	(original)
+++ trunk/lib/SVK/Project.pm	Thu Jul 10 10:53:27 2008
@@ -326,6 +326,9 @@
     return 'trunk' if (dir($self->trunk)->subsumes($bpath));
     my $branch_location = $is_local ? $self->local_root : $self->branch_location;
     $bpath =~ s{^\Q$branch_location\E/}{};
+    my $pbname;
+    ($pbname) = grep { $bpath =~ m#^$_(/|$)# } @{$self->branches};
+    return $pbname if $pbname;
     return $bpath;
 }
 
@@ -347,6 +350,9 @@
     return 'trunk' if (dir($self->trunk)->subsumes($bpath));
     my $tag_location = $self->tag_location;
     $bpath =~ s{^\Q$tag_location\E/}{};
+    my $pbname;
+    ($pbname) = grep { $bpath =~ m#^$_(/|$)# } @{$self->tags};
+    return $pbname if $pbname;
     return $bpath;
 }
 
@@ -367,12 +373,12 @@
 	if (dir($self->trunk)->subsumes($target->path)) {
 	    $bname = 'trunk';
 	} elsif (dir($self->branch_location)->subsumes($target->path)) {
-	    $bname = $target->_to_pclass($target->path)->relative($self->branch_location)->dir_list(0);
+	    $bname = $self->branch_name($target->path);
 	} elsif ($self->tag_location and dir($self->tag_location)->subsumes($target->path)) {
-	    $bname = $target->_to_pclass($target->path)->relative($self->tag_location)->dir_list(0);
+	    $bname = $self->tag_name($target->path);
 	} elsif (dir($self->local_root)->subsumes($target->path)) {
 	    $where = 'offline';
-	    $bname = $target->_to_pclass($target->path)->relative($self->local_root)->dir_list(0);
+	    $bname = $self->branch_name($target->path,1);
 	}
 
 	if ($where) {
@@ -380,8 +386,10 @@
 	    return unless $verbose;
 	    $logger->info ( loc("Repository path: %1\n", $target->depotpath ));
 	    if ($where ne 'trunk') { # project trunk should not have Copied info
-		if (my $copy_ancestor = ($target->copy_ancestors)[0]) {
-		    $logger->info( loc("Copied From: %1@%2\n", $self->branch_name($copy_ancestor->[0]), $copy_ancestor->[1]));
+		for ($target->copy_ancestors) {
+		    next if $bname eq $self->branch_name($_->[0]);
+		    $logger->info( loc("Copied From: %1@%2\n", $self->branch_name($_->[0]), $_->[1]));
+		    last;
 		}
 	    }
 	}

Modified: trunk/t/bm/online-offline.t
==============================================================================
--- trunk/t/bm/online-offline.t	(original)
+++ trunk/t/bm/online-offline.t	Thu Jul 10 10:53:27 2008
@@ -114,9 +114,13 @@
 
 $svk->br('--offline'); # offline the feature/foobar branch
 
+chdir ("C");
 TODO: {
 
     local $TODO = "test case for http://task.hm/FFAW";
-is_output_like ($svk, 'br', [],
-   qr|Copied From: feature/foobar@\d+|);
+is_output ($svk, 'br', [],
+    ["Project name: MyProject",
+     "Branch: release/abc (offline)",
+     "Repository path: //local/MyProject/release/abc/C",
+     'Copied From: feature/foobar at 12']);
 }


More information about the svk-commit mailing list