Show More
@@ -102,9 +102,14 b' class CompareController(BaseRepoControll' | |||||
102 | log.error('Could not found repo %s or %s' % (org_repo, other_repo)) |
|
102 | log.error('Could not found repo %s or %s' % (org_repo, other_repo)) | |
103 | raise HTTPNotFound |
|
103 | raise HTTPNotFound | |
104 |
|
104 | |||
105 | if c.org_repo.scm_instance.alias != 'hg': |
|
105 | if c.org_repo != c.other_repo and h.is_git(c.rhodecode_repo): | |
106 |
log.error(' |
|
106 | log.error('compare of two remote repos not available for GIT REPOS') | |
107 | raise HTTPNotFound |
|
107 | raise HTTPNotFound | |
|
108 | ||||
|
109 | if c.org_repo.scm_instance.alias != c.other_repo.scm_instance.alias: | |||
|
110 | log.error('compare of two different kind of remote repos not available') | |||
|
111 | raise HTTPNotFound | |||
|
112 | ||||
108 | partial = request.environ.get('HTTP_X_PARTIAL_XHR') |
|
113 | partial = request.environ.get('HTTP_X_PARTIAL_XHR') | |
109 | self.__get_cs_or_redirect(rev=org_ref, repo=org_repo, partial=partial) |
|
114 | self.__get_cs_or_redirect(rev=org_ref, repo=org_repo, partial=partial) | |
110 | self.__get_cs_or_redirect(rev=other_ref, repo=other_repo, partial=partial) |
|
115 | self.__get_cs_or_redirect(rev=other_ref, repo=other_repo, partial=partial) |
@@ -99,8 +99,8 b' class ForksController(BaseRepoController' | |||||
99 | c.repo_last_rev) * 100) |
|
99 | c.repo_last_rev) * 100) | |
100 |
|
100 | |||
101 | defaults = RepoModel()._get_defaults(repo_name) |
|
101 | defaults = RepoModel()._get_defaults(repo_name) | |
102 |
# add |
|
102 | # add suffix to fork | |
103 |
defaults['repo_name'] = 'fork |
|
103 | defaults['repo_name'] = '%s-fork' % defaults['repo_name'] | |
104 | return defaults |
|
104 | return defaults | |
105 |
|
105 | |||
106 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
106 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
@@ -720,13 +720,21 b' def differ(org_repo, org_ref, other_repo' | |||||
720 | bundlerepo = None |
|
720 | bundlerepo = None | |
721 | ignore_whitespace = ignore_whitespace |
|
721 | ignore_whitespace = ignore_whitespace | |
722 | context = context |
|
722 | context = context | |
723 |
org_repo = org_repo.scm_instance |
|
723 | org_repo_scm = org_repo.scm_instance | |
|
724 | org_repo = org_repo_scm._repo | |||
724 | other_repo = other_repo.scm_instance._repo |
|
725 | other_repo = other_repo.scm_instance._repo | |
725 | opts = diffopts(git=True, ignorews=ignore_whitespace, context=context) |
|
726 | opts = diffopts(git=True, ignorews=ignore_whitespace, context=context) | |
726 | org_ref = org_ref[1] |
|
727 | org_ref = org_ref[1] | |
727 | other_ref = other_ref[1] |
|
728 | other_ref = other_ref[1] | |
728 |
|
729 | |||
729 |
if org_repo |
|
730 | if org_repo == other_repo: | |
|
731 | log.debug('running diff between %s@%s and %s@%s' | |||
|
732 | % (org_repo, org_ref, other_repo, other_ref)) | |||
|
733 | _diff = org_repo_scm.get_diff(rev1=other_ref, rev2=org_ref, | |||
|
734 | ignore_whitespace=ignore_whitespace, context=context) | |||
|
735 | return _diff | |||
|
736 | ||||
|
737 | elif bundle_compare: | |||
730 |
|
738 | |||
731 | common, incoming, rheads = discovery_data |
|
739 | common, incoming, rheads = discovery_data | |
732 | other_repo_peer = localrepo.locallegacypeer(other_repo.local()) |
|
740 | other_repo_peer = localrepo.locallegacypeer(other_repo.local()) | |
@@ -760,8 +768,4 b' def differ(org_repo, org_ref, other_repo' | |||||
760 | node1=org_repo[org_ref].node(), |
|
768 | node1=org_repo[org_ref].node(), | |
761 | node2=other_repo[other_ref].node(), |
|
769 | node2=other_repo[other_ref].node(), | |
762 | opts=opts)) |
|
770 | opts=opts)) | |
763 | else: |
|
771 | ||
764 | log.debug('running diff between %s@%s and %s@%s' |
|
|||
765 | % (org_repo, org_ref, other_repo, other_ref)) |
|
|||
766 | return ''.join(patch.diff(org_repo, node1=org_ref, node2=other_ref, |
|
|||
767 | opts=opts)) |
|
@@ -26,6 +26,7 b'' | |||||
26 | import logging |
|
26 | import logging | |
27 | import binascii |
|
27 | import binascii | |
28 | import datetime |
|
28 | import datetime | |
|
29 | import re | |||
29 |
|
30 | |||
30 | from pylons.i18n.translation import _ |
|
31 | from pylons.i18n.translation import _ | |
31 |
|
32 | |||
@@ -144,7 +145,7 b' class PullRequestModel(BaseModel):' | |||||
144 | pull_request.updated_on = datetime.datetime.now() |
|
145 | pull_request.updated_on = datetime.datetime.now() | |
145 | self.sa.add(pull_request) |
|
146 | self.sa.add(pull_request) | |
146 |
|
147 | |||
147 | def _get_changesets(self, org_repo, org_ref, other_repo, other_ref, |
|
148 | def _get_changesets(self, alias, org_repo, org_ref, other_repo, other_ref, | |
148 | discovery_data): |
|
149 | discovery_data): | |
149 | """ |
|
150 | """ | |
150 | Returns a list of changesets that are incoming from org_repo@org_ref |
|
151 | Returns a list of changesets that are incoming from org_repo@org_ref | |
@@ -173,6 +174,8 b' class PullRequestModel(BaseModel):' | |||||
173 | for cs in reversed(map(binascii.hexlify, revs)): |
|
174 | for cs in reversed(map(binascii.hexlify, revs)): | |
174 | changesets.append(org_repo.get_changeset(cs)) |
|
175 | changesets.append(org_repo.get_changeset(cs)) | |
175 | else: |
|
176 | else: | |
|
177 | #no remote compare do it on the same repository | |||
|
178 | if alias == 'hg': | |||
176 | _revset_predicates = { |
|
179 | _revset_predicates = { | |
177 | 'branch': 'branch', |
|
180 | 'branch': 'branch', | |
178 | 'book': 'bookmark', |
|
181 | 'book': 'bookmark', | |
@@ -190,6 +193,14 b' class PullRequestModel(BaseModel):' | |||||
190 | out = scmutil.revrange(org_repo._repo, revs) |
|
193 | out = scmutil.revrange(org_repo._repo, revs) | |
191 | for cs in reversed(out): |
|
194 | for cs in reversed(out): | |
192 | changesets.append(org_repo.get_changeset(cs)) |
|
195 | changesets.append(org_repo.get_changeset(cs)) | |
|
196 | elif alias == 'git': | |||
|
197 | so, se = org_repo.run_git_command( | |||
|
198 | 'log --pretty="format: %%H" -s -p %s..%s' % (org_ref[1], | |||
|
199 | other_ref[1]) | |||
|
200 | ) | |||
|
201 | ids = re.findall(r'[0-9a-fA-F]{40}', so) | |||
|
202 | for cs in reversed(ids): | |||
|
203 | changesets.append(org_repo.get_changeset(cs)) | |||
193 |
|
204 | |||
194 | return changesets |
|
205 | return changesets | |
195 |
|
206 | |||
@@ -231,7 +242,8 b' class PullRequestModel(BaseModel):' | |||||
231 |
|
242 | |||
232 | def get_compare_data(self, org_repo, org_ref, other_repo, other_ref): |
|
243 | def get_compare_data(self, org_repo, org_ref, other_repo, other_ref): | |
233 | """ |
|
244 | """ | |
234 | Returns a tuple of incomming changesets, and discoverydata cache |
|
245 | Returns a tuple of incomming changesets, and discoverydata cache for | |
|
246 | mercurial repositories | |||
235 |
|
247 | |||
236 | :param org_repo: |
|
248 | :param org_repo: | |
237 | :type org_repo: |
|
249 | :type org_repo: | |
@@ -249,14 +261,17 b' class PullRequestModel(BaseModel):' | |||||
249 | if len(other_ref) != 2 or not isinstance(org_ref, (list, tuple)): |
|
261 | if len(other_ref) != 2 or not isinstance(org_ref, (list, tuple)): | |
250 | raise Exception('other_ref must be a two element list/tuple') |
|
262 | raise Exception('other_ref must be a two element list/tuple') | |
251 |
|
263 | |||
252 |
|
|
264 | org_repo_scm = org_repo.scm_instance | |
253 | org_ref, |
|
265 | other_repo_scm = other_repo.scm_instance | |
254 | other_repo.scm_instance, |
|
266 | ||
255 | other_ref) |
|
267 | alias = org_repo.scm_instance.alias | |
256 | cs_ranges = self._get_changesets(org_repo.scm_instance, |
|
268 | discovery_data = [None, None, None] | |
257 | org_ref, |
|
269 | if alias == 'hg': | |
258 | other_repo.scm_instance, |
|
270 | discovery_data = self._get_discovery(org_repo_scm, org_ref, | |
259 |
other_ref |
|
271 | other_repo_scm, other_ref) | |
|
272 | cs_ranges = self._get_changesets(alias, | |||
|
273 | org_repo_scm, org_ref, | |||
|
274 | other_repo_scm, other_ref, | |||
260 | discovery_data) |
|
275 | discovery_data) | |
261 |
|
276 | |||
262 | return cs_ranges, discovery_data |
|
277 | return cs_ranges, discovery_data |
@@ -44,8 +44,7 b" YUE.on('compare_branches','click',functi" | |||||
44 | .replace('__OTHER__',other.value); |
|
44 | .replace('__OTHER__',other.value); | |
45 | window.location=u; |
|
45 | window.location=u; | |
46 | } |
|
46 | } | |
47 |
|
47 | }); | ||
48 | }) |
|
|||
49 |
|
|
48 | // main table sorting | |
50 | var myColumnDefs = [ |
|
49 | var myColumnDefs = [ | |
51 | {key:"name",label:"${_('Name')}",sortable:true}, |
|
50 | {key:"name",label:"${_('Name')}",sortable:true}, |
@@ -3,11 +3,11 b'' | |||||
3 | <table id="branches_data"> |
|
3 | <table id="branches_data"> | |
4 | <thead> |
|
4 | <thead> | |
5 | <tr> |
|
5 | <tr> | |
6 |
<th class="left">${_(' |
|
6 | <th class="left">${_('Name')}</th> | |
7 |
<th class="left">${_(' |
|
7 | <th class="left">${_('Date')}</th> | |
8 |
<th class="left">${_(' |
|
8 | <th class="left">${_('Author')}</th> | |
9 |
<th class="left">${_(' |
|
9 | <th class="left">${_('Revision')}</th> | |
10 |
<th class="left">${_(' |
|
10 | <th class="left">${_('Compare')}</th> | |
11 | </tr> |
|
11 | </tr> | |
12 | </thead> |
|
12 | </thead> | |
13 | %for cnt,branch in enumerate(c.repo_branches.items()): |
|
13 | %for cnt,branch in enumerate(c.repo_branches.items()): |
@@ -37,7 +37,7 b'' | |||||
37 | <a href="#" class="ui-btn small" id="rev_range_clear" style="display:none">${_('Clear selection')}</a> |
|
37 | <a href="#" class="ui-btn small" id="rev_range_clear" style="display:none">${_('Clear selection')}</a> | |
38 |
|
38 | |||
39 | %if c.rhodecode_db_repo.fork: |
|
39 | %if c.rhodecode_db_repo.fork: | |
40 | <a title="${_('compare fork with %s' % c.rhodecode_db_repo.fork.repo_name)}" href="${h.url('compare_url',repo_name=c.repo_name,org_ref_type='branch',org_ref=request.GET.get('branch') or 'default',other_ref_type='branch',other_ref='default',repo=c.rhodecode_db_repo.fork.repo_name)}" class="ui-btn small">${_('Compare fork')}</a> |
|
40 | <a title="${_('compare fork with %s' % c.rhodecode_db_repo.fork.repo_name)}" href="${h.url('compare_url',repo_name=c.repo_name,org_ref_type='branch',org_ref=request.GET.get('branch') or 'default',other_ref_type='branch',other_ref='default',repo=c.rhodecode_db_repo.fork.repo_name)}" class="ui-btn small">${_('Compare fork with parent')}</a> | |
41 | %endif |
|
41 | %endif | |
42 | %if h.is_hg(c.rhodecode_repo): |
|
42 | %if h.is_hg(c.rhodecode_repo): | |
43 | <a id="open_new_pr" href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="ui-btn small">${_('Open new pull request')}</a> |
|
43 | <a id="open_new_pr" href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="ui-btn small">${_('Open new pull request')}</a> |
@@ -25,11 +25,26 b'' | |||||
25 | ${self.breadcrumbs()} |
|
25 | ${self.breadcrumbs()} | |
26 | </div> |
|
26 | </div> | |
27 | <!-- end box / title --> |
|
27 | <!-- end box / title --> | |
|
28 | %if c.repo_tags: | |||
|
29 | <div class="info_box" id="compare_tags" style="clear: both;padding: 10px 19px;vertical-align: right;text-align: right;"><a href="#" class="ui-btn small">${_('Compare tags')}</a></div> | |||
|
30 | %endif | |||
28 | <div class="table"> |
|
31 | <div class="table"> | |
29 | <%include file='tags_data.html'/> |
|
32 | <%include file='tags_data.html'/> | |
30 | </div> |
|
33 | </div> | |
31 | </div> |
|
34 | </div> | |
32 | <script type="text/javascript"> |
|
35 | <script type="text/javascript"> | |
|
36 | YUE.on('compare_tags','click',function(e){ | |||
|
37 | YUE.preventDefault(e); | |||
|
38 | var org = YUQ('input[name=compare_org]:checked')[0]; | |||
|
39 | var other = YUQ('input[name=compare_other]:checked')[0]; | |||
|
40 | ||||
|
41 | if(org && other){ | |||
|
42 | var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='tag',org_ref='__ORG__',other_ref_type='tag',other_ref='__OTHER__')}"; | |||
|
43 | var u = compare_url.replace('__ORG__',org.value) | |||
|
44 | .replace('__OTHER__',other.value); | |||
|
45 | window.location=u; | |||
|
46 | } | |||
|
47 | }); | |||
33 |
|
48 | |||
34 | // main table sorting |
|
49 | // main table sorting | |
35 | var myColumnDefs = [ |
|
50 | var myColumnDefs = [ | |
@@ -39,6 +54,7 b' var myColumnDefs = [' | |||||
39 | {key:"author",label:"${_('Author')}",sortable:true}, |
|
54 | {key:"author",label:"${_('Author')}",sortable:true}, | |
40 | {key:"revision",label:"${_('Revision')}",sortable:true, |
|
55 | {key:"revision",label:"${_('Revision')}",sortable:true, | |
41 | sortOptions: { sortFunction: revisionSort }}, |
|
56 | sortOptions: { sortFunction: revisionSort }}, | |
|
57 | {key:"compare",label:"${_('Compare')}",sortable:false,}, | |||
42 | ]; |
|
58 | ]; | |
43 |
|
59 | |||
44 | var myDataSource = new YAHOO.util.DataSource(YUD.get("tags_data")); |
|
60 | var myDataSource = new YAHOO.util.DataSource(YUD.get("tags_data")); | |
@@ -51,6 +67,7 b' myDataSource.responseSchema = {' | |||||
51 | {key:"date"}, |
|
67 | {key:"date"}, | |
52 | {key:"author"}, |
|
68 | {key:"author"}, | |
53 | {key:"revision"}, |
|
69 | {key:"revision"}, | |
|
70 | {key:"compare"}, | |||
54 | ] |
|
71 | ] | |
55 | }; |
|
72 | }; | |
56 |
|
73 |
@@ -7,6 +7,7 b'' | |||||
7 | <th class="left">${_('Date')}</th> |
|
7 | <th class="left">${_('Date')}</th> | |
8 | <th class="left">${_('Author')}</th> |
|
8 | <th class="left">${_('Author')}</th> | |
9 | <th class="left">${_('Revision')}</th> |
|
9 | <th class="left">${_('Revision')}</th> | |
|
10 | <th class="left">${_('Compare')}</th> | |||
10 | </tr> |
|
11 | </tr> | |
11 | </thead> |
|
12 | </thead> | |
12 | %for cnt,tag in enumerate(c.repo_tags.items()): |
|
13 | %for cnt,tag in enumerate(c.repo_tags.items()): | |
@@ -25,6 +26,10 b'' | |||||
25 | <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id)}">r${tag[1].revision}:${h.short_id(tag[1].raw_id)}</a></pre> |
|
26 | <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id)}">r${tag[1].revision}:${h.short_id(tag[1].raw_id)}</a></pre> | |
26 | </div> |
|
27 | </div> | |
27 | </td> |
|
28 | </td> | |
|
29 | <td> | |||
|
30 | <input class="branch-compare" type="radio" name="compare_org" value="${tag[0]}"/> | |||
|
31 | <input class="branch-compare" type="radio" name="compare_other" value="${tag[0]}"/> | |||
|
32 | </td> | |||
28 | </tr> |
|
33 | </tr> | |
29 | %endfor |
|
34 | %endfor | |
30 | </table> |
|
35 | </table> |
General Comments 0
You need to be logged in to leave comments.
Login now