Пример #1
0
 def test_preparePath(self):
     path_with_slash_at_begin = "/test/path"
     path_without_slash_at_begin = "test/path"
     path_with_slash_at_end = "/test/path/"
     path_without_slash_at_end = "/test/path"
     self.assertEqual(tools.preparePath(path_with_slash_at_begin),
                      path_with_slash_at_begin)
     self.assertEqual(tools.preparePath(path_without_slash_at_begin),
                      path_with_slash_at_begin)
     self.assertEqual(tools.preparePath(path_without_slash_at_end),
                      path_without_slash_at_end)
     self.assertEqual(tools.preparePath(path_with_slash_at_end),
                      path_without_slash_at_end)
Пример #2
0
def restore(cfg, snapshot_id = None, what = None, where = None, **kwargs):
    if what is None:
        what = input('File to restore: ')
    what = tools.preparePath(os.path.abspath(os.path.expanduser(what)))

    if where is None:
        where = input('Restore to (empty for original path): ')
    if where:
        where = tools.preparePath(os.path.abspath(os.path.expanduser(where)))

    snapshotsList = snapshots.listSnapshots(cfg)

    sid = selectSnapshot(snapshotsList, cfg, snapshot_id, 'SnapshotID to restore')
    print('')
    RestoreDialog(cfg, sid, what, where, **kwargs).run()
Пример #3
0
def restore(cfg, snapshot_id=None, what=None, where=None, **kwargs):
    if what is None:
        what = input('File to restore: ')
    what = tools.preparePath(os.path.abspath(os.path.expanduser(what)))

    if where is None:
        where = input('Restore to (empty for original path): ')
    if where:
        where = tools.preparePath(os.path.abspath(os.path.expanduser(where)))

    snapshotsList = snapshots.listSnapshots(cfg)

    sid = selectSnapshot(snapshotsList, cfg, snapshot_id,
                         'SnapshotID to restore')
    print('')
    RestoreDialog(cfg, sid, what, where, **kwargs).run()
Пример #4
0
 def test_preparePath(self):
     path_with_slash_at_begin = "/test/path"
     path_without_slash_at_begin = "test/path"
     path_with_slash_at_end = "/test/path/"
     path_without_slash_at_end = "/test/path"
     self.assertEqual(
         tools.preparePath(path_with_slash_at_begin),
         path_with_slash_at_begin)
     self.assertEqual(
         tools.preparePath(path_without_slash_at_begin),
         path_with_slash_at_begin)
     self.assertEqual(
         tools.preparePath(path_without_slash_at_end),
         path_without_slash_at_end)
     self.assertEqual(
         tools.preparePath(path_with_slash_at_end),
         path_without_slash_at_end)