changeset 3484:75e563531350 beta

compare: drop unused rev_start and rev_end
author Mads Kiilerich <madski@unity3d.com>
date Mon, 04 Mar 2013 17:38:34 +0100
parents 8ee36513efae
children b19b1723ff10
files rhodecode/controllers/compare.py rhodecode/controllers/pullrequests.py rhodecode/templates/pullrequests/pullrequest.html rhodecode/tests/functional/test_compare.py
diffstat 4 files changed, 13 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/compare.py	Wed Mar 06 15:04:09 2013 +0100
+++ b/rhodecode/controllers/compare.py	Mon Mar 04 17:38:34 2013 +0100
@@ -91,9 +91,6 @@
         other_repo = request.GET.get('other_repo', org_repo)
         # fulldiff disables cut_off_limit
         c.fulldiff = request.GET.get('fulldiff')
-        # only consider this range of changesets
-        rev_start = request.GET.get('rev_start')
-        rev_end = request.GET.get('rev_end')
         # partial uses compare_cs.html template directly
         partial = request.environ.get('HTTP_X_PARTIAL_XHR')
         # as_form puts hidden input field with changeset revisions
@@ -133,21 +130,6 @@
         c.org_ref_type = org_ref[0]
         c.other_ref_type = other_ref[0]
 
-        if rev_start and rev_end:
-            # swap revs with cherry picked ones, save them for display
-            #org_ref = ('rev', rev_start)
-            #other_ref = ('rev', rev_end)
-            c.org_ref = rev_start[:12]
-            c.other_ref = rev_end[:12]
-            # get parent of
-            # rev start to include it in the diff
-            _cs = other_repo.scm_instance.get_changeset(rev_start)
-            rev_start = _cs.parents[0].raw_id if _cs.parents else EmptyChangeset().raw_id
-            org_ref = ('rev', rev_start)
-            other_ref = ('rev', rev_end)
-            #if we cherry pick it's not remote, make the other_repo org_repo
-            org_repo = other_repo
-
         c.cs_ranges, ancestor = PullRequestModel().get_compare_data(
             org_repo, org_ref, other_repo, other_ref)
 
--- a/rhodecode/controllers/pullrequests.py	Wed Mar 06 15:04:09 2013 +0100
+++ b/rhodecode/controllers/pullrequests.py	Mon Mar 04 17:38:34 2013 +0100
@@ -265,9 +265,6 @@
         :param pull_request:
         :type pull_request:
         """
-        rev_start = request.GET.get('rev_start')
-        rev_end = request.GET.get('rev_end')
-
         org_repo = pull_request.org_repo
         (org_ref_type,
          org_ref_name,
@@ -279,7 +276,7 @@
          other_ref_rev) = pull_request.other_ref.split(':')
 
         # despite opening revisions for bookmarks/branches/tags, we always
-        # convert this to rev to prevent changes after book or branch change
+        # convert this to rev to prevent changes after bookmark or branch change
         org_ref = ('rev', org_ref_rev)
         other_ref = ('rev', other_ref_rev)
 
--- a/rhodecode/templates/pullrequests/pullrequest.html	Wed Mar 06 15:04:09 2013 +0100
+++ b/rhodecode/templates/pullrequests/pullrequest.html	Mon Mar 04 17:38:34 2013 +0100
@@ -21,9 +21,6 @@
     </div>
     ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')}
     <div style="float:left;padding:0px 30px 30px 30px">
-        <input type="hidden" name="rev_start" value="${request.GET.get('rev_start')}" />
-        <input type="hidden" name="rev_end" value="${request.GET.get('rev_end')}" />
-
         ##ORG
         <div style="float:left">
             <div>
@@ -136,8 +133,7 @@
                          other_ref_type='__org_ref_type__',
                          other_ref='__org_ref__',
                          as_form=True,
-                         rev_start=request.GET.get('rev_start',''),
-                         rev_end=request.GET.get('rev_end',''))}";
+                         )}";
       var org_repo = YUQ('#pull_request_form #org_repo')[0].value;
       var org_ref = YUQ('#pull_request_form #org_ref')[0].value.split(':');
 
--- a/rhodecode/tests/functional/test_compare.py	Wed Mar 06 15:04:09 2013 +0100
+++ b/rhodecode/tests/functional/test_compare.py	Mon Mar 04 17:38:34 2013 +0100
@@ -215,20 +215,15 @@
         cs5 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\nline6\n',
                              message='commit6', vcs_type='hg', parent=cs4)
 
-        rev1 = 'tip'
-        rev2 = 'tip'
-
         response = self.app.get(url(controller='compare', action='index',
                                     repo_name=repo2.repo_name,
-                                    org_ref_type="tag",
-                                    org_ref=rev1,
+                                    org_ref_type="rev",
+                                    org_ref=cs1.short_id, # parent of cs2, in repo2
                                     other_repo=repo1.repo_name,
-                                    other_ref_type="tag",
-                                    other_ref=rev2,
-                                    rev_start=cs2.raw_id,
-                                    rev_end=cs4.raw_id,
+                                    other_ref_type="rev",
+                                    other_ref=cs4.short_id,
                                     ))
-        response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, cs2.short_id, repo1.repo_name, cs4.short_id))
+        response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, cs1.short_id, repo1.repo_name, cs4.short_id))
         response.mustcontain("""Showing 3 commits""")
         response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
 
@@ -280,21 +275,15 @@
                              message='commit5', vcs_type='hg', parent=cs3)
         cs5 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\nline6\n',
                              message='commit6', vcs_type='hg', parent=cs4)
-        rev1 = 'tip'
-        rev2 = 'tip'
-
         response = self.app.get(url(controller='compare', action='index',
-                                    repo_name=repo2.repo_name,
-                                    org_ref_type="tag",
-                                    org_ref=rev1,
-                                    other_repo=repo1.repo_name,
-                                    other_ref_type="tag",
-                                    other_ref=rev2,
-                                    rev_start=cs3.raw_id,
-                                    rev_end=cs5.raw_id,
+                                    repo_name=repo1.repo_name,
+                                    org_ref_type="rev",
+                                    org_ref=cs2.short_id, # parent of cs3, not in repo2
+                                    other_ref_type="rev",
+                                    other_ref=cs5.short_id,
                                     ))
 
-        response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, cs3.short_id, repo1.repo_name, cs5.short_id))
+        response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, cs2.short_id, repo1.repo_name, cs5.short_id))
         response.mustcontain("""Showing 3 commits""")
         response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")