Add api and script to restore
This commit is contained in:
@@ -16,7 +16,8 @@ from .database import update_snapshot, update_snapshot_for_current_operation
|
||||
from .database import delete_snapshot, delete_snapshot_by_operation
|
||||
from .database import get_operation_by_snapshot, get_snapshot_by_operation
|
||||
from .database import pick_snapshot
|
||||
from .database import pick_operation, sync_with_server, get_restore_operation, set_restore_operation, set_restore_operation_to_current
|
||||
from .database import pick_operation, sync_with_server
|
||||
from .database import get_restore_operation, set_restore_operation, set_restore_operation_to_current, restore
|
||||
|
||||
from .batch_cmd import execute_batch_command
|
||||
from .batch_cmds import execute_batch_commands
|
||||
|
||||
@@ -339,3 +339,8 @@ def set_restore_operation(name: str, operation: int) -> None:
|
||||
|
||||
def set_restore_operation_to_current(name: str) -> None:
|
||||
return set_restore_operation(name, get_current_operation(name))
|
||||
|
||||
|
||||
def restore(name: str, discard: bool) -> ChangeSet:
|
||||
op = get_restore_operation(name)
|
||||
return pick_operation(name, op, discard)
|
||||
|
||||
12
restore_project.py
Normal file
12
restore_project.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import sys
|
||||
from tjnetwork import *
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print("restore_project name")
|
||||
return
|
||||
|
||||
restore(sys.argv[1])
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
8
restore_projects.py
Normal file
8
restore_projects.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from tjnetwork import *
|
||||
|
||||
def main():
|
||||
for p in list_project():
|
||||
restore(p)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -291,6 +291,9 @@ def set_restore_operation(name: str, operation: int) -> None:
|
||||
def set_restore_operation_to_current(name: str) -> None:
|
||||
return api.set_restore_operation_to_current(name)
|
||||
|
||||
def restore(name: str, discard: bool = False) -> ChangeSet:
|
||||
return api.restore(name, discard)
|
||||
|
||||
|
||||
############################################################
|
||||
# type
|
||||
|
||||
Reference in New Issue
Block a user