Show More
@@ -161,7 +161,10 b' class CompareController(BaseRepoControll' | |||||
161 |
|
161 | |||
162 | diff_limit = self.cut_off_limit if not c.fulldiff else None |
|
162 | diff_limit = self.cut_off_limit if not c.fulldiff else None | |
163 |
|
163 | |||
164 | _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref) |
|
164 | log.debug('running diff between %s@%s and %s@%s' | |
|
165 | % (org_repo.scm_instance.path, org_ref, | |||
|
166 | other_repo.scm_instance.path, other_ref)) | |||
|
167 | _diff = org_repo.scm_instance.get_diff(rev1=safe_str(org_ref[1]), rev2=safe_str(other_ref[1])) | |||
165 |
|
168 | |||
166 | diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff', |
|
169 | diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff', | |
167 | diff_limit=diff_limit) |
|
170 | diff_limit=diff_limit) |
@@ -42,6 +42,7 b' from rhodecode.lib.helpers import Page' | |||||
42 | from rhodecode.lib import helpers as h |
|
42 | from rhodecode.lib import helpers as h | |
43 | from rhodecode.lib import diffs |
|
43 | from rhodecode.lib import diffs | |
44 | from rhodecode.lib.utils import action_logger, jsonify |
|
44 | from rhodecode.lib.utils import action_logger, jsonify | |
|
45 | from rhodecode.lib.vcs.utils import safe_str | |||
45 | from rhodecode.lib.vcs.exceptions import EmptyRepositoryError |
|
46 | from rhodecode.lib.vcs.exceptions import EmptyRepositoryError | |
46 | from rhodecode.lib.vcs.backends.base import EmptyChangeset |
|
47 | from rhodecode.lib.vcs.backends.base import EmptyChangeset | |
47 | from rhodecode.lib.diffs import LimitedDiffContainer |
|
48 | from rhodecode.lib.diffs import LimitedDiffContainer | |
@@ -328,7 +329,10 b' class PullrequestsController(BaseRepoCon' | |||||
328 | diff_limit = self.cut_off_limit if not fulldiff else None |
|
329 | diff_limit = self.cut_off_limit if not fulldiff else None | |
329 |
|
330 | |||
330 | #we swap org/other ref since we run a simple diff on one repo |
|
331 | #we swap org/other ref since we run a simple diff on one repo | |
331 | _diff = diffs.differ(org_repo, other_ref, other_repo, org_ref) |
|
332 | log.debug('running diff between %s@%s and %s@%s' | |
|
333 | % (org_repo.scm_instance.path, org_ref, | |||
|
334 | other_repo.scm_instance.path, other_ref)) | |||
|
335 | _diff = org_repo.scm_instance.get_diff(rev1=safe_str(org_ref[1]), rev2=safe_str(other_ref[1])) | |||
332 |
|
336 | |||
333 | diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff', |
|
337 | diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff', | |
334 | diff_limit=diff_limit) |
|
338 | diff_limit=diff_limit) |
@@ -682,36 +682,3 b' class DiffProcessor(object):' | |||||
682 | Returns tuple of added, and removed lines for this instance |
|
682 | Returns tuple of added, and removed lines for this instance | |
683 | """ |
|
683 | """ | |
684 | return self.adds, self.removes |
|
684 | return self.adds, self.removes | |
685 |
|
||||
686 |
|
||||
687 | def differ(org_repo, org_ref, other_repo, other_ref, |
|
|||
688 | context=3, ignore_whitespace=False): |
|
|||
689 | """ |
|
|||
690 | General differ between branches, bookmarks, revisions of two remote or |
|
|||
691 | local but related repositories |
|
|||
692 |
|
||||
693 | :param org_repo: |
|
|||
694 | :param org_ref: |
|
|||
695 | :param other_repo: |
|
|||
696 | :type other_repo: |
|
|||
697 | :type other_ref: |
|
|||
698 | """ |
|
|||
699 |
|
||||
700 | org_repo_scm = org_repo.scm_instance |
|
|||
701 | other_repo_scm = other_repo.scm_instance |
|
|||
702 |
|
||||
703 | org_repo = org_repo_scm._repo |
|
|||
704 | other_repo = other_repo_scm._repo |
|
|||
705 |
|
||||
706 | org_ref = safe_str(org_ref[1]) |
|
|||
707 | other_ref = safe_str(other_ref[1]) |
|
|||
708 |
|
||||
709 | if org_repo_scm == other_repo_scm: |
|
|||
710 | log.debug('running diff between %s@%s and %s@%s' |
|
|||
711 | % (org_repo.path, org_ref, |
|
|||
712 | other_repo.path, other_ref)) |
|
|||
713 | _diff = org_repo_scm.get_diff(rev1=org_ref, rev2=other_ref, |
|
|||
714 | ignore_whitespace=ignore_whitespace, context=context) |
|
|||
715 | return _diff |
|
|||
716 |
|
||||
717 | return '' # FIXME: when is it ever relevant to return nothing? |
|
General Comments 0
You need to be logged in to leave comments.
Login now