diff rhodecode/controllers/pullrequests.py @ 2892:5fba3778431c beta

#590 Add GET flag that controls the way the diff are generated, for pull requests we want to use non-bundle based diffs, That are far better for doing code reviews. The /compare url still uses bundle compare for full comparision including the incoming changesets. - Fixed tests
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 03 Oct 2012 18:41:57 +0200
parents 95923493de9a
children eb180eb16c18
line wrap: on
line diff
--- a/rhodecode/controllers/pullrequests.py	Tue Oct 02 23:24:41 2012 +0200
+++ b/rhodecode/controllers/pullrequests.py	Wed Oct 03 18:41:57 2012 +0200
@@ -272,6 +272,12 @@
         c.cs_ranges, discovery_data = PullRequestModel().get_compare_data(
                                        org_repo, org_ref, other_repo, other_ref
                                       )
+        if c.cs_ranges:
+            # case we want a simple diff without incoming changesets, just
+            # for review purposes. Make the diff on the forked repo, with
+            # revision that is common ancestor
+            other_ref = ('rev', c.cs_ranges[-1].parents[0].raw_id)
+            other_repo = org_repo
 
         c.statuses = org_repo.statuses([x.raw_id for x in c.cs_ranges])
         # defines that we need hidden inputs with changesets