treemanifest: auto create manifest pack directory

The pack/manifests directory wasn't being automatically created, so let's make
it so.
This commit is contained in:
Durham Goode 2016-09-21 13:51:39 -07:00
parent 50d6b599f4
commit df86b3486d
5 changed files with 11 additions and 8 deletions

View File

@ -2,6 +2,7 @@ import errno, hashlib, mmap, os, struct, time
from mercurial import osutil
import constants
import shallowutil
# The pack version supported by this implementation. This will need to be
# rev'd whenever the byte format changes. Ex: changing the fanout prefix,
@ -200,9 +201,11 @@ class basepack(object):
raise NotImplemented()
class mutablebasepack(object):
def __init__(self, opener):
def __init__(self, ui, opener):
self.opener = opener
self.entries = {}
shallowutil.mkstickygroupdir(ui, opener.base)
self.packfp, self.packpath = opener.mkstemp(
suffix=self.PACKSUFFIX + '-tmp')
self.idxfp, self.idxpath = opener.mkstemp(

View File

@ -437,8 +437,8 @@ class fileserverclient(object):
opener = scmutil.vfs(packpath)
# Packs should be write-once files, so set them to read-only.
opener.createmode = 0o444
with datapack.mutabledatapack(opener) as dpack:
with historypack.mutablehistorypack(opener) as hpack:
with datapack.mutabledatapack(self.ui, opener) as dpack:
with historypack.mutablehistorypack(self.ui, opener) as hpack:
for filename in self.readfiles(remote):
i += 1
self.ui.progress(_downloading, i, total=len(groupedfiles))

View File

@ -312,8 +312,8 @@ class mutablehistorypack(basepack.mutablebasepack):
PACKSUFFIX = PACKSUFFIX
INDEXENTRYLENGTH = INDEXENTRYLENGTH
def __init__(self, opener):
super(mutablehistorypack, self).__init__(opener)
def __init__(self, ui, opener):
super(mutablehistorypack, self).__init__(ui, opener)
self.pastfiles = {}
self.currentfile = None
self.currententries = []

View File

@ -156,8 +156,8 @@ def _runrepack(repo, data, history):
opener = scmutil.vfs(packpath)
# Packs should be write-once files, so set them to read-only.
opener.createmode = 0o444
with datapack.mutabledatapack(opener) as dpack:
with historypack.mutablehistorypack(opener) as hpack:
with datapack.mutabledatapack(repo.ui, opener) as dpack:
with historypack.mutablehistorypack(repo.ui, opener) as hpack:
try:
packer.run(dpack, hpack)
except error.LockHeld:

View File

@ -55,7 +55,7 @@ def _unpackmanifests(orig, self, repo, *args, **kwargs):
repo.ui.configbool('treemanifest', 'autocreatetrees')):
packpath = shallowutil.getpackpath(repo, PACK_CATEGORY)
opener = scmutil.vfs(packpath)
with mutabledatapack(opener) as dpack:
with mutabledatapack(repo.ui, opener) as dpack:
recordmanifest(dpack, repo, oldtip, len(mf))
dpack.close()