chiark / gitweb /
Add facility to print short list of patches around 'top'
authorChuck Lever <cel@netapp.com>
Tue, 29 Nov 2005 22:09:47 +0000 (17:09 -0500)
committerCatalin Marinas <catalin.marinas@gmail.com>
Wed, 30 Nov 2005 22:14:16 +0000 (22:14 +0000)
When working in the middle of a very long series, I often find it useful
to have a list of the patches right around the current patch.  Add an
option to "stg series" called "--short" to provide this short list.

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

index a8433077514aa9687b34d74b57b53dfffda9852d..ec1aaaf991f47b0d403f71c2cf0cce141c6709e9 100644 (file)
@@ -39,6 +39,9 @@ options = [make_option('-b', '--branch',
            make_option('-e', '--empty',
                        help = 'check whether patches are empty '
                        '(much slower)',
+                       action = 'store_true'),
+           make_option('-s', '--short',
+                       help = 'list just the patches around the topmost patch',
                        action = 'store_true') ]
 
 
@@ -66,6 +69,13 @@ def func(parser, options, args):
 
     applied = crt_series.get_applied()
     unapplied = crt_series.get_unapplied()
+
+    if options.short:
+        if len(applied) > 5:
+            applied = applied[-6:]
+        if len(unapplied) > 5:
+            unapplied = unapplied[:5]
+
     patches = applied + unapplied
 
     max_len = 0