From f2944a74ffacb504b6fa092e138c3e7af3ed5ffb Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Wed, 26 Oct 2005 14:51:49 -0400 Subject: [PATCH] "stg mail" doesn't distinguish between unapplied and non-existent patches Same fix as the recent fixes to "pop" and "push". Signed-off-by: Chuck Lever --- stgit/commands/mail.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py index 6c761bd..566c669 100644 --- a/stgit/commands/mail.py +++ b/stgit/commands/mail.py @@ -341,12 +341,15 @@ def func(parser, options, args): smtppassword = config.get('stgit', 'smtppassword') applied = crt_series.get_applied() + unapplied = crt_series.get_unapplied() if len(args) >= 1: for patch in args: - if not patch in applied: + if patch in unapplied: raise CmdException, 'Patch "%s" not applied' % patch - patches = args + if not patch in applied: + raise CmdException, 'Patch "%s" does not exist' % patch + patches = args elif options.all: patches = applied elif options.range: @@ -369,11 +372,17 @@ def func(parser, options, args): if start in applied: start_idx = applied.index(start) else: - raise CmdException, 'Patch "%s" not applied' % start + if start in unapplied: + raise CmdException, 'Patch "%s" not applied' % start + else: + raise CmdException, 'Patch "%s" does not exist' % start if stop in applied: stop_idx = applied.index(stop) + 1 else: - raise CmdException, 'Patch "%s" not applied' % stop + if stop in unapplied: + raise CmdException, 'Patch "%s" not applied' % stop + else: + raise CmdException, 'Patch "%s" does not exist' % stop if start_idx >= stop_idx: raise CmdException, 'Incorrect patch range order' -- 2.11.0