Show More
@@ -102,9 +102,14 b' class CompareController(BaseRepoControll' | |||
|
102 | 102 | log.error('Could not found repo %s or %s' % (org_repo, other_repo)) |
|
103 | 103 | raise HTTPNotFound |
|
104 | 104 | |
|
105 | if c.org_repo.scm_instance.alias != 'hg': | |
|
106 |
log.error(' |
|
|
105 | if c.org_repo != c.other_repo and h.is_git(c.rhodecode_repo): | |
|
106 | log.error('compare of two remote repos not available for GIT REPOS') | |
|
107 | 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 | 113 | partial = request.environ.get('HTTP_X_PARTIAL_XHR') |
|
109 | 114 | self.__get_cs_or_redirect(rev=org_ref, repo=org_repo, partial=partial) |
|
110 | 115 | self.__get_cs_or_redirect(rev=other_ref, repo=other_repo, partial=partial) |
@@ -99,8 +99,8 b' class ForksController(BaseRepoController' | |||
|
99 | 99 | c.repo_last_rev) * 100) |
|
100 | 100 | |
|
101 | 101 | defaults = RepoModel()._get_defaults(repo_name) |
|
102 |
# add |
|
|
103 |
defaults['repo_name'] = 'fork |
|
|
102 | # add suffix to fork | |
|
103 | defaults['repo_name'] = '%s-fork' % defaults['repo_name'] | |
|
104 | 104 | return defaults |
|
105 | 105 | |
|
106 | 106 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
@@ -720,13 +720,21 b' def differ(org_repo, org_ref, other_repo' | |||
|
720 | 720 | bundlerepo = None |
|
721 | 721 | ignore_whitespace = ignore_whitespace |
|
722 | 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 | 725 | other_repo = other_repo.scm_instance._repo |
|
725 | 726 | opts = diffopts(git=True, ignorews=ignore_whitespace, context=context) |
|
726 | 727 | org_ref = org_ref[1] |
|
727 | 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 | 739 | common, incoming, rheads = discovery_data |
|
732 | 740 | other_repo_peer = localrepo.locallegacypeer(other_repo.local()) |
@@ -760,8 +768,4 b' def differ(org_repo, org_ref, other_repo' | |||
|
760 | 768 | node1=org_repo[org_ref].node(), |
|
761 | 769 | node2=other_repo[other_ref].node(), |
|
762 | 770 | opts=opts)) |
|
763 | else: | |
|
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)) | |
|
771 |
@@ -26,6 +26,7 b'' | |||
|
26 | 26 | import logging |
|
27 | 27 | import binascii |
|
28 | 28 | import datetime |
|
29 | import re | |
|
29 | 30 | |
|
30 | 31 | from pylons.i18n.translation import _ |
|
31 | 32 | |
@@ -144,7 +145,7 b' class PullRequestModel(BaseModel):' | |||
|
144 | 145 | pull_request.updated_on = datetime.datetime.now() |
|
145 | 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 | 149 | discovery_data): |
|
149 | 150 | """ |
|
150 | 151 | Returns a list of changesets that are incoming from org_repo@org_ref |
@@ -173,23 +174,33 b' class PullRequestModel(BaseModel):' | |||
|
173 | 174 | for cs in reversed(map(binascii.hexlify, revs)): |
|
174 | 175 | changesets.append(org_repo.get_changeset(cs)) |
|
175 | 176 | else: |
|
176 | _revset_predicates = { | |
|
177 | 'branch': 'branch', | |
|
178 | 'book': 'bookmark', | |
|
179 |
' |
|
|
180 |
' |
|
|
181 | } | |
|
177 | #no remote compare do it on the same repository | |
|
178 | if alias == 'hg': | |
|
179 | _revset_predicates = { | |
|
180 | 'branch': 'branch', | |
|
181 | 'book': 'bookmark', | |
|
182 | 'tag': 'tag', | |
|
183 | 'rev': 'id', | |
|
184 | } | |
|
182 | 185 | |
|
183 | revs = [ | |
|
184 | "ancestors(%s('%s')) and not ancestors(%s('%s'))" % ( | |
|
185 | _revset_predicates[org_ref[0]], org_ref[1], | |
|
186 | _revset_predicates[other_ref[0]], other_ref[1] | |
|
187 | ) | |
|
188 | ] | |
|
186 | revs = [ | |
|
187 | "ancestors(%s('%s')) and not ancestors(%s('%s'))" % ( | |
|
188 | _revset_predicates[org_ref[0]], org_ref[1], | |
|
189 | _revset_predicates[other_ref[0]], other_ref[1] | |
|
190 | ) | |
|
191 | ] | |
|
189 | 192 | |
|
190 | out = scmutil.revrange(org_repo._repo, revs) | |
|
191 | for cs in reversed(out): | |
|
192 | changesets.append(org_repo.get_changeset(cs)) | |
|
193 | out = scmutil.revrange(org_repo._repo, revs) | |
|
194 | for cs in reversed(out): | |
|
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 | 205 | return changesets |
|
195 | 206 | |
@@ -231,7 +242,8 b' class PullRequestModel(BaseModel):' | |||
|
231 | 242 | |
|
232 | 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 | 248 | :param org_repo: |
|
237 | 249 | :type org_repo: |
@@ -249,14 +261,17 b' class PullRequestModel(BaseModel):' | |||
|
249 | 261 | if len(other_ref) != 2 or not isinstance(org_ref, (list, tuple)): |
|
250 | 262 | raise Exception('other_ref must be a two element list/tuple') |
|
251 | 263 | |
|
252 |
|
|
|
253 | org_ref, | |
|
254 | other_repo.scm_instance, | |
|
255 | other_ref) | |
|
256 | cs_ranges = self._get_changesets(org_repo.scm_instance, | |
|
257 | org_ref, | |
|
258 | other_repo.scm_instance, | |
|
259 |
other_ref |
|
|
264 | org_repo_scm = org_repo.scm_instance | |
|
265 | other_repo_scm = other_repo.scm_instance | |
|
266 | ||
|
267 | alias = org_repo.scm_instance.alias | |
|
268 | discovery_data = [None, None, None] | |
|
269 | if alias == 'hg': | |
|
270 | discovery_data = self._get_discovery(org_repo_scm, org_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 | 275 | discovery_data) |
|
261 | 276 | |
|
262 | 277 | return cs_ranges, discovery_data |
@@ -44,8 +44,7 b" YUE.on('compare_branches','click',functi" | |||
|
44 | 44 | .replace('__OTHER__',other.value); |
|
45 | 45 | window.location=u; |
|
46 | 46 | } |
|
47 | ||
|
48 | }) | |
|
47 | }); | |
|
49 | 48 |
|
|
50 | 49 | var myColumnDefs = [ |
|
51 | 50 | {key:"name",label:"${_('Name')}",sortable:true}, |
@@ -3,11 +3,11 b'' | |||
|
3 | 3 | <table id="branches_data"> |
|
4 | 4 | <thead> |
|
5 | 5 | <tr> |
|
6 |
<th class="left">${_(' |
|
|
7 |
<th class="left">${_(' |
|
|
8 |
<th class="left">${_(' |
|
|
9 |
<th class="left">${_(' |
|
|
10 |
<th class="left">${_(' |
|
|
6 | <th class="left">${_('Name')}</th> | |
|
7 | <th class="left">${_('Date')}</th> | |
|
8 | <th class="left">${_('Author')}</th> | |
|
9 | <th class="left">${_('Revision')}</th> | |
|
10 | <th class="left">${_('Compare')}</th> | |
|
11 | 11 | </tr> |
|
12 | 12 | </thead> |
|
13 | 13 | %for cnt,branch in enumerate(c.repo_branches.items()): |
@@ -37,7 +37,7 b'' | |||
|
37 | 37 | <a href="#" class="ui-btn small" id="rev_range_clear" style="display:none">${_('Clear selection')}</a> |
|
38 | 38 | |
|
39 | 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 | 41 | %endif |
|
42 | 42 | %if h.is_hg(c.rhodecode_repo): |
|
43 | 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 | 25 | ${self.breadcrumbs()} |
|
26 | 26 | </div> |
|
27 | 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 | 31 | <div class="table"> |
|
29 | 32 | <%include file='tags_data.html'/> |
|
30 | 33 | </div> |
|
31 | 34 | </div> |
|
32 | 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 | 49 | // main table sorting |
|
35 | 50 | var myColumnDefs = [ |
@@ -39,6 +54,7 b' var myColumnDefs = [' | |||
|
39 | 54 | {key:"author",label:"${_('Author')}",sortable:true}, |
|
40 | 55 | {key:"revision",label:"${_('Revision')}",sortable:true, |
|
41 | 56 | sortOptions: { sortFunction: revisionSort }}, |
|
57 | {key:"compare",label:"${_('Compare')}",sortable:false,}, | |
|
42 | 58 | ]; |
|
43 | 59 | |
|
44 | 60 | var myDataSource = new YAHOO.util.DataSource(YUD.get("tags_data")); |
@@ -51,6 +67,7 b' myDataSource.responseSchema = {' | |||
|
51 | 67 | {key:"date"}, |
|
52 | 68 | {key:"author"}, |
|
53 | 69 | {key:"revision"}, |
|
70 | {key:"compare"}, | |
|
54 | 71 | ] |
|
55 | 72 | }; |
|
56 | 73 |
@@ -7,6 +7,7 b'' | |||
|
7 | 7 | <th class="left">${_('Date')}</th> |
|
8 | 8 | <th class="left">${_('Author')}</th> |
|
9 | 9 | <th class="left">${_('Revision')}</th> |
|
10 | <th class="left">${_('Compare')}</th> | |
|
10 | 11 | </tr> |
|
11 | 12 | </thead> |
|
12 | 13 | %for cnt,tag in enumerate(c.repo_tags.items()): |
@@ -25,6 +26,10 b'' | |||
|
25 | 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 | 27 | </div> |
|
27 | 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 | 33 | </tr> |
|
29 | 34 | %endfor |
|
30 | 35 | </table> |
General Comments 0
You need to be logged in to leave comments.
Login now