comparison tests/simplestorerepo.py @ 39883:3e896b51aa5d

storageutil: move metadata parsing and packing from revlog (API) Parsing and writing of revision text metadata is likely identical across storage backends. Let's move the code out of revlog so we don't need to import the revlog module in order to use it. Differential Revision: https://phab.mercurial-scm.org/D4754
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 24 Sep 2018 14:31:31 -0700
parents f8eb71f9e3bd
children 2f80eaf38ed4
comparison
equal deleted inserted replaced
39882:f8eb71f9e3bd 39883:3e896b51aa5d
324 324
325 if self.parents(node)[0] != nullid: 325 if self.parents(node)[0] != nullid:
326 return False 326 return False
327 327
328 fulltext = self.revision(node) 328 fulltext = self.revision(node)
329 m = revlog.parsemeta(fulltext)[0] 329 m = storageutil.parsemeta(fulltext)[0]
330 330
331 if m and 'copy' in m: 331 if m and 'copy' in m:
332 return m['copy'], bin(m['copyrev']) 332 return m['copy'], bin(m['copyrev'])
333 333
334 return False 334 return False
409 409
410 return [b'/'.join((self._storepath, f)) for f in entries] 410 return [b'/'.join((self._storepath, f)) for f in entries]
411 411
412 def add(self, text, meta, transaction, linkrev, p1, p2): 412 def add(self, text, meta, transaction, linkrev, p1, p2):
413 if meta or text.startswith(b'\1\n'): 413 if meta or text.startswith(b'\1\n'):
414 text = revlog.packmeta(meta, text) 414 text = storageutil.packmeta(meta, text)
415 415
416 return self.addrevision(text, transaction, linkrev, p1, p2) 416 return self.addrevision(text, transaction, linkrev, p1, p2)
417 417
418 def addrevision(self, text, transaction, linkrev, p1, p2, node=None, 418 def addrevision(self, text, transaction, linkrev, p1, p2, node=None,
419 flags=revlog.REVIDX_DEFAULT_FLAGS, cachedelta=None): 419 flags=revlog.REVIDX_DEFAULT_FLAGS, cachedelta=None):