From: Catalin Marinas Date: Fri, 16 Feb 2007 22:42:35 +0000 (+0000) Subject: Add --author option to series X-Git-Tag: v0.14.3~333 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/54fac8e67115d98b4addcd4e7c9bfe9f39820b09 Add --author option to series This is similar to the --description option, only that the author name is displayed instead. Signed-off-by: Catalin Marinas --- diff --git a/stgit/commands/series.py b/stgit/commands/series.py index 31ce5cb..7777201 100644 --- a/stgit/commands/series.py +++ b/stgit/commands/series.py @@ -50,6 +50,9 @@ options = [make_option('-b', '--branch', make_option('-d', '--description', help = 'show a short description for each patch', action = 'store_true'), + make_option('--author', + help = 'show the author name for each patch', + action = 'store_true'), make_option('-e', '--empty', help = 'check whether patches are empty ' '(much slower)', @@ -76,6 +79,12 @@ def __get_description(patch): descr_lines = descr.split('\n') return descr_lines[0].rstrip() +def __get_author(patch): + """Extract and return a patch's short description + """ + p = crt_series.get_patch(patch) + return p.get_authname(); + def __print_patch(patch, hidden, branch_str, prefix, empty_prefix, length, options): """Print a patch name, description and various markers. @@ -89,9 +98,13 @@ def __print_patch(patch, hidden, branch_str, prefix, empty_prefix, length, if not options.noprefix and patch in hidden: patch_str += '*' + if options.description or options.author: + patch_str = patch_str.ljust(length) + if options.description: - print prefix + patch_str.ljust(length) + ' | ' \ - + __get_description(patch) + print prefix + patch_str + ' | ' + __get_description(patch) + elif options.author: + print prefix + patch_str + ' | ' + __get_author(patch) else: print prefix + patch_str