Replaced `be diff` options --new, --removed, --modified, and --all with --uuids.
authorW. Trevor King <wking@drexel.edu>
Sat, 5 Dec 2009 06:30:30 +0000 (01:30 -0500)
committerW. Trevor King <wking@drexel.edu>
Sat, 5 Dec 2009 06:30:30 +0000 (01:30 -0500)
We'll be adding a --subscribe option which will select the
bugs/changes we're interested in, which deprecates the selection
portion of the old options.  The new --uuids just selects the "bug
uuid" output over the default "change summary" output.

becommands/diff.py

index f581ace60ffc210132d9102b027354c676502df5..aebbfdb0fa698a948b9a6bc2810156b12c1d7088 100644 (file)
@@ -84,16 +84,11 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
     d = diff.Diff(old_bd, bd)
     tree = d.report_tree()
 
-    uuids = []
-    if options.all == True:
-        options.new = options.modified = options.removed = True
-    if options.new == True:
-        uuids.extend([c.name for c in tree.child_by_path("/bugs/new")])
-    if options.modified == True:
-        uuids.extend([c.name for c in tree.child_by_path("/bugs/mod")])
-    if options.removed == True:
-        uuids.extend([c.name for c in tree.child_by_path("/bugs/rem")])
-    if (options.new or options.modified or options.removed) == True:
+    if options.uuids == True:
+        uuids = []
+        bugs = tree.child_by_path("/bugs")
+        for bug_type in bugs:
+            uuids.extend([bug.name for bug in bug_type])
         print "\n".join(uuids)
     else :
         rep = tree.report_string()
@@ -105,20 +100,10 @@ def execute(args, manipulate_encodings=True, restrict_file_access=False):
 
 def get_parser():
     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",
-                          default=False, dest=attr, help=help)
     parser.add_option("-d", "--dir", dest="dir", metavar="DIR",
                       help="Compare with repository in DIR instead of the current directory.")
+    parser.add_option("-u", "--uuids", action="store_true", dest="uuids",
+                      help="Only print the bug UUIDS.", default=False)
     return parser
 
 longhelp="""