From 0c032afab8b5a22428d6148bd611cfe171934ae2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 25 Nov 2008 16:45:42 -0500 Subject: [PATCH] Added -a/n/m/r to becommands/diff.py. --- becommands/diff.py | 36 +++++++++++++++++++++++++++++++++--- becommands/list.py | 2 +- libbe/comment.py | 4 ++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/becommands/diff.py b/becommands/diff.py index 8714d77..1696913 100644 --- a/becommands/diff.py +++ b/becommands/diff.py @@ -52,11 +52,37 @@ def execute(args, test=False): else: old_bd = bd.duplicate_bugdir(revision) r,m,a = diff.diff(old_bd, bd) - print diff.diff_report((r,m,a), bd).encode(bd.encoding) + + optbugs = [] + if options.all == True: + options.new = options.modified = options.removed = True + if options.new == True: + optbugs.extend(a) + if options.modified == True: + optbugs.extend([new for old,new in m]) + if options.removed == True: + optbugs.extend(r) + if len(optbugs) > 0: + for bug in optbugs: + print bug.uuid + else : + print diff.diff_report((r,m,a), bd).encode(bd.encoding) bd.remove_duplicate_bugdir() def get_parser(): - parser = cmdutil.CmdOptionParser("be diff [SPECIFIER]") + parser = cmdutil.CmdOptionParser("be diff [options] REVISION") + # boolean options + bools = (("n", "new", "Print UUIDS for new bugs"), + ("m", "modified", "Print UUIDS for modified bugs"), + ("r", "removed", "Print UUIDS for removed bugs"), + ("a", "all", "Print UUIDS for all changed bugs")) + for s in bools: + attr = s[1].replace('-','_') + short = "-%c" % s[0] + long = "--%s" % s[1] + help = s[2] + parser.add_option(short, long, action="store_true", + dest=attr, help=help) return parser longhelp=""" @@ -64,7 +90,11 @@ Uses the RCS to compare the current tree with a previous tree, and prints a pretty report. If specifier is given, it is a specifier for the particular previous tree to use. Specifiers are specific to their RCS. -For Arch: a fully-qualified revision name +For Arch your specifier must be a fully-qualified revision name. + +Besides the standard summary output, you can use the options to output +UUIDS for the different categories. This output can be used as the +input to 'be show' to get and understanding of the current status. """ def help(): diff --git a/becommands/list.py b/becommands/list.py index 1f5b462..5c0d326 100644 --- a/becommands/list.py +++ b/becommands/list.py @@ -136,7 +136,7 @@ def get_parser(): help="List options matching ASSIGNED", default=None) parser.add_option("-t", "--target", metavar="TARGET", dest="target", help="List options matching TARGET", default=None) - # boolean shortucts. All of these are special cases of long forms + # boolean options. All but uuids are special cases of long forms bools = (("u", "uuids", "Only print the bug UUIDS"), ("w", "wishlist", "List bugs with 'wishlist' severity"), ("i", "important", "List bugs with >= 'serious' severity"), diff --git a/libbe/comment.py b/libbe/comment.py index bd085fa..0c8372e 100644 --- a/libbe/comment.py +++ b/libbe/comment.py @@ -85,8 +85,8 @@ class Comment(Tree): def __init__(self, bug=None, uuid=None, from_disk=False, in_reply_to=None, body=None): """ - Set from_disk=True to load an old bug. - Set from_disk=False to create a new bug. + Set from_disk=True to load an old comment. + Set from_disk=False to create a new comment. The uuid option is required when from_disk==True. -- 2.26.2