##// END OF EJS Templates
revlog: change addrevision to return the new revision, not node...
Joerg Sonnenberger -
r47258:f7b61ad3 default
parent child Browse files
Show More
@@ -636,7 +636,8 b' class sqlitefilestore(object):'
636 if meta or filedata.startswith(b'\x01\n'):
636 if meta or filedata.startswith(b'\x01\n'):
637 filedata = storageutil.packmeta(meta, filedata)
637 filedata = storageutil.packmeta(meta, filedata)
638
638
639 return self.addrevision(filedata, transaction, linkrev, p1, p2)
639 rev = self.addrevision(filedata, transaction, linkrev, p1, p2)
640 return self.node(rev)
640
641
641 def addrevision(
642 def addrevision(
642 self,
643 self,
@@ -658,15 +659,16 b' class sqlitefilestore(object):'
658 if validatehash:
659 if validatehash:
659 self._checkhash(revisiondata, node, p1, p2)
660 self._checkhash(revisiondata, node, p1, p2)
660
661
661 if node in self._nodetorev:
662 rev = self._nodetorev.get(node)
662 return node
663 if rev is not None:
664 return rev
663
665
664 node = self._addrawrevision(
666 rev = self._addrawrevision(
665 node, revisiondata, transaction, linkrev, p1, p2
667 node, revisiondata, transaction, linkrev, p1, p2
666 )
668 )
667
669
668 self._revisioncache[node] = revisiondata
670 self._revisioncache[node] = revisiondata
669 return node
671 return rev
670
672
671 def addgroup(
673 def addgroup(
672 self,
674 self,
@@ -1079,7 +1081,7 b' class sqlitefilestore(object):'
1079 self._revtonode[rev] = node
1081 self._revtonode[rev] = node
1080 self._revisions[node] = entry
1082 self._revisions[node] = entry
1081
1083
1082 return node
1084 return rev
1083
1085
1084
1086
1085 class sqliterepository(localrepo.localrepository):
1087 class sqliterepository(localrepo.localrepository):
@@ -598,9 +598,10 b' class changelog(revlog.revlog):'
598 parseddate = b"%s %s" % (parseddate, extra)
598 parseddate = b"%s %s" % (parseddate, extra)
599 l = [hex(manifest), user, parseddate] + sortedfiles + [b"", desc]
599 l = [hex(manifest), user, parseddate] + sortedfiles + [b"", desc]
600 text = b"\n".join(l)
600 text = b"\n".join(l)
601 return self.addrevision(
601 rev = self.addrevision(
602 text, transaction, len(self), p1, p2, sidedata=sidedata, flags=flags
602 text, transaction, len(self), p1, p2, sidedata=sidedata, flags=flags
603 )
603 )
604 return self.node(rev)
604
605
605 def branchinfo(self, rev):
606 def branchinfo(self, rev):
606 """return the branch name and open/close state of a revision
607 """return the branch name and open/close state of a revision
@@ -176,7 +176,8 b' class filelog(object):'
176 def add(self, text, meta, transaction, link, p1=None, p2=None):
176 def add(self, text, meta, transaction, link, p1=None, p2=None):
177 if meta or text.startswith(b'\1\n'):
177 if meta or text.startswith(b'\1\n'):
178 text = storageutil.packmeta(meta, text)
178 text = storageutil.packmeta(meta, text)
179 return self.addrevision(text, transaction, link, p1, p2)
179 rev = self.addrevision(text, transaction, link, p1, p2)
180 return self.node(rev)
180
181
181 def renamed(self, node):
182 def renamed(self, node):
182 return storageutil.filerevisioncopied(self, node)
183 return storageutil.filerevisioncopied(self, node)
@@ -734,7 +734,7 b' class ifilemutation(interfaceutil.Interf'
734 flags=0,
734 flags=0,
735 cachedelta=None,
735 cachedelta=None,
736 ):
736 ):
737 """Add a new revision to the store.
737 """Add a new revision to the store and return its number.
738
738
739 This is similar to ``add()`` except it operates at a lower level.
739 This is similar to ``add()`` except it operates at a lower level.
740
740
@@ -1704,9 +1704,10 b' class manifestrevlog(object):'
1704 arraytext, deltatext = m.fastdelta(self.fulltextcache[p1], work)
1704 arraytext, deltatext = m.fastdelta(self.fulltextcache[p1], work)
1705 cachedelta = self._revlog.rev(p1), deltatext
1705 cachedelta = self._revlog.rev(p1), deltatext
1706 text = util.buffer(arraytext)
1706 text = util.buffer(arraytext)
1707 n = self._revlog.addrevision(
1707 rev = self._revlog.addrevision(
1708 text, transaction, link, p1, p2, cachedelta
1708 text, transaction, link, p1, p2, cachedelta
1709 )
1709 )
1710 n = self._revlog.node(rev)
1710 except FastdeltaUnavailable:
1711 except FastdeltaUnavailable:
1711 # The first parent manifest isn't already loaded or the
1712 # The first parent manifest isn't already loaded or the
1712 # manifest implementation doesn't support fastdelta, so
1713 # manifest implementation doesn't support fastdelta, so
@@ -1724,7 +1725,8 b' class manifestrevlog(object):'
1724 arraytext = None
1725 arraytext = None
1725 else:
1726 else:
1726 text = m.text()
1727 text = m.text()
1727 n = self._revlog.addrevision(text, transaction, link, p1, p2)
1728 rev = self._revlog.addrevision(text, transaction, link, p1, p2)
1729 n = self._revlog.node(rev)
1728 arraytext = bytearray(text)
1730 arraytext = bytearray(text)
1729
1731
1730 if arraytext is not None:
1732 if arraytext is not None:
@@ -1765,9 +1767,10 b' class manifestrevlog(object):'
1765 n = m2.node()
1767 n = m2.node()
1766
1768
1767 if not n:
1769 if not n:
1768 n = self._revlog.addrevision(
1770 rev = self._revlog.addrevision(
1769 text, transaction, link, m1.node(), m2.node()
1771 text, transaction, link, m1.node(), m2.node()
1770 )
1772 )
1773 n = self._revlog.node(rev)
1771
1774
1772 # Save nodeid so parent manifest can calculate its nodeid
1775 # Save nodeid so parent manifest can calculate its nodeid
1773 m.setnode(n)
1776 m.setnode(n)
@@ -2106,13 +2106,14 b' class revlog(object):'
2106 )
2106 )
2107
2107
2108 node = node or self.hash(rawtext, p1, p2)
2108 node = node or self.hash(rawtext, p1, p2)
2109 if self.index.has_node(node):
2109 rev = self.index.get_rev(node)
2110 return node
2110 if rev is not None:
2111 return rev
2111
2112
2112 if validatehash:
2113 if validatehash:
2113 self.checkhash(rawtext, node, p1=p1, p2=p2)
2114 self.checkhash(rawtext, node, p1=p1, p2=p2)
2114
2115
2115 rev = self.addrawrevision(
2116 return self.addrawrevision(
2116 rawtext,
2117 rawtext,
2117 transaction,
2118 transaction,
2118 link,
2119 link,
@@ -2123,7 +2124,6 b' class revlog(object):'
2123 cachedelta=cachedelta,
2124 cachedelta=cachedelta,
2124 deltacomputer=deltacomputer,
2125 deltacomputer=deltacomputer,
2125 )
2126 )
2126 return node
2127
2127
2128 def addrawrevision(
2128 def addrawrevision(
2129 self,
2129 self,
General Comments 0
You need to be logged in to leave comments. Login now