diff --git a/rhodecode/controllers/compare.py b/rhodecode/controllers/compare.py --- a/rhodecode/controllers/compare.py +++ b/rhodecode/controllers/compare.py @@ -3,7 +3,7 @@ rhodecode.controllers.compare ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - compare controller for pylons showoing differences between two + compare controller for pylons showing differences between two repos, branches, bookmarks or tips :created_on: May 6, 2012 @@ -89,7 +89,6 @@ class CompareController(BaseRepoControll org_ref = (org_ref_type, org_ref) other_ref = (other_ref_type, other_ref) other_repo = request.GET.get('repo', org_repo) - incoming_changesets = str2bool(request.GET.get('bundle', False)) c.fulldiff = fulldiff = request.GET.get('fulldiff') rev_start = request.GET.get('rev_start') rev_end = request.GET.get('rev_end') @@ -97,8 +96,7 @@ class CompareController(BaseRepoControll c.swap_url = h.url('compare_url', repo_name=other_repo, org_ref_type=other_ref[0], org_ref=other_ref[1], other_ref_type=org_ref[0], other_ref=org_ref[1], - repo=org_repo, as_form=request.GET.get('as_form'), - bundle=incoming_changesets) + repo=org_repo, as_form=request.GET.get('as_form')) c.org_repo = org_repo = Repository.get_by_repo_name(org_repo) c.other_repo = other_repo = Repository.get_by_repo_name(other_repo) @@ -142,7 +140,7 @@ class CompareController(BaseRepoControll c.org_ref = org_ref[1] c.other_ref = other_ref[1] - if not incoming_changesets and c.cs_ranges and c.org_repo != c.other_repo: + if c.cs_ranges and c.org_repo != c.other_repo: # 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 @@ -155,8 +153,7 @@ class CompareController(BaseRepoControll diff_limit = self.cut_off_limit if not fulldiff else None - _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref, - remote_compare=incoming_changesets) + _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref) diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff', diff_limit=diff_limit) diff --git a/rhodecode/lib/diffs.py b/rhodecode/lib/diffs.py --- a/rhodecode/lib/diffs.py +++ b/rhodecode/lib/diffs.py @@ -28,23 +28,15 @@ import re import difflib import logging -import traceback from itertools import tee, imap -from mercurial import patch -from mercurial.mdiff import diffopts -from mercurial.bundlerepo import bundlerepository - from pylons.i18n.translation import _ -from rhodecode.lib.compat import BytesIO -from rhodecode.lib.vcs.utils.hgcompat import localrepo from rhodecode.lib.vcs.exceptions import VCSError from rhodecode.lib.vcs.nodes import FileNode, SubModuleNode from rhodecode.lib.vcs.backends.base import EmptyChangeset from rhodecode.lib.helpers import escape -from rhodecode.lib.utils import make_ui from rhodecode.lib.utils2 import safe_unicode log = logging.getLogger(__name__) @@ -692,20 +684,8 @@ class DiffProcessor(object): return self.adds, self.removes -class InMemoryBundleRepo(bundlerepository): - def __init__(self, ui, path, bundlestream): - self._tempparent = None - localrepo.localrepository.__init__(self, ui, path) - self.ui.setconfig('phases', 'publish', False) - - self.bundle = bundlestream - - # dict with the mapping 'filename' -> position in the bundle - self.bundlefilespos = {} - - def differ(org_repo, org_ref, other_repo, other_ref, - remote_compare=False, context=3, ignore_whitespace=False): + context=3, ignore_whitespace=False): """ General differ between branches, bookmarks, revisions of two remote or local but related repositories @@ -733,37 +713,4 @@ def differ(org_repo, org_ref, other_repo ignore_whitespace=ignore_whitespace, context=context) return _diff - elif remote_compare: - opts = diffopts(git=True, ignorews=ignore_whitespace, context=context) - org_repo_peer = localrepo.locallegacypeer(org_repo.local()) - # create a bundle (uncompressed if other repo is not local) - if org_repo_peer.capable('getbundle'): - # disable repo hooks here since it's just bundle ! - # patch and reset hooks section of UI config to not run any - # hooks on fetching archives with subrepos - for k, _ in org_repo.ui.configitems('hooks'): - org_repo.ui.setconfig('hooks', k, None) - unbundle = org_repo.getbundle('incoming', common=None, - heads=None) - - buf = BytesIO() - while True: - chunk = unbundle._stream.read(1024 * 4) - if not chunk: - break - buf.write(chunk) - - buf.seek(0) - # replace chunked _stream with data that can do tell() and seek() - unbundle._stream = buf - - ui = make_ui('db') - bundlerepo = InMemoryBundleRepo(ui, path=org_repo.root, - bundlestream=unbundle) - - return ''.join(patch.diff(bundlerepo, - node1=other_repo[other_ref].node(), - node2=org_repo[org_ref].node(), - opts=opts)) - return '' diff --git a/rhodecode/templates/pullrequests/pullrequest.html b/rhodecode/templates/pullrequests/pullrequest.html --- a/rhodecode/templates/pullrequests/pullrequest.html +++ b/rhodecode/templates/pullrequests/pullrequest.html @@ -143,7 +143,7 @@ org_ref_type='org_ref_type', org_ref='org_ref', other_ref_type='other_ref_type', other_ref='other_ref', repo='other_repo', - as_form=True, bundle=False, + as_form=True, rev_start=request.GET.get('rev_start',''), rev_end=request.GET.get('rev_end',''))}"; diff --git a/rhodecode/tests/functional/test_compare_local.py b/rhodecode/tests/functional/test_compare_local.py --- a/rhodecode/tests/functional/test_compare_local.py +++ b/rhodecode/tests/functional/test_compare_local.py @@ -54,7 +54,6 @@ class TestCompareController(TestControll org_ref=tag1, other_ref_type="tag", other_ref=tag2, - bundle=False )) response.mustcontain('%s@%s -> %s@%s' % (GIT_REPO, tag1, GIT_REPO, tag2))