##// 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 COMPRESSION_ZLIB = 3
110 COMPRESSION_ZLIB = 3
111
111
112 FLAG_CENSORED = 1
112 FLAG_CENSORED = 1
113 FLAG_MISSING_P1 = 2
114 FLAG_MISSING_P2 = 4
113
115
114 CREATE_SCHEMA = [
116 CREATE_SCHEMA = [
115 # Deltas are stored as content-indexed blobs.
117 # Deltas are stored as content-indexed blobs.
@@ -535,6 +537,11 b' class sqlitefilestore(object):'
535 self._revisioncache, stoprids,
537 self._revisioncache, stoprids,
536 zstddctx=self._dctx)
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 if _verifyhash:
545 if _verifyhash:
539 self._checkhash(fulltext, node)
546 self._checkhash(fulltext, node)
540 self._revisioncache[node] = fulltext
547 self._revisioncache[node] = fulltext
@@ -618,10 +625,6 b' class sqlitefilestore(object):'
618
625
619 def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None,
626 def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None,
620 maybemissingparents=False):
627 maybemissingparents=False):
621 if maybemissingparents:
622 raise error.Abort(_('SQLite storage does not support missing '
623 'parents write mode'))
624
625 nodes = []
628 nodes = []
626
629
627 for node, p1, p2, linknode, deltabase, delta, wireflags in deltas:
630 for node, p1, p2, linknode, deltabase, delta, wireflags in deltas:
@@ -633,6 +636,15 b' class sqlitefilestore(object):'
633 if wireflags & ~repository.REVISION_FLAG_CENSORED:
636 if wireflags & ~repository.REVISION_FLAG_CENSORED:
634 raise SQLiteStoreError('unhandled revision flag')
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 baserev = self.rev(deltabase)
648 baserev = self.rev(deltabase)
637
649
638 # If base is censored, delta must be full replacement in a single
650 # If base is censored, delta must be full replacement in a single
@@ -657,6 +669,29 b' class sqlitefilestore(object):'
657 nodes.append(node)
669 nodes.append(node)
658
670
659 if node in self._revisions:
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 continue
695 continue
661
696
662 if deltabase == nullid:
697 if deltabase == nullid:
General Comments 0
You need to be logged in to leave comments. Login now