///////////////////////////////////////////////////////////////////////////
| 54 | |
| 55 | //////////////////////////////////////////////////////////////////////////////// |
| 56 | int CmdUndo::execute(std::string&) { |
| 57 | auto& replica = Context::getContext().tdb2.replica(); |
| 58 | rust::Vec<tc::Operation> undo_ops = replica->get_undo_operations(); |
| 59 | if (confirm_revert(Operation::operations(undo_ops))) { |
| 60 | // Note that commit_reversed_operations rebuilds the working set, so that |
| 61 | // need not be done here. |
| 62 | if (!replica->commit_reversed_operations(std::move(undo_ops))) { |
| 63 | std::cout << "Could not undo: other operations have occurred."; |
| 64 | } |
| 65 | } |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | //////////////////////////////////////////////////////////////////////////////// |
| 70 | bool CmdUndo::confirm_revert(const std::vector<Operation>& undo_ops) { |
nothing calls this directly
no test coverage detected