+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'),
+ 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'),
+ make_option('-g', '--graphical',
+ help = 'run gitk instead of printing',
+ action = 'store_true')]
+
+
+def __get_description(patch):
+ """Extract and return a patch's short description
+ """
+ p = crt_series.get_patch(patch)
+ descr = p.get_description().strip()
+ descr_lines = descr.split('\n')
+ return descr_lines[0].rstrip()
+
+def __print_patch(patch, prefix, empty_prefix, length, options):
+ if options.empty and crt_series.empty_patch(patch):
+ prefix = empty_prefix
+ if options.description:
+ print prefix + patch.ljust(length) + ' | ' + __get_description(patch)
+ else:
+ print prefix + patch