mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 02:08:54 +00:00
borg mount --first / --last / --sort / --prefix, fixes #1542
also: use consider_part_files when dealing with multiple archives / whole repo mount
This commit is contained in:
parent
913809689c
commit
26e6ac4fea
2 changed files with 13 additions and 12 deletions
|
@ -853,12 +853,7 @@ def do_mount(self, args, repository, manifest, key):
|
|||
return self.exit_code
|
||||
|
||||
with cache_if_remote(repository) as cached_repo:
|
||||
if args.location.archive:
|
||||
archive = Archive(repository, key, manifest, args.location.archive,
|
||||
consider_part_files=args.consider_part_files)
|
||||
else:
|
||||
archive = None
|
||||
operations = FuseOperations(key, repository, manifest, archive, cached_repo)
|
||||
operations = FuseOperations(key, repository, manifest, args, cached_repo, archiver=self)
|
||||
logger.info("Mounting filesystem")
|
||||
try:
|
||||
operations.mount(args.mountpoint, args.options, args.foreground)
|
||||
|
@ -2115,6 +2110,7 @@ def build_parser(self, prog=None):
|
|||
help='stay in foreground, do not daemonize')
|
||||
subparser.add_argument('-o', dest='options', type=str,
|
||||
help='Extra mount options')
|
||||
self.add_archives_filters_args(subparser)
|
||||
|
||||
info_epilog = textwrap.dedent("""
|
||||
This command displays detailed information about the specified archive or repository.
|
||||
|
|
|
@ -58,11 +58,12 @@ class FuseOperations(llfuse.Operations):
|
|||
allow_damaged_files = False
|
||||
versions = False
|
||||
|
||||
def __init__(self, key, repository, manifest, archive, cached_repo):
|
||||
def __init__(self, key, repository, manifest, args, cached_repo, archiver):
|
||||
super().__init__()
|
||||
self.archiver = archiver
|
||||
self.repository_uncached = repository
|
||||
self.repository = cached_repo
|
||||
self.archive = archive
|
||||
self.args = args
|
||||
self.manifest = manifest
|
||||
self.key = key
|
||||
self._inode_count = 0
|
||||
|
@ -79,11 +80,15 @@ def __init__(self, key, repository, manifest, archive, cached_repo):
|
|||
|
||||
def _create_filesystem(self):
|
||||
self._create_dir(parent=1) # first call, create root dir (inode == 1)
|
||||
if self.archive:
|
||||
self.process_archive(self.archive)
|
||||
if self.args.location.archive:
|
||||
archive = Archive(self.repository_uncached, self.key, self.manifest, self.args.location.archive,
|
||||
consider_part_files=self.args.consider_part_files)
|
||||
self.process_archive(archive)
|
||||
else:
|
||||
for name in self.manifest.archives:
|
||||
archive = Archive(self.repository_uncached, self.key, self.manifest, name)
|
||||
archive_names = (x.name for x in self.archiver._get_filtered_archives(self.args, self.manifest))
|
||||
for name in archive_names:
|
||||
archive = Archive(self.repository_uncached, self.key, self.manifest, name,
|
||||
consider_part_files=self.args.consider_part_files)
|
||||
if self.versions:
|
||||
# process archives immediately
|
||||
self.process_archive(archive)
|
||||
|
|
Loading…
Reference in a new issue