diff options
Diffstat (limited to 'becommands')
-rw-r--r-- | becommands/comment.py | 2 | ||||
-rw-r--r-- | becommands/depend.py | 1 | ||||
-rw-r--r-- | becommands/diff.py | 9 | ||||
-rw-r--r-- | becommands/merge.py | 8 | ||||
-rw-r--r-- | becommands/new.py | 1 | ||||
-rw-r--r-- | becommands/open.py | 1 | ||||
-rw-r--r-- | becommands/remove.py | 1 | ||||
-rw-r--r-- | becommands/set.py | 3 | ||||
-rw-r--r-- | becommands/severity.py | 1 | ||||
-rw-r--r-- | becommands/show.py | 25 | ||||
-rw-r--r-- | becommands/status.py | 1 | ||||
-rw-r--r-- | becommands/tag.py | 3 | ||||
-rw-r--r-- | becommands/target.py | 1 |
13 files changed, 28 insertions, 29 deletions
diff --git a/becommands/comment.py b/becommands/comment.py index 918f922..9408b09 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -158,7 +158,7 @@ def execute(args, manipulate_encodings=True): kids = [c.uuid for c in parent.traverse()] for nc in new_comments: assert nc.uuid in kids, "%s wasn't added to %s" % (nc.uuid, parent.uuid) - bd.save() + nc.save() def get_parser(): parser = cmdutil.CmdOptionParser("be comment ID [COMMENT]") diff --git a/becommands/depend.py b/becommands/depend.py index 977edae..201c2ea 100644 --- a/becommands/depend.py +++ b/becommands/depend.py @@ -59,7 +59,6 @@ def execute(args, manipulate_encodings=True): else: # add the dependency estrs.append(depend_string) bugA.extra_strings = estrs # reassign to notice change - bugA.save() depends = [] for estr in bugA.extra_strings: diff --git a/becommands/diff.py b/becommands/diff.py index 20fcb4c..50dea7c 100644 --- a/becommands/diff.py +++ b/becommands/diff.py @@ -24,10 +24,10 @@ def execute(args, manipulate_encodings=True): """ >>> import os >>> bd = bugdir.simple_bug_dir() + >>> bd.set_sync_with_disk(True) >>> original = bd.rcs.commit("Original status") >>> bug = bd.bug_from_uuid("a") >>> bug.status = "closed" - >>> bd.save() >>> changed = bd.rcs.commit("Closed bug a") >>> os.chdir(bd.root) >>> if bd.rcs.versioned == True: @@ -89,9 +89,10 @@ def get_parser(): return parser longhelp=""" -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. +Uses the RCS to compare the current tree with a previous tree, and +prints a pretty report. If REVISION is given, it is a specifier for +the particular previous tree to use. Specifiers are specific to their +RCS. For Arch your specifier must be a fully-qualified revision name. diff --git a/becommands/merge.py b/becommands/merge.py index c7cae2b..8e1fd50 100644 --- a/becommands/merge.py +++ b/becommands/merge.py @@ -22,6 +22,7 @@ def execute(args, manipulate_encodings=True): """ >>> from libbe import utility >>> bd = bugdir.simple_bug_dir() + >>> bd.set_sync_with_disk(True) >>> a = bd.bug_from_shortname("a") >>> a.comment_root.time = 0 >>> dummy = a.new_comment("Testing") @@ -35,7 +36,6 @@ def execute(args, manipulate_encodings=True): >>> dummy.time = 1 >>> dummy = dummy.new_reply("1 2 3 4") >>> dummy.time = 2 - >>> bd.save() >>> os.chdir(bd.root) >>> execute(["a", "b"], manipulate_encodings=False) Merging bugs a and b @@ -141,13 +141,13 @@ def execute(args, manipulate_encodings=True): bugB.load_comments() mergeA = bugA.new_comment("Merged from bug %s" % bugB.uuid) newCommTree = copy.deepcopy(bugB.comment_root) - for comment in newCommTree.traverse(): + for comment in newCommTree.traverse(): # all descendant comments comment.bug = bugA - for comment in newCommTree: + comment.save() # force onto disk under bugA + for comment in newCommTree: # just the child comments mergeA.add_reply(comment, allow_time_inversion=True) bugB.new_comment("Merged into bug %s" % bugA.uuid) bugB.status = "closed" - bd.save() print "Merging bugs %s and %s" % (bugA.uuid, bugB.uuid) def get_parser(): diff --git a/becommands/new.py b/becommands/new.py index 8512e22..2487bac 100644 --- a/becommands/new.py +++ b/becommands/new.py @@ -59,7 +59,6 @@ def execute(args, manipulate_encodings=True): bug.assigned = options.assigned elif bd.default_assignee != None: bug.assigned = bd.default_assignee - bd.save() print "Created bug with ID %s" % bd.bug_shortname(bug) def get_parser(): diff --git a/becommands/open.py b/becommands/open.py index ee81422..b98463d 100644 --- a/becommands/open.py +++ b/becommands/open.py @@ -44,7 +44,6 @@ def execute(args, manipulate_encodings=True): manipulate_encodings=manipulate_encodings) bug = bd.bug_from_shortname(args[0]) bug.status = "open" - bd.save() def get_parser(): parser = cmdutil.CmdOptionParser("be open BUG-ID") diff --git a/becommands/remove.py b/becommands/remove.py index d6ba999..884b792 100644 --- a/becommands/remove.py +++ b/becommands/remove.py @@ -44,7 +44,6 @@ def execute(args, manipulate_encodings=True): manipulate_encodings=manipulate_encodings) bug = bd.bug_from_shortname(args[0]) bd.remove_bug(bug) - bd.save() print "Removed bug %s" % bug.uuid def get_parser(): diff --git a/becommands/set.py b/becommands/set.py index 7bef644..f7fca54 100644 --- a/becommands/set.py +++ b/becommands/set.py @@ -62,7 +62,7 @@ def execute(args, manipulate_encodings=True): print _value_string(bd, args[0]) else: if args[1] == "none": - del bd.settings[args[0]] + setattr(bd, args[0], settings_object.EMPTY) else: if args[0] not in bd.settings_properties: msg = "Invalid setting %s\n" % args[0] @@ -71,7 +71,6 @@ def execute(args, manipulate_encodings=True): raise cmdutil.UserError(msg) old_setting = bd.settings.get(args[0]) setattr(bd, args[0], args[1]) - bd.save() def get_parser(): parser = cmdutil.CmdOptionParser("be set [NAME] [VALUE]") diff --git a/becommands/severity.py b/becommands/severity.py index 4e95638..d125789 100644 --- a/becommands/severity.py +++ b/becommands/severity.py @@ -51,7 +51,6 @@ def execute(args, manipulate_encodings=True): if e.name != "severity": raise e raise cmdutil.UserError ("Invalid severity level: %s" % e.value) - bd.save() def get_parser(): parser = cmdutil.CmdOptionParser("be severity BUG-ID [SEVERITY]") diff --git a/becommands/show.py b/becommands/show.py index ae1c7f3..b7bfe78 100644 --- a/becommands/show.py +++ b/becommands/show.py @@ -59,6 +59,8 @@ def execute(args, manipulate_encodings=True): raise cmdutil.UsageError bd = bugdir.BugDir(from_disk=True, manipulate_encodings=manipulate_encodings) + if options.XML: + print '<?xml version="1.0" encoding="%s" ?>' % bd.encoding for shortname in args: if shortname.count(':') > 1: raise cmdutil.UserError("Invalid id '%s'." % shortname) @@ -69,32 +71,37 @@ def execute(args, manipulate_encodings=True): else: bugname = shortname is_comment = False + if is_comment == True and options.comments == False: + continue bug = bd.bug_from_shortname(bugname) if is_comment == False: - if options.dumpXML: - print '<?xml version="1.0" encoding="%s" ?>' % bd.encoding - print bug.xml(show_comments=True) + if options.XML: + print bug.xml(show_comments=options.comments) else: - print bug.string(show_comments=True) + print bug.string(show_comments=options.comments) else: comment = bug.comment_root.comment_from_shortname( shortname, bug_shortname=bugname) - if options.dumpXML: + if options.XML: print comment.xml(shortname=shortname) else: if len(args) == 1 and options.only_raw_body == True: sys.__stdout__.write(comment.body) else: print comment.string(shortname=shortname) - if shortname != args[-1] and options.dumpXML == False: + if shortname != args[-1] and options.XML == False: print "" # add a blank line between bugs/comments def get_parser(): parser = cmdutil.CmdOptionParser("be show [options] ID [ID ...]") - parser.add_option("-x", "--xml", action="store_true", - dest='dumpXML', help="Dump as XML") + parser.add_option("-x", "--xml", action="store_true", default=False, + dest='XML', help="Dump as XML") parser.add_option("--only-raw-body", action="store_true", - dest='only_raw_body', help="When printing only a single comment, just print it's body. This allows extraction of non-text content types.") + dest='only_raw_body', + help="When printing only a single comment, just print it's body. This allows extraction of non-text content types.") + parser.add_option("-c", "--no-comments", dest="comments", + action="store_false", default=True, + help="Disable comment output. This is useful if you just want more details on a bug's current status.") return parser longhelp=""" diff --git a/becommands/status.py b/becommands/status.py index a122aec..56cb505 100644 --- a/becommands/status.py +++ b/becommands/status.py @@ -48,7 +48,6 @@ def execute(args, manipulate_encodings=True): if e.name != "status": raise raise cmdutil.UserError ("Invalid status: %s" % e.value) - bd.save() def get_parser(): parser = cmdutil.CmdOptionParser("be status BUG-ID [STATUS]") diff --git a/becommands/tag.py b/becommands/tag.py index 2932589..5c4b7a6 100644 --- a/becommands/tag.py +++ b/becommands/tag.py @@ -22,6 +22,7 @@ def execute(args, manipulate_encodings=True): """ >>> from libbe import utility >>> bd = bugdir.simple_bug_dir() + >>> bd.set_sync_with_disk(True) >>> os.chdir(bd.root) >>> a = bd.bug_from_shortname("a") >>> print a.extra_strings @@ -56,7 +57,6 @@ def execute(args, manipulate_encodings=True): >>> a.extra_strings = [] >>> print a.extra_strings [] - >>> a.save() >>> execute(["a"], manipulate_encodings=False) >>> bd._clear_bugs() # resync our copy of bug >>> a = bd.bug_from_shortname("a") @@ -103,7 +103,6 @@ def execute(args, manipulate_encodings=True): else: # add the tag estrs.append(tag_string) bug.extra_strings = estrs # reassign to notice change - bd.save() tags = [] for estr in bug.extra_strings: diff --git a/becommands/target.py b/becommands/target.py index 66bacb8..541918c 100644 --- a/becommands/target.py +++ b/becommands/target.py @@ -66,7 +66,6 @@ def execute(args, manipulate_encodings=True): bug.target = None else: bug.target = args[1] - bd.save() def get_parser(): parser = cmdutil.CmdOptionParser("be target BUG-ID [TARGET]\nor: be target --list") |