Add a new option to "stg applied" and "stg unapplied" that provides a count
[stgit] / stgit / commands / series.py
index e66f1bd..105eeb9 100644 (file)
@@ -33,6 +33,9 @@ prefixed with a '>'. Empty patches are prefixed with a '0'."""
 
 options = [make_option('-b', '--branch',
                        help = 'use BRANCH instead of the default one'),
+           make_option('-c', '--count',
+                       help = 'print the number of patches in the series',
+                       action = 'store_true'),
            make_option('-d', '--description',
                        help = 'show a short description for each patch',
                        action = 'store_true'),
@@ -73,6 +76,10 @@ def func(parser, options, args):
     applied = crt_series.get_applied()
     unapplied = crt_series.get_unapplied()
 
+    if options.count:
+        print len(applied) + len(unapplied)
+        return
+
     if options.short:
         if len(applied) > 5:
             applied = applied[-6:]