changeset 509:b50e79b4257a

fixes to pidlock, to not raise unneded execptions few fixes in templating for empty repository to not show some labels, fixed tag/branch switcher
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 28 Sep 2010 19:53:52 +0000
parents fdb78a140ae4
children 9bedaa073c23
files pylons_app/lib/celerylib/tasks.py pylons_app/lib/pidlock.py pylons_app/templates/base/base.html pylons_app/templates/index.html pylons_app/templates/shortlog/shortlog_data.html pylons_app/templates/summary/summary.html
diffstat 6 files changed, 35 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/lib/celerylib/tasks.py	Tue Sep 28 02:31:10 2010 +0200
+++ b/pylons_app/lib/celerylib/tasks.py	Tue Sep 28 19:53:52 2010 +0000
@@ -85,7 +85,7 @@
     repo = MercurialRepository(repos_path + repo_name)
 
     skip_date_limit = True
-    parse_limit = 350 #limit for single task changeset parsing
+    parse_limit = 350 #limit for single task changeset parsing optimal for
     last_rev = 0
     last_cs = None
     timegetter = itemgetter('time')
@@ -98,9 +98,12 @@
         .filter(Statistics.repository == dbrepo).scalar()
     if cur_stats:
         last_rev = cur_stats.stat_on_revision
+    if not repo.revisions:
+        return True
     
     if last_rev == repo.revisions[-1] and len(repo.revisions) > 1:
-        #pass silently without any work
+        #pass silently without any work if we're not on first revision or current
+        #state of parsing revision(from db marker) is the last revision
         return True
     
     if cur_stats:
--- a/pylons_app/lib/pidlock.py	Tue Sep 28 02:31:10 2010 +0200
+++ b/pylons_app/lib/pidlock.py	Tue Sep 28 19:53:52 2010 +0000
@@ -74,7 +74,8 @@
                         print "Lock File is there but the program is not running"
                         print "Removing lock file for the: %s" % running_pid                        
                         self.release()
-                    raise
+                    else:
+                        raise
                 else:
                     print "You already have an instance of the program running"
                     print "It is running as process %s" % running_pid                    
--- a/pylons_app/templates/base/base.html	Tue Sep 28 02:31:10 2010 +0200
+++ b/pylons_app/templates/base/base.html	Tue Sep 28 19:53:52 2010 +0000
@@ -143,17 +143,25 @@
                         <li>
                             ${h.link_to(_('branches'),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')}
                             <ul>
+                            %if c.repository_branches.values():
 						        %for cnt,branch in enumerate(c.repository_branches.items()):
 						            <li>${h.link_to('%s - %s' % (branch[0],branch[1]),h.url('files_home',repo_name=c.repo_name,revision=branch[1]))}</li>
 						        %endfor
+						    %else:
+						    	<li>${h.link_to(_('There are no branches yet'),'#')}</li>
+						    %endif
                             </ul>                        
                         </li>
                         <li>
                             ${h.link_to(_('tags'),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')}
                             <ul>
+                            %if c.repository_tags.values():
                                 %for cnt,tag in enumerate(c.repository_tags.items()):
                                  <li>${h.link_to('%s - %s' % (tag[0],tag[1]),h.url('files_home',repo_name=c.repo_name,revision=tag[1]))}</li>
                                 %endfor
+                            %else:
+                            	<li>${h.link_to(_('There are no tags yet'),'#')}</li>
+                            %endif
                             </ul>                        
                         </li>                        
                     </ul>
--- a/pylons_app/templates/index.html	Tue Sep 28 02:31:10 2010 +0200
+++ b/pylons_app/templates/index.html	Tue Sep 28 19:53:52 2010 +0000
@@ -64,10 +64,16 @@
 					                h.url('summary_home',repo_name=repo['name']))}</td>
 					            <td title="${repo['description']}">${h.truncate(repo['description'],60)}</td>
 					            <td>${h.age(repo['last_change'])}</td>
-					            <td>${h.link_to_if(repo['rev']>=0,'r%s:%s' % (repo['rev'],repo['tip']),
+					            <td>
+					            	%if repo['rev']>=0:
+					            	${h.link_to('r%s:%s' % (repo['rev'],repo['tip']),
 					                h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
 					                class_="tooltip",
-					                tooltip_title=h.tooltip(repo['last_msg']))}</td>
+					                tooltip_title=h.tooltip(repo['last_msg']))}
+					            	%else:
+					            		${_('No changesets yet')}
+					            	%endif    
+					            </td>
 					            <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
 					            <td>
 					                <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon"  href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a>
--- a/pylons_app/templates/shortlog/shortlog_data.html	Tue Sep 28 02:31:10 2010 +0200
+++ b/pylons_app/templates/shortlog/shortlog_data.html	Tue Sep 28 19:53:52 2010 +0000
@@ -38,7 +38,7 @@
 		|
 		${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
 		</td>
-	</tr>	
+	</tr>
 %endfor
 
 </table>
@@ -59,5 +59,5 @@
 YAHOO.util.Dom.setStyle(data_div,'opacity','1');}},null); return false;""")}
 </div>
 %else:
-    ${_('There are no commits yet')}
+    ${_('There are no changes yet')}
 %endif
--- a/pylons_app/templates/summary/summary.html	Tue Sep 28 02:31:10 2010 +0200
+++ b/pylons_app/templates/summary/summary.html	Tue Sep 28 19:53:52 2010 +0000
@@ -136,7 +136,7 @@
 			  		if(no_data){
 			  			var tr = document.createElement('tr');
 			  			var td1 = document.createElement('td');
-			  			td1.innerHTML = "${_('No data loaded yet...')}";
+			  			td1.innerHTML = "${_('No data loaded yet')}";
 			  			tr.appendChild(td1);
 			  			tbl.appendChild(tr);
 					}
@@ -538,7 +538,9 @@
     </div>    
     <div class="table">
         <%include file='../shortlog/shortlog_data.html'/>
-        ${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))}
+        %if c.repo_changesets:
+        	${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))}
+        %endif
     </div>
 </div>
 <div class="box">    
@@ -547,7 +549,9 @@
     </div>    
     <div class="table">
         <%include file='../tags/tags_data.html'/>
-        ${h.link_to(_('show more'),h.url('tags_home',repo_name=c.repo_name))}
+        %if c.repo_changesets:
+        	${h.link_to(_('show more'),h.url('tags_home',repo_name=c.repo_name))}
+        %endif
     </div>
 </div>
 <div class="box">
@@ -556,7 +560,9 @@
     </div>    
     <div class="table">
         <%include file='../branches/branches_data.html'/>
-        ${h.link_to(_('show more'),h.url('branches_home',repo_name=c.repo_name))}
+        %if c.repo_changesets:
+        	${h.link_to(_('show more'),h.url('branches_home',repo_name=c.repo_name))}
+        %endif
     </div>      
 </div>