/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-21 17:02:47 UTC
  • mto: This revision was merged to the branch mainline in revision 4771.
  • Revision ID: john@arbash-meinel.com-20091021170247-wrxl9tee83r1arnb
Track down a bunch of places in the 'inventory' code that was
passing simple tuples into the CHKMap layer. Note that almost all of these
are cases where we started with a file_id and then want to translate that
into the CHKMap lookup key. As such, these aren't places where we would
expect to already have a tuple. Since the Inventory api is in raw strings
and not keys. Anyway, forward progress as this fixes a lot of failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1600
1600
        interesting.add(None) # this will auto-filter it in the loop
1601
1601
        remaining_parents.discard(None) 
1602
1602
        while remaining_parents:
1603
 
            if None in remaining_parents:
1604
 
                import pdb; pdb.set_trace()
1605
1603
            next_parents = set()
1606
1604
            for entry in self._getitems(remaining_parents):
1607
1605
                next_parents.add(entry.parent_id)
1616
1614
        while directories_to_expand:
1617
1615
            # Expand directories by looking in the
1618
1616
            # parent_id_basename_to_file_id map
1619
 
            keys = [(f,) for f in directories_to_expand]
 
1617
            keys = [StaticTuple(f,) for f in directories_to_expand]
1620
1618
            directories_to_expand = set()
1621
1619
            items = self.parent_id_basename_to_file_id.iteritems(keys)
1622
1620
            next_file_ids = set([item[1] for item in items])
2016
2014
            return result
2017
2015
        try:
2018
2016
            return self._bytes_to_entry(
2019
 
                self.id_to_entry.iteritems([(file_id,)]).next()[1])
 
2017
                self.id_to_entry.iteritems([StaticTuple(file_id,)]).next()[1])
2020
2018
        except StopIteration:
2021
2019
            # really we're passing an inventory, not a tree...
2022
2020
            raise errors.NoSuchId(self, file_id)
2035
2033
                remaining.append(file_id)
2036
2034
            else:
2037
2035
                result.append(entry)
2038
 
        file_keys = [(f,) for f in remaining]
 
2036
        file_keys = [StaticTuple(f,) for f in remaining]
2039
2037
        for file_key, value in self.id_to_entry.iteritems(file_keys):
2040
2038
            entry = self._bytes_to_entry(value)
2041
2039
            result.append(entry)
2046
2044
        # Perhaps have an explicit 'contains' method on CHKMap ?
2047
2045
        if self._fileid_to_entry_cache.get(file_id, None) is not None:
2048
2046
            return True
2049
 
        return len(list(self.id_to_entry.iteritems([(file_id,)]))) == 1
 
2047
        return len(list(
 
2048
            self.id_to_entry.iteritems([StaticTuple(file_id,)]))) == 1
2050
2049
 
2051
2050
    def is_root(self, file_id):
2052
2051
        return file_id == self.root_id
2204
2203
            basename_utf8 = basename.encode('utf8')
2205
2204
            file_id = self._path_to_fileid_cache.get(cur_path, None)
2206
2205
            if file_id is None:
2207
 
                key_filter = [(current_id, basename_utf8)]
 
2206
                key_filter = [StaticTuple(current_id, basename_utf8)]
2208
2207
                items = parent_id_index.iteritems(key_filter)
2209
2208
                for (parent_id, name_utf8), file_id in items:
2210
2209
                    if parent_id != current_id or name_utf8 != basename_utf8:
2234
2233
            lines.append("root_id: %s\n" % self.root_id)
2235
2234
            if self.parent_id_basename_to_file_id is not None:
2236
2235
                lines.append('parent_id_basename_to_file_id: %s\n' %
2237
 
                    self.parent_id_basename_to_file_id.key())
2238
 
            lines.append("id_to_entry: %s\n" % self.id_to_entry.key())
 
2236
                    (self.parent_id_basename_to_file_id.key()[0],))
 
2237
            lines.append("id_to_entry: %s\n" % (self.id_to_entry.key()[0],))
2239
2238
        return lines
2240
2239
 
2241
2240
    @property
2282
2281
        parent_id_index = self._chk_inventory.parent_id_basename_to_file_id
2283
2282
        child_keys = set()
2284
2283
        for (parent_id, name_utf8), file_id in parent_id_index.iteritems(
2285
 
            key_filter=[(self.file_id,)]):
2286
 
            child_keys.add((file_id,))
 
2284
            key_filter=[StaticTuple(self.file_id,)]):
 
2285
            child_keys.add(StaticTuple(file_id,))
2287
2286
        cached = set()
2288
2287
        for file_id_key in child_keys:
2289
2288
            entry = self._chk_inventory._fileid_to_entry_cache.get(