コード例 #1
0
 def _create_archive(number_of_turns):
     while number_of_turns > 0:
         backup_thread = restic.BackupThread(['.'])
         backup_thread.run()
         number_of_turns -= 1
     list_thread = restic.ListThread()
     return list_thread.run()
コード例 #2
0
 def background_backup(self):
     self.config.read()
     self.config._set_environment_variables()
     backup_thread = restic.BackupThread(self.config.includes,
                                         excludes=self.config.excludes,
                                         prefix=self.config.prefix)
     backup_thread.run()
     if self.config.retention_policy_enabled:
         prune_thread = restic.PruneThread(self.config.retention_policy)
         prune_thread.run()
コード例 #3
0
 def create_backup(self):
     """Creates a backup of the selected item in the treeview."""
     if not self._check_mounts():
         return
     try:
         self._check_path()
         backup_thread = restic.BackupThread([self.src_path],
                                             excludes=self.config.excludes,
                                             prefix=self.config.prefix)
         backup_dialog = ProgressDialog(backup_thread)
         backup_dialog.label_info.setText("Restic-Qt is currently creating an"
                                          " archive.")
         backup_dialog.exec_()
         if self.config.retention_policy_enabled:
             prune_thread = restic.PruneThread(self.config.retention_policy)
             prune_dialog = ProgressDialog(prune_thread)
             prune_dialog.label_info.setText("Restic-Qt is currently pruning "
                                             "the repository.")
             prune_dialog.exec_()
         self.update_ui()
     except ResticException as e:
         show_error(e)
コード例 #4
0
def test_info(repository):
    backup_thread = restic.BackupThread(['.'])
    backup_thread.run()
    info_thread = restic.InfoThread()
    output = info_thread.run()
    assert len(output) == 2
コード例 #5
0
def test_list(repository):
    backup_thread = restic.BackupThread(['.'])
    backup_thread.run()
    list_thread = restic.ListThread()
    output = list_thread.run()
    assert str(os.path.realpath('.')) == output[0]['paths'][0]
コード例 #6
0
def test_backup(repository):
    backup_thread = restic.BackupThread(['.'])
    backup_thread.run()
    output = subprocess.check_output(['restic', 'snapshots', '--json'],
                                     encoding='utf8')
    assert -1 != output.find(str(os.path.realpath('.')))
コード例 #7
0
def archives(repository):
    backup_thread = restic.BackupThread(['.'])
    backup_thread.run()
    list_thread = restic.ListThread()
    output = list_thread.run()
    return output