/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 git/objects.py

  • Committer: James Westby
  • Date: 2007-03-30 16:20:00 UTC
  • mto: (0.215.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jw+debian@jameswestby.net-20070330162000-0muski7om3axcszs
Add some basic pack handling code.

It has classes for the index and data parts. It supports lookup of an object
name in the index, and then access to the object in the data part using the
offset returned from the index lookup.

There are many problems with it so far.

  * The mmap in python has no offset, so the whole files are mapped.
  * There is no support for delta objects.
  * There is no consistency checking.
  * The code is not hooked up to provide a simple API.
  * The code is not hooked in to the repo, so that objects are still not
    retrieved from packs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
    finally:
133
133
      f.close()
134
134
 
 
135
  @classmethod
 
136
  def from_raw_string(cls, type, string):
 
137
    """Creates an object of the indicated type from the raw string given.
 
138
 
 
139
    Type is the numeric type of an object. String is the raw uncompressed
 
140
    contents.
 
141
    """
 
142
    real_class = num_type_map[type]
 
143
    obj = real_class()
 
144
    obj._text = string
 
145
    obj._update_contents()
 
146
    return obj
 
147
 
135
148
  def _header(self):
136
149
    return "%s %lu\0" % (self._type, len(self._contents))
137
150