Different fixes for the branch command
[stgit] / stgit / commands / pop.py
index fb85eb8..64848f8 100644 (file)
@@ -25,7 +25,11 @@ from stgit import stack, git
 
 
 help = 'pop the top of the series'
-usage = '%prog [options]'
+usage = """%prog [options]
+
+Pop the topmost patch or a range of patches starting with the topmost
+one from the stack. The command fails if there are local changes or
+conflicts."""
 
 options = [make_option('-a', '--all',
                        help = 'pop all the applied patches',
@@ -53,7 +57,10 @@ def func(parser, options, args):
 
     if options.to:
         if options.to not in applied:
-            raise CmdException, 'Patch "%s" not applied' % options.to
+            if options.to in crt_series.get_unapplied():
+                raise CmdException, 'Patch "%s" is not currently applied.' % options.to
+            else:
+                raise CmdException, 'Patch "%s" does not exist.' % options.to
         patches = applied[:applied.index(options.to)]
     elif options.number:
         patches = applied[:options.number]