##// END OF EJS Templates
compare: cleanup of as_form handling...
Mads Kiilerich -
r3442:b3680a20 beta
parent child Browse files
Show More
@@ -91,15 +91,17 b' class CompareController(BaseRepoControll'
91 91 c.fulldiff = fulldiff = request.GET.get('fulldiff')
92 92 rev_start = request.GET.get('rev_start')
93 93 rev_end = request.GET.get('rev_end')
94
95 c.swap_url = h.url('compare_url', as_form=request.GET.get('as_form'),
94 # partial uses compare_cs.html template directly
95 partial = request.environ.get('HTTP_X_PARTIAL_XHR')
96 # as_form puts hidden input field with changeset revisions
97 c.as_form = partial and request.GET.get('as_form')
98 # swap url for compare_diff page - never partial and never as_form
99 c.swap_url = h.url('compare_url',
96 100 repo_name=other_repo,
97 101 org_ref_type=other_ref[0], org_ref=other_ref[1],
98 102 other_repo=org_repo,
99 103 other_ref_type=org_ref[0], other_ref=org_ref[1])
100 104
101 partial = request.environ.get('HTTP_X_PARTIAL_XHR')
102
103 105 org_repo = Repository.get_by_repo_name(org_repo)
104 106 other_repo = Repository.get_by_repo_name(other_repo)
105 107
@@ -148,8 +150,6 b' class CompareController(BaseRepoControll'
148 150
149 151 c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
150 152 c.cs_ranges])
151 # defines that we need hidden inputs with changesets
152 c.as_form = request.GET.get('as_form', False)
153 153 if partial:
154 154 return render('compare/compare_cs.html')
155 155
@@ -291,8 +291,6 b' class PullrequestsController(BaseRepoCon'
291 291 else EmptyChangeset(), 'raw_id'))
292 292
293 293 c.statuses = org_repo.statuses([x.raw_id for x in c.cs_ranges])
294 # defines that we need hidden inputs with changesets
295 c.as_form = request.GET.get('as_form', False)
296 294
297 295 c.org_ref = org_ref[1]
298 296 c.org_ref_type = org_ref[0]
@@ -391,6 +389,7 b' class PullrequestsController(BaseRepoCon'
391 389 )
392 390 c.changeset_statuses = ChangesetStatus.STATUSES
393 391
392 c.as_form = False
394 393 return render('/pullrequests/pullrequest_show.html')
395 394
396 395 @NotAnonymous()
@@ -120,7 +120,7 b' class TestCompareController(TestControll'
120 120 ## files
121 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 122 #swap
123 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
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 124
125 125 def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self):
126 126 self.log_user()
@@ -173,7 +173,7 b' class TestCompareController(TestControll'
173 173 ## files
174 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))
175 175 #swap
176 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
176 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
177 177
178 178 def test_compare_cherry_pick_changesets_from_bottom(self):
179 179
General Comments 0
You need to be logged in to leave comments. Login now