Skip to content

Commit

Permalink
Merge pull request #56 from ThomasWaldmann/fix-remote-repo
Browse files Browse the repository at this point in the history
borg repository might be local or remote, fixes #47
  • Loading branch information
ThomasWaldmann authored Nov 5, 2022
2 parents c788b92 + ef92e8b commit f7c58e9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/borg_import/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ def borg_import(args, archive_name, path, timestamp=None):
if args.create_options:
borg_cmdline += args.create_options.split()

repository = args.repository.resolve()
location = '{}::{}'.format(repository, archive_name)
borg_cmdline.append(location)
borg_cmdline.append(args.repository + "::" + archive_name)
borg_cmdline.append('.')

log.debug('Borg command line: %r', borg_cmdline)
Expand All @@ -37,8 +35,7 @@ def borg_import(args, archive_name, path, timestamp=None):

def list_borg_archives(args):
borg_cmdline = ['borg', 'list', '--short']
repository = args.repository.resolve()
borg_cmdline.append(str(repository))
borg_cmdline.append(args.repository)
return subprocess.check_output(borg_cmdline).decode().splitlines()


Expand Down Expand Up @@ -85,7 +82,8 @@ def populate_parser(self, parser):
parser.add_argument('rsnapshot_root', metavar='RSNAPSHOT_ROOT',
help='Path to rsnapshot root directory', type=Path)
# TODO: support the full wealth of borg possibilities
parser.add_argument('repository', metavar='BORG_REPOSITORY', help='Borg repository', type=Path)
parser.add_argument('repository', metavar='BORG_REPOSITORY',
help='Borg repository (must be an absolute local path or a remote repo specification)')
parser.set_defaults(function=self.import_rsnapshot)

def import_rsnapshot(self, args):
Expand Down Expand Up @@ -161,7 +159,8 @@ def populate_parser(self, parser):
parser.add_argument('rsync_root', metavar='RSYNC_ROOT',
help='Path to root directory', type=Path)
# TODO: support the full wealth of borg possibilities
parser.add_argument('repository', metavar='BORG_REPOSITORY', help='Borg repository', type=Path)
parser.add_argument('repository', metavar='BORG_REPOSITORY',
help='Borg repository (must be an absolute local path or a remote repo specification)')
parser.set_defaults(function=self.import_rsynchl)

def import_rsynchl(self, args):
Expand Down

0 comments on commit f7c58e9

Please sign in to comment.