shafile.set_raw_string(string)
return shafile
- def _raw_length(self):
+ def raw_length(self):
"""Returns the length of the raw string of this object."""
return len(self.as_raw_string())
def _header(self):
- return "%s %lu\0" % (self._type, self._raw_length())
+ return "%s %lu\0" % (self._type, self.raw_length())
def _make_sha(self):
ret = make_sha()
def _serialize(self):
self._text = "".join(self._chunked)
- def _raw_length(self):
+ def raw_length(self):
ret = 0
for chunk in self.chunked:
ret += len(chunk)
# This helps us find good objects to diff against us
magic = []
for obj, path in recency:
- magic.append( (obj.type, path, 1, -len(obj.as_raw_string()), obj) )
+ magic.append( (obj.type, path, 1, -obj.raw_length(), obj) )
magic.sort()
# Build a map of objects and their index in magic - so we can find preceeding objects
# to diff against
def test_raw_length(self):
c = self.make_base()
- self.assertEquals(len(c.as_raw_string()), c._raw_length())
+ self.assertEquals(len(c.as_raw_string()), c.raw_length())
def test_simple(self):
c = self.make_base()