diff --git a/rhodecode/controllers/compare.py b/rhodecode/controllers/compare.py --- a/rhodecode/controllers/compare.py +++ b/rhodecode/controllers/compare.py @@ -91,15 +91,17 @@ class CompareController(BaseRepoControll c.fulldiff = fulldiff = request.GET.get('fulldiff') rev_start = request.GET.get('rev_start') rev_end = request.GET.get('rev_end') - - c.swap_url = h.url('compare_url', as_form=request.GET.get('as_form'), + # partial uses compare_cs.html template directly + partial = request.environ.get('HTTP_X_PARTIAL_XHR') + # as_form puts hidden input field with changeset revisions + c.as_form = partial and request.GET.get('as_form') + # swap url for compare_diff page - never partial and never as_form + c.swap_url = h.url('compare_url', repo_name=other_repo, org_ref_type=other_ref[0], org_ref=other_ref[1], other_repo=org_repo, other_ref_type=org_ref[0], other_ref=org_ref[1]) - partial = request.environ.get('HTTP_X_PARTIAL_XHR') - org_repo = Repository.get_by_repo_name(org_repo) other_repo = Repository.get_by_repo_name(other_repo) @@ -148,8 +150,6 @@ class CompareController(BaseRepoControll c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in c.cs_ranges]) - # defines that we need hidden inputs with changesets - c.as_form = request.GET.get('as_form', False) if partial: return render('compare/compare_cs.html') diff --git a/rhodecode/controllers/pullrequests.py b/rhodecode/controllers/pullrequests.py --- a/rhodecode/controllers/pullrequests.py +++ b/rhodecode/controllers/pullrequests.py @@ -291,8 +291,6 @@ class PullrequestsController(BaseRepoCon else EmptyChangeset(), 'raw_id')) c.statuses = org_repo.statuses([x.raw_id for x in c.cs_ranges]) - # defines that we need hidden inputs with changesets - c.as_form = request.GET.get('as_form', False) c.org_ref = org_ref[1] c.org_ref_type = org_ref[0] @@ -391,6 +389,7 @@ class PullrequestsController(BaseRepoCon ) c.changeset_statuses = ChangesetStatus.STATUSES + c.as_form = False return render('/pullrequests/pullrequest_show.html') @NotAnonymous() diff --git a/rhodecode/tests/functional/test_compare.py b/rhodecode/tests/functional/test_compare.py --- a/rhodecode/tests/functional/test_compare.py +++ b/rhodecode/tests/functional/test_compare.py @@ -120,7 +120,7 @@ class TestCompareController(TestControll ## files response.mustcontain("""file1""" % (repo1.repo_name, rev2, rev1, repo2.repo_name)) #swap - response.mustcontain("""[swap]""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) + response.mustcontain("""[swap]""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self): self.log_user() @@ -173,7 +173,7 @@ class TestCompareController(TestControll ## files response.mustcontain("""file1""" % (repo1.repo_name, rev2, rev1, repo2.repo_name)) #swap - response.mustcontain("""[swap]""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) + response.mustcontain("""[swap]""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) def test_compare_cherry_pick_changesets_from_bottom(self):