##// END OF EJS Templates
fixed broken swap url, and added a test to detect it in feature
marcink -
r3320:75431548 beta
parent child Browse files
Show More
@@ -1,181 +1,181 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.controllers.compare
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 compare controller for pylons showing differences between two
7 7 repos, branches, bookmarks or tips
8 8
9 9 :created_on: May 6, 2012
10 10 :author: marcink
11 11 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
12 12 :license: GPLv3, see COPYING for more details.
13 13 """
14 14 # This program is free software: you can redistribute it and/or modify
15 15 # it under the terms of the GNU General Public License as published by
16 16 # the Free Software Foundation, either version 3 of the License, or
17 17 # (at your option) any later version.
18 18 #
19 19 # This program is distributed in the hope that it will be useful,
20 20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 22 # GNU General Public License for more details.
23 23 #
24 24 # You should have received a copy of the GNU General Public License
25 25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 26 import logging
27 27 import traceback
28 28
29 29 from webob.exc import HTTPNotFound
30 30 from pylons import request, response, session, tmpl_context as c, url
31 31 from pylons.controllers.util import abort, redirect
32 32 from pylons.i18n.translation import _
33 33
34 34 from rhodecode.lib.vcs.exceptions import EmptyRepositoryError, RepositoryError
35 35 from rhodecode.lib import helpers as h
36 36 from rhodecode.lib.base import BaseRepoController, render
37 37 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
38 38 from rhodecode.lib import diffs
39 39
40 40 from rhodecode.model.db import Repository
41 41 from rhodecode.model.pull_request import PullRequestModel
42 42 from webob.exc import HTTPBadRequest
43 43 from rhodecode.lib.utils2 import str2bool
44 44 from rhodecode.lib.diffs import LimitedDiffContainer
45 45 from rhodecode.lib.vcs.backends.base import EmptyChangeset
46 46
47 47 log = logging.getLogger(__name__)
48 48
49 49
50 50 class CompareController(BaseRepoController):
51 51
52 52 @LoginRequired()
53 53 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
54 54 'repository.admin')
55 55 def __before__(self):
56 56 super(CompareController, self).__before__()
57 57
58 58 def __get_cs_or_redirect(self, rev, repo, redirect_after=True,
59 59 partial=False):
60 60 """
61 61 Safe way to get changeset if error occur it redirects to changeset with
62 62 proper message. If partial is set then don't do redirect raise Exception
63 63 instead
64 64
65 65 :param rev: revision to fetch
66 66 :param repo: repo instance
67 67 """
68 68
69 69 try:
70 70 type_, rev = rev
71 71 return repo.scm_instance.get_changeset(rev)
72 72 except EmptyRepositoryError, e:
73 73 if not redirect_after:
74 74 return None
75 75 h.flash(h.literal(_('There are no changesets yet')),
76 76 category='warning')
77 77 redirect(url('summary_home', repo_name=repo.repo_name))
78 78
79 79 except RepositoryError, e:
80 80 log.error(traceback.format_exc())
81 81 h.flash(str(e), category='warning')
82 82 if not partial:
83 83 redirect(h.url('summary_home', repo_name=repo.repo_name))
84 84 raise HTTPBadRequest()
85 85
86 86 def index(self, org_ref_type, org_ref, other_ref_type, other_ref):
87 87
88 88 org_repo = c.rhodecode_db_repo.repo_name
89 89 org_ref = (org_ref_type, org_ref)
90 90 other_ref = (other_ref_type, other_ref)
91 91 other_repo = request.GET.get('other_repo', org_repo)
92 92 c.fulldiff = fulldiff = request.GET.get('fulldiff')
93 93 rev_start = request.GET.get('rev_start')
94 94 rev_end = request.GET.get('rev_end')
95 95
96 96 c.swap_url = h.url('compare_url', as_form=request.GET.get('as_form'),
97 97 repo_name=other_repo,
98 98 org_ref_type=other_ref[0], org_ref=other_ref[1],
99 repo=org_repo,
99 other_repo=org_repo,
100 100 other_ref_type=org_ref[0], other_ref=org_ref[1])
101 101
102 102 c.org_repo = org_repo = Repository.get_by_repo_name(org_repo)
103 103 c.other_repo = other_repo = Repository.get_by_repo_name(other_repo)
104 104
105 105 if c.org_repo is None:
106 106 log.error('Could not find org repo %s' % org_repo)
107 107 raise HTTPNotFound
108 108 if c.other_repo is None:
109 109 log.error('Could not find other repo %s' % other_repo)
110 110 raise HTTPNotFound
111 111
112 112 if c.org_repo != c.other_repo and h.is_git(c.rhodecode_repo):
113 113 log.error('compare of two remote repos not available for GIT REPOS')
114 114 raise HTTPNotFound
115 115
116 116 if c.org_repo.scm_instance.alias != c.other_repo.scm_instance.alias:
117 117 log.error('compare of two different kind of remote repos not available')
118 118 raise HTTPNotFound
119 119
120 120 partial = request.environ.get('HTTP_X_PARTIAL_XHR')
121 121 self.__get_cs_or_redirect(rev=org_ref, repo=org_repo, partial=partial)
122 122 self.__get_cs_or_redirect(rev=other_ref, repo=other_repo, partial=partial)
123 123
124 124 if rev_start and rev_end:
125 125 #replace our org_ref with given CS
126 126 org_ref = ('rev', rev_start)
127 127 other_ref = ('rev', rev_end)
128 128
129 129 c.cs_ranges = PullRequestModel().get_compare_data(
130 130 org_repo, org_ref, other_repo, other_ref,
131 131 )
132 132
133 133 c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
134 134 c.cs_ranges])
135 135 c.target_repo = c.repo_name
136 136 # defines that we need hidden inputs with changesets
137 137 c.as_form = request.GET.get('as_form', False)
138 138 if partial:
139 139 return render('compare/compare_cs.html')
140 140
141 141 c.org_ref = org_ref[1]
142 142 c.other_ref = other_ref[1]
143 143
144 144 if c.cs_ranges and c.org_repo != c.other_repo:
145 145 # case we want a simple diff without incoming changesets, just
146 146 # for review purposes. Make the diff on the forked repo, with
147 147 # revision that is common ancestor
148 148 _org_ref = org_ref
149 149 org_ref = ('rev', getattr(c.cs_ranges[0].parents[0]
150 150 if c.cs_ranges[0].parents
151 151 else EmptyChangeset(), 'raw_id'))
152 152 log.debug('Changed org_ref from %s to %s' % (_org_ref, org_ref))
153 153 other_repo = org_repo
154 154
155 155 diff_limit = self.cut_off_limit if not fulldiff else None
156 156
157 157 _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref)
158 158
159 159 diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff',
160 160 diff_limit=diff_limit)
161 161 _parsed = diff_processor.prepare()
162 162
163 163 c.limited_diff = False
164 164 if isinstance(_parsed, LimitedDiffContainer):
165 165 c.limited_diff = True
166 166
167 167 c.files = []
168 168 c.changes = {}
169 169 c.lines_added = 0
170 170 c.lines_deleted = 0
171 171 for f in _parsed:
172 172 st = f['stats']
173 173 if st[0] != 'b':
174 174 c.lines_added += st[0]
175 175 c.lines_deleted += st[1]
176 176 fid = h.FID('', f['filename'])
177 177 c.files.append([fid, f['operation'], f['filename'], f['stats']])
178 178 diff = diff_processor.as_html(enable_comments=False, parsed_lines=[f])
179 179 c.changes[fid] = [f['operation'], f['filename'], diff]
180 180
181 181 return render('compare/compare_diff.html')
@@ -1,346 +1,348 b''
1 1 from rhodecode.tests import *
2 2 from rhodecode.model.repo import RepoModel
3 3 from rhodecode.model.meta import Session
4 4 from rhodecode.model.db import Repository
5 5 from rhodecode.model.scm import ScmModel
6 6 from rhodecode.lib.vcs.backends.base import EmptyChangeset
7 7
8 8
9 9 def _fork_repo(fork_name, vcs_type, parent=None):
10 10 if vcs_type =='hg':
11 11 _REPO = HG_REPO
12 12 elif vcs_type == 'git':
13 13 _REPO = GIT_REPO
14 14
15 15 if parent:
16 16 _REPO = parent
17 17
18 18 form_data = dict(
19 19 repo_name=fork_name,
20 20 repo_name_full=fork_name,
21 21 repo_group=None,
22 22 repo_type=vcs_type,
23 23 description='',
24 24 private=False,
25 25 copy_permissions=False,
26 26 landing_rev='tip',
27 27 update_after_clone=False,
28 28 fork_parent_id=Repository.get_by_repo_name(_REPO),
29 29 )
30 30 repo = RepoModel().create_fork(form_data, cur_user=TEST_USER_ADMIN_LOGIN)
31 31
32 32 Session().commit()
33 33 return Repository.get_by_repo_name(fork_name)
34 34
35 35
36 36 def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False):
37 37 repo = Repository.get_by_repo_name(repo)
38 38 _cs = parent
39 39 if not parent:
40 40 _cs = EmptyChangeset(alias=vcs_type)
41 41
42 42 if newfile:
43 43 cs = ScmModel().create_node(
44 44 repo=repo.scm_instance, repo_name=repo.repo_name,
45 45 cs=_cs, user=TEST_USER_ADMIN_LOGIN,
46 46 author=TEST_USER_ADMIN_LOGIN,
47 47 message=message,
48 48 content=content,
49 49 f_path=filename
50 50 )
51 51 else:
52 52 cs = ScmModel().commit_change(
53 53 repo=repo.scm_instance, repo_name=repo.repo_name,
54 54 cs=parent, user=TEST_USER_ADMIN_LOGIN,
55 55 author=TEST_USER_ADMIN_LOGIN,
56 56 message=message,
57 57 content=content,
58 58 f_path=filename
59 59 )
60 60 return cs
61 61
62 62
63 63 class TestCompareController(TestController):
64 64
65 65 def test_compare_forks_on_branch_extra_commits_hg(self):
66 66 self.log_user()
67 67
68 68 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
69 69 description='diff-test',
70 70 owner=TEST_USER_ADMIN_LOGIN)
71 71 r1_id = repo1.repo_id
72 72 Session().commit()
73 73 #commit something !
74 74 cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
75 75 message='commit1', vcs_type='hg', parent=None, newfile=True)
76 76
77 77 #fork this repo
78 78 repo2 = _fork_repo('one-fork', 'hg', parent='one')
79 79 Session().commit()
80 80 r2_id = repo2.repo_id
81 81
82 82 #add two extra commit into fork
83 83 cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n',
84 84 message='commit2', vcs_type='hg', parent=cs0)
85 85
86 86 cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
87 87 message='commit3', vcs_type='hg', parent=cs1)
88 88
89 89 rev1 = 'default'
90 90 rev2 = 'default'
91 91 response = self.app.get(url(controller='compare', action='index',
92 92 repo_name=repo2.repo_name,
93 93 org_ref_type="branch",
94 94 org_ref=rev1,
95 95 other_repo=repo1.repo_name,
96 96 other_ref_type="branch",
97 97 other_ref=rev2,
98 98 ))
99 99
100 100 try:
101 101 response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2))
102 102 response.mustcontain("""Showing 2 commits""")
103 103 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
104 104
105 105 response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""")
106 106 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
107 107
108 108 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
109 109 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
110 110 ## files
111 111 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
112
112 #swap
113 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo1.repo_name, rev1, rev2, repo2.repo_name))
113 114 finally:
114 115 RepoModel().delete(r2_id)
115 116 RepoModel().delete(r1_id)
116 117
117 118 def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self):
118 119 self.log_user()
119 120
120 121 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
121 122 description='diff-test',
122 123 owner=TEST_USER_ADMIN_LOGIN)
123 124 r1_id = repo1.repo_id
124 125 Session().commit()
125 126 #commit something !
126 127 cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
127 128 message='commit1', vcs_type='hg', parent=None, newfile=True)
128 129
129 130 #fork this repo
130 131 repo2 = _fork_repo('one-fork', 'hg', parent='one')
131 132 Session().commit()
132 133
133 134 #now commit something to origin repo
134 135 cs1_prim = _commit_change(repo1.repo_name, filename='file2', content='line1file2\n',
135 136 message='commit2', vcs_type='hg', parent=cs0, newfile=True)
136 137
137 138 r2_id = repo2.repo_id
138 139
139 140 #add two extra commit into fork
140 141 cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n',
141 142 message='commit2', vcs_type='hg', parent=cs0)
142 143
143 144 cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
144 145 message='commit3', vcs_type='hg', parent=cs1)
145 146
146 147 rev1 = 'default'
147 148 rev2 = 'default'
148 149 response = self.app.get(url(controller='compare', action='index',
149 150 repo_name=repo2.repo_name,
150 151 org_ref_type="branch",
151 152 org_ref=rev1,
152 153 other_repo=repo1.repo_name,
153 154 other_ref_type="branch",
154 155 other_ref=rev2,
155 156 ))
156 157
157 158 try:
158 159 response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2))
159 160 response.mustcontain("""Showing 2 commits""")
160 161 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
161 162
162 163 response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""")
163 164 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
164 165
165 166 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
166 167 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
167 168 ## files
168 169 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
169
170 #swap
171 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo1.repo_name, rev1, rev2, repo2.repo_name))
170 172 finally:
171 173 RepoModel().delete(r2_id)
172 174 RepoModel().delete(r1_id)
173 175
174 176
175 177 # def test_compare_remote_repos_remote_flag_off(self):
176 178 # self.log_user()
177 179 # _fork_repo(HG_FORK, 'hg')
178 180 #
179 181 # rev1 = '56349e29c2af'
180 182 # rev2 = '7d4bc8ec6be5'
181 183 #
182 184 # response = self.app.get(url(controller='compare', action='index',
183 185 # repo_name=HG_REPO,
184 186 # org_ref_type="rev",
185 187 # org_ref=rev1,
186 188 # other_ref_type="rev",
187 189 # other_ref=rev2,
188 190 # repo=HG_FORK,
189 191 # bundle=False,
190 192 # ))
191 193 #
192 194 # try:
193 195 # response.mustcontain('%s@%s -&gt; %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
194 196 # ## outgoing changesets between those revisions
195 197 #
196 198 # response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO))
197 199 # response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_REPO))
198 200 # response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2))
199 201 #
200 202 # ## files
201 203 # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2))
202 204 # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2))
203 205 # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2))
204 206 # finally:
205 207 # RepoModel().delete(HG_FORK)
206 208
207 209
208 210
209 211 #
210 212 # def test_compare_remote_branches_hg(self):
211 213 # self.log_user()
212 214 #
213 215 # _fork_repo(HG_FORK, 'hg')
214 216 #
215 217 # rev1 = '56349e29c2af'
216 218 # rev2 = '7d4bc8ec6be5'
217 219 #
218 220 # response = self.app.get(url(controller='compare', action='index',
219 221 # repo_name=HG_REPO,
220 222 # org_ref_type="rev",
221 223 # org_ref=rev1,
222 224 # other_ref_type="rev",
223 225 # other_ref=rev2,
224 226 # repo=HG_FORK,
225 227 # ))
226 228 #
227 229 # try:
228 230 # response.mustcontain('%s@%s -&gt; %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
229 231 # ## outgoing changesets between those revisions
230 232 #
231 233 # response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO))
232 234 # response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_REPO))
233 235 # response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2))
234 236 #
235 237 # ## files
236 238 # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2))
237 239 # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2))
238 240 # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2))
239 241 # finally:
240 242 # RepoModel().delete(HG_FORK)
241 243 #
242 244 # def test_org_repo_new_commits_after_forking_simple_diff(self):
243 245 # self.log_user()
244 246 #
245 247 # repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
246 248 # description='diff-test',
247 249 # owner=TEST_USER_ADMIN_LOGIN)
248 250 #
249 251 # Session().commit()
250 252 # r1_id = repo1.repo_id
251 253 # r1_name = repo1.repo_name
252 254 #
253 255 # #commit something initially !
254 256 # cs0 = ScmModel().create_node(
255 257 # repo=repo1.scm_instance, repo_name=r1_name,
256 258 # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
257 259 # author=TEST_USER_ADMIN_LOGIN,
258 260 # message='commit1',
259 261 # content='line1',
260 262 # f_path='file1'
261 263 # )
262 264 # Session().commit()
263 265 # self.assertEqual(repo1.scm_instance.revisions, [cs0.raw_id])
264 266 # #fork the repo1
265 267 # repo2 = RepoModel().create_repo(repo_name='one-fork', repo_type='hg',
266 268 # description='compare-test',
267 269 # clone_uri=repo1.repo_full_path,
268 270 # owner=TEST_USER_ADMIN_LOGIN, fork_of='one')
269 271 # Session().commit()
270 272 # self.assertEqual(repo2.scm_instance.revisions, [cs0.raw_id])
271 273 # r2_id = repo2.repo_id
272 274 # r2_name = repo2.repo_name
273 275 #
274 276 # #make 3 new commits in fork
275 277 # cs1 = ScmModel().create_node(
276 278 # repo=repo2.scm_instance, repo_name=r2_name,
277 279 # cs=repo2.scm_instance[-1], user=TEST_USER_ADMIN_LOGIN,
278 280 # author=TEST_USER_ADMIN_LOGIN,
279 281 # message='commit1-fork',
280 282 # content='file1-line1-from-fork',
281 283 # f_path='file1-fork'
282 284 # )
283 285 # cs2 = ScmModel().create_node(
284 286 # repo=repo2.scm_instance, repo_name=r2_name,
285 287 # cs=cs1, user=TEST_USER_ADMIN_LOGIN,
286 288 # author=TEST_USER_ADMIN_LOGIN,
287 289 # message='commit2-fork',
288 290 # content='file2-line1-from-fork',
289 291 # f_path='file2-fork'
290 292 # )
291 293 # cs3 = ScmModel().create_node(
292 294 # repo=repo2.scm_instance, repo_name=r2_name,
293 295 # cs=cs2, user=TEST_USER_ADMIN_LOGIN,
294 296 # author=TEST_USER_ADMIN_LOGIN,
295 297 # message='commit3-fork',
296 298 # content='file3-line1-from-fork',
297 299 # f_path='file3-fork'
298 300 # )
299 301 #
300 302 # #compare !
301 303 # rev1 = 'default'
302 304 # rev2 = 'default'
303 305 # response = self.app.get(url(controller='compare', action='index',
304 306 # repo_name=r2_name,
305 307 # org_ref_type="branch",
306 308 # org_ref=rev1,
307 309 # other_ref_type="branch",
308 310 # other_ref=rev2,
309 311 # repo=r1_name,
310 312 # bundle=False,
311 313 # ))
312 314 #
313 315 # try:
314 316 # #response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2))
315 317 #
316 318 # #add new commit into parent !
317 319 # cs0 = ScmModel().create_node(
318 320 # repo=repo1.scm_instance, repo_name=r1_name,
319 321 # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
320 322 # author=TEST_USER_ADMIN_LOGIN,
321 323 # message='commit2',
322 324 # content='line1',
323 325 # f_path='file2'
324 326 # )
325 327 # #compare !
326 328 # rev1 = 'default'
327 329 # rev2 = 'default'
328 330 # response = self.app.get(url(controller='compare', action='index',
329 331 # repo_name=r2_name,
330 332 # org_ref_type="branch",
331 333 # org_ref=rev1,
332 334 # other_ref_type="branch",
333 335 # other_ref=rev2,
334 336 # repo=r1_name,
335 337 # bundle=False
336 338 # ))
337 339 #
338 340 # response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2))
339 341 # response.mustcontain("""file1-line1-from-fork""")
340 342 # response.mustcontain("""file2-line1-from-fork""")
341 343 # response.mustcontain("""file3-line1-from-fork""")
342 344 # self.assertFalse("""<a href="#">file2</a>""" in response.body) # new commit from parent
343 345 # self.assertFalse("""line1-from-new-parent""" in response.body)
344 346 # finally:
345 347 # RepoModel().delete(r2_id)
346 348 # RepoModel().delete(r1_id)
General Comments 0
You need to be logged in to leave comments. Login now