##// END OF EJS Templates
sqlitestore: support for storing revisions without their parents...
Gregory Szorc -
r40428:595641bd default
parent child Browse files
Show More
@@ -110,6 +110,8 b' COMPRESSION_ZSTD = 2'
110 110 COMPRESSION_ZLIB = 3
111 111
112 112 FLAG_CENSORED = 1
113 FLAG_MISSING_P1 = 2
114 FLAG_MISSING_P2 = 4
113 115
114 116 CREATE_SCHEMA = [
115 117 # Deltas are stored as content-indexed blobs.
@@ -535,6 +537,11 b' class sqlitefilestore(object):'
535 537 self._revisioncache, stoprids,
536 538 zstddctx=self._dctx)
537 539
540 # Don't verify hashes if parent nodes were rewritten, as the hash
541 # wouldn't verify.
542 if self._revisions[node].flags & (FLAG_MISSING_P1 | FLAG_MISSING_P2):
543 _verifyhash = False
544
538 545 if _verifyhash:
539 546 self._checkhash(fulltext, node)
540 547 self._revisioncache[node] = fulltext
@@ -618,10 +625,6 b' class sqlitefilestore(object):'
618 625
619 626 def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None,
620 627 maybemissingparents=False):
621 if maybemissingparents:
622 raise error.Abort(_('SQLite storage does not support missing '
623 'parents write mode'))
624
625 628 nodes = []
626 629
627 630 for node, p1, p2, linknode, deltabase, delta, wireflags in deltas:
@@ -633,6 +636,15 b' class sqlitefilestore(object):'
633 636 if wireflags & ~repository.REVISION_FLAG_CENSORED:
634 637 raise SQLiteStoreError('unhandled revision flag')
635 638
639 if maybemissingparents:
640 if p1 != nullid and not self.hasnode(p1):
641 p1 = nullid
642 storeflags |= FLAG_MISSING_P1
643
644 if p2 != nullid and not self.hasnode(p2):
645 p2 = nullid
646 storeflags |= FLAG_MISSING_P2
647
636 648 baserev = self.rev(deltabase)
637 649
638 650 # If base is censored, delta must be full replacement in a single
@@ -657,6 +669,29 b' class sqlitefilestore(object):'
657 669 nodes.append(node)
658 670
659 671 if node in self._revisions:
672 # Possibly reset parents to make them proper.
673 entry = self._revisions[node]
674
675 if entry.flags & FLAG_MISSING_P1 and p1 != nullid:
676 entry.p1node = p1
677 entry.p1rev = self._nodetorev[p1]
678 entry.flags &= ~FLAG_MISSING_P1
679
680 self._db.execute(
681 r'UPDATE fileindex SET p1rev=?, flags=? '
682 r'WHERE id=?',
683 (self._nodetorev[p1], entry.flags, entry.rid))
684
685 if entry.flags & FLAG_MISSING_P2 and p2 != nullid:
686 entry.p2node = p2
687 entry.p2rev = self._nodetorev[p2]
688 entry.flags &= ~FLAG_MISSING_P2
689
690 self._db.execute(
691 r'UPDATE fileindex SET p2rev=?, flags=? '
692 r'WHERE id=?',
693 (self._nodetorev[p1], entry.flags, entry.rid))
694
660 695 continue
661 696
662 697 if deltabase == nullid:
General Comments 0
You need to be logged in to leave comments. Login now