##// END OF EJS Templates
commits: skip hidden/obsolete commits (on vcsserver) and display branch when DAG diverges on child/parent links
marcink -
r3852:611dc781 default
parent child Browse files
Show More
@@ -1,350 +1,356 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2
2
3 <%inherit file="/base/base.mako"/>
3 <%inherit file="/base/base.mako"/>
4 <%namespace name="diff_block" file="/changeset/diff_block.mako"/>
4 <%namespace name="diff_block" file="/changeset/diff_block.mako"/>
5
5
6 <%def name="title()">
6 <%def name="title()">
7 ${_('%s Commit') % c.repo_name} - ${h.show_id(c.commit)}
7 ${_('%s Commit') % c.repo_name} - ${h.show_id(c.commit)}
8 %if c.rhodecode_name:
8 %if c.rhodecode_name:
9 &middot; ${h.branding(c.rhodecode_name)}
9 &middot; ${h.branding(c.rhodecode_name)}
10 %endif
10 %endif
11 </%def>
11 </%def>
12
12
13 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
14 ${self.menu_items(active='repositories')}
14 ${self.menu_items(active='repositories')}
15 </%def>
15 </%def>
16
16
17 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
18 ${self.repo_menu(active='commits')}
18 ${self.repo_menu(active='commits')}
19 </%def>
19 </%def>
20
20
21 <%def name="main()">
21 <%def name="main()">
22 <script>
22 <script>
23 // TODO: marcink switch this to pyroutes
23 // TODO: marcink switch this to pyroutes
24 AJAX_COMMENT_DELETE_URL = "${h.route_path('repo_commit_comment_delete',repo_name=c.repo_name,commit_id=c.commit.raw_id,comment_id='__COMMENT_ID__')}";
24 AJAX_COMMENT_DELETE_URL = "${h.route_path('repo_commit_comment_delete',repo_name=c.repo_name,commit_id=c.commit.raw_id,comment_id='__COMMENT_ID__')}";
25 templateContext.commit_data.commit_id = "${c.commit.raw_id}";
25 templateContext.commit_data.commit_id = "${c.commit.raw_id}";
26 </script>
26 </script>
27 <div class="box">
27 <div class="box">
28
28
29 <div id="changeset_compare_view_content" class="summary changeset">
29 <div id="changeset_compare_view_content" class="summary changeset">
30 <div class="summary-detail">
30 <div class="summary-detail">
31 <div class="fieldset">
31 <div class="fieldset">
32 <div class="left-label-summary">
32 <div class="left-label-summary">
33 <p>${_('Commit')}</p>
33 <p>${_('Commit')}</p>
34 <div class="right-label-summary">
34 <div class="right-label-summary">
35 <code>
35 <code>
36 ${h.show_id(c.commit)}
36 ${h.show_id(c.commit)}
37 </code>
37 </code>
38 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.commit.raw_id}" title="${_('Copy the full commit id')}"></i>
38 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.commit.raw_id}" title="${_('Copy the full commit id')}"></i>
39 % if hasattr(c.commit, 'phase'):
39 % if hasattr(c.commit, 'phase'):
40 <span class="tag phase-${c.commit.phase} tooltip" title="${_('Commit phase')}">${c.commit.phase}</span>
40 <span class="tag phase-${c.commit.phase} tooltip" title="${_('Commit phase')}">${c.commit.phase}</span>
41 % endif
41 % endif
42
42
43 ## obsolete commits
43 ## obsolete commits
44 % if hasattr(c.commit, 'obsolete'):
44 % if hasattr(c.commit, 'obsolete'):
45 % if c.commit.obsolete:
45 % if c.commit.obsolete:
46 <span class="tag obsolete-${c.commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
46 <span class="tag obsolete-${c.commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
47 % endif
47 % endif
48 % endif
48 % endif
49
49
50 ## hidden commits
50 ## hidden commits
51 % if hasattr(c.commit, 'hidden'):
51 % if hasattr(c.commit, 'hidden'):
52 % if c.commit.hidden:
52 % if c.commit.hidden:
53 <span class="tag hidden-${c.commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
53 <span class="tag hidden-${c.commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
54 % endif
54 % endif
55 % endif
55 % endif
56
56
57
57
58 <div class="pull-right">
58 <div class="pull-right">
59 <span id="parent_link">
59 <span id="parent_link">
60 <a href="#parentCommit" title="${_('Parent Commit')}"><i class="icon-left icon-no-margin"></i>${_('parent')}</a>
60 <a href="#parentCommit" title="${_('Parent Commit')}"><i class="icon-left icon-no-margin"></i>${_('parent')}</a>
61 </span>
61 </span>
62 |
62 |
63 <span id="child_link">
63 <span id="child_link">
64 <a href="#childCommit" title="${_('Child Commit')}">${_('child')}<i class="icon-right icon-no-margin"></i></a>
64 <a href="#childCommit" title="${_('Child Commit')}">${_('child')}<i class="icon-right icon-no-margin"></i></a>
65 </span>
65 </span>
66 </div>
66 </div>
67
67
68 </div>
68 </div>
69 </div>
69 </div>
70 </div>
70 </div>
71
71
72
72
73
73
74 <div class="fieldset">
74 <div class="fieldset">
75 <div class="left-label-summary">
75 <div class="left-label-summary">
76 <p>${_('Description')}:</p>
76 <p>${_('Description')}:</p>
77 <div class="right-label-summary">
77 <div class="right-label-summary">
78 <div id="trimmed_message_box" class="commit">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div>
78 <div id="trimmed_message_box" class="commit">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div>
79 <div id="message_expand" style="display:none;">
79 <div id="message_expand" style="display:none;">
80 ${_('Expand')}
80 ${_('Expand')}
81 </div>
81 </div>
82 </div>
82 </div>
83 </div>
83 </div>
84 </div>
84 </div>
85
85
86 %if c.statuses:
86 %if c.statuses:
87 <div class="fieldset">
87 <div class="fieldset">
88 <div class="left-label-summary">
88 <div class="left-label-summary">
89 <p>${_('Commit status')}:</p>
89 <p>${_('Commit status')}:</p>
90 <div class="right-label-summary">
90 <div class="right-label-summary">
91 <div class="changeset-status-ico">
91 <div class="changeset-status-ico">
92 <div class="${'flag_status %s' % c.statuses[0]} pull-left"></div>
92 <div class="${'flag_status %s' % c.statuses[0]} pull-left"></div>
93 </div>
93 </div>
94 <div title="${_('Commit status')}" class="changeset-status-lbl">[${h.commit_status_lbl(c.statuses[0])}]</div>
94 <div title="${_('Commit status')}" class="changeset-status-lbl">[${h.commit_status_lbl(c.statuses[0])}]</div>
95 </div>
95 </div>
96 </div>
96 </div>
97 </div>
97 </div>
98 %endif
98 %endif
99
99
100 <div class="fieldset">
100 <div class="fieldset">
101 <div class="left-label-summary">
101 <div class="left-label-summary">
102 <p>${_('References')}:</p>
102 <p>${_('References')}:</p>
103 <div class="right-label-summary">
103 <div class="right-label-summary">
104 <div class="tags">
104 <div class="tags">
105 %if c.commit.merge:
105 %if c.commit.merge:
106 <span class="mergetag tag">
106 <span class="mergetag tag">
107 <i class="icon-merge"></i>${_('merge')}
107 <i class="icon-merge"></i>${_('merge')}
108 </span>
108 </span>
109 %endif
109 %endif
110
110
111 %if h.is_hg(c.rhodecode_repo):
111 %if h.is_hg(c.rhodecode_repo):
112 %for book in c.commit.bookmarks:
112 %for book in c.commit.bookmarks:
113 <span class="booktag tag" title="${h.tooltip(_('Bookmark %s') % book)}">
113 <span class="booktag tag" title="${h.tooltip(_('Bookmark %s') % book)}">
114 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
114 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
115 </span>
115 </span>
116 %endfor
116 %endfor
117 %endif
117 %endif
118
118
119 %for tag in c.commit.tags:
119 %for tag in c.commit.tags:
120 <span class="tagtag tag" title="${h.tooltip(_('Tag %s') % tag)}">
120 <span class="tagtag tag" title="${h.tooltip(_('Tag %s') % tag)}">
121 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=tag))}"><i class="icon-tag"></i>${tag}</a>
121 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=tag))}"><i class="icon-tag"></i>${tag}</a>
122 </span>
122 </span>
123 %endfor
123 %endfor
124
124
125 %if c.commit.branch:
125 %if c.commit.branch:
126 <span class="branchtag tag" title="${h.tooltip(_('Branch %s') % c.commit.branch)}">
126 <span class="branchtag tag" title="${h.tooltip(_('Branch %s') % c.commit.branch)}">
127 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=c.commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(c.commit.branch)}</a>
127 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=c.commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(c.commit.branch)}</a>
128 </span>
128 </span>
129 %endif
129 %endif
130 </div>
130 </div>
131 </div>
131 </div>
132 </div>
132 </div>
133 </div>
133 </div>
134
134
135 <div class="fieldset">
135 <div class="fieldset">
136 <div class="left-label-summary">
136 <div class="left-label-summary">
137 <p>${_('Diff options')}:</p>
137 <p>${_('Diff options')}:</p>
138 <div class="right-label-summary">
138 <div class="right-label-summary">
139 <div class="diff-actions">
139 <div class="diff-actions">
140 <a href="${h.route_path('repo_commit_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Raw diff'))}">
140 <a href="${h.route_path('repo_commit_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Raw diff'))}">
141 ${_('Raw Diff')}
141 ${_('Raw Diff')}
142 </a>
142 </a>
143 |
143 |
144 <a href="${h.route_path('repo_commit_patch',repo_name=c.repo_name,commit_id=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Patch diff'))}">
144 <a href="${h.route_path('repo_commit_patch',repo_name=c.repo_name,commit_id=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Patch diff'))}">
145 ${_('Patch Diff')}
145 ${_('Patch Diff')}
146 </a>
146 </a>
147 |
147 |
148 <a href="${h.route_path('repo_commit_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(diff='download'))}" class="tooltip" title="${h.tooltip(_('Download diff'))}">
148 <a href="${h.route_path('repo_commit_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(diff='download'))}" class="tooltip" title="${h.tooltip(_('Download diff'))}">
149 ${_('Download Diff')}
149 ${_('Download Diff')}
150 </a>
150 </a>
151 </div>
151 </div>
152 </div>
152 </div>
153 </div>
153 </div>
154 </div>
154 </div>
155
155
156 <div class="fieldset">
156 <div class="fieldset">
157 <div class="left-label-summary">
157 <div class="left-label-summary">
158 <p>${_('Comments')}:</p>
158 <p>${_('Comments')}:</p>
159 <div class="right-label-summary">
159 <div class="right-label-summary">
160 <div class="comments-number">
160 <div class="comments-number">
161 %if c.comments:
161 %if c.comments:
162 <a href="#comments">${_ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}</a>,
162 <a href="#comments">${_ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}</a>,
163 %else:
163 %else:
164 ${_ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}
164 ${_ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}
165 %endif
165 %endif
166 %if c.inline_cnt:
166 %if c.inline_cnt:
167 <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a>
167 <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a>
168 %else:
168 %else:
169 ${_ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}
169 ${_ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}
170 %endif
170 %endif
171 </div>
171 </div>
172 </div>
172 </div>
173 </div>
173 </div>
174 </div>
174 </div>
175
175
176 <div class="fieldset">
176 <div class="fieldset">
177 <div class="left-label-summary">
177 <div class="left-label-summary">
178 <p>${_('Unresolved TODOs')}:</p>
178 <p>${_('Unresolved TODOs')}:</p>
179 <div class="right-label-summary">
179 <div class="right-label-summary">
180 <div class="comments-number">
180 <div class="comments-number">
181 % if c.unresolved_comments:
181 % if c.unresolved_comments:
182 % for co in c.unresolved_comments:
182 % for co in c.unresolved_comments:
183 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','}
183 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','}
184 % endfor
184 % endfor
185 % else:
185 % else:
186 ${_('There are no unresolved TODOs')}
186 ${_('There are no unresolved TODOs')}
187 % endif
187 % endif
188 </div>
188 </div>
189 </div>
189 </div>
190 </div>
190 </div>
191 </div>
191 </div>
192
192
193 <div class="fieldset">
193 <div class="fieldset">
194 <div class="left-label-summary">
194 <div class="left-label-summary">
195 <p>${_('Author')}</p>
195 <p>${_('Author')}</p>
196
196
197 <div class="right-label-summary">
197 <div class="right-label-summary">
198 ${self.gravatar_with_user(c.commit.author)}
198 ${self.gravatar_with_user(c.commit.author)}
199 <div class="user-inline-data">- ${h.age_component(c.commit.date)}</div>
199 <div class="user-inline-data">- ${h.age_component(c.commit.date)}</div>
200 </div>
200 </div>
201 </div>
201 </div>
202
202
203 <div class="clear-fix"></div>
203 <div class="clear-fix"></div>
204
204
205 </div> <!-- end summary-detail -->
205 </div> <!-- end summary-detail -->
206 </div> <!-- end summary -->
206 </div> <!-- end summary -->
207 </div>
207 </div>
208 <div class="cs_files">
208 <div class="cs_files">
209 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
209 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
210 ${cbdiffs.render_diffset_menu(c.changes[c.commit.raw_id])}
210 ${cbdiffs.render_diffset_menu(c.changes[c.commit.raw_id])}
211 ${cbdiffs.render_diffset(
211 ${cbdiffs.render_diffset(
212 c.changes[c.commit.raw_id], commit=c.commit, use_comments=True,inline_comments=c.inline_comments )}
212 c.changes[c.commit.raw_id], commit=c.commit, use_comments=True,inline_comments=c.inline_comments )}
213 </div>
213 </div>
214
214
215 ## template for inline comment form
215 ## template for inline comment form
216 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
216 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
217
217
218 ## render comments
218 ## render comments
219 ${comment.generate_comments(c.comments)}
219 ${comment.generate_comments(c.comments)}
220
220
221 ## main comment form and it status
221 ## main comment form and it status
222 ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id=c.commit.raw_id),
222 ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id=c.commit.raw_id),
223 h.commit_status(c.rhodecode_db_repo, c.commit.raw_id))}
223 h.commit_status(c.rhodecode_db_repo, c.commit.raw_id))}
224 </div>
224 </div>
225
225
226 ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS
226 ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS
227 <script type="text/javascript">
227 <script type="text/javascript">
228
228
229 $(document).ready(function() {
229 $(document).ready(function() {
230
230
231 var boxmax = parseInt($('#trimmed_message_box').css('max-height'), 10);
231 var boxmax = parseInt($('#trimmed_message_box').css('max-height'), 10);
232 if($('#trimmed_message_box').height() === boxmax){
232 if($('#trimmed_message_box').height() === boxmax){
233 $('#message_expand').show();
233 $('#message_expand').show();
234 }
234 }
235
235
236 $('#message_expand').on('click', function(e){
236 $('#message_expand').on('click', function(e){
237 $('#trimmed_message_box').css('max-height', 'none');
237 $('#trimmed_message_box').css('max-height', 'none');
238 $(this).hide();
238 $(this).hide();
239 });
239 });
240
240
241 $('.show-inline-comments').on('click', function(e){
241 $('.show-inline-comments').on('click', function(e){
242 var boxid = $(this).attr('data-comment-id');
242 var boxid = $(this).attr('data-comment-id');
243 var button = $(this);
243 var button = $(this);
244
244
245 if(button.hasClass("comments-visible")) {
245 if(button.hasClass("comments-visible")) {
246 $('#{0} .inline-comments'.format(boxid)).each(function(index){
246 $('#{0} .inline-comments'.format(boxid)).each(function(index){
247 $(this).hide();
247 $(this).hide();
248 });
248 });
249 button.removeClass("comments-visible");
249 button.removeClass("comments-visible");
250 } else {
250 } else {
251 $('#{0} .inline-comments'.format(boxid)).each(function(index){
251 $('#{0} .inline-comments'.format(boxid)).each(function(index){
252 $(this).show();
252 $(this).show();
253 });
253 });
254 button.addClass("comments-visible");
254 button.addClass("comments-visible");
255 }
255 }
256 });
256 });
257
257
258
258
259 // next links
259 // next links
260 $('#child_link').on('click', function(e){
260 $('#child_link').on('click', function(e){
261 // fetch via ajax what is going to be the next link, if we have
261 // fetch via ajax what is going to be the next link, if we have
262 // >1 links show them to user to choose
262 // >1 links show them to user to choose
263 if(!$('#child_link').hasClass('disabled')){
263 if(!$('#child_link').hasClass('disabled')){
264 $.ajax({
264 $.ajax({
265 url: '${h.route_path('repo_commit_children',repo_name=c.repo_name, commit_id=c.commit.raw_id)}',
265 url: '${h.route_path('repo_commit_children',repo_name=c.repo_name, commit_id=c.commit.raw_id)}',
266 success: function(data) {
266 success: function(data) {
267 if(data.results.length === 0){
267 if(data.results.length === 0){
268 $('#child_link').html("${_('No Child Commits')}").addClass('disabled');
268 $('#child_link').html("${_('No Child Commits')}").addClass('disabled');
269 }
269 }
270 if(data.results.length === 1){
270 if(data.results.length === 1){
271 var commit = data.results[0];
271 var commit = data.results[0];
272 window.location = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': commit.raw_id});
272 window.location = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': commit.raw_id});
273 }
273 }
274 else if(data.results.length === 2){
274 else if(data.results.length === 2){
275 $('#child_link').addClass('disabled');
275 $('#child_link').addClass('disabled');
276 $('#child_link').addClass('double');
276 $('#child_link').addClass('double');
277
277 var _html = '';
278 var _html = '';
278 _html +='<a title="__title__" href="__url__">__rev__</a> '
279 _html +='<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a> '
280 .replace('__branch__', data.results[0].branch)
279 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
281 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
280 .replace('__title__', data.results[0].message)
282 .replace('__title__', data.results[0].message)
281 .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[0].raw_id}));
283 .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[0].raw_id}));
282 _html +=' | ';
284 _html +=' | ';
283 _html +='<a title="__title__" href="__url__">__rev__</a> '
285 _html +='<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a> '
286 .replace('__branch__', data.results[1].branch)
284 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
287 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
285 .replace('__title__', data.results[1].message)
288 .replace('__title__', data.results[1].message)
286 .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[1].raw_id}));
289 .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[1].raw_id}));
287 $('#child_link').html(_html);
290 $('#child_link').html(_html);
288 }
291 }
289 }
292 }
290 });
293 });
291 e.preventDefault();
294 e.preventDefault();
292 }
295 }
293 });
296 });
294
297
295 // prev links
298 // prev links
296 $('#parent_link').on('click', function(e){
299 $('#parent_link').on('click', function(e){
297 // fetch via ajax what is going to be the next link, if we have
300 // fetch via ajax what is going to be the next link, if we have
298 // >1 links show them to user to choose
301 // >1 links show them to user to choose
299 if(!$('#parent_link').hasClass('disabled')){
302 if(!$('#parent_link').hasClass('disabled')){
300 $.ajax({
303 $.ajax({
301 url: '${h.route_path("repo_commit_parents",repo_name=c.repo_name, commit_id=c.commit.raw_id)}',
304 url: '${h.route_path("repo_commit_parents",repo_name=c.repo_name, commit_id=c.commit.raw_id)}',
302 success: function(data) {
305 success: function(data) {
303 if(data.results.length === 0){
306 if(data.results.length === 0){
304 $('#parent_link').html('${_('No Parent Commits')}').addClass('disabled');
307 $('#parent_link').html('${_('No Parent Commits')}').addClass('disabled');
305 }
308 }
306 if(data.results.length === 1){
309 if(data.results.length === 1){
307 var commit = data.results[0];
310 var commit = data.results[0];
308 window.location = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': commit.raw_id});
311 window.location = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': commit.raw_id});
309 }
312 }
310 else if(data.results.length === 2){
313 else if(data.results.length === 2){
311 $('#parent_link').addClass('disabled');
314 $('#parent_link').addClass('disabled');
312 $('#parent_link').addClass('double');
315 $('#parent_link').addClass('double');
316
313 var _html = '';
317 var _html = '';
314 _html +='<a title="__title__" href="__url__">Parent __rev__</a>'
318 _html +='<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a>'
319 .replace('__branch__', data.results[0].branch)
315 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
320 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
316 .replace('__title__', data.results[0].message)
321 .replace('__title__', data.results[0].message)
317 .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[0].raw_id}));
322 .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[0].raw_id}));
318 _html +=' | ';
323 _html +=' | ';
319 _html +='<a title="__title__" href="__url__">Parent __rev__</a>'
324 _html +='<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a>'
325 .replace('__branch__', data.results[1].branch)
320 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
326 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
321 .replace('__title__', data.results[1].message)
327 .replace('__title__', data.results[1].message)
322 .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[1].raw_id}));
328 .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[1].raw_id}));
323 $('#parent_link').html(_html);
329 $('#parent_link').html(_html);
324 }
330 }
325 }
331 }
326 });
332 });
327 e.preventDefault();
333 e.preventDefault();
328 }
334 }
329 });
335 });
330
336
331 if (location.hash) {
337 if (location.hash) {
332 var result = splitDelimitedHash(location.hash);
338 var result = splitDelimitedHash(location.hash);
333 var line = $('html').find(result.loc);
339 var line = $('html').find(result.loc);
334 if (line.length > 0){
340 if (line.length > 0){
335 offsetScroll(line, 70);
341 offsetScroll(line, 70);
336 }
342 }
337 }
343 }
338
344
339 // browse tree @ revision
345 // browse tree @ revision
340 $('#files_link').on('click', function(e){
346 $('#files_link').on('click', function(e){
341 window.location = '${h.route_path('repo_files:default_path',repo_name=c.repo_name, commit_id=c.commit.raw_id)}';
347 window.location = '${h.route_path('repo_files:default_path',repo_name=c.repo_name, commit_id=c.commit.raw_id)}';
342 e.preventDefault();
348 e.preventDefault();
343 });
349 });
344
350
345 // inject comments into their proper positions
351 // inject comments into their proper positions
346 var file_comments = $('.inline-comment-placeholder');
352 var file_comments = $('.inline-comment-placeholder');
347 })
353 })
348 </script>
354 </script>
349
355
350 </%def>
356 </%def>
General Comments 0
You need to be logged in to leave comments. Login now