Mercurial > hg > hg-fastimport
comparison hgext3rd/fastimport/hgimport.py @ 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 | 3b398a887b95 |
| children |
comparison
equal
deleted
inserted
replaced
| 96:7eb15a5c4cad | 97:cde0e1d24e58 |
|---|---|
| 206 def _getblobfilename(self, blobid): | 206 def _getblobfilename(self, blobid): |
| 207 # XXX should escape ":" for windows | 207 # XXX should escape ":" for windows |
| 208 return os.path.join(self.blobpath, b"blob-" + blobid) | 208 return os.path.join(self.blobpath, b"blob-" + blobid) |
| 209 | 209 |
| 210 def writeblob(self, blobid, data): | 210 def writeblob(self, blobid, data): |
| 211 if self.compressor: | 211 data = self.compressor.compress(data) |
| 212 data = self.compressor.compress(data) | |
| 213 | 212 |
| 214 if have_sqlite: | 213 if have_sqlite: |
| 215 if self.blobdb is None: | 214 if self.blobdb is None: |
| 216 self._openblobdb() | 215 self._openblobdb() |
| 217 self.blobdb.execute("INSERT OR IGNORE INTO blob(id, content) VALUES(?, ?)", | 216 self.blobdb.execute("INSERT OR IGNORE INTO blob(id, content) VALUES(?, ?)", |
| 244 data = f.read() | 243 data = f.read() |
| 245 | 244 |
| 246 if not data: | 245 if not data: |
| 247 raise RuntimeError("missing blob %s for fileid %s" | 246 raise RuntimeError("missing blob %s for fileid %s" |
| 248 % (blobid, fileid)) | 247 % (blobid, fileid)) |
| 249 if self.decompressor: | 248 return self.decompressor.decompress(data, 10**8) |
| 250 data = self.decompressor.decompress(data, 10**8) | |
| 251 return data | |
| 252 | 249 |
| 253 def getmode(self, name, fileid): | 250 def getmode(self, name, fileid): |
| 254 (commitid, blobid) = fileid | 251 (commitid, blobid) = fileid |
| 255 return self.filemodes[commitid][name] | 252 return self.filemodes[commitid][name] |
| 256 | 253 |
