From c6f366f6b7452e24edf5bff06da8b69c500899a4 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Fri, 26 Jan 2007 22:29:10 +0000 Subject: [PATCH] Make the 'series --short' length configurable Organization: Straylight/Edgeware From: Catalin Marinas The 'shortnr' config option was added so that one can set a different length than the default 5. Signed-off-by: Catalin Marinas --- examples/gitconfig | 4 ++++ stgit/commands/series.py | 9 +++++---- stgit/config.py | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/gitconfig b/examples/gitconfig index 5e7b240..ee68d07 100644 --- a/examples/gitconfig +++ b/examples/gitconfig @@ -64,6 +64,10 @@ # 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 diff --git a/stgit/commands/series.py b/stgit/commands/series.py index 4f372ff..4a12d75 100644 --- a/stgit/commands/series.py +++ b/stgit/commands/series.py @@ -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 diff --git a/stgit/config.py b/stgit/config.py index f5fbdab..a6afbfd 100644 --- a/stgit/config.py +++ b/stgit/config.py @@ -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 -- [mdw]