changeset 3304:70309536c143 beta

compare and diff: remove unused "bundle" functionality The 'bundle' parameter was never set, incoming_changesets was thus always False, remote_compare was thus always False, and InMemoryBundleRepo and bundlerepo was neverused.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 31 Jan 2013 23:27:21 +0100
parents ae5ac36cdf83
children 2f2202dbc523
files rhodecode/controllers/compare.py rhodecode/lib/diffs.py rhodecode/templates/pullrequests/pullrequest.html rhodecode/tests/functional/test_compare_local.py
diffstat 4 files changed, 6 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/compare.py	Thu Jan 03 18:05:18 2013 +0100
+++ b/rhodecode/controllers/compare.py	Thu Jan 31 23:27:21 2013 +0100
@@ -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 @@
         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 @@
         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 @@
         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 @@
 
         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)
--- a/rhodecode/lib/diffs.py	Thu Jan 03 18:05:18 2013 +0100
+++ b/rhodecode/lib/diffs.py	Thu Jan 31 23:27:21 2013 +0100
@@ -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 @@
         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 @@
             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 ''
--- a/rhodecode/templates/pullrequests/pullrequest.html	Thu Jan 03 18:05:18 2013 +0100
+++ b/rhodecode/templates/pullrequests/pullrequest.html	Thu Jan 31 23:27:21 2013 +0100
@@ -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',''))}";
 
--- a/rhodecode/tests/functional/test_compare_local.py	Thu Jan 03 18:05:18 2013 +0100
+++ b/rhodecode/tests/functional/test_compare_local.py	Thu Jan 31 23:27:21 2013 +0100
@@ -54,7 +54,6 @@
                                     org_ref=tag1,
                                     other_ref_type="tag",
                                     other_ref=tag2,
-                                    bundle=False
                                     ))
         response.mustcontain('%s@%s -&gt; %s@%s' % (GIT_REPO, tag1, GIT_REPO, tag2))