Rev 63: Handle when self._index is NULL, mostly because the source text was the empty strig. in http://bzr.arbash-meinel.com/plugins/groupcompress_rabin
John Arbash Meinel
john at arbash-meinel.com
Sat Feb 28 04:28:03 GMT 2009
At http://bzr.arbash-meinel.com/plugins/groupcompress_rabin
------------------------------------------------------------
revno: 63
revision-id: john at arbash-meinel.com-20090228042802-joang5uih4qcf45p
parent: john at arbash-meinel.com-20090228042448-nfhhzpjuqic78bfr
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: groupcompress_rabin
timestamp: Fri 2009-02-27 22:28:02 -0600
message:
Handle when self._index is NULL, mostly because the source text was the empty strig.
Start using DeltaIndex as part of the stardard compressing.
-------------- next part --------------
=== modified file '_groupcompress_c.pyx'
--- a/_groupcompress_c.pyx 2009-02-28 04:24:48 +0000
+++ b/_groupcompress_c.pyx 2009-02-28 04:28:02 +0000
@@ -127,7 +127,8 @@
cdef void * delta
cdef unsigned long delta_size
- assert self._index != NULL
+ if self._index == NULL:
+ return None
if not PyString_CheckExact(target_bytes):
raise TypeError('target is not a str')
=== modified file 'groupcompress.py'
--- a/groupcompress.py 2009-02-28 04:00:12 +0000
+++ b/groupcompress.py 2009-02-28 04:28:02 +0000
@@ -52,7 +52,7 @@
VersionedFiles,
)
-_NO_LABELS = True
+_NO_LABELS = False
def parse(bytes):
if _NO_LABELS:
@@ -173,7 +173,8 @@
# we could try a delta against whatever the last delta we
# computed, (the idea being we just computed the delta_index, so
# we re-use it here, and see if that is good enough, etc)
- delta = _groupcompress_c.make_delta(source_text, target_text)
+ delta_index = _groupcompress_c.DeltaIndex(source_text)
+ delta = delta_index.make_delta(target_text)
if (delta is None
or len(delta) > len(target_text) / 2):
# We can't delta (perhaps source_text is empty)
More information about the bazaar-commits
mailing list