Rev 108: Don't depend on things we don't use in http://bazaar.launchpad.net/%7Ebzr/bzr-groupcompress/rabin

John Arbash Meinel john at arbash-meinel.com
Wed Mar 4 20:53:57 GMT 2009


At http://bazaar.launchpad.net/%7Ebzr/bzr-groupcompress/rabin

------------------------------------------------------------
revno: 108
revision-id: john at arbash-meinel.com-20090304205302-lctq3j0gqkpxga0a
parent: john at arbash-meinel.com-20090304153824-86p8mekizpx70bkr
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: rabin
timestamp: Wed 2009-03-04 14:53:02 -0600
message:
  Don't depend on things we don't use
-------------- next part --------------
=== removed file 'equivalence_table.py'
--- a/equivalence_table.py	2008-07-24 03:11:33 +0000
+++ b/equivalence_table.py	1970-01-01 00:00:00 +0000
@@ -1,85 +0,0 @@
-# Copyright (C) 2008 Canonical Limited.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
-#
-
-"""Functions for dealing with a persistent equivalency table."""
-
-
-SENTINEL = -1
-
-
-class EquivalenceTable(object):
-    """This class tracks equivalencies between lists of hashable objects.
-
-    :ivar lines: The 'static' lines that will be preserved between runs.
-    :ival _matching_lines: A dict of {line:[matching offsets]}
-    """
-
-    def __init__(self, lines):
-        self.lines = lines
-        self._right_lines = None
-        # For each line in 'left' give the offset to the other lines which
-        # match it.
-        self._generate_matching_lines()
-
-    def _generate_matching_lines(self):
-        matches = {}
-        for idx, line in enumerate(self.lines):
-            matches.setdefault(line, []).append(idx)
-        self._matching_lines = matches
-
-    def _update_matching_lines(self, new_lines, index):
-        matches = self._matching_lines
-        start_idx = len(self.lines)
-        for idx, do_index in enumerate(index):
-            if not do_index:
-                continue
-            matches.setdefault(new_lines[idx], []).append(start_idx + idx)
-
-    def get_matches(self, line):
-        """Return the lines which match the line in right."""
-        try:
-            return self._matching_lines[line]
-        except KeyError:
-            return None
-
-    def _get_matching_lines(self):
-        """Return a dictionary showing matching lines."""
-        matching = {}
-        for line in self.lines:
-            matching[line] = self.get_matches(line)
-        return matching
-
-    def get_idx_matches(self, right_idx):
-        """Return the left lines matching the right line at the given offset."""
-        line = self._right_lines[right_idx]
-        try:
-            return self._matching_lines[line]
-        except KeyError:
-            return None
-
-    def extend_lines(self, lines, index):
-        """Add more lines to the left-lines list.
-
-        :param lines: A list of lines to add
-        :param index: A True/False for each node to define if it should be
-            indexed.
-        """
-        self._update_matching_lines(lines, index)
-        self.lines.extend(lines)
-
-    def set_right_lines(self, lines):
-        """Set the lines we will be matching against."""
-        self._right_lines = lines

=== modified file 'groupcompress.py'
--- a/groupcompress.py	2009-03-04 15:27:48 +0000
+++ b/groupcompress.py	2009-03-04 20:53:02 +0000
@@ -42,7 +42,6 @@
     )
 from bzrlib.btree_index import BTreeBuilder
 from bzrlib.lru_cache import LRUSizeCache
-from bzrlib.plugins.groupcompress import equivalence_table
 from bzrlib.tsort import topo_sort
 from bzrlib.versionedfile import (
     adapter_registry,



More information about the bazaar-commits mailing list