Make the 'series --short' length configurable
authorCatalin Marinas <catalin.marinas@gmail.com>
Fri, 26 Jan 2007 22:29:10 +0000 (22:29 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Fri, 26 Jan 2007 22:29:10 +0000 (22:29 +0000)
The 'shortnr' config option was added so that one can set a different
length than the default 5.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
examples/gitconfig
stgit/commands/series.py
stgit/config.py

index 5e7b240..ee68d07 100644 (file)
        # current, patched)
        #extensions = .ancestor .current .patched
 
+       # The number of patches to be listed before and after the
+       # current one by the 'series --short' command
+       #shortnr = 5
+
 [mail "alias"]
        # E-mail aliases used with the 'mail' command
        git = git@vger.kernel.org
index 4f372ff..4a12d75 100644 (file)
@@ -135,10 +135,11 @@ def func(parser, options, args):
     unapplied = [p for p in unapplied if p in show_patches]
 
     if options.short:
-        if len(applied) > 5:
-            applied = applied[-6:]
-        if len(unapplied) > 5:
-            unapplied = unapplied[:5]
+        nr = int(config.get('stgit', 'shortnr'))
+        if len(applied) > nr:
+            applied = applied[-(nr+1):]
+        if len(unapplied) > nr:
+            unapplied = unapplied[:nr]
 
     patches = applied + unapplied
 
index f5fbdab..a6afbfd 100644 (file)
@@ -73,6 +73,7 @@ def config_setup():
     config.set('stgit', 'keeporig', 'yes')
     config.set('stgit', 'keepoptimized', 'no')
     config.set('stgit', 'extensions', '.ancestor .current .patched')
+    config.set('stgit', 'shortnr', '5')
 
     # Read the configuration files (if any) and override the default settings
     # stgitrc are read for backward compatibility