treemanifest: split _addtopack

Summary:
In order to not have to deal with linkrev in mutablehistorypack, let's split
_addtopack in 2. This will allow _addtreeentry to be wrapped later to deal with
linkrev.

Reviewed By: kulshrax

Differential Revision: D15684625

fbshipit-source-id: 772ffa25ce7b72f95f057d0ae00c89c7dc91bf18
This commit is contained in:
Xavier Deguillard 2019-06-10 11:07:01 -07:00 committed by Facebook Github Bot
parent 8fa3d943d9
commit 16da1f1b4a

View File

@ -736,6 +736,14 @@ class basetreemanifestlog(object):
def getmutablesharedpacks(self):
return self._mutablesharedpacks.getmutablepack()
def _addtreeentry(
self, dpack, hpack, nname, nnode, ntext, np1, np2, linknode, linkrev
):
# Not using deltas, since there aren't any other trees in
# this pack it could delta against.
dpack.add(nname, nnode, revlog.nullid, ntext)
hpack.add(nname, nnode, np1, np2, linknode, "", linkrev=linkrev)
def _addtopack(
self,
ui,
@ -765,10 +773,9 @@ class basetreemanifestlog(object):
node = overridenode
for nname, nnode, ntext, np1text, np1, np2 in newtreeiter:
# Not using deltas, since there aren't any other trees in
# this pack it could delta against.
dpack.add(nname, nnode, revlog.nullid, ntext)
hpack.add(nname, nnode, np1, np2, linknode, "", linkrev=linkrev)
self._addtreeentry(
dpack, hpack, nname, nnode, ntext, np1, np2, linknode, linkrev
)
if node is None and nname == "":
node = nnode