comparison rhodecode/tests/functional/test_compare.py @ 3486:2053053e0882 beta

compare/pullrequest: introduce merge parameter This is more correct and flexible than the old way of looking on same/different repo.
author Mads Kiilerich <madski@unity3d.com>
date Tue, 05 Mar 2013 11:55:01 +0100
parents 75e563531350
children aef5f5ce5ead
comparison
equal deleted inserted replaced
3485:b19b1723ff10 3486:2053053e0882
104 org_ref_type="branch", 104 org_ref_type="branch",
105 org_ref=rev2, 105 org_ref=rev2,
106 other_repo=repo2.repo_name, 106 other_repo=repo2.repo_name,
107 other_ref_type="branch", 107 other_ref_type="branch",
108 other_ref=rev1, 108 other_ref=rev1,
109 merge='1',
109 )) 110 ))
110 111
111 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, rev2, repo2.repo_name, rev1)) 112 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, rev2, repo2.repo_name, rev1))
112 response.mustcontain("""Showing 2 commits""") 113 response.mustcontain("""Showing 2 commits""")
113 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""") 114 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
116 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""") 117 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
117 118
118 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id)) 119 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
119 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id)) 120 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
120 ## files 121 ## files
121 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name)) 122 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=1#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
122 #swap 123 #swap
123 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) 124 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
124 125
125 def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self): 126 def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self):
126 self.log_user() 127 self.log_user()
127 128
128 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg', 129 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
158 org_ref_type="branch", 159 org_ref_type="branch",
159 org_ref=rev2, 160 org_ref=rev2,
160 other_repo=repo2.repo_name, 161 other_repo=repo2.repo_name,
161 other_ref_type="branch", 162 other_ref_type="branch",
162 other_ref=rev1, 163 other_ref=rev1,
164 merge='x',
163 )) 165 ))
164 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, rev2, repo2.repo_name, rev1)) 166 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, rev2, repo2.repo_name, rev1))
165 response.mustcontain("""Showing 2 commits""") 167 response.mustcontain("""Showing 2 commits""")
166 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""") 168 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
167 169
169 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""") 171 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
170 172
171 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id)) 173 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
172 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id)) 174 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
173 ## files 175 ## files
174 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name)) 176 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=x#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
175 #swap 177 #swap
176 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) 178 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
177 179
178 def test_compare_cherry_pick_changesets_from_bottom(self): 180 def test_compare_cherry_pick_changesets_from_bottom(self):
179 181
180 # repo1: 182 # repo1:
181 # cs0: 183 # cs0:
220 org_ref_type="rev", 222 org_ref_type="rev",
221 org_ref=cs1.short_id, # parent of cs2, in repo2 223 org_ref=cs1.short_id, # parent of cs2, in repo2
222 other_repo=repo1.repo_name, 224 other_repo=repo1.repo_name,
223 other_ref_type="rev", 225 other_ref_type="rev",
224 other_ref=cs4.short_id, 226 other_ref=cs4.short_id,
227 merge='True',
225 )) 228 ))
226 response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, cs1.short_id, repo1.repo_name, cs4.short_id)) 229 response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, cs1.short_id, repo1.repo_name, cs4.short_id))
227 response.mustcontain("""Showing 3 commits""") 230 response.mustcontain("""Showing 3 commits""")
228 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""") 231 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
229 232
279 repo_name=repo1.repo_name, 282 repo_name=repo1.repo_name,
280 org_ref_type="rev", 283 org_ref_type="rev",
281 org_ref=cs2.short_id, # parent of cs3, not in repo2 284 org_ref=cs2.short_id, # parent of cs3, not in repo2
282 other_ref_type="rev", 285 other_ref_type="rev",
283 other_ref=cs5.short_id, 286 other_ref=cs5.short_id,
287 merge='1',
284 )) 288 ))
285 289
286 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, cs2.short_id, repo1.repo_name, cs5.short_id)) 290 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, cs2.short_id, repo1.repo_name, cs5.short_id))
287 response.mustcontain("""Showing 3 commits""") 291 response.mustcontain("""Showing 3 commits""")
288 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""") 292 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
317 org_ref_type="rev", 321 org_ref_type="rev",
318 org_ref=rev1, 322 org_ref=rev1,
319 other_ref_type="rev", 323 other_ref_type="rev",
320 other_ref=rev2, 324 other_ref=rev2,
321 other_repo=HG_FORK, 325 other_repo=HG_FORK,
326 merge='1',
322 )) 327 ))
323 response.mustcontain('%s@%s -&gt; %s@%s' % (HG_REPO, rev1, HG_FORK, rev2)) 328 response.mustcontain('%s@%s -&gt; %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
324 ## outgoing changesets between those revisions 329 ## outgoing changesets between those revisions
325 330
326 response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_FORK)) 331 response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_FORK))
327 response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_FORK)) 332 response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_FORK))
328 response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_FORK, rev2)) 333 response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_FORK, rev2))
329 334
330 ## files 335 ## files
331 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2, HG_FORK)) 336 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s&amp;merge=1#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2, HG_FORK))
332 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2, HG_FORK)) 337 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s&amp;merge=1#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2, HG_FORK))
333 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2, HG_FORK)) 338 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s&amp;merge=1#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2, HG_FORK))
334 339
335 def test_org_repo_new_commits_after_forking_simple_diff(self): 340 def test_org_repo_new_commits_after_forking_simple_diff(self):
336 self.log_user() 341 self.log_user()
337 342
338 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg', 343 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
399 org_ref_type="branch", 404 org_ref_type="branch",
400 org_ref=rev1, 405 org_ref=rev1,
401 other_ref_type="branch", 406 other_ref_type="branch",
402 other_ref=rev2, 407 other_ref=rev2,
403 other_repo=r1_name, 408 other_repo=r1_name,
409 merge='1',
404 )) 410 ))
405 response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2)) 411 response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2))
406 response.mustcontain('No files') 412 response.mustcontain('No files')
407 response.mustcontain('No changesets') 413 response.mustcontain('No changesets')
408 414
423 org_ref_type="branch", 429 org_ref_type="branch",
424 org_ref=rev1, 430 org_ref=rev1,
425 other_ref_type="branch", 431 other_ref_type="branch",
426 other_ref=rev2, 432 other_ref=rev2,
427 other_repo=r1_name, 433 other_repo=r1_name,
434 merge='1',
428 )) 435 ))
429 436
430 response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2)) 437 response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2))
431 438
432 response.mustcontain("""commit2-parent""") 439 response.mustcontain("""commit2-parent""")