1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 18:28:42 +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:
Thomas Waldmann 2016-10-13 03:08:57 +02:00
parent 913809689c
commit 26e6ac4fea
2 changed files with 13 additions and 12 deletions

View file

@ -853,12 +853,7 @@ def do_mount(self, args, repository, manifest, key):
return self.exit_code return self.exit_code
with cache_if_remote(repository) as cached_repo: with cache_if_remote(repository) as cached_repo:
if args.location.archive: operations = FuseOperations(key, repository, manifest, args, cached_repo, archiver=self)
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)
logger.info("Mounting filesystem") logger.info("Mounting filesystem")
try: try:
operations.mount(args.mountpoint, args.options, args.foreground) 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') help='stay in foreground, do not daemonize')
subparser.add_argument('-o', dest='options', type=str, subparser.add_argument('-o', dest='options', type=str,
help='Extra mount options') help='Extra mount options')
self.add_archives_filters_args(subparser)
info_epilog = textwrap.dedent(""" info_epilog = textwrap.dedent("""
This command displays detailed information about the specified archive or repository. This command displays detailed information about the specified archive or repository.

View file

@ -58,11 +58,12 @@ class FuseOperations(llfuse.Operations):
allow_damaged_files = False allow_damaged_files = False
versions = False versions = False
def __init__(self, key, repository, manifest, archive, cached_repo): def __init__(self, key, repository, manifest, args, cached_repo, archiver):
super().__init__() super().__init__()
self.archiver = archiver
self.repository_uncached = repository self.repository_uncached = repository
self.repository = cached_repo self.repository = cached_repo
self.archive = archive self.args = args
self.manifest = manifest self.manifest = manifest
self.key = key self.key = key
self._inode_count = 0 self._inode_count = 0
@ -79,11 +80,15 @@ def __init__(self, key, repository, manifest, archive, cached_repo):
def _create_filesystem(self): def _create_filesystem(self):
self._create_dir(parent=1) # first call, create root dir (inode == 1) self._create_dir(parent=1) # first call, create root dir (inode == 1)
if self.archive: if self.args.location.archive:
self.process_archive(self.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: else:
for name in self.manifest.archives: archive_names = (x.name for x in self.archiver._get_filtered_archives(self.args, self.manifest))
archive = Archive(self.repository_uncached, self.key, self.manifest, name) 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: if self.versions:
# process archives immediately # process archives immediately
self.process_archive(archive) self.process_archive(archive)