From 8441eb82f3a1a4d03eb0e194e91bc86017ab4466 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 1 Oct 2020 13:34:16 +0200 Subject: dashboard/app: add unfix command Add "#syz unfix" command that undoes "#syz fix" effects and resets any existing fixing commits. --- pkg/email/parser.go | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) (limited to 'pkg/email/parser.go') diff --git a/pkg/email/parser.go b/pkg/email/parser.go index 589598ba2..df7cc4717 100644 --- a/pkg/email/parser.go +++ b/pkg/email/parser.go @@ -38,6 +38,7 @@ const ( CmdNone CmdUpstream CmdFix + CmdUnFix CmdDup CmdUnDup CmdTest @@ -223,28 +224,7 @@ func extractCommand(body string) (cmd Command, str, args string) { cmdEnd = cmdEnd1 } str = body[cmdPos : cmdPos+cmdEnd] - switch str { - default: - cmd = CmdUnknown - case "": - cmd = CmdNone - case "upstream": - cmd = CmdUpstream - case "fix", "fix:": - cmd = CmdFix - case "dup", "dup:": - cmd = CmdDup - case "undup": - cmd = CmdUnDup - case "test", "test:": - cmd = CmdTest - case "invalid": - cmd = CmdInvalid - case "uncc", "uncc:": - cmd = CmdUnCC - case "test_5_arg_cmd": - cmd = cmdTest5 - } + cmd = strToCmd(str) // Some email clients split text emails at 80 columns are the transformation is irrevesible. // We try hard to restore what was there before. // For "test:" command we know that there must be 2 tokens without spaces. @@ -260,6 +240,33 @@ func extractCommand(body string) (cmd Command, str, args string) { return } +func strToCmd(str string) Command { + switch str { + default: + return CmdUnknown + case "": + return CmdNone + case "upstream": + return CmdUpstream + case "fix", "fix:": + return CmdFix + case "unfix": + return CmdUnFix + case "dup", "dup:": + return CmdDup + case "undup": + return CmdUnDup + case "test", "test:": + return CmdTest + case "invalid": + return CmdInvalid + case "uncc", "uncc:": + return CmdUnCC + case "test_5_arg_cmd": + return cmdTest5 + } +} + func extractArgsTokens(body string, num int) string { var args []string for pos := 0; len(args) < num && pos < len(body); { -- cgit mrf-deployment