chiark / gitweb /
"stg mail" doesn't distinguish between unapplied and non-existent patches
authorChuck Lever <cel@netapp.com>
Wed, 26 Oct 2005 18:51:49 +0000 (14:51 -0400)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 27 Oct 2005 19:47:13 +0000 (20:47 +0100)
Same fix as the recent fixes to "pop" and "push".

Signed-off-by: Chuck Lever <cel@netapp.com>
stgit/commands/mail.py

index 6c761bdbb8a3f3735dfe151a25c120d0c0475e8a..566c669b78d890e60674369054fbcfa5145db45d 100644 (file)
@@ -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'