mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
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:
parent
50d6b599f4
commit
df86b3486d
@ -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(
|
||||
|
@ -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))
|
||||
|
@ -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 = []
|
||||
|
@ -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:
|
||||
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user