changeset 97:cde0e1d24e58

We always compress/decompress blob data So remove the test if we have a compressor or decompressor. While here, fix a line limit.
author Roy Marples <roy@marples.name>
date Fri, 22 Jan 2021 15:53:03 +0000
parents 7eb15a5c4cad
children 03224546f948
files hgext3rd/fastimport/__init__.py hgext3rd/fastimport/hgimport.py
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/fastimport/__init__.py	Fri Jan 22 00:03:52 2021 +0000
+++ b/hgext3rd/fastimport/__init__.py	Fri Jan 22 15:53:03 2021 +0000
@@ -65,7 +65,8 @@
 
     # sink is the current repo, src is the list of fastimport streams
     destc = hg.mercurial_sink(ui, b"hg", repo.root)
-    srcc = fastimport_source(ui, b"fastimport", repo, sources, opts[b"blobpath"])
+    srcc = fastimport_source(ui, b"fastimport", repo, sources,
+                             opts[b"blobpath"])
 
     defaultsort = b"branchsort"          # for efficiency and consistency
     sortmodes = (b"branchsort", b"datesort", b"sourcesort")
--- a/hgext3rd/fastimport/hgimport.py	Fri Jan 22 00:03:52 2021 +0000
+++ b/hgext3rd/fastimport/hgimport.py	Fri Jan 22 15:53:03 2021 +0000
@@ -208,8 +208,7 @@
         return os.path.join(self.blobpath, b"blob-" + blobid)
 
     def writeblob(self, blobid, data):
-        if self.compressor:
-            data = self.compressor.compress(data)
+        data = self.compressor.compress(data)
 
         if have_sqlite:
             if self.blobdb is None:
@@ -246,9 +245,7 @@
         if not data:
             raise RuntimeError("missing blob %s for fileid %s"
                                % (blobid, fileid))
-        if self.decompressor:
-            data = self.decompressor.decompress(data, 10**8)
-        return data
+        return self.decompressor.decompress(data, 10**8)
 
     def getmode(self, name, fileid):
         (commitid, blobid) = fileid