##// END OF EJS Templates
pullrequests: use shared changelog_table implementation...
Mads Kiilerich -
r6775:00905ed0 default
parent child Browse files
Show More
@@ -1,120 +1,137 b''
1 ## Render changelog table with id 'changesets' with the range of changesets,
1 ## Render changelog table with id 'changesets' with the range of changesets,
2 ## statuses, and comments.
2 ## statuses, and comments.
3 ## Optionally, pass a js snippet to run whenever a table resize is triggered.
3 ## Optionally, pass a js snippet to run whenever a table resize is triggered.
4 <%def name="changelog(repo_name, cs_range, cs_statuses, cs_comments, show_checkbox=False, show_branch=True, resize_js='')">
4 <%def name="changelog(repo_name, cs_range, cs_statuses, cs_comments, show_checkbox=False, show_branch=True, show_index=False, resize_js='')">
5 <% num_cs = len(cs_range) %>
5 <table class="table" id="changesets">
6 <table class="table" id="changesets">
6 <tbody>
7 <tbody>
7 %for cnt,cs in enumerate(cs_range):
8 %for cnt,cs in enumerate(cs_range):
8 <tr id="chg_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 else ''}">
9 <tr id="chg_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 else ''}">
9 %if show_checkbox:
10 %if show_checkbox:
10 <td class="checkbox-column">
11 <td class="checkbox-column">
11 ${h.checkbox(cs.raw_id,class_="changeset_range")}
12 ${h.checkbox(cs.raw_id,class_="changeset_range")}
12 </td>
13 </td>
13 %endif
14 %endif
15 %if show_index:
16 <td class="changeset-logical-index">
17 <%
18 index = num_cs - cnt
19 if index == 1:
20 title = _('First (oldest) changeset in this list')
21 elif index == num_cs:
22 title = _('Last (most recent) changeset in this list')
23 else:
24 title = _('Position in this list of changesets')
25 %>
26 <span data-toggle="tooltip" title="${title}">
27 ${index}
28 </span>
29 </td>
30 %endif
14 <td class="status">
31 <td class="status">
15 %if cs_statuses.get(cs.raw_id):
32 %if cs_statuses.get(cs.raw_id):
16 %if cs_statuses.get(cs.raw_id)[2]:
33 %if cs_statuses.get(cs.raw_id)[2]:
17 <a data-toggle="tooltip"
34 <a data-toggle="tooltip"
18 title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (cs_statuses.get(cs.raw_id)[1], cs_statuses.get(cs.raw_id)[5].username, cs_statuses.get(cs.raw_id)[4])}"
35 title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (cs_statuses.get(cs.raw_id)[1], cs_statuses.get(cs.raw_id)[5].username, cs_statuses.get(cs.raw_id)[4])}"
19 href="${h.url('pullrequest_show',repo_name=cs_statuses.get(cs.raw_id)[3],pull_request_id=cs_statuses.get(cs.raw_id)[2])}">
36 href="${h.url('pullrequest_show',repo_name=cs_statuses.get(cs.raw_id)[3],pull_request_id=cs_statuses.get(cs.raw_id)[2])}">
20 <i class="icon-circle changeset-status-${cs_statuses.get(cs.raw_id)[0]}"></i>
37 <i class="icon-circle changeset-status-${cs_statuses.get(cs.raw_id)[0]}"></i>
21 </a>
38 </a>
22 %else:
39 %else:
23 <a data-toggle="tooltip"
40 <a data-toggle="tooltip"
24 title="${_('Changeset status: %s by %s') % (cs_statuses.get(cs.raw_id)[1], cs_statuses.get(cs.raw_id)[5].username)}"
41 title="${_('Changeset status: %s by %s') % (cs_statuses.get(cs.raw_id)[1], cs_statuses.get(cs.raw_id)[5].username)}"
25 href="${cs_comments[cs.raw_id][0].url()}">
42 href="${cs_comments[cs.raw_id][0].url()}">
26 <i class="icon-circle changeset-status-${cs_statuses.get(cs.raw_id)[0]}"></i>
43 <i class="icon-circle changeset-status-${cs_statuses.get(cs.raw_id)[0]}"></i>
27 </a>
44 </a>
28 %endif
45 %endif
29 %endif
46 %endif
30 </td>
47 </td>
31 <td class="author" data-toggle="tooltip" title="${cs.author}">
48 <td class="author" data-toggle="tooltip" title="${cs.author}">
32 ${h.gravatar(h.email_or_none(cs.author), size=16)}
49 ${h.gravatar(h.email_or_none(cs.author), size=16)}
33 <span class="user">${h.person(cs.author)}</span>
50 <span class="user">${h.person(cs.author)}</span>
34 </td>
51 </td>
35 <td class="hash">
52 <td class="hash">
36 ${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id), class_='changeset_hash')}
53 ${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id), class_='changeset_hash')}
37 </td>
54 </td>
38 <td class="date">
55 <td class="date">
39 <div data-toggle="tooltip" title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div>
56 <div data-toggle="tooltip" title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div>
40 </td>
57 </td>
41 <% message_lines = cs.message.splitlines() %>
58 <% message_lines = cs.message.splitlines() %>
42 %if len(message_lines) > 1:
59 %if len(message_lines) > 1:
43 <td class="expand_commit" title="${_('Expand commit message')}">
60 <td class="expand_commit" title="${_('Expand commit message')}">
44 <i class="icon-align-left"></i>
61 <i class="icon-align-left"></i>
45 </td>
62 </td>
46 %else:
63 %else:
47 <td></td>
64 <td></td>
48 %endif
65 %endif
49 <td class="mid">
66 <td class="mid">
50 <div class="log-container">
67 <div class="log-container">
51 <div class="message">
68 <div class="message">
52 <div class="message-firstline">${h.urlify_text(message_lines[0], c.repo_name,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}</div>
69 <div class="message-firstline">${h.urlify_text(message_lines[0], c.repo_name,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}</div>
53 %if len(message_lines) > 1:
70 %if len(message_lines) > 1:
54 <div class="message-full hidden">${h.urlify_text(cs.message, repo_name)}</div>
71 <div class="message-full hidden">${h.urlify_text(cs.message, repo_name)}</div>
55 %endif
72 %endif
56 </div>
73 </div>
57 <div class="extra-container">
74 <div class="extra-container">
58 %if cs_comments.get(cs.raw_id):
75 %if cs_comments.get(cs.raw_id):
59 <a class="comments-container comments-cnt" href="${cs_comments[cs.raw_id][0].url()}" data-toggle="tooltip" title="${_('%s comments') % len(cs_comments[cs.raw_id])}">
76 <a class="comments-container comments-cnt" href="${cs_comments[cs.raw_id][0].url()}" data-toggle="tooltip" title="${_('%s comments') % len(cs_comments[cs.raw_id])}">
60 ${len(cs_comments[cs.raw_id])}
77 ${len(cs_comments[cs.raw_id])}
61 <i class="icon-comment-discussion"></i>
78 <i class="icon-comment-discussion"></i>
62 </a>
79 </a>
63 %endif
80 %endif
64 %if cs.bumped:
81 %if cs.bumped:
65 <span class="bumpedtag" title="Bumped">
82 <span class="bumpedtag" title="Bumped">
66 Bumped
83 Bumped
67 </span>
84 </span>
68 %endif
85 %endif
69 %if cs.divergent:
86 %if cs.divergent:
70 <span class="divergenttag" title="Divergent">
87 <span class="divergenttag" title="Divergent">
71 Divergent
88 Divergent
72 </span>
89 </span>
73 %endif
90 %endif
74 %if cs.extinct:
91 %if cs.extinct:
75 <span class="extincttag" title="Extinct">
92 <span class="extincttag" title="Extinct">
76 Extinct
93 Extinct
77 </span>
94 </span>
78 %endif
95 %endif
79 %if cs.unstable:
96 %if cs.unstable:
80 <span class="unstabletag" title="Unstable">
97 <span class="unstabletag" title="Unstable">
81 Unstable
98 Unstable
82 </span>
99 </span>
83 %endif
100 %endif
84 %if cs.phase:
101 %if cs.phase:
85 <span class="phasetag" title="Phase">
102 <span class="phasetag" title="Phase">
86 ${cs.phase}
103 ${cs.phase}
87 </span>
104 </span>
88 %endif
105 %endif
89 %for book in cs.bookmarks:
106 %for book in cs.bookmarks:
90 <span class="booktag" title="${_('Bookmark %s') % book}">
107 <span class="booktag" title="${_('Bookmark %s') % book}">
91 ${h.link_to(book,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}
108 ${h.link_to(book,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}
92 </span>
109 </span>
93 %endfor
110 %endfor
94 %for tag in cs.tags:
111 %for tag in cs.tags:
95 <span class="tagtag" title="${_('Tag %s') % tag}">
112 <span class="tagtag" title="${_('Tag %s') % tag}">
96 ${h.link_to(tag,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}
113 ${h.link_to(tag,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}
97 </span>
114 </span>
98 %endfor
115 %endfor
99 %if show_branch and cs.branch:
116 %if show_branch and cs.branch:
100 <span class="branchtag" title="${_('Branch %s' % cs.branch)}">
117 <span class="branchtag" title="${_('Branch %s' % cs.branch)}">
101 ${h.link_to(cs.branch,h.url('changelog_home',repo_name=repo_name,branch=cs.branch))}
118 ${h.link_to(cs.branch,h.url('changelog_home',repo_name=repo_name,branch=cs.branch))}
102 </span>
119 </span>
103 %endif
120 %endif
104 </div>
121 </div>
105 </div>
122 </div>
106 </td>
123 </td>
107 </tr>
124 </tr>
108 %endfor
125 %endfor
109 </tbody>
126 </tbody>
110 </table>
127 </table>
111
128
112 <script type="text/javascript">
129 <script type="text/javascript">
113 $(document).ready(function() {
130 $(document).ready(function() {
114 $('#changesets .expand_commit').on('click',function(e){
131 $('#changesets .expand_commit').on('click',function(e){
115 $(this).next('.mid').find('.message > div').toggleClass('hidden');
132 $(this).next('.mid').find('.message > div').toggleClass('hidden');
116 ${resize_js};
133 ${resize_js};
117 });
134 });
118 });
135 });
119 </script>
136 </script>
120 </%def>
137 </%def>
@@ -1,143 +1,85 b''
1 ## Changesets table !
1 ## Changesets table with graph
2 <%namespace name="changelog_table" file="/changelog/changelog_table.html"/>
2 <div>
3 <div>
3 %if not c.cs_ranges:
4 %if not c.cs_ranges:
4 <span class="empty_data">${_('No changesets')}</span>
5 <span class="empty_data">${_('No changesets')}</span>
5 %else:
6 %else:
6
7
7 %if c.ancestors:
8 %if c.ancestors:
8 <div class="ancestor">
9 <div class="ancestor">
9 %if len(c.ancestors) > 1:
10 %if len(c.ancestors) > 1:
10 <div class="text-danger">
11 <div class="text-danger">
11 ${_('Criss cross merge situation with multiple merge ancestors detected!')}
12 ${_('Criss cross merge situation with multiple merge ancestors detected!')}
12 </div>
13 </div>
13 <div>
14 <div>
14 ${_('Please merge the target branch to your branch before creating a pull request.')}
15 ${_('Please merge the target branch to your branch before creating a pull request.')}
15 </div>
16 </div>
16 %endif
17 %endif
17 <div>
18 <div>
18 ${_('Merge Ancestor')}:
19 ${_('Merge Ancestor')}:
19 %for ancestor in c.ancestors:
20 %for ancestor in c.ancestors:
20 ${h.link_to(h.short_id(ancestor),h.url('changeset_home',repo_name=c.repo_name,revision=ancestor), class_="changeset_hash")}
21 ${h.link_to(h.short_id(ancestor),h.url('changeset_home',repo_name=c.repo_name,revision=ancestor), class_="changeset_hash")}
21 %endfor
22 %endfor
22 </div>
23 </div>
23 </div>
24 </div>
24 %endif
25 %endif
25
26
26 <div id="graph_nodes">
27 <div id="graph_nodes">
27 <canvas id="graph_canvas"></canvas>
28 <canvas id="graph_canvas"></canvas>
28 </div>
29 </div>
29
30
30 <div id="graph_content_pr">
31 <div id="graph_content_pr">
31
32 ${changelog_table.changelog(c.cs_repo.repo_name, list(reversed(c.cs_ranges)), c.cs_statuses, c.cs_comments,
32 <table class="table compare_view_commits">
33 show_index=True,
33 %for cnt, cs in enumerate(reversed(c.cs_ranges)):
34 resize_js='graph.render(jsdata)')}
34 <tr id="chg_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 else ''}">
35 <td>
36 %if cs.raw_id in c.cs_statuses:
37 <i class="icon-circle changeset-status-${c.cs_statuses[cs.raw_id][0]}" title="${_('Changeset status: %s') % c.cs_statuses[cs.raw_id][1]}"></i>
38 %endif
39 %if c.cs_comments.get(cs.raw_id):
40 <div class="comments-container">
41 <div class="comments-cnt" title="${_('Changeset has comments')}">
42 <a href="${c.cs_comments[cs.raw_id][0].url()}">
43 ${len(c.cs_comments[cs.raw_id])}
44 <i class="icon-comment"></i>
45 </a>
46 </div>
47 </div>
48 %endif
49 </td>
50 <td class="changeset-logical-index">
51 <%
52 num_cs = len(c.cs_ranges)
53 index = num_cs - cnt
54 if index == 1:
55 title = _('First (oldest) changeset in this list')
56 elif index == num_cs:
57 title = _('Last (most recent) changeset in this list')
58 else:
59 title = _('Position in this list of changesets')
60 %>
61 <span data-toggle="tooltip" title="${title}">
62 ${index}
63 </span>
64 </td>
65 <td><span data-toggle="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
66 <td class="author">
67 ${h.gravatar(h.email_or_none(cs.author), size=16)}
68 <span data-toggle="tooltip" title="${cs.author}" class="user">${h.person(cs.author)}</span>
69 </td>
70 <td>${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id), class_='changeset_hash')}</td>
71 <td>
72 %if cs.branch:
73 <span class="branchtag">${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.cs_repo.repo_name,branch=cs.branch))}</span>
74 %endif
75 </td>
76 <td class="expand_commit" title="${_('Expand commit message')}">
77 <i class="icon-align-left"></i>
78 </td>
79 <td class="mid">
80 <div class="pull-right">
81 %for tag in cs.tags:
82 <span class="tagtag" title="${_('Tag %s') % tag}">
83 ${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
84 </span>
85 %endfor
86 </div>
87 <div class="message">${h.urlify_text(cs.message, c.repo_name)}</div>
88 </td>
89 </tr>
90 %endfor
91 </table>
92
93 </div>
35 </div>
94
36
95 %if c.is_ajax_preview:
37 %if c.is_ajax_preview:
96 <h5>
38 <h5>
97 ## links should perhaps use ('rev', c.a_rev) instead ...
39 ## links should perhaps use ('rev', c.a_rev) instead ...
98 ${h.link_to(_('Show merge diff'),
40 ${h.link_to(_('Show merge diff'),
99 h.url('compare_url',
41 h.url('compare_url',
100 repo_name=c.a_repo.repo_name,
42 repo_name=c.a_repo.repo_name,
101 org_ref_type=c.a_ref_type, org_ref_name=c.a_ref_name,
43 org_ref_type=c.a_ref_type, org_ref_name=c.a_ref_name,
102 other_repo=c.cs_repo.repo_name,
44 other_repo=c.cs_repo.repo_name,
103 other_ref_type=c.cs_ref_type, other_ref_name=c.cs_ref_name,
45 other_ref_type=c.cs_ref_type, other_ref_name=c.cs_ref_name,
104 merge='1')
46 merge='1')
105 )}
47 )}
106 </h5>
48 </h5>
107 %endif
49 %endif
108 %if c.cs_ranges_org is not None:
50 %if c.cs_ranges_org is not None:
109 ## TODO: list actual changesets?
51 ## TODO: list actual changesets?
110 <div>
52 <div>
111 ${h.link_to_ref(c.cs_repo.repo_name, c.cs_ref_type, c.cs_ref_name, c.cs_rev)}
53 ${h.link_to_ref(c.cs_repo.repo_name, c.cs_ref_type, c.cs_ref_name, c.cs_rev)}
112 ${_('is')}
54 ${_('is')}
113 <a href="${c.swap_url}">${_('%s changesets') % (len(c.cs_ranges_org))}</a>
55 <a href="${c.swap_url}">${_('%s changesets') % (len(c.cs_ranges_org))}</a>
114 ${_('behind')}
56 ${_('behind')}
115 ${h.link_to_ref(c.a_repo.repo_name, c.a_ref_type, c.a_ref_name)}
57 ${h.link_to_ref(c.a_repo.repo_name, c.a_ref_type, c.a_ref_name)}
116 </div>
58 </div>
117 %endif
59 %endif
118 %endif
60 %endif
119 </div>
61 </div>
120
62
121 %if c.is_ajax_preview:
63 %if c.is_ajax_preview:
122 <div id="jsdata" style="display:none">${h.js(c.jsdata)}</div>
64 <div id="jsdata" style="display:none">${h.js(c.jsdata)}</div>
123 %else:
65 %else:
124 <script type="text/javascript" src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
66 <script type="text/javascript" src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
125 %endif
67 %endif
126
68
127 <script type="text/javascript">
69 <script type="text/javascript">
128 var jsdata = ${h.js(c.jsdata)};
70 var jsdata = ${h.js(c.jsdata)};
129 var graph = new BranchRenderer('graph_canvas', 'graph_content_pr', 'chg_');
71 var graph = new BranchRenderer('graph_canvas', 'graph_content_pr', 'chg_');
130
72
131 $(document).ready(function(){
73 $(document).ready(function(){
132 graph.render(jsdata);
74 graph.render(jsdata);
133
75
134 $('.expand_commit').click(function(e){
76 $('.expand_commit').click(function(e){
135 $(this).next('.mid').find('.message').toggleClass('expanded');
77 $(this).next('.mid').find('.message').toggleClass('expanded');
136 graph.render(jsdata);
78 graph.render(jsdata);
137 });
79 });
138 });
80 });
139 $(window).resize(function(){
81 $(window).resize(function(){
140 graph.render(jsdata);
82 graph.render(jsdata);
141 });
83 });
142
84
143 </script>
85 </script>
@@ -1,595 +1,595 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 from kallithea.tests.base import *
2 from kallithea.tests.base import *
3 from kallithea.model.repo import RepoModel
3 from kallithea.model.repo import RepoModel
4 from kallithea.model.meta import Session
4 from kallithea.model.meta import Session
5 from kallithea.tests.fixture import Fixture
5 from kallithea.tests.fixture import Fixture
6
6
7 fixture = Fixture()
7 fixture = Fixture()
8
8
9 def _commit_ref(sha, msg):
9 def _commit_ref(repo_name, sha, msg):
10 return '''<div class="message">%s</div>''' % msg
10 return '''<div class="message-firstline"><a class="message-link" href="/%s/changeset/%s">%s</a></div>''' % (repo_name, sha, msg)
11
11
12
12
13 class TestCompareController(TestController):
13 class TestCompareController(TestController):
14
14
15 def setup_method(self, method):
15 def setup_method(self, method):
16 self.r1_id = None
16 self.r1_id = None
17 self.r2_id = None
17 self.r2_id = None
18
18
19 def teardown_method(self, method):
19 def teardown_method(self, method):
20 if self.r2_id:
20 if self.r2_id:
21 RepoModel().delete(self.r2_id)
21 RepoModel().delete(self.r2_id)
22 if self.r1_id:
22 if self.r1_id:
23 RepoModel().delete(self.r1_id)
23 RepoModel().delete(self.r1_id)
24 Session().commit()
24 Session().commit()
25 Session.remove()
25 Session.remove()
26
26
27 def test_compare_forks_on_branch_extra_commits_hg(self):
27 def test_compare_forks_on_branch_extra_commits_hg(self):
28 self.log_user()
28 self.log_user()
29 repo1 = fixture.create_repo(u'one', repo_type='hg',
29 repo1 = fixture.create_repo(u'one', repo_type='hg',
30 repo_description='diff-test',
30 repo_description='diff-test',
31 cur_user=TEST_USER_ADMIN_LOGIN)
31 cur_user=TEST_USER_ADMIN_LOGIN)
32 self.r1_id = repo1.repo_id
32 self.r1_id = repo1.repo_id
33 #commit something !
33 #commit something !
34 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
34 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
35 content='line1\n', message='commit1', vcs_type='hg',
35 content='line1\n', message='commit1', vcs_type='hg',
36 parent=None, newfile=True)
36 parent=None, newfile=True)
37
37
38 #fork this repo
38 #fork this repo
39 repo2 = fixture.create_fork(u'one', u'one-fork')
39 repo2 = fixture.create_fork(u'one', u'one-fork')
40 self.r2_id = repo2.repo_id
40 self.r2_id = repo2.repo_id
41
41
42 #add two extra commit into fork
42 #add two extra commit into fork
43 cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
43 cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
44 content='line1\nline2\n', message='commit2', vcs_type='hg',
44 content='line1\nline2\n', message='commit2', vcs_type='hg',
45 parent=cs0)
45 parent=cs0)
46
46
47 cs2 = fixture.commit_change(repo2.repo_name, filename='file1',
47 cs2 = fixture.commit_change(repo2.repo_name, filename='file1',
48 content='line1\nline2\nline3\n', message='commit3',
48 content='line1\nline2\nline3\n', message='commit3',
49 vcs_type='hg', parent=cs1)
49 vcs_type='hg', parent=cs1)
50
50
51 rev1 = 'default'
51 rev1 = 'default'
52 rev2 = 'default'
52 rev2 = 'default'
53
53
54 response = self.app.get(url('compare_url',
54 response = self.app.get(url('compare_url',
55 repo_name=repo1.repo_name,
55 repo_name=repo1.repo_name,
56 org_ref_type="branch",
56 org_ref_type="branch",
57 org_ref_name=rev2,
57 org_ref_name=rev2,
58 other_repo=repo2.repo_name,
58 other_repo=repo2.repo_name,
59 other_ref_type="branch",
59 other_ref_type="branch",
60 other_ref_name=rev1,
60 other_ref_name=rev1,
61 merge='1',))
61 merge='1',))
62
62
63 response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
63 response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
64 response.mustcontain('%s@%s' % (repo2.repo_name, rev1))
64 response.mustcontain('%s@%s' % (repo2.repo_name, rev1))
65 response.mustcontain("""Showing 2 commits""")
65 response.mustcontain("""Showing 2 commits""")
66 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
66 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
67
67
68 response.mustcontain(_commit_ref(cs1.raw_id, 'commit2'))
68 response.mustcontain(_commit_ref(repo2.repo_name, cs1.raw_id, 'commit2'))
69 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
69 response.mustcontain(_commit_ref(repo2.repo_name, cs2.raw_id, 'commit3'))
70
70
71 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
71 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
72 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
72 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
73 ## files
73 ## files
74 response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
74 response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
75 #swap
75 #swap
76 response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
76 response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
77
77
78 def test_compare_forks_on_branch_extra_commits_git(self):
78 def test_compare_forks_on_branch_extra_commits_git(self):
79 self.log_user()
79 self.log_user()
80 repo1 = fixture.create_repo(u'one-git', repo_type='git',
80 repo1 = fixture.create_repo(u'one-git', repo_type='git',
81 repo_description='diff-test',
81 repo_description='diff-test',
82 cur_user=TEST_USER_ADMIN_LOGIN)
82 cur_user=TEST_USER_ADMIN_LOGIN)
83 self.r1_id = repo1.repo_id
83 self.r1_id = repo1.repo_id
84 #commit something !
84 #commit something !
85 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
85 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
86 content='line1\n', message='commit1', vcs_type='git',
86 content='line1\n', message='commit1', vcs_type='git',
87 parent=None, newfile=True)
87 parent=None, newfile=True)
88
88
89 #fork this repo
89 #fork this repo
90 repo2 = fixture.create_fork(u'one-git', u'one-git-fork')
90 repo2 = fixture.create_fork(u'one-git', u'one-git-fork')
91 self.r2_id = repo2.repo_id
91 self.r2_id = repo2.repo_id
92
92
93 #add two extra commit into fork
93 #add two extra commit into fork
94 cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
94 cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
95 content='line1\nline2\n', message='commit2', vcs_type='git',
95 content='line1\nline2\n', message='commit2', vcs_type='git',
96 parent=cs0)
96 parent=cs0)
97
97
98 cs2 = fixture.commit_change(repo2.repo_name, filename='file1',
98 cs2 = fixture.commit_change(repo2.repo_name, filename='file1',
99 content='line1\nline2\nline3\n', message='commit3',
99 content='line1\nline2\nline3\n', message='commit3',
100 vcs_type='git', parent=cs1)
100 vcs_type='git', parent=cs1)
101
101
102 rev1 = 'master'
102 rev1 = 'master'
103 rev2 = 'master'
103 rev2 = 'master'
104
104
105 response = self.app.get(url('compare_url',
105 response = self.app.get(url('compare_url',
106 repo_name=repo1.repo_name,
106 repo_name=repo1.repo_name,
107 org_ref_type="branch",
107 org_ref_type="branch",
108 org_ref_name=rev2,
108 org_ref_name=rev2,
109 other_repo=repo2.repo_name,
109 other_repo=repo2.repo_name,
110 other_ref_type="branch",
110 other_ref_type="branch",
111 other_ref_name=rev1,
111 other_ref_name=rev1,
112 merge='1',))
112 merge='1',))
113
113
114 response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
114 response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
115 response.mustcontain('%s@%s' % (repo2.repo_name, rev1))
115 response.mustcontain('%s@%s' % (repo2.repo_name, rev1))
116 response.mustcontain("""Showing 2 commits""")
116 response.mustcontain("""Showing 2 commits""")
117 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
117 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
118
118
119 response.mustcontain(_commit_ref(cs1.raw_id, 'commit2'))
119 response.mustcontain(_commit_ref(repo2.repo_name, cs1.raw_id, 'commit2'))
120 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
120 response.mustcontain(_commit_ref(repo2.repo_name, cs2.raw_id, 'commit3'))
121
121
122 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
122 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
123 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
123 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
124 ## files
124 ## files
125 response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
125 response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
126 #swap
126 #swap
127 response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
127 response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
128
128
129 def test_compare_forks_on_branch_extra_commits_origin_has_incoming_hg(self):
129 def test_compare_forks_on_branch_extra_commits_origin_has_incoming_hg(self):
130 self.log_user()
130 self.log_user()
131
131
132 repo1 = fixture.create_repo(u'one', repo_type='hg',
132 repo1 = fixture.create_repo(u'one', repo_type='hg',
133 repo_description='diff-test',
133 repo_description='diff-test',
134 cur_user=TEST_USER_ADMIN_LOGIN)
134 cur_user=TEST_USER_ADMIN_LOGIN)
135
135
136 self.r1_id = repo1.repo_id
136 self.r1_id = repo1.repo_id
137
137
138 #commit something !
138 #commit something !
139 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
139 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
140 content='line1\n', message='commit1', vcs_type='hg',
140 content='line1\n', message='commit1', vcs_type='hg',
141 parent=None, newfile=True)
141 parent=None, newfile=True)
142
142
143 #fork this repo
143 #fork this repo
144 repo2 = fixture.create_fork(u'one', u'one-fork')
144 repo2 = fixture.create_fork(u'one', u'one-fork')
145 self.r2_id = repo2.repo_id
145 self.r2_id = repo2.repo_id
146
146
147 #now commit something to origin repo
147 #now commit something to origin repo
148 cs1_prim = fixture.commit_change(repo1.repo_name, filename='file2',
148 cs1_prim = fixture.commit_change(repo1.repo_name, filename='file2',
149 content='line1file2\n', message='commit2', vcs_type='hg',
149 content='line1file2\n', message='commit2', vcs_type='hg',
150 parent=cs0, newfile=True)
150 parent=cs0, newfile=True)
151
151
152 #add two extra commit into fork
152 #add two extra commit into fork
153 cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
153 cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
154 content='line1\nline2\n', message='commit2', vcs_type='hg',
154 content='line1\nline2\n', message='commit2', vcs_type='hg',
155 parent=cs0)
155 parent=cs0)
156
156
157 cs2 = fixture.commit_change(repo2.repo_name, filename='file1',
157 cs2 = fixture.commit_change(repo2.repo_name, filename='file1',
158 content='line1\nline2\nline3\n', message='commit3',
158 content='line1\nline2\nline3\n', message='commit3',
159 vcs_type='hg', parent=cs1)
159 vcs_type='hg', parent=cs1)
160
160
161 rev1 = 'default'
161 rev1 = 'default'
162 rev2 = 'default'
162 rev2 = 'default'
163
163
164 response = self.app.get(url('compare_url',
164 response = self.app.get(url('compare_url',
165 repo_name=repo1.repo_name,
165 repo_name=repo1.repo_name,
166 org_ref_type="branch",
166 org_ref_type="branch",
167 org_ref_name=rev2,
167 org_ref_name=rev2,
168 other_repo=repo2.repo_name,
168 other_repo=repo2.repo_name,
169 other_ref_type="branch",
169 other_ref_type="branch",
170 other_ref_name=rev1,
170 other_ref_name=rev1,
171 merge='1',))
171 merge='1',))
172
172
173 response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
173 response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
174 response.mustcontain('%s@%s' % (repo2.repo_name, rev1))
174 response.mustcontain('%s@%s' % (repo2.repo_name, rev1))
175 response.mustcontain("""Showing 2 commits""")
175 response.mustcontain("""Showing 2 commits""")
176 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
176 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
177
177
178 response.mustcontain(_commit_ref(cs1.raw_id, 'commit2'))
178 response.mustcontain(_commit_ref(repo2.repo_name, cs1.raw_id, 'commit2'))
179 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
179 response.mustcontain(_commit_ref(repo2.repo_name, cs2.raw_id, 'commit3'))
180
180
181 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
181 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
182 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
182 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
183 ## files
183 ## files
184 response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
184 response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
185 #swap
185 #swap
186 response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
186 response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
187
187
188 def test_compare_forks_on_branch_extra_commits_origin_has_incoming_git(self):
188 def test_compare_forks_on_branch_extra_commits_origin_has_incoming_git(self):
189 self.log_user()
189 self.log_user()
190
190
191 repo1 = fixture.create_repo(u'one-git', repo_type='git',
191 repo1 = fixture.create_repo(u'one-git', repo_type='git',
192 repo_description='diff-test',
192 repo_description='diff-test',
193 cur_user=TEST_USER_ADMIN_LOGIN)
193 cur_user=TEST_USER_ADMIN_LOGIN)
194
194
195 self.r1_id = repo1.repo_id
195 self.r1_id = repo1.repo_id
196
196
197 #commit something !
197 #commit something !
198 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
198 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
199 content='line1\n', message='commit1', vcs_type='git',
199 content='line1\n', message='commit1', vcs_type='git',
200 parent=None, newfile=True)
200 parent=None, newfile=True)
201
201
202 #fork this repo
202 #fork this repo
203 repo2 = fixture.create_fork(u'one-git', u'one-git-fork')
203 repo2 = fixture.create_fork(u'one-git', u'one-git-fork')
204 self.r2_id = repo2.repo_id
204 self.r2_id = repo2.repo_id
205
205
206 #now commit something to origin repo
206 #now commit something to origin repo
207 cs1_prim = fixture.commit_change(repo1.repo_name, filename='file2',
207 cs1_prim = fixture.commit_change(repo1.repo_name, filename='file2',
208 content='line1file2\n', message='commit2', vcs_type='git',
208 content='line1file2\n', message='commit2', vcs_type='git',
209 parent=cs0, newfile=True)
209 parent=cs0, newfile=True)
210
210
211 #add two extra commit into fork
211 #add two extra commit into fork
212 cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
212 cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
213 content='line1\nline2\n', message='commit2', vcs_type='git',
213 content='line1\nline2\n', message='commit2', vcs_type='git',
214 parent=cs0)
214 parent=cs0)
215
215
216 cs2 = fixture.commit_change(repo2.repo_name, filename='file1',
216 cs2 = fixture.commit_change(repo2.repo_name, filename='file1',
217 content='line1\nline2\nline3\n', message='commit3',
217 content='line1\nline2\nline3\n', message='commit3',
218 vcs_type='git', parent=cs1)
218 vcs_type='git', parent=cs1)
219
219
220 rev1 = 'master'
220 rev1 = 'master'
221 rev2 = 'master'
221 rev2 = 'master'
222
222
223 response = self.app.get(url('compare_url',
223 response = self.app.get(url('compare_url',
224 repo_name=repo1.repo_name,
224 repo_name=repo1.repo_name,
225 org_ref_type="branch",
225 org_ref_type="branch",
226 org_ref_name=rev2,
226 org_ref_name=rev2,
227 other_repo=repo2.repo_name,
227 other_repo=repo2.repo_name,
228 other_ref_type="branch",
228 other_ref_type="branch",
229 other_ref_name=rev1,
229 other_ref_name=rev1,
230 merge='1',))
230 merge='1',))
231
231
232 response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
232 response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
233 response.mustcontain('%s@%s' % (repo2.repo_name, rev1))
233 response.mustcontain('%s@%s' % (repo2.repo_name, rev1))
234 response.mustcontain("""Showing 2 commits""")
234 response.mustcontain("""Showing 2 commits""")
235 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
235 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
236
236
237 response.mustcontain(_commit_ref(cs1.raw_id, 'commit2'))
237 response.mustcontain(_commit_ref(repo2.repo_name, cs1.raw_id, 'commit2'))
238 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
238 response.mustcontain(_commit_ref(repo2.repo_name, cs2.raw_id, 'commit3'))
239
239
240 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
240 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
241 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
241 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
242 ## files
242 ## files
243 response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
243 response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
244 #swap
244 #swap
245 response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
245 response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
246
246
247 def test_compare_cherry_pick_changesets_from_bottom(self):
247 def test_compare_cherry_pick_changesets_from_bottom(self):
248
248
249 # repo1:
249 # repo1:
250 # cs0:
250 # cs0:
251 # cs1:
251 # cs1:
252 # repo1-fork- in which we will cherry pick bottom changesets
252 # repo1-fork- in which we will cherry pick bottom changesets
253 # cs0:
253 # cs0:
254 # cs1:
254 # cs1:
255 # cs2: x
255 # cs2: x
256 # cs3: x
256 # cs3: x
257 # cs4: x
257 # cs4: x
258 # cs5:
258 # cs5:
259 #make repo1, and cs1+cs2
259 #make repo1, and cs1+cs2
260 self.log_user()
260 self.log_user()
261
261
262 repo1 = fixture.create_repo(u'repo1', repo_type='hg',
262 repo1 = fixture.create_repo(u'repo1', repo_type='hg',
263 repo_description='diff-test',
263 repo_description='diff-test',
264 cur_user=TEST_USER_ADMIN_LOGIN)
264 cur_user=TEST_USER_ADMIN_LOGIN)
265 self.r1_id = repo1.repo_id
265 self.r1_id = repo1.repo_id
266
266
267 #commit something !
267 #commit something !
268 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
268 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
269 content='line1\n', message='commit1', vcs_type='hg',
269 content='line1\n', message='commit1', vcs_type='hg',
270 parent=None, newfile=True)
270 parent=None, newfile=True)
271 cs1 = fixture.commit_change(repo1.repo_name, filename='file1',
271 cs1 = fixture.commit_change(repo1.repo_name, filename='file1',
272 content='line1\nline2\n', message='commit2', vcs_type='hg',
272 content='line1\nline2\n', message='commit2', vcs_type='hg',
273 parent=cs0)
273 parent=cs0)
274 #fork this repo
274 #fork this repo
275 repo2 = fixture.create_fork(u'repo1', u'repo1-fork')
275 repo2 = fixture.create_fork(u'repo1', u'repo1-fork')
276 self.r2_id = repo2.repo_id
276 self.r2_id = repo2.repo_id
277 #now make cs3-6
277 #now make cs3-6
278 cs2 = fixture.commit_change(repo1.repo_name, filename='file1',
278 cs2 = fixture.commit_change(repo1.repo_name, filename='file1',
279 content='line1\nline2\nline3\n', message='commit3',
279 content='line1\nline2\nline3\n', message='commit3',
280 vcs_type='hg', parent=cs1)
280 vcs_type='hg', parent=cs1)
281 cs3 = fixture.commit_change(repo1.repo_name, filename='file1',
281 cs3 = fixture.commit_change(repo1.repo_name, filename='file1',
282 content='line1\nline2\nline3\nline4\n', message='commit4',
282 content='line1\nline2\nline3\nline4\n', message='commit4',
283 vcs_type='hg', parent=cs2)
283 vcs_type='hg', parent=cs2)
284 cs4 = fixture.commit_change(repo1.repo_name, filename='file1',
284 cs4 = fixture.commit_change(repo1.repo_name, filename='file1',
285 content='line1\nline2\nline3\nline4\nline5\n',
285 content='line1\nline2\nline3\nline4\nline5\n',
286 message='commit5', vcs_type='hg', parent=cs3)
286 message='commit5', vcs_type='hg', parent=cs3)
287 cs5 = fixture.commit_change(repo1.repo_name, filename='file1',
287 cs5 = fixture.commit_change(repo1.repo_name, filename='file1',
288 content='line1\nline2\nline3\nline4\nline5\nline6\n',
288 content='line1\nline2\nline3\nline4\nline5\nline6\n',
289 message='commit6', vcs_type='hg', parent=cs4)
289 message='commit6', vcs_type='hg', parent=cs4)
290
290
291 response = self.app.get(url('compare_url',
291 response = self.app.get(url('compare_url',
292 repo_name=repo2.repo_name,
292 repo_name=repo2.repo_name,
293 org_ref_type="rev",
293 org_ref_type="rev",
294 org_ref_name=cs1.short_id, # parent of cs2, in repo2
294 org_ref_name=cs1.short_id, # parent of cs2, in repo2
295 other_repo=repo1.repo_name,
295 other_repo=repo1.repo_name,
296 other_ref_type="rev",
296 other_ref_type="rev",
297 other_ref_name=cs4.short_id,
297 other_ref_name=cs4.short_id,
298 merge='True',
298 merge='True',
299 ))
299 ))
300 response.mustcontain('%s@%s' % (repo2.repo_name, cs1.short_id))
300 response.mustcontain('%s@%s' % (repo2.repo_name, cs1.short_id))
301 response.mustcontain('%s@%s' % (repo1.repo_name, cs4.short_id))
301 response.mustcontain('%s@%s' % (repo1.repo_name, cs4.short_id))
302 response.mustcontain("""Showing 3 commits""")
302 response.mustcontain("""Showing 3 commits""")
303 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
303 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
304
304
305 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
305 response.mustcontain(_commit_ref(repo1.repo_name, cs2.raw_id, 'commit3'))
306 response.mustcontain(_commit_ref(cs3.raw_id, 'commit4'))
306 response.mustcontain(_commit_ref(repo1.repo_name, cs3.raw_id, 'commit4'))
307 response.mustcontain(_commit_ref(cs4.raw_id, 'commit5'))
307 response.mustcontain(_commit_ref(repo1.repo_name, cs4.raw_id, 'commit5'))
308
308
309 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo1.repo_name, cs2.raw_id, cs2.short_id))
309 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo1.repo_name, cs2.raw_id, cs2.short_id))
310 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r3:%s</a>""" % (repo1.repo_name, cs3.raw_id, cs3.short_id))
310 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r3:%s</a>""" % (repo1.repo_name, cs3.raw_id, cs3.short_id))
311 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r4:%s</a>""" % (repo1.repo_name, cs4.raw_id, cs4.short_id))
311 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r4:%s</a>""" % (repo1.repo_name, cs4.raw_id, cs4.short_id))
312 ## files
312 ## files
313 response.mustcontain("""#C--826e8142e6ba">file1</a>""")
313 response.mustcontain("""#C--826e8142e6ba">file1</a>""")
314
314
315 def test_compare_cherry_pick_changesets_from_top(self):
315 def test_compare_cherry_pick_changesets_from_top(self):
316 # repo1:
316 # repo1:
317 # cs0:
317 # cs0:
318 # cs1:
318 # cs1:
319 # repo1-fork- in which we will cherry pick bottom changesets
319 # repo1-fork- in which we will cherry pick bottom changesets
320 # cs0:
320 # cs0:
321 # cs1:
321 # cs1:
322 # cs2:
322 # cs2:
323 # cs3: x
323 # cs3: x
324 # cs4: x
324 # cs4: x
325 # cs5: x
325 # cs5: x
326 #
326 #
327 #make repo1, and cs1+cs2
327 #make repo1, and cs1+cs2
328 self.log_user()
328 self.log_user()
329 repo1 = fixture.create_repo(u'repo1', repo_type='hg',
329 repo1 = fixture.create_repo(u'repo1', repo_type='hg',
330 repo_description='diff-test',
330 repo_description='diff-test',
331 cur_user=TEST_USER_ADMIN_LOGIN)
331 cur_user=TEST_USER_ADMIN_LOGIN)
332 self.r1_id = repo1.repo_id
332 self.r1_id = repo1.repo_id
333
333
334 #commit something !
334 #commit something !
335 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
335 cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
336 content='line1\n', message='commit1', vcs_type='hg',
336 content='line1\n', message='commit1', vcs_type='hg',
337 parent=None, newfile=True)
337 parent=None, newfile=True)
338 cs1 = fixture.commit_change(repo1.repo_name, filename='file1',
338 cs1 = fixture.commit_change(repo1.repo_name, filename='file1',
339 content='line1\nline2\n', message='commit2', vcs_type='hg',
339 content='line1\nline2\n', message='commit2', vcs_type='hg',
340 parent=cs0)
340 parent=cs0)
341 #fork this repo
341 #fork this repo
342 repo2 = fixture.create_fork(u'repo1', u'repo1-fork')
342 repo2 = fixture.create_fork(u'repo1', u'repo1-fork')
343 self.r2_id = repo2.repo_id
343 self.r2_id = repo2.repo_id
344 #now make cs3-6
344 #now make cs3-6
345 cs2 = fixture.commit_change(repo1.repo_name, filename='file1',
345 cs2 = fixture.commit_change(repo1.repo_name, filename='file1',
346 content='line1\nline2\nline3\n', message='commit3',
346 content='line1\nline2\nline3\n', message='commit3',
347 vcs_type='hg', parent=cs1)
347 vcs_type='hg', parent=cs1)
348 cs3 = fixture.commit_change(repo1.repo_name, filename='file1',
348 cs3 = fixture.commit_change(repo1.repo_name, filename='file1',
349 content='line1\nline2\nline3\nline4\n', message='commit4',
349 content='line1\nline2\nline3\nline4\n', message='commit4',
350 vcs_type='hg', parent=cs2)
350 vcs_type='hg', parent=cs2)
351 cs4 = fixture.commit_change(repo1.repo_name, filename='file1',
351 cs4 = fixture.commit_change(repo1.repo_name, filename='file1',
352 content='line1\nline2\nline3\nline4\nline5\n',
352 content='line1\nline2\nline3\nline4\nline5\n',
353 message='commit5', vcs_type='hg', parent=cs3)
353 message='commit5', vcs_type='hg', parent=cs3)
354 cs5 = fixture.commit_change(repo1.repo_name, filename='file1',
354 cs5 = fixture.commit_change(repo1.repo_name, filename='file1',
355 content='line1\nline2\nline3\nline4\nline5\nline6\n',
355 content='line1\nline2\nline3\nline4\nline5\nline6\n',
356 message='commit6', vcs_type='hg', parent=cs4)
356 message='commit6', vcs_type='hg', parent=cs4)
357
357
358 response = self.app.get(url('compare_url',
358 response = self.app.get(url('compare_url',
359 repo_name=repo1.repo_name,
359 repo_name=repo1.repo_name,
360 org_ref_type="rev",
360 org_ref_type="rev",
361 org_ref_name=cs2.short_id, # parent of cs3, not in repo2
361 org_ref_name=cs2.short_id, # parent of cs3, not in repo2
362 other_ref_type="rev",
362 other_ref_type="rev",
363 other_ref_name=cs5.short_id,
363 other_ref_name=cs5.short_id,
364 merge='1',))
364 merge='1',))
365
365
366 response.mustcontain('%s@%s' % (repo1.repo_name, cs2.short_id))
366 response.mustcontain('%s@%s' % (repo1.repo_name, cs2.short_id))
367 response.mustcontain('%s@%s' % (repo1.repo_name, cs5.short_id))
367 response.mustcontain('%s@%s' % (repo1.repo_name, cs5.short_id))
368 response.mustcontain("""Showing 3 commits""")
368 response.mustcontain("""Showing 3 commits""")
369 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
369 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
370
370
371 response.mustcontain(_commit_ref(cs3.raw_id, 'commit4'))
371 response.mustcontain(_commit_ref(repo1.repo_name, cs3.raw_id, 'commit4'))
372 response.mustcontain(_commit_ref(cs4.raw_id, 'commit5'))
372 response.mustcontain(_commit_ref(repo1.repo_name, cs4.raw_id, 'commit5'))
373 response.mustcontain(_commit_ref(cs5.raw_id, 'commit6'))
373 response.mustcontain(_commit_ref(repo1.repo_name, cs5.raw_id, 'commit6'))
374
374
375 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r3:%s</a>""" % (repo1.repo_name, cs3.raw_id, cs3.short_id))
375 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r3:%s</a>""" % (repo1.repo_name, cs3.raw_id, cs3.short_id))
376 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r4:%s</a>""" % (repo1.repo_name, cs4.raw_id, cs4.short_id))
376 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r4:%s</a>""" % (repo1.repo_name, cs4.raw_id, cs4.short_id))
377 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r5:%s</a>""" % (repo1.repo_name, cs5.raw_id, cs5.short_id))
377 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r5:%s</a>""" % (repo1.repo_name, cs5.raw_id, cs5.short_id))
378 ## files
378 ## files
379 response.mustcontain("""#C--826e8142e6ba">file1</a>""")
379 response.mustcontain("""#C--826e8142e6ba">file1</a>""")
380
380
381 def test_compare_cherry_pick_changeset_mixed_branches(self):
381 def test_compare_cherry_pick_changeset_mixed_branches(self):
382 #TODO: write this
382 #TODO: write this
383 assert 1
383 assert 1
384
384
385 def test_compare_remote_branches_hg(self):
385 def test_compare_remote_branches_hg(self):
386 self.log_user()
386 self.log_user()
387
387
388 repo2 = fixture.create_fork(HG_REPO, HG_FORK)
388 repo2 = fixture.create_fork(HG_REPO, HG_FORK)
389 self.r2_id = repo2.repo_id
389 self.r2_id = repo2.repo_id
390 rev1 = '56349e29c2af'
390 rev1 = '56349e29c2af'
391 rev2 = '7d4bc8ec6be5'
391 rev2 = '7d4bc8ec6be5'
392
392
393 response = self.app.get(url('compare_url',
393 response = self.app.get(url('compare_url',
394 repo_name=HG_REPO,
394 repo_name=HG_REPO,
395 org_ref_type="rev",
395 org_ref_type="rev",
396 org_ref_name=rev1,
396 org_ref_name=rev1,
397 other_ref_type="rev",
397 other_ref_type="rev",
398 other_ref_name=rev2,
398 other_ref_name=rev2,
399 other_repo=HG_FORK,
399 other_repo=HG_FORK,
400 merge='1',))
400 merge='1',))
401
401
402 response.mustcontain('%s@%s' % (HG_REPO, rev1))
402 response.mustcontain('%s@%s' % (HG_REPO, rev1))
403 response.mustcontain('%s@%s' % (HG_FORK, rev2))
403 response.mustcontain('%s@%s' % (HG_FORK, rev2))
404 ## outgoing changesets between those revisions
404 ## outgoing changesets between those revisions
405
405
406 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_FORK))
406 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_FORK))
407 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_FORK))
407 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_FORK))
408 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_FORK, rev2))
408 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_FORK, rev2))
409
409
410 ## files
410 ## files
411 response.mustcontain("""<a href="#C--9c390eb52cd6">vcs/backends/hg.py</a>""")
411 response.mustcontain("""<a href="#C--9c390eb52cd6">vcs/backends/hg.py</a>""")
412 response.mustcontain("""<a href="#C--41b41c1f2796">vcs/backends/__init__.py</a>""")
412 response.mustcontain("""<a href="#C--41b41c1f2796">vcs/backends/__init__.py</a>""")
413 response.mustcontain("""<a href="#C--2f574d260608">vcs/backends/base.py</a>""")
413 response.mustcontain("""<a href="#C--2f574d260608">vcs/backends/base.py</a>""")
414
414
415 def test_compare_remote_branches_git(self):
415 def test_compare_remote_branches_git(self):
416 self.log_user()
416 self.log_user()
417
417
418 repo2 = fixture.create_fork(GIT_REPO, GIT_FORK)
418 repo2 = fixture.create_fork(GIT_REPO, GIT_FORK)
419 self.r2_id = repo2.repo_id
419 self.r2_id = repo2.repo_id
420 rev1 = '102607b09cdd60e2793929c4f90478be29f85a17'
420 rev1 = '102607b09cdd60e2793929c4f90478be29f85a17'
421 rev2 = 'd7e0d30fbcae12c90680eb095a4f5f02505ce501'
421 rev2 = 'd7e0d30fbcae12c90680eb095a4f5f02505ce501'
422
422
423 response = self.app.get(url('compare_url',
423 response = self.app.get(url('compare_url',
424 repo_name=GIT_REPO,
424 repo_name=GIT_REPO,
425 org_ref_type="rev",
425 org_ref_type="rev",
426 org_ref_name=rev1,
426 org_ref_name=rev1,
427 other_ref_type="rev",
427 other_ref_type="rev",
428 other_ref_name=rev2,
428 other_ref_name=rev2,
429 other_repo=GIT_FORK,
429 other_repo=GIT_FORK,
430 merge='1',))
430 merge='1',))
431
431
432 response.mustcontain('%s@%s' % (GIT_REPO, rev1))
432 response.mustcontain('%s@%s' % (GIT_REPO, rev1))
433 response.mustcontain('%s@%s' % (GIT_FORK, rev2))
433 response.mustcontain('%s@%s' % (GIT_FORK, rev2))
434 ## outgoing changesets between those revisions
434 ## outgoing changesets between those revisions
435
435
436 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/49d3fd156b6f7db46313fac355dca1a0b94a0017">r4:49d3fd156b6f</a>""" % (GIT_FORK))
436 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/49d3fd156b6f7db46313fac355dca1a0b94a0017">r4:49d3fd156b6f</a>""" % (GIT_FORK))
437 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/2d1028c054665b962fa3d307adfc923ddd528038">r5:2d1028c05466</a>""" % (GIT_FORK))
437 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/2d1028c054665b962fa3d307adfc923ddd528038">r5:2d1028c05466</a>""" % (GIT_FORK))
438 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/d7e0d30fbcae12c90680eb095a4f5f02505ce501">r6:%s</a>""" % (GIT_FORK, rev2[:12]))
438 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/d7e0d30fbcae12c90680eb095a4f5f02505ce501">r6:%s</a>""" % (GIT_FORK, rev2[:12]))
439
439
440 ## files
440 ## files
441 response.mustcontain("""<a href="#C--9c390eb52cd6">vcs/backends/hg.py</a>""")
441 response.mustcontain("""<a href="#C--9c390eb52cd6">vcs/backends/hg.py</a>""")
442 response.mustcontain("""<a href="#C--41b41c1f2796">vcs/backends/__init__.py</a>""")
442 response.mustcontain("""<a href="#C--41b41c1f2796">vcs/backends/__init__.py</a>""")
443 response.mustcontain("""<a href="#C--2f574d260608">vcs/backends/base.py</a>""")
443 response.mustcontain("""<a href="#C--2f574d260608">vcs/backends/base.py</a>""")
444
444
445 def test_org_repo_new_commits_after_forking_simple_diff_hg(self):
445 def test_org_repo_new_commits_after_forking_simple_diff_hg(self):
446 self.log_user()
446 self.log_user()
447
447
448 repo1 = fixture.create_repo(u'one', repo_type='hg',
448 repo1 = fixture.create_repo(u'one', repo_type='hg',
449 repo_description='diff-test',
449 repo_description='diff-test',
450 cur_user=TEST_USER_ADMIN_LOGIN)
450 cur_user=TEST_USER_ADMIN_LOGIN)
451
451
452 self.r1_id = repo1.repo_id
452 self.r1_id = repo1.repo_id
453 r1_name = repo1.repo_name
453 r1_name = repo1.repo_name
454
454
455 cs0 = fixture.commit_change(repo=r1_name, filename='file1',
455 cs0 = fixture.commit_change(repo=r1_name, filename='file1',
456 content='line1', message='commit1', vcs_type='hg', newfile=True)
456 content='line1', message='commit1', vcs_type='hg', newfile=True)
457 Session().commit()
457 Session().commit()
458 assert repo1.scm_instance.revisions == [cs0.raw_id]
458 assert repo1.scm_instance.revisions == [cs0.raw_id]
459 #fork the repo1
459 #fork the repo1
460 repo2 = fixture.create_repo(u'one-fork', repo_type='hg',
460 repo2 = fixture.create_repo(u'one-fork', repo_type='hg',
461 repo_description='diff-test',
461 repo_description='diff-test',
462 cur_user=TEST_USER_ADMIN_LOGIN,
462 cur_user=TEST_USER_ADMIN_LOGIN,
463 clone_uri=repo1.repo_full_path,
463 clone_uri=repo1.repo_full_path,
464 fork_of='one')
464 fork_of='one')
465 Session().commit()
465 Session().commit()
466 assert repo2.scm_instance.revisions == [cs0.raw_id]
466 assert repo2.scm_instance.revisions == [cs0.raw_id]
467 self.r2_id = repo2.repo_id
467 self.r2_id = repo2.repo_id
468 r2_name = repo2.repo_name
468 r2_name = repo2.repo_name
469
469
470 cs1 = fixture.commit_change(repo=r2_name, filename='file1-fork',
470 cs1 = fixture.commit_change(repo=r2_name, filename='file1-fork',
471 content='file1-line1-from-fork', message='commit1-fork',
471 content='file1-line1-from-fork', message='commit1-fork',
472 vcs_type='hg', parent=repo2.scm_instance[-1], newfile=True)
472 vcs_type='hg', parent=repo2.scm_instance[-1], newfile=True)
473
473
474 cs2 = fixture.commit_change(repo=r2_name, filename='file2-fork',
474 cs2 = fixture.commit_change(repo=r2_name, filename='file2-fork',
475 content='file2-line1-from-fork', message='commit2-fork',
475 content='file2-line1-from-fork', message='commit2-fork',
476 vcs_type='hg', parent=cs1, newfile=True)
476 vcs_type='hg', parent=cs1, newfile=True)
477
477
478 cs3 = fixture.commit_change(repo=r2_name, filename='file3-fork',
478 cs3 = fixture.commit_change(repo=r2_name, filename='file3-fork',
479 content='file3-line1-from-fork', message='commit3-fork',
479 content='file3-line1-from-fork', message='commit3-fork',
480 vcs_type='hg', parent=cs2, newfile=True)
480 vcs_type='hg', parent=cs2, newfile=True)
481 #compare !
481 #compare !
482 rev1 = 'default'
482 rev1 = 'default'
483 rev2 = 'default'
483 rev2 = 'default'
484
484
485 response = self.app.get(url('compare_url',
485 response = self.app.get(url('compare_url',
486 repo_name=r2_name,
486 repo_name=r2_name,
487 org_ref_type="branch",
487 org_ref_type="branch",
488 org_ref_name=rev2,
488 org_ref_name=rev2,
489 other_ref_type="branch",
489 other_ref_type="branch",
490 other_ref_name=rev1,
490 other_ref_name=rev1,
491 other_repo=r1_name,
491 other_repo=r1_name,
492 merge='1',), status=404)
492 merge='1',), status=404)
493
493
494 response.mustcontain('Cannot show empty diff')
494 response.mustcontain('Cannot show empty diff')
495
495
496 cs0 = fixture.commit_change(repo=r1_name, filename='file2',
496 cs0 = fixture.commit_change(repo=r1_name, filename='file2',
497 content='line1-added-after-fork', message='commit2-parent',
497 content='line1-added-after-fork', message='commit2-parent',
498 vcs_type='hg', parent=None, newfile=True)
498 vcs_type='hg', parent=None, newfile=True)
499
499
500 #compare !
500 #compare !
501 rev1 = 'default'
501 rev1 = 'default'
502 rev2 = 'default'
502 rev2 = 'default'
503 response = self.app.get(url('compare_url',
503 response = self.app.get(url('compare_url',
504 repo_name=r2_name,
504 repo_name=r2_name,
505 org_ref_type="branch",
505 org_ref_type="branch",
506 org_ref_name=rev2,
506 org_ref_name=rev2,
507 other_ref_type="branch",
507 other_ref_type="branch",
508 other_ref_name=rev1,
508 other_ref_name=rev1,
509 other_repo=r1_name,
509 other_repo=r1_name,
510 merge='1',
510 merge='1',
511 ))
511 ))
512
512
513 response.mustcontain('%s@%s' % (r2_name, rev1))
513 response.mustcontain('%s@%s' % (r2_name, rev1))
514 response.mustcontain('%s@%s' % (r1_name, rev2))
514 response.mustcontain('%s@%s' % (r1_name, rev2))
515
515
516 response.mustcontain("""commit2-parent""")
516 response.mustcontain("""commit2-parent""")
517 response.mustcontain("""1 file changed with 1 insertions and 0 deletions""")
517 response.mustcontain("""1 file changed with 1 insertions and 0 deletions""")
518 response.mustcontain("""line1-added-after-fork""")
518 response.mustcontain("""line1-added-after-fork""")
519
519
520 def test_org_repo_new_commits_after_forking_simple_diff_git(self):
520 def test_org_repo_new_commits_after_forking_simple_diff_git(self):
521 self.log_user()
521 self.log_user()
522
522
523 repo1 = fixture.create_repo(u'one-git', repo_type='git',
523 repo1 = fixture.create_repo(u'one-git', repo_type='git',
524 repo_description='diff-test',
524 repo_description='diff-test',
525 cur_user=TEST_USER_ADMIN_LOGIN)
525 cur_user=TEST_USER_ADMIN_LOGIN)
526
526
527 self.r1_id = repo1.repo_id
527 self.r1_id = repo1.repo_id
528 r1_name = repo1.repo_name
528 r1_name = repo1.repo_name
529
529
530 cs0 = fixture.commit_change(repo=r1_name, filename='file1',
530 cs0 = fixture.commit_change(repo=r1_name, filename='file1',
531 content='line1', message='commit1', vcs_type='git',
531 content='line1', message='commit1', vcs_type='git',
532 newfile=True)
532 newfile=True)
533 Session().commit()
533 Session().commit()
534 assert repo1.scm_instance.revisions == [cs0.raw_id]
534 assert repo1.scm_instance.revisions == [cs0.raw_id]
535 #fork the repo1
535 #fork the repo1
536 repo2 = fixture.create_repo(u'one-git-fork', repo_type='git',
536 repo2 = fixture.create_repo(u'one-git-fork', repo_type='git',
537 repo_description='diff-test',
537 repo_description='diff-test',
538 cur_user=TEST_USER_ADMIN_LOGIN,
538 cur_user=TEST_USER_ADMIN_LOGIN,
539 clone_uri=repo1.repo_full_path,
539 clone_uri=repo1.repo_full_path,
540 fork_of='one-git')
540 fork_of='one-git')
541 Session().commit()
541 Session().commit()
542 assert repo2.scm_instance.revisions == [cs0.raw_id]
542 assert repo2.scm_instance.revisions == [cs0.raw_id]
543 self.r2_id = repo2.repo_id
543 self.r2_id = repo2.repo_id
544 r2_name = repo2.repo_name
544 r2_name = repo2.repo_name
545
545
546
546
547 cs1 = fixture.commit_change(repo=r2_name, filename='file1-fork',
547 cs1 = fixture.commit_change(repo=r2_name, filename='file1-fork',
548 content='file1-line1-from-fork', message='commit1-fork',
548 content='file1-line1-from-fork', message='commit1-fork',
549 vcs_type='git', parent=repo2.scm_instance[-1], newfile=True)
549 vcs_type='git', parent=repo2.scm_instance[-1], newfile=True)
550
550
551 cs2 = fixture.commit_change(repo=r2_name, filename='file2-fork',
551 cs2 = fixture.commit_change(repo=r2_name, filename='file2-fork',
552 content='file2-line1-from-fork', message='commit2-fork',
552 content='file2-line1-from-fork', message='commit2-fork',
553 vcs_type='git', parent=cs1, newfile=True)
553 vcs_type='git', parent=cs1, newfile=True)
554
554
555 cs3 = fixture.commit_change(repo=r2_name, filename='file3-fork',
555 cs3 = fixture.commit_change(repo=r2_name, filename='file3-fork',
556 content='file3-line1-from-fork', message='commit3-fork',
556 content='file3-line1-from-fork', message='commit3-fork',
557 vcs_type='git', parent=cs2, newfile=True)
557 vcs_type='git', parent=cs2, newfile=True)
558 #compare !
558 #compare !
559 rev1 = 'master'
559 rev1 = 'master'
560 rev2 = 'master'
560 rev2 = 'master'
561
561
562 response = self.app.get(url('compare_url',
562 response = self.app.get(url('compare_url',
563 repo_name=r2_name,
563 repo_name=r2_name,
564 org_ref_type="branch",
564 org_ref_type="branch",
565 org_ref_name=rev1,
565 org_ref_name=rev1,
566 other_ref_type="branch",
566 other_ref_type="branch",
567 other_ref_name=rev2,
567 other_ref_name=rev2,
568 other_repo=r1_name,
568 other_repo=r1_name,
569 merge='1',), status=404)
569 merge='1',), status=404)
570
570
571 response.mustcontain('Cannot show empty diff')
571 response.mustcontain('Cannot show empty diff')
572
572
573 cs0 = fixture.commit_change(repo=r1_name, filename='file2',
573 cs0 = fixture.commit_change(repo=r1_name, filename='file2',
574 content='line1-added-after-fork', message='commit2-parent',
574 content='line1-added-after-fork', message='commit2-parent',
575 vcs_type='git', parent=None, newfile=True)
575 vcs_type='git', parent=None, newfile=True)
576
576
577 #compare !
577 #compare !
578 rev1 = 'master'
578 rev1 = 'master'
579 rev2 = 'master'
579 rev2 = 'master'
580 response = self.app.get(url('compare_url',
580 response = self.app.get(url('compare_url',
581 repo_name=r2_name,
581 repo_name=r2_name,
582 org_ref_type="branch",
582 org_ref_type="branch",
583 org_ref_name=rev1,
583 org_ref_name=rev1,
584 other_ref_type="branch",
584 other_ref_type="branch",
585 other_ref_name=rev2,
585 other_ref_name=rev2,
586 other_repo=r1_name,
586 other_repo=r1_name,
587 merge='1',
587 merge='1',
588 ))
588 ))
589
589
590 response.mustcontain('%s@%s' % (r2_name, rev1))
590 response.mustcontain('%s@%s' % (r2_name, rev1))
591 response.mustcontain('%s@%s' % (r1_name, rev2))
591 response.mustcontain('%s@%s' % (r1_name, rev2))
592
592
593 response.mustcontain("""commit2-parent""")
593 response.mustcontain("""commit2-parent""")
594 response.mustcontain("""1 file changed with 1 insertions and 0 deletions""")
594 response.mustcontain("""1 file changed with 1 insertions and 0 deletions""")
595 response.mustcontain("""line1-added-after-fork""")
595 response.mustcontain("""line1-added-after-fork""")
General Comments 0
You need to be logged in to leave comments. Login now