Rev 4: We are now able to 'bzr branch' at least with older bzr.dev. in http://bzr.arbash-meinel.com/plugins/xdelta_repo

John Arbash Meinel john at arbash-meinel.com
Fri Feb 20 20:33:28 GMT 2009


At http://bzr.arbash-meinel.com/plugins/xdelta_repo

------------------------------------------------------------
revno: 4
revision-id: john at arbash-meinel.com-20090220203305-np9cf3z9j94tjw2l
parent: john at arbash-meinel.com-20090220201243-ga4w1zg55m3z3f4j
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: xdelta_repo
timestamp: Fri 2009-02-20 14:33:05 -0600
message:
  We are now able to 'bzr branch' at least with older bzr.dev.
  
  Newer bzr.dev uses some weird knit-delta-closure work, that doesn't properly
  map to the old way of doing things.
  
  The final size is grossly bloated (14M up from 2.9M), though it is rather
  fast to work with.
  
  Need to work on including 'source' compression.
-------------- next part --------------
=== modified file 'xdelta_repo.py'
--- a/xdelta_repo.py	2009-02-20 20:12:43 +0000
+++ b/xdelta_repo.py	2009-02-20 20:33:05 +0000
@@ -27,11 +27,15 @@
     knit,
     osutils,
     pack,
+    repository,
     versionedfile,
     )
 from bzrlib.repofmt import pack_repo
 
-chk_support = False
+if getattr(pack_repo, 'CHKInventoryRepository', None) is not None:
+    chk_support = True
+else:
+    chk_support = False
 
 
 def _parse(bytes):
@@ -466,9 +470,12 @@
             index, start, length = self._access.add_raw_records(
                 [(None, len(comp_bytes))], comp_bytes)[0]
             # For now, we have no compression parents
-            nodes = [(record.key, "%d %d %d" % (start, length,
-                                                total_bytes_length),
-                      (record.parents, ()))]
+            value = "%d %d %d" % (start, length, total_bytes_length)
+            if self._delta:
+                refs = (record.parents, ())
+            else:
+                refs = (record.parents,)
+            nodes = [(record.key, value, refs)]
             self._index.add_records(nodes)
             yield sha1
 
@@ -661,4 +668,15 @@
         return ("Development repository format - btree+xdelta,"
                 " interoperates with pack-0.92\n")
 
-
+def pack_incompatible(source, target,
+                      orig_method=repository.InterPackRepo.is_compatible):
+    """Be incompatible with the regular fetch code."""
+    formats = (RepositoryFormatPackXDelta,)
+    # XXX: handle chk_support
+    if isinstance(source._format, formats) or isinstance(target._format, formats):
+        return False
+    else:
+        return orig_method(source, target)
+
+
+repository.InterPackRepo.is_compatible = staticmethod(pack_incompatible)



More information about the bazaar-commits mailing list