Mercurial > kallithea
comparison rhodecode/controllers/compare.py @ 3323:a07296564f6b beta
compare: show aggregated diff of what will be merged to other repo, using merge ancestor
pull_request.get_compare_data will also now return the ancestor that would be
used for actual merging. Showing a diff from that ancestor instead of the first
'new' changeset will give a more realistic diff that doesn't include merges.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 01 Feb 2013 23:13:10 +0100 |
parents | c9b0f1d363c7 |
children | c9b85375776d |
comparison
equal
deleted
inserted
replaced
3322:c9b0f1d363c7 | 3323:a07296564f6b |
---|---|
124 if rev_start and rev_end: | 124 if rev_start and rev_end: |
125 #replace our org_ref with given CS | 125 #replace our org_ref with given CS |
126 org_ref = ('rev', rev_start) | 126 org_ref = ('rev', rev_start) |
127 other_ref = ('rev', rev_end) | 127 other_ref = ('rev', rev_end) |
128 | 128 |
129 c.cs_ranges = PullRequestModel().get_compare_data( | 129 c.cs_ranges, ancestor = PullRequestModel().get_compare_data( |
130 org_repo, org_ref, other_repo, other_ref, | 130 org_repo, org_ref, other_repo, other_ref) |
131 ) | |
132 | 131 |
133 c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in | 132 c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in |
134 c.cs_ranges]) | 133 c.cs_ranges]) |
135 c.target_repo = c.other_repo.repo_name | 134 c.target_repo = c.other_repo.repo_name |
136 # defines that we need hidden inputs with changesets | 135 # defines that we need hidden inputs with changesets |
139 return render('compare/compare_cs.html') | 138 return render('compare/compare_cs.html') |
140 | 139 |
141 c.org_ref = org_ref[1] | 140 c.org_ref = org_ref[1] |
142 c.other_ref = other_ref[1] | 141 c.other_ref = other_ref[1] |
143 | 142 |
144 if c.cs_ranges and c.org_repo != c.other_repo: | 143 if ancestor and c.org_repo != c.other_repo: |
145 # case we want a simple diff without incoming changesets, just | 144 # case we want a simple diff without incoming changesets, |
146 # for review purposes. Make the diff on the forked repo, with | 145 # previewing what will be merged. |
146 # Make the diff on the forked repo, with | |
147 # revision that is common ancestor | 147 # revision that is common ancestor |
148 _org_ref = org_ref | 148 _org_ref = org_ref |
149 org_ref = ('rev', getattr(c.cs_ranges[0].parents[0] | 149 log.debug('Using ancestor %s as org_ref instead of %s', ancestor, _org_ref) |
150 if c.cs_ranges[0].parents | 150 org_ref = ('rev', ancestor) |
151 else EmptyChangeset(), 'raw_id')) | |
152 log.debug('Changed org_ref from %s to %s' % (_org_ref, org_ref)) | |
153 org_repo = other_repo | 151 org_repo = other_repo |
154 | 152 |
155 diff_limit = self.cut_off_limit if not fulldiff else None | 153 diff_limit = self.cut_off_limit if not fulldiff else None |
156 | 154 |
157 _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref) | 155 _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref) |