~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Robert Collins
  • Date: 2007-10-10 00:54:09 UTC
  • mto: This revision was merged to the branch mainline in revision 2933.
  • Revision ID: robertc@robertcollins.net-20071010005409-4o492b9bqzatqfww
Basic implementation of all_packs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
class Pack(object):
94
94
    """An in memory proxy for a .pack and its indices."""
95
95
 
96
 
    def __init__(self):
97
 
        self.revision_index = None
98
 
        self.inventory_index = None
99
 
        self.text_index = None
100
 
        self.signature_index = None
101
 
        self.name = None
102
 
        self.transport = None
 
96
    def __init__(self, transport=None, name=None, revision_index=None,
 
97
        inventory_index=None, text_index=None, signature_index=None):
 
98
        self.revision_index = revision_index
 
99
        self.inventory_index = inventory_index
 
100
        self.text_index = text_index
 
101
        self.signature_index = signature_index
 
102
        self.name = name
 
103
        self.transport = transport
 
104
 
 
105
    def __eq__(self, other):
 
106
        return self.__dict__ == other.__dict__
 
107
 
 
108
    def __ne__(self, other):
 
109
        return not self.__eq__(other)
 
110
 
 
111
    def __repr__(self):
 
112
        return "<bzrlib.repofmt.pack_repo.Pack object at 0x%x, %s, %s" % (
 
113
            id(self), self.transport, self.name)
103
114
 
104
115
    def get_revision_count(self):
105
116
        return self.revision_index.key_count()
167
178
            revision_id, parents, new_lines, nostore_sha=nostore_sha,
168
179
            random_id=random_revid, check_content=False)[0:2]
169
180
 
 
181
    def all_packs(self):
 
182
        """Return a list of all the Pack objects this repository has.
 
183
 
 
184
        :return: A list of Pack objects for all the packs in the repository.
 
185
        """
 
186
        result = []
 
187
        for name in self.names():
 
188
            result.append(Pack(self._pack_transport, name, None, None, None))
 
189
        return result
 
190
 
170
191
    def all_pack_details(self):
171
192
        """Return a list of all the packs as transport,name tuples.
172
193