package seedu.address.logic.commands;

public class UndoCommand extends Command {

    public static final String COMMAND_WORD = "undo";
    public static final String MESSAGE_USAGE = COMMAND_WORD;
    public static final String MESSAGE_SUCCESS = "Successfully undo previous change";
    public static final String MESSAGE_NO_CHANGE = "No change to be undone";

    /**
     * Default empty constructor.
     */
    public UndoCommand() {
    }

    public CommandResult execute() {
        if (model.checkChanges()) {
            return new CommandResult(MESSAGE_NO_CHANGE);
        } else {
            model.resetData(model.getCopy());
            model.clearCopy();
            return new CommandResult(MESSAGE_SUCCESS);
        }
    }
}

@@ -492,27 +492,43 @@
 if (
+!
 model.
-checkChanges(
+getFlag().equals(%22undo copy%22
 )) %7B
@@ -679,16 +679,60 @@
 Copy();%0A
+            model.updateFlag(%22empty copy%22);%0A
         

Modify undo command