# HG changeset patch # User Marcin Kuzminski # Date 2017-03-28 20:37:46 # Node ID 73b23dff15092863b630abc5766746af1895bf23 # Parent dcac0725c81a1e3eab137bad0850ddae3616763d helpers: remove deprecated fancy_file_stats that is not used anymore. diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -1549,99 +1549,6 @@ def format_byte_size_binary(file_size): return formatted_size -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 - """ - from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \ - MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE - - def cgen(l_type, a_v, d_v): - mapping = {'tr': 'top-right-rounded-corner-mid', - 'tl': 'top-left-rounded-corner-mid', - 'br': 'bottom-right-rounded-corner-mid', - 'bl': 'bottom-left-rounded-corner-mid'} - map_getter = lambda x: mapping[x] - - if l_type == 'a' and d_v: - #case when added and deleted are present - return ' '.join(map(map_getter, ['tl', 'bl'])) - - if l_type == 'a' and not d_v: - return ' '.join(map(map_getter, ['tr', 'br', 'tl', 'bl'])) - - if l_type == 'd' and a_v: - return ' '.join(map(map_getter, ['tr', 'br'])) - - if l_type == 'd' and not a_v: - return ' '.join(map(map_getter, ['tr', 'br', 'tl', 'bl'])) - - a, d = stats['added'], stats['deleted'] - width = 100 - - if stats['binary']: # binary operations like chmod/rename etc - lbl = [] - bin_op = 0 # undefined - - # prefix with bin for binary files - if BIN_FILENODE in stats['ops']: - lbl += ['bin'] - - if NEW_FILENODE in stats['ops']: - lbl += [_('new file')] - bin_op = NEW_FILENODE - elif MOD_FILENODE in stats['ops']: - lbl += [_('mod')] - bin_op = MOD_FILENODE - elif DEL_FILENODE in stats['ops']: - lbl += [_('del')] - bin_op = DEL_FILENODE - elif RENAMED_FILENODE in stats['ops']: - lbl += [_('rename')] - bin_op = RENAMED_FILENODE - - # chmod can go with other operations, so we add a + to lbl if needed - if CHMOD_FILENODE in stats['ops']: - lbl += [_('chmod')] - if bin_op == 0: - bin_op = CHMOD_FILENODE - - lbl = '+'.join(lbl) - b_a = '
%s
' \ - % (bin_op, cgen('a', a_v='', d_v=0), lbl) - b_d = '
' - return literal('
%s%s
' % (width, b_a, b_d)) - - t = stats['added'] + stats['deleted'] - unit = float(width) / (t or 1) - - # 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: - #adjust the percentage to be == 100% since we adjusted to 9 - if a_p > d_p: - a_p = a_p - (p_sum - width) - else: - d_p = d_p - (p_sum - width) - - a_v = a if a > 0 else '' - d_v = d if d > 0 else '' - - d_a = '
%s
' % ( - cgen('a', a_v, d_v), a_p, a_v - ) - d_d = '
%s
' % ( - cgen('d', a_v, d_v), d_p, d_v - ) - return literal('
%s%s
' % (width, d_a, d_d)) - - def urlify_text(text_, safe=True): """ Extrac urls from text and make html links out of them