chiark / gitweb /
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 5e7b240806892d9f28dff6aa2e9effed0e601f68..ee68d071bdaca63dc17b4250162da8b59a4bd462 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 4f372ff0c8dd94bbbd495f8ec4295da3fa1532d1..4a12d75e8c91d71f072dc24913aa89b398f42730 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 f5fbdabec3ed85c68cfdf2116df85656836cb084..a6afbfd057acde62f6e83ce96baa17736ca3f733 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