[Bps-public-commit] r10108 - in SVKUI/trunk: lib/SVKUI/Model share/web/templates/project

clsung at bestpractical.com clsung at bestpractical.com
Mon Dec 24 20:44:27 EST 2007


Author: clsung
Date: Mon Dec 24 20:44:26 2007
New Revision: 10108

Modified:
   SVKUI/trunk/lib/SVKUI.pm
   SVKUI/trunk/lib/SVKUI/Model/Project.pm
   SVKUI/trunk/share/web/templates/project/index.html

Log:
- more support to local mode

Modified: SVKUI/trunk/lib/SVKUI.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI.pm	(original)
+++ SVKUI/trunk/lib/SVKUI.pm	Mon Dec 24 20:44:26 2007
@@ -30,16 +30,16 @@
 sub load_mirror {
     my $class = shift;
     my $xd = shift;
-    my $mirrors = SVKUI::Model::ProjectCollection->new;
-    $mirrors->unlimit();
-    while ( my $m = $mirrors->next ) {
+    my $projects = SVKUI::Model::ProjectCollection->new;
+    $projects->unlimit();
+    while ( my $p = $projects->next ) {
 	$xd->{checkout}->store (
 	    SVK::Util::abs_path(Jifty->config->app('checkoutroot').
-		$SVK::Util::SEP.$m->name)
+		$SVK::Util::SEP.$p->name)
 	    ,
 	    {
-		'depotpath' => $m->localrepos,
-		'revision' => $m->revision || 0,
+		'depotpath' => $p->is_local ? $p->localrepos : $p->repospath,
+		'revision' => $p->revision || 0,
 	    } 
 	);
     }
@@ -48,14 +48,20 @@
 sub update_mirror {
     my $class = shift;
     my $xd = $class->svk->{xd};
-    my $mirrors = SVKUI::Model::ProjectCollection->new;
-    $mirrors->unlimit();
-    while ( my $m = $mirrors->next ) {
+    my $projects = SVKUI::Model::ProjectCollection->new;
+    $projects->unlimit();
+    while ( my $p = $projects->next ) {
 	my $hash = $xd->{checkout}->get (
 	    SVK::Util::abs_path(Jifty->config->app('checkoutroot').
-		$SVK::Util::SEP.$m->name)
+		$SVK::Util::SEP.$p->name)
 	);
-	$m->update_revision($hash->{'revision'}) if ($hash->{'depotpath'} eq $m->localrepos);
+	if ($p->is_local) {
+	    $p->update_localrev($hash->{'revision'})
+		if ($hash->{'depotpath'} eq $p->localrepos);
+	} else {
+	    $p->update_revision($hash->{'revision'})
+		if ($hash->{'depotpath'} eq $p->repospath);
+	}
     }
 }
 

Modified: SVKUI/trunk/lib/SVKUI/Model/Project.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI/Model/Project.pm	(original)
+++ SVKUI/trunk/lib/SVKUI/Model/Project.pm	Mon Dec 24 20:44:26 2007
@@ -63,6 +63,12 @@
     hints is 'If the Project is synced';
 
 column
+    is_local => type is 'boolean',
+    label is _('Project is currently local mode?'),
+    default is 0,
+    hints is 'If the Project state is in local';
+
+column
     localrepos => type is 'varchar',
     label is _('LOCALREPOS'),
     hints is 'local copied repos path';
@@ -74,6 +80,12 @@
     hints is 'revision number';
 
 column
+    localrev => type is 'int',
+    label is _('Local repos rev'),
+    default is 0,
+    hints is 'local revision number';
+
+column
     description => type is 'varchar',
     label is _('DESCRIPTION'),
     render_as 'textarea',
@@ -224,8 +236,10 @@
     return 0;
 }
 
+# XXX Replaced by project creatation
 sub try_copy {
     my $self = shift;
+    return 1 if $self->trunkpath; # only valid in non-project mirror
     my $localrepos = $self->repospath;
     $localrepos =~ s#^//mirror/#//local/#;
     $localrepos = '//local/'.$self->name if $self->trunkpath;

Modified: SVKUI/trunk/share/web/templates/project/index.html
==============================================================================
--- SVKUI/trunk/share/web/templates/project/index.html	(original)
+++ SVKUI/trunk/share/web/templates/project/index.html	Mon Dec 24 20:44:26 2007
@@ -44,7 +44,7 @@
 <% $project->repospath %>
 
 % if ($project->trunkpath) {
-<h4>Project trunk</h4>
+<h4>Project trunk path</h4>
 <% '/mirror'.$project->trunkpath %>
 <h4>Project braches</h4>
 <% $branches %>
@@ -54,7 +54,7 @@
 <%	$edit->form_field('is_local', type => 'checkbox', default_value => 0) %>
 <%      Jifty->web->form->submit( label => 'Add Branch' ) %>
 <%      Jifty->web->form->end() %>
-<h4>Project tags</h4>
+<h4>Project tags path</h4>
 <% '/mirror'.$project->tagspath %>
 <h4>Project local branches</h4>
 <% $localbranches %>
@@ -66,7 +66,7 @@
 <% $project->localrepos %>
 <h4>Click to enter interactive mode</h4>
 <%Jifty->web->link( url => '/ia/'.$project->name, label => 'Commands')%>
-% } else {
+% } elsif (!$project->trunkpath) {
 <h4>Click to copy a local branch</h4>
 <%Jifty->web->link( url => '/copy/'.$project->name, label => 'Click here')%>
 % }



More information about the Bps-public-commit mailing list