diff --git a/rhodecode/lib/__init__.py b/rhodecode/lib/__init__.py
--- a/rhodecode/lib/__init__.py
+++ b/rhodecode/lib/__init__.py
@@ -173,3 +173,72 @@ def engine_from_config(configuration, pr
kwargs.update({'poolclass': NullPool})
return efc(configuration, prefix, **kwargs)
+
+
+def age(curdate):
+ """
+ turns a datetime into an age string.
+
+ :param curdate: datetime object
+ :rtype: unicode
+ :returns: unicode words describing age
+ """
+
+ from datetime import datetime
+ from webhelpers.date import time_ago_in_words
+
+ _ = lambda s:s
+
+ if not curdate:
+ return ''
+
+ agescales = [(_(u"year"), 3600 * 24 * 365),
+ (_(u"month"), 3600 * 24 * 30),
+ (_(u"day"), 3600 * 24),
+ (_(u"hour"), 3600),
+ (_(u"minute"), 60),
+ (_(u"second"), 1), ]
+
+ age = datetime.now() - curdate
+ age_seconds = (age.days * agescales[2][1]) + age.seconds
+ pos = 1
+ for scale in agescales:
+ if scale[1] <= age_seconds:
+ if pos == 6:pos = 5
+ return '%s %s' % (time_ago_in_words(curdate,
+ agescales[pos][0]), _('ago'))
+ pos += 1
+
+ return _(u'just now')
+
+
+def credentials_hidder(uri):
+ """
+ Removes user:password from given url string
+
+ :param uri:
+ :rtype: unicode
+ :returns: filtered list of strings
+ """
+ if not uri:
+ return ''
+
+ proto = ''
+
+ for pat in ('https://', 'http://'):
+ if uri.startswith(pat):
+ uri = uri[len(pat):]
+ proto = pat
+ break
+
+ # remove passwords and username
+ uri = uri[uri.find('@') + 1:]
+
+ # get the port
+ cred_pos = uri.find(':')
+ if cred_pos == -1:
+ host, port = uri, None
+ else:
+ host, port = uri[:cred_pos], uri[cred_pos + 1:]
+
+ return filter(None, [proto, host, port])
diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py
--- a/rhodecode/lib/helpers.py
+++ b/rhodecode/lib/helpers.py
@@ -320,30 +320,9 @@ flash = _Flash()
#==============================================================================
from mercurial import util
from mercurial.templatefilters import person as _person
-
-def _age(curdate):
- """turns a datetime into an age string."""
-
- if not curdate:
- return ''
+from rhodecode.lib import credentials_hidder, age as _age
- agescales = [("year", 3600 * 24 * 365),
- ("month", 3600 * 24 * 30),
- ("day", 3600 * 24),
- ("hour", 3600),
- ("minute", 60),
- ("second", 1), ]
- age = datetime.now() - curdate
- age_seconds = (age.days * agescales[2][1]) + age.seconds
- pos = 1
- for scale in agescales:
- if scale[1] <= age_seconds:
- if pos == 6:pos = 5
- return time_ago_in_words(curdate, agescales[pos][0]) + ' ' + _('ago')
- pos += 1
-
- return _('just now')
age = lambda x:_age(x)
capitalize = lambda x: x.capitalize()
@@ -351,7 +330,7 @@ email = util.email
email_or_none = lambda x: util.email(x) if util.email(x) != x else None
person = lambda x: _person(x)
short_id = lambda x: x[:12]
-
+hide_credentials = lambda x: ''.join(credentials_hidder(x))
def bool2icon(value):
"""Returns True/False values represented as small html image of true/false
@@ -534,7 +513,7 @@ def gravatar_url(email_address, size=30)
#==============================================================================
-# REPO PAGER
+# REPO PAGER, PAGER FOR REPOSITORY
#==============================================================================
class RepoPage(Page):
@@ -620,6 +599,12 @@ class RepoPage(Page):
def changed_tooltip(nodes):
+ """
+ Generates a html string for changed nodes in changeset page.
+ It limits the output to 30 entries
+
+ :param nodes: LazyNodesGenerator
+ """
if nodes:
pref = ':
'
suf = ''
@@ -633,6 +618,15 @@ def changed_tooltip(nodes):
def repo_link(groups_and_repos):
+ """
+ Makes a breadcrumbs link to repo within a group
+ joins » on each group to create a fancy link
+
+ ex::
+ group >> subgroup >> repo
+
+ :param groups_and_repos:
+ """
groups, repo_name = groups_and_repos
if not groups:
@@ -646,12 +640,20 @@ def repo_link(groups_and_repos):
def fancy_file_stats(stats):
+ """
+ Displays a fancy two colored bar for number of added/deleted
+ lines of code on file
+
+ :param stats: two element list of added/deleted lines of code
+ """
+
a, d, t = stats[0], stats[1], stats[0] + stats[1]
width = 100
unit = float(width) / (t or 1)
- a_p = max(9, unit * a) if a > 0 else 0# needs > 9% to be visible
- d_p = max(9, unit * d) if d > 0 else 0 # needs > 9% to be visible
+ # needs > 9% of width to be visible or 0 to be hidden
+ a_p = max(9, unit * a) if a > 0 else 0
+ d_p = max(9, unit * d) if d > 0 else 0
p_sum = a_p + d_p
if p_sum > width:
diff --git a/rhodecode/templates/summary/summary.html b/rhodecode/templates/summary/summary.html
--- a/rhodecode/templates/summary/summary.html
+++ b/rhodecode/templates/summary/summary.html
@@ -75,11 +75,11 @@
##REMOTE
%if c.dbrepo.clone_uri: