Support to set restore operation
This commit is contained in:
@@ -9,7 +9,7 @@ from .database import ChangeSet
|
||||
from .database import get_current_operation
|
||||
from .database import execute_undo, execute_redo
|
||||
from .database import have_snapshot, take_snapshot, pick_snapshot
|
||||
from .database import pick_operation, sync_with_server, get_restore_operation
|
||||
from .database import pick_operation, sync_with_server, get_restore_operation, set_restore_operation
|
||||
|
||||
from .batch_cmd import execute_batch_command
|
||||
from .batch_cmds import execute_batch_commands
|
||||
|
||||
@@ -278,3 +278,7 @@ def sync_with_server(name: str, operation: int) -> ChangeSet:
|
||||
|
||||
def get_restore_operation(name: str) -> int:
|
||||
return read(name, f'select * from restore_operation')['id']
|
||||
|
||||
|
||||
def set_restore_operation(name: str, operation: int) -> None:
|
||||
write(name, f'update restore_operation set id = {operation}')
|
||||
|
||||
@@ -229,7 +229,7 @@ def read_inp(project: str, inp: str):
|
||||
|
||||
execute_batch_commands(project, _read_inp(inp))
|
||||
op = get_current_operation(project)
|
||||
write(project, f'update restore_operation set id = {op}')
|
||||
set_restore_operation(project, op)
|
||||
|
||||
|
||||
def dump_inp(project: str, inp: str):
|
||||
|
||||
@@ -193,6 +193,9 @@ def execute_batch_commands(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
def get_restore_operation(name: str) -> int:
|
||||
return api.get_restore_operation(name)
|
||||
|
||||
def set_restore_operation(name: str, operation: int) -> None:
|
||||
return api.set_restore_operation(name, operation)
|
||||
|
||||
|
||||
############################################################
|
||||
# type
|
||||
|
||||
Reference in New Issue
Block a user