##// END OF EJS Templates
started work on #93 added rev ranges view, checkboxes in changelog to view ranges of changes
marcink -
r977:28524453 beta
parent child Browse files
Show More
@@ -0,0 +1,86 b''
1 <%inherit file="/base/base.html"/>
2
3 <%def name="title()">
4 ${c.repo_name} ${_('Changesets')} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -> r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)} - ${c.rhodecode_name}
5 </%def>
6
7 <%def name="breadcrumbs_links()">
8 ${h.link_to(u'Home',h.url('/'))}
9 &raquo;
10 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
11 &raquo;
12 ${_('Changesets')} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -> r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)}
13 </%def>
14
15 <%def name="page_nav()">
16 ${self.menu('changelog')}
17 </%def>
18
19 <%def name="main()">
20 <div class="box">
21 <!-- box / title -->
22 <div class="title">
23 ${self.breadcrumbs()}
24 </div>
25 <div class="table">
26 <div id="body" class="diffblock">
27 <div class="code-header">
28 <div>
29 ${_('Changesets')} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -> r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)}
30 ##&raquo; <span>${h.link_to(_('raw diff'),
31 ##h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show'))}</span>
32 ##&raquo; <span>${h.link_to(_('download diff'),
33 ##h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download'))}</span>
34 </div>
35 </div>
36 </div>
37 <div id="changeset_content">
38 <div class="container">
39
40 </div>
41 <span style="font-size:1.1em;font-weight: bold">${_('Files affected')}</span>
42 <div class="cs_files">
43 %for cs in c.cs_ranges:
44 ${cs}
45 %for change,filenode,diff,cs1,cs2 in c.changes[cs.raw_id]:
46 <div class="cs_${change}">${h.link_to(filenode.path,h.url.current(anchor=h.repo_name_slug('C%s-%s' % (cs.short_id,filenode.path))))}</div>
47 %endfor
48 %endfor
49 </div>
50 </div>
51
52 </div>
53 %for cs in c.cs_ranges:
54 %for change,filenode,diff,cs1,cs2 in c.changes[cs.raw_id]:
55 %if change !='removed':
56 <div style="clear:both;height:10px"></div>
57 <div class="diffblock">
58 <div id="${h.repo_name_slug('C%s-%s' % (cs.short_id,filenode.path))}" class="code-header">
59 <div class="changeset_header">
60 <span class="changeset_file">
61 ${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name,
62 revision=filenode.changeset.raw_id,f_path=filenode.path))}
63 </span>
64 %if 1:
65 &raquo; <span>${h.link_to(_('diff'),
66 h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='diff'))}</span>
67 &raquo; <span>${h.link_to(_('raw diff'),
68 h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='raw'))}</span>
69 &raquo; <span>${h.link_to(_('download diff'),
70 h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='download'))}</span>
71 %endif
72 </div>
73 </div>
74 <div class="code-body">
75 %if diff:
76 ${diff|n}
77 %else:
78 ${_('No changes in this file')}
79 %endif
80 </div>
81 </div>
82 %endif
83 %endfor
84 %endfor
85 </div>
86 </%def> No newline at end of file
@@ -3,7 +3,8 b''
3 3 rhodecode.controllers.changeset
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 changeset controller for pylons
6 changeset controller for pylons showoing changes beetween
7 revisions
7 8
8 9 :created_on: Apr 25, 2010
9 10 :author: marcink
@@ -40,6 +41,7 b' from rhodecode.model.scm import ScmModel'
40 41 from vcs.exceptions import RepositoryError, ChangesetError
41 42 from vcs.nodes import FileNode
42 43 from vcs.utils import diffs as differ
44 from vcs.utils.ordered_dict import OrderedDict
43 45
44 46 log = logging.getLogger(__name__)
45 47
@@ -63,25 +65,67 b' class ChangesetController(BaseController'
63 65 </tr>
64 66 </table>''' % str
65 67
68 def get_cs_range(repo, rev_start, rev_end):
69 """
70 Temp fix function until VCS will handle that
71 see issue #48
72 :param rev_start:
73 :param rev_end:
74 """
75
76 start_cs = repo.get_changeset(rev_start)
77 end_cs = repo.get_changeset(rev_end)
78
79 if start_cs.revision >= end_cs.revision:
80 raise Exception('Start cannot be after End')
81
82 yield start_cs
83
84 while 1:
85 next = start_cs.next()
86 yield next
87 start_cs = next
88 if next == end_cs:
89 break
90
91 #======================================================================
92 # REAL CODE BELOW
93 #======================================================================
94 #get ranges of revisions if preset
95 rev_range = revision.split('...')[:2]
96
66 97 try:
67 c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
98 repo = hg_model.get_repo(c.repo_name)
99 if len(rev_range) == 2:
100 rev_start = rev_range[0]
101 rev_end = rev_range[1]
102 rev_ranges = get_cs_range(repo, rev_start, rev_end)
103
104 else:
105 rev_ranges = [repo.get_changeset(revision)]
68 106 except RepositoryError, e:
69 107 log.error(traceback.format_exc())
70 108 h.flash(str(e), category='warning')
71 109 return redirect(url('home'))
72 else:
73 try:
74 c.changeset_old = c.changeset.parents[0]
75 except IndexError:
76 c.changeset_old = None
77 c.changes = []
110
111 c.changes = OrderedDict()
112 c.sum_added = 0
113 c.sum_removed = 0
114
115 c.cs_ranges = list(rev_ranges)
78 116
79 #===================================================================
117 for changeset in c.cs_ranges:
118 c.changes[changeset.raw_id] = []
119 try:
120 changeset_parent = changeset.parents[0]
121 except IndexError:
122 changeset_parent = None
123
124
125 #==================================================================
80 126 # ADDED FILES
81 #===================================================================
82 c.sum_added = 0
83 for node in c.changeset.added:
84
127 #==================================================================
128 for node in changeset.added:
85 129 filenode_old = FileNode(node.path, '', EmptyChangeset())
86 130 if filenode_old.is_binary or node.is_binary:
87 131 diff = wrap_to_table(_('binary file'))
@@ -97,15 +141,14 b' class ChangesetController(BaseController'
97 141
98 142 cs1 = None
99 143 cs2 = node.last_changeset.raw_id
100 c.changes.append(('added', node, diff, cs1, cs2))
144 c.changes[changeset.raw_id].append(('added', node, diff, cs1, cs2))
101 145
102 #===================================================================
146 #==================================================================
103 147 # CHANGED FILES
104 #===================================================================
105 c.sum_removed = 0
106 for node in c.changeset.changed:
148 #==================================================================
149 for node in changeset.changed:
107 150 try:
108 filenode_old = c.changeset_old.get_node(node.path)
151 filenode_old = changeset_parent.get_node(node.path)
109 152 except ChangesetError:
110 153 filenode_old = FileNode(node.path, '', EmptyChangeset())
111 154
@@ -125,15 +168,21 b' class ChangesetController(BaseController'
125 168
126 169 cs1 = filenode_old.last_changeset.raw_id
127 170 cs2 = node.last_changeset.raw_id
128 c.changes.append(('changed', node, diff, cs1, cs2))
171 c.changes[changeset.raw_id].append(('changed', node, diff, cs1, cs2))
129 172
130 #===================================================================
173 #==================================================================
131 174 # REMOVED FILES
132 #===================================================================
133 for node in c.changeset.removed:
134 c.changes.append(('removed', node, None, None, None))
175 #==================================================================
176 for node in changeset.removed:
177 c.changes[changeset.raw_id].append(('removed', node, None, None, None))
135 178
136 return render('changeset/changeset.html')
179 if len(c.cs_ranges) == 1:
180 c.changeset = c.cs_ranges[0]
181 c.changes = c.changes[c.changeset.raw_id]
182
183 return render('changeset/changeset.html')
184 else:
185 return render('changeset/changeset_range.html')
137 186
138 187 def raw_changeset(self, revision):
139 188
@@ -148,9 +197,9 b' class ChangesetController(BaseController'
148 197 return redirect(url('home'))
149 198 else:
150 199 try:
151 c.changeset_old = c.changeset.parents[0]
200 c.changeset_parent = c.changeset.parents[0]
152 201 except IndexError:
153 c.changeset_old = None
202 c.changeset_parent = None
154 203 c.changes = []
155 204
156 205 for node in c.changeset.added:
@@ -166,7 +215,7 b' class ChangesetController(BaseController'
166 215 c.changes.append(('added', node, diff, cs1, cs2))
167 216
168 217 for node in c.changeset.changed:
169 filenode_old = c.changeset_old.get_node(node.path)
218 filenode_old = c.changeset_parent.get_node(node.path)
170 219 if filenode_old.is_binary or node.is_binary:
171 220 diff = _('binary file')
172 221 else:
@@ -1510,7 +1510,9 b' float:left;'
1510 1510 border:1px solid #CCC;
1511 1511 padding:10px;
1512 1512 }
1513
1513 #graph_content #rev_range_container{
1514 padding:10px 0px;
1515 }
1514 1516 #graph_content .container {
1515 1517 border-bottom:1px solid #CCC;
1516 1518 border-left:1px solid #CCC;
@@ -1531,6 +1533,9 b' padding-bottom:5px;'
1531 1533 font-weight:700;
1532 1534 padding-bottom:5px;
1533 1535 }
1536 #graph_content .container .left .date span{
1537 vertical-align: text-top;
1538 }
1534 1539
1535 1540 #graph_content .container .left .message {
1536 1541 font-size:100%;
@@ -32,21 +32,25 b''
32 32 </div>
33 33 <div id="graph_content">
34 34 <div class="container_header">
35
36 ${h.form(h.url.current(),method='get')}
37 <div class="info_box">
38 <span>${_('Show')}:</span>
39 ${h.text('size',size=1,value=c.size)}
40 <span>${_('revisions')}</span>
41 ${h.submit('set',_('set'))}
42 </div>
43 ${h.end_form()}
44
35 ${h.form(h.url.current(),method='get')}
36 <div class="info_box">
37 <span>${_('Show')}:</span>
38 ${h.text('size',size=1,value=c.size)}
39 <span>${_('revisions')}</span>
40 ${h.submit('set',_('set'))}
41
42 </div>
43 ${h.end_form()}
44 <div id="rev_range_container" style="display:none"></div>
45 45 </div>
46
46 47 %for cnt,cs in enumerate(c.pagination):
47 48 <div id="chg_${cnt+1}" class="container">
48 49 <div class="left">
49 <div class="date">${_('commit')} ${cs.revision}: ${h.short_id(cs.raw_id)}@${cs.date}</div>
50 <div class="date">
51 ${h.checkbox(cs.short_id,class_="changeset_range")}
52 <span>${_('commit')} ${cs.revision}: ${h.short_id(cs.raw_id)}@${cs.date}</span>
53 </div>
50 54 <div class="author">
51 55 <div class="gravatar">
52 56 <img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),20)}"/>
@@ -113,6 +117,37 b''
113 117 <script type="text/javascript" src="/js/graph.js"></script>
114 118 <script type="text/javascript">
115 119 YAHOO.util.Event.onDOMReady(function(){
120
121 //Monitor range checkboxes and build a link to changesets
122 //ranges
123 var checkboxes = YUD.getElementsByClassName('changeset_range');
124 var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}";
125 YUE.on(checkboxes,'click',function(e){
126 var checked_checkboxes = [];
127 for (pos in checkboxes){
128 if(checkboxes[pos].checked){
129 checked_checkboxes.push(checkboxes[pos]);
130 }
131 }
132 if(checked_checkboxes.length>1){
133 var rev_end = checked_checkboxes[0].name;
134 var rev_start = checked_checkboxes[checked_checkboxes.length-1].name;
135
136 var url = url_tmpl.replace('__REVRANGE__',
137 rev_start+'...'+rev_end);
138
139 var link = "<a href="+url+">${_('Show selected changes __S -> __E')}</a>"
140 link = link.replace('__S',rev_start);
141 link = link.replace('__E',rev_end);
142 YUD.get('rev_range_container').innerHTML = link;
143 YUD.setStyle('rev_range_container','display','');
144 }
145 else{
146 YUD.setStyle('rev_range_container','display','none');
147
148 }
149 });
150
116 151 function set_canvas() {
117 152 var c = document.getElementById('graph_nodes');
118 153 var t = document.getElementById('graph_content');
@@ -125,7 +160,10 b''
125 160 set_canvas();
126 161 var jsdata = ${c.jsdata|n};
127 162 var r = new BranchRenderer();
128 r.render(jsdata);
163 r.render(jsdata);
164
165
166
129 167 });
130 168 </script>
131 169 %else:
@@ -23,7 +23,7 b''
23 23 ${self.breadcrumbs()}
24 24 </div>
25 25 <div class="table">
26 <div id="body" class="diffblock">
26 <div class="diffblock">
27 27 <div class="code-header">
28 28 <div>
29 29 ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
@@ -81,7 +81,7 b''
81 81 <span style="font-size:1.1em;font-weight: bold">${_('Files affected')}</span>
82 82 <div class="cs_files">
83 83 %for change,filenode,diff,cs1,cs2 in c.changes:
84 <div class="cs_${change}">${h.link_to(filenode.path,h.url.current(anchor='CHANGE-%s'%filenode.path))}</div>
84 <div class="cs_${change}">${h.link_to(filenode.path,h.url.current(anchor=h.repo_name_slug('C%s' % filenode.path)))}</div>
85 85 %endfor
86 86 </div>
87 87 </div>
@@ -91,8 +91,8 b''
91 91 %for change,filenode,diff,cs1,cs2 in c.changes:
92 92 %if change !='removed':
93 93 <div style="clear:both;height:10px"></div>
94 <div id="body" class="diffblock">
95 <div id="${'CHANGE-%s'%filenode.path}" class="code-header">
94 <div class="diffblock">
95 <div id="${h.repo_name_slug('C%s' % filenode.path)}" class="code-header">
96 96 <div class="changeset_header">
97 97 <span class="changeset_file">
98 98 ${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name,
@@ -118,7 +118,5 b''
118 118 </div>
119 119 %endif
120 120 %endfor
121 </div>
122 </div>
123
121 </div>
124 122 </%def> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now