"stg export" error message could be more specific
authorChuck Lever <cel@netapp.com>
Wed, 2 Nov 2005 21:55:37 +0000 (16:55 -0500)
committerCatalin Marinas <catalin.marinas@gmail.com>
Fri, 4 Nov 2005 21:36:43 +0000 (21:36 +0000)
Like similar previous patches, make "stg export" distinguish between an
unapplied patch and a non-existent one when reporting a failure.

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

index c04ecc5..58a3965 100644 (file)
@@ -99,11 +99,18 @@ 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'