Slightly modify the "publish" command description
[stgit] / stgit / commands / log.py
index 1f63ef5..92aaf0b 100644 (file)
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 import os.path
 from optparse import make_option
-from stgit import run
+from stgit import argparse, run
 from stgit.argparse import opt
 from stgit.commands import common
 from stgit.lib import log
@@ -37,17 +37,22 @@ the named patches.
 "stg undo" and "stg redo" let you step back and forth in the patch
 stack. "stg reset" lets you go directly to any state."""
 
+args = [argparse.patch_range(argparse.applied_patches,
+                             argparse.unapplied_patches,
+                             argparse.hidden_patches)]
 options = [
-    opt('-b', '--branch',
+    opt('-b', '--branch', args = [argparse.stg_branches],
         short = 'Use BRANCH instead of the default one'),
-    opt('-p', '--patch', action = 'store_true',
+    opt('-d', '--diff', action = 'store_true',
         short = 'Show the refresh diffs'),
     opt('-n', '--number', type = 'int',
         short = 'Limit the output to NUMBER commits'),
     opt('-f', '--full', action = 'store_true',
         short = 'Show the full commit ids'),
     opt('-g', '--graphical', action = 'store_true',
-        short = 'Run gitk instead of printing')]
+        short = 'Run gitk instead of printing'),
+    opt('--clear', action = 'store_true',
+        short = 'Clear the log history')]
 
 directory = common.DirectoryHasRepositoryLib()
 
@@ -73,6 +78,11 @@ def func(parser, options, args):
     except KeyError:
         out.info('Log is empty')
         return
+
+    if options.clear:
+        log.delete_log(stack.repository, stack.name)
+        return
+
     stacklog = log.get_log_entry(stack.repository, logref, logcommit)
     pathlim = [os.path.join('patches', pn) for pn in patches]