Mercurial > kallithea
comparison rhodecode/controllers/pullrequests.py @ 3015:16af24982e30 beta
Multiple changes for compare system
- count number of changed lines and files
- add combined compare button into the old per changeset compare
- fixed some logic for remote & bundle compare system
- added few tests for git compare
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 18 Nov 2012 23:17:02 +0100 |
parents | 32471bd1f4ee |
children | c2a206162062 |
comparison
equal
deleted
inserted
replaced
3014:02bbd574fa14 | 3015:16af24982e30 |
---|---|
49 from rhodecode.model.repo import RepoModel | 49 from rhodecode.model.repo import RepoModel |
50 from rhodecode.model.comment import ChangesetCommentsModel | 50 from rhodecode.model.comment import ChangesetCommentsModel |
51 from rhodecode.model.changeset_status import ChangesetStatusModel | 51 from rhodecode.model.changeset_status import ChangesetStatusModel |
52 from rhodecode.model.forms import PullRequestForm | 52 from rhodecode.model.forms import PullRequestForm |
53 from rhodecode.lib.vcs.exceptions import EmptyRepositoryError | 53 from rhodecode.lib.vcs.exceptions import EmptyRepositoryError |
54 from rhodecode.lib.vcs.backends.base import EmptyChangeset | |
54 | 55 |
55 log = logging.getLogger(__name__) | 56 log = logging.getLogger(__name__) |
56 | 57 |
57 | 58 |
58 class PullrequestsController(BaseRepoController): | 59 class PullrequestsController(BaseRepoController): |
275 ) | 276 ) |
276 if c.cs_ranges: | 277 if c.cs_ranges: |
277 # case we want a simple diff without incoming changesets, just | 278 # case we want a simple diff without incoming changesets, just |
278 # for review purposes. Make the diff on the forked repo, with | 279 # for review purposes. Make the diff on the forked repo, with |
279 # revision that is common ancestor | 280 # revision that is common ancestor |
280 other_ref = ('rev', c.cs_ranges[-1].parents[0].raw_id) | 281 other_ref = ('rev', getattr(c.cs_ranges[-1].parents[0] |
282 if c.cs_ranges[-1].parents | |
283 else EmptyChangeset(), 'raw_id')) | |
281 other_repo = org_repo | 284 other_repo = org_repo |
282 | 285 |
283 c.statuses = org_repo.statuses([x.raw_id for x in c.cs_ranges]) | 286 c.statuses = org_repo.statuses([x.raw_id for x in c.cs_ranges]) |
284 # defines that we need hidden inputs with changesets | 287 # defines that we need hidden inputs with changesets |
285 c.as_form = request.GET.get('as_form', False) | 288 c.as_form = request.GET.get('as_form', False) |
286 | 289 |
287 c.org_ref = org_ref[1] | 290 c.org_ref = org_ref[1] |
288 c.other_ref = other_ref[1] | 291 c.other_ref = other_ref[1] |
289 # diff needs to have swapped org with other to generate proper diff | 292 _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref, |
290 _diff = diffs.differ(other_repo, other_ref, org_repo, org_ref, | |
291 discovery_data) | 293 discovery_data) |
294 | |
292 diff_processor = diffs.DiffProcessor(_diff, format='gitdiff') | 295 diff_processor = diffs.DiffProcessor(_diff, format='gitdiff') |
293 _parsed = diff_processor.prepare() | 296 _parsed = diff_processor.prepare() |
294 | 297 |
295 c.files = [] | 298 c.files = [] |
296 c.changes = {} | 299 c.changes = {} |