##// END OF EJS Templates
Implemented --stat for changelog
marcink -
r1257:0a2a10a1 beta
parent child Browse files
Show More
@@ -86,6 +86,8 b' class ChangesetController(BaseRepoContro'
86 c.changes = OrderedDict()
86 c.changes = OrderedDict()
87 c.sum_added = 0
87 c.sum_added = 0
88 c.sum_removed = 0
88 c.sum_removed = 0
89 c.lines_added = 0
90 c.lines_deleted = 0
89 c.cut_off = False
91 c.cut_off = False
90
92
91 for changeset in c.cs_ranges:
93 for changeset in c.cs_ranges:
@@ -106,9 +108,8 b' class ChangesetController(BaseRepoContro'
106 c.sum_added += node.size
108 c.sum_added += node.size
107 if c.sum_added < self.cut_off_limit:
109 if c.sum_added < self.cut_off_limit:
108 f_gitdiff = differ.get_gitdiff(filenode_old, node)
110 f_gitdiff = differ.get_gitdiff(filenode_old, node)
109 diff = differ.DiffProcessor(f_gitdiff,
111 d = differ.DiffProcessor(f_gitdiff, format='gitdiff')
110 format='gitdiff').as_html()
112 diff = d.as_html()
111
112 else:
113 else:
113 diff = wrap_to_table(_('Changeset is to big and '
114 diff = wrap_to_table(_('Changeset is to big and '
114 'was cut off, see raw '
115 'was cut off, see raw '
@@ -118,8 +119,11 b' class ChangesetController(BaseRepoContro'
118
119
119 cs1 = None
120 cs1 = None
120 cs2 = node.last_changeset.raw_id
121 cs2 = node.last_changeset.raw_id
121 c.changes[changeset.raw_id].append(('added', node,
122 st = d.stat()
122 diff, cs1, cs2))
123 c.lines_added += st[0]
124 c.lines_deleted += st[1]
125 c.changes[changeset.raw_id].append(('added', node, diff,
126 cs1, cs2, st))
123
127
124 #==================================================================
128 #==================================================================
125 # CHANGED FILES
129 # CHANGED FILES
@@ -138,9 +142,10 b' class ChangesetController(BaseRepoContro'
138
142
139 if c.sum_removed < self.cut_off_limit:
143 if c.sum_removed < self.cut_off_limit:
140 f_gitdiff = differ.get_gitdiff(filenode_old, node)
144 f_gitdiff = differ.get_gitdiff(filenode_old, node)
141 diff = differ.DiffProcessor(f_gitdiff,
145 d = differ.DiffProcessor(f_gitdiff,
142 format='gitdiff')\
146 format='gitdiff')
143 .as_html()
147 diff = d.as_html()
148
144 if diff:
149 if diff:
145 c.sum_removed += len(diff)
150 c.sum_removed += len(diff)
146 else:
151 else:
@@ -152,8 +157,11 b' class ChangesetController(BaseRepoContro'
152
157
153 cs1 = filenode_old.last_changeset.raw_id
158 cs1 = filenode_old.last_changeset.raw_id
154 cs2 = node.last_changeset.raw_id
159 cs2 = node.last_changeset.raw_id
155 c.changes[changeset.raw_id].append(('changed', node,
160 st = d.stat()
156 diff, cs1, cs2))
161 c.lines_added += st[0]
162 c.lines_deleted += st[1]
163 c.changes[changeset.raw_id].append(('changed', node, diff,
164 cs1, cs2, st))
157
165
158 #==================================================================
166 #==================================================================
159 # REMOVED FILES
167 # REMOVED FILES
@@ -161,7 +169,7 b' class ChangesetController(BaseRepoContro'
161 if not c.cut_off:
169 if not c.cut_off:
162 for node in changeset.removed:
170 for node in changeset.removed:
163 c.changes[changeset.raw_id].append(('removed', node, None,
171 c.changes[changeset.raw_id].append(('removed', node, None,
164 None, None))
172 None, None, None))
165
173
166 if len(c.cs_ranges) == 1:
174 if len(c.cs_ranges) == 1:
167 c.changeset = c.cs_ranges[0]
175 c.changeset = c.cs_ranges[0]
@@ -622,7 +622,8 b' def changed_tooltip(nodes):'
622 suf = ''
622 suf = ''
623 if len(nodes) > 30:
623 if len(nodes) > 30:
624 suf = '<br/>' + _(' and %s more') % (len(nodes) - 30)
624 suf = '<br/>' + _(' and %s more') % (len(nodes) - 30)
625 return literal(pref + '<br/> '.join([safe_unicode(x.path) for x in nodes[:30]]) + suf)
625 return literal(pref + '<br/> '.join([safe_unicode(x.path)
626 for x in nodes[:30]]) + suf)
626 else:
627 else:
627 return ': ' + _('No Files')
628 return ': ' + _('No Files')
628
629
@@ -635,6 +636,56 b' def repo_link(groups_and_repos):'
635 return repo_name
636 return repo_name
636 else:
637 else:
637 def make_link(group):
638 def make_link(group):
638 return link_to(group.group_name, url('repos_group', id=group.group_id))
639 return link_to(group.group_name, url('repos_group',
640 id=group.group_id))
639 return literal(' &raquo; '.join(map(make_link, groups)) + \
641 return literal(' &raquo; '.join(map(make_link, groups)) + \
640 " &raquo; " + repo_name)
642 " &raquo; " + repo_name)
643
644
645 def fancy_file_stats(stats):
646 a, d, t = stats[0], stats[1], stats[0] + stats[1]
647 width = 100
648 unit = float(width) / t
649
650 a_p = max(9, unit * a) if a > 0 else 0# needs > 9% to be visible
651 d_p = max(9, unit * d) if d > 0 else 0 # needs > 9% to be visible
652 p_sum = a_p + d_p
653
654 if p_sum > width:
655 #adjust the percentage to be == 100% since we adjusted to 9
656 if a_p > d_p:
657 a_p = a_p - (p_sum - width)
658 else:
659 d_p = d_p - (p_sum - width)
660
661 a_v = a if a > 0 else ''
662 d_v = d if d > 0 else ''
663
664
665 def cgen(l_type):
666 mapping = {'tr':'top-right-rounded-corner',
667 'tl':'top-left-rounded-corner',
668 'br':'bottom-right-rounded-corner',
669 'bl':'bottom-left-rounded-corner'}
670 map_getter = lambda x:mapping[x]
671
672 if l_type == 'a' and d_v:
673 #case when added and deleted are present
674 return ' '.join(map(map_getter, ['tl', 'bl']))
675
676 if l_type == 'a' and not d_v:
677 return ' '.join(map(map_getter, ['tr', 'br', 'tl', 'bl']))
678
679 if l_type == 'd' and a_v:
680 return ' '.join(map(map_getter, ['tr', 'br']))
681
682 if l_type == 'd' and not a_v:
683 return ' '.join(map(map_getter, ['tr', 'br', 'tl', 'bl']))
684
685
686
687 d_a = '<div class="added %s" style="width:%s%%">%s</div>' % (cgen('a'),
688 a_p, a_v)
689 d_d = '<div class="deleted %s" style="width:%s%%">%s</div>' % (cgen('d'),
690 d_p, d_v)
691 return literal('<div style="width:%spx">%s%s</div>' % (width, d_a, d_d))
@@ -1546,6 +1546,24 b' margin:10px 2px;'
1546 font-weight: bold;
1546 font-weight: bold;
1547 }
1547 }
1548
1548
1549 .cs_files .node{
1550 float: left;
1551 }
1552 .cs_files .changes{
1553 float: right;
1554 }
1555 .cs_files .changes .added{
1556 background-color: #BBFFBB;
1557 float: left;
1558 text-align: center;
1559 font-size: 90%;
1560 }
1561 .cs_files .changes .deleted{
1562 background-color: #FF8888;
1563 float: left;
1564 text-align: center;
1565 font-size: 90%;
1566 }
1549 .cs_files .cs_added {
1567 .cs_files .cs_added {
1550 background:url("../images/icons/page_white_add.png") no-repeat scroll 3px;
1568 background:url("../images/icons/page_white_add.png") no-repeat scroll 3px;
1551 height:16px;
1569 height:16px;
@@ -86,10 +86,16 b''
86 </span>
86 </span>
87 </div>
87 </div>
88 </div>
88 </div>
89 <span style="font-size:1.1em;font-weight: bold">${_('Files affected (%s)' % len(c.changeset.affected_files))}</span>
89 <span style="font-size:1.1em;font-weight: bold">
90 ${_('%s files affected with %s additions and %s deletions.') % (len(c.changeset.affected_files),c.lines_added,c.lines_deleted)}
91 </span>
90 <div class="cs_files">
92 <div class="cs_files">
91 %for change,filenode,diff,cs1,cs2 in c.changes:
93 %for change,filenode,diff,cs1,cs2,stat in c.changes:
92 <div class="cs_${change}">${h.link_to(h.safe_unicode(filenode.path),h.url.current(anchor=h.repo_name_slug('C%s' % h.safe_unicode(filenode.path))))}</div>
94 <div class="cs_${change}">
95 <div class="node">${h.link_to(h.safe_unicode(filenode.path),
96 h.url.current(anchor=h.repo_name_slug('C%s' % h.safe_unicode(filenode.path))))}</div>
97 <div class="changes">${h.fancy_file_stats(stat)}</div>
98 </div>
93 %endfor
99 %endfor
94 % if c.cut_off:
100 % if c.cut_off:
95 ${_('Changeset was to big and was cut off...')}
101 ${_('Changeset was to big and was cut off...')}
@@ -99,7 +105,7 b''
99
105
100 </div>
106 </div>
101
107
102 %for change,filenode,diff,cs1,cs2 in c.changes:
108 %for change,filenode,diff,cs1,cs2,stat in c.changes:
103 %if change !='removed':
109 %if change !='removed':
104 <div style="clear:both;height:10px"></div>
110 <div style="clear:both;height:10px"></div>
105 <div class="diffblock">
111 <div class="diffblock">
General Comments 0
You need to be logged in to leave comments. Login now