aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2010-09-28 19:53:52 +0000
committerMarcin Kuzminski <marcin@python-works.com>2010-09-28 19:53:52 +0000
commit784ad1e2ca29828099e730ef4a8657fd30974e6d (patch)
treecb43961ff02ffbf07d2a1b797c556f8f9168a36f
parentc9c35a25ac0a879546a25b90d5fc7b76c58105b1 (diff)
fixes to pidlock, to not raise unneded execptions
few fixes in templating for empty repository to not show some labels, fixed tag/branch switcher
-rw-r--r--pylons_app/lib/celerylib/tasks.py7
-rw-r--r--pylons_app/lib/pidlock.py3
-rw-r--r--pylons_app/templates/base/base.html8
-rw-r--r--pylons_app/templates/index.html10
-rw-r--r--pylons_app/templates/shortlog/shortlog_data.html4
-rw-r--r--pylons_app/templates/summary/summary.html14
6 files changed, 35 insertions, 11 deletions
diff --git a/pylons_app/lib/celerylib/tasks.py b/pylons_app/lib/celerylib/tasks.py
index fab82b7c..9bd5c1de 100644
--- a/pylons_app/lib/celerylib/tasks.py
+++ b/pylons_app/lib/celerylib/tasks.py
@@ -85,7 +85,7 @@ def get_commits_stats(repo_name, ts_min_y, ts_max_y):
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 @@ def get_commits_stats(repo_name, ts_min_y, ts_max_y):
.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:
diff --git a/pylons_app/lib/pidlock.py b/pylons_app/lib/pidlock.py
index e9b429c5..a5c67c01 100644
--- a/pylons_app/lib/pidlock.py
+++ b/pylons_app/lib/pidlock.py
@@ -74,7 +74,8 @@ class DaemonLock(object):
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
diff --git a/pylons_app/templates/base/base.html b/pylons_app/templates/base/base.html
index eeeab9b2..a1c5630b 100644
--- a/pylons_app/templates/base/base.html
+++ b/pylons_app/templates/base/base.html
@@ -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>
diff --git a/pylons_app/templates/index.html b/pylons_app/templates/index.html
index 6ceae35a..8647ca31 100644
--- a/pylons_app/templates/index.html
+++ b/pylons_app/templates/index.html
@@ -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>
diff --git a/pylons_app/templates/shortlog/shortlog_data.html b/pylons_app/templates/shortlog/shortlog_data.html
index 9e5b8ada..5ea37f71 100644
--- a/pylons_app/templates/shortlog/shortlog_data.html
+++ b/pylons_app/templates/shortlog/shortlog_data.html
@@ -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.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link')
YAHOO.util.Dom.setStyle(data_div,'opacity','1');}},null); return false;""")}
</div>
%else:
- ${_('There are no commits yet')}
+ ${_('There are no changes yet')}
%endif
diff --git a/pylons_app/templates/summary/summary.html b/pylons_app/templates/summary/summary.html
index 33e49123..98c093c5 100644
--- a/pylons_app/templates/summary/summary.html
+++ b/pylons_app/templates/summary/summary.html
@@ -136,7 +136,7 @@ E.onDOMReady(function(e){
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 @@ E.onDOMReady(function(e){
</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 @@ E.onDOMReady(function(e){
</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 @@ E.onDOMReady(function(e){
</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>