[svk-commit] r2829 - trunk/lib/SVK

nobody at bestpractical.com nobody at bestpractical.com
Wed May 7 22:34:25 EDT 2008


Author: clsung
Date: Wed May  7 22:34:24 2008
New Revision: 2829

Modified:
   trunk/lib/SVK/Project.pm

Log:
- Now when in local branch, br will take the original branch (where the local was copied from)
  as the path to detect the project
  - one problem might be raised => currently br not loading project properties in local, needs to add
- Add '(local branch)' output for br info
- ref http://task.hm/EC3K

Modified: trunk/lib/SVK/Project.pm
==============================================================================
--- trunk/lib/SVK/Project.pm	(original)
+++ trunk/lib/SVK/Project.pm	Wed May  7 22:34:24 2008
@@ -230,6 +230,13 @@
     my ($mirror_path,$project_name);
     my ($trunk_path, $branch_path, $tag_path);
     my $current_path = $path_obj->_to_pclass($path_obj->path);
+
+    if ($path_obj->_to_pclass("/local")->subsumes($current_path)) { # guess if in local branch
+	# should only be 1 entry
+	$project_name = $path_obj->_to_pclass($current_path)->dir_list(2);
+	$current_path = ($path_obj->copy_ancestors)[0]->[0];
+    }
+
     # Finding inverse layout first
     my ($path) = $current_path =~ m{^/(.+?/(?:trunk|branches|tags)/[^/]+)};
     if ($path) {
@@ -248,12 +255,6 @@
     # not found in inverse layout, else 
     ($path) = $current_path =~ m{^(.*?)(?:/(?:trunk|branches/.*?|tags/.*?))?/?$};
 
-    if ($path =~ m{^/local/([^/]+)/?}) { # guess if in local branch
-	# should only be 1 entry
-	($path) = grep {/\/$1$/} $path_obj->depot->mirror->entries;
-	$path =~ s#^/##;
-    }
-
     while (!$project_name) {
 	($mirror_path,$project_name) = # always assume the last entry the projectname
 	    $path =~ m{^(.*/)?([\w\-_]+)$}; 
@@ -316,9 +317,12 @@
 	} elsif (dir($self->branch_location)->subsumes($target->path)) {
 	    $where = 'branch';
 	    $bname = $target->_to_pclass($target->path)->relative($self->branch_location)->dir_list(0);
-	} elsif (dir($self->tag_location)->subsumes($target->path)) {
+	} elsif ($self->tag_location and dir($self->tag_location)->subsumes($target->path)) {
 	    $where = 'tag';
 	    $bname = $target->_to_pclass($target->path)->relative($self->tag_location)->dir_list(0);
+	} elsif (dir($self->local_root)->subsumes($target->path)) {
+	    $where = 'local branch';
+	    $bname = $target->_to_pclass($target->path)->relative($self->local_root)->dir_list(0);
 	}
 
 	if ($where) {


More information about the svk-commit mailing list