aboutsummaryrefslogtreecommitdiffstats
path: root/becommands
diff options
context:
space:
mode:
authorAaron Bentley <aaron.bentley@utoronto.ca>2006-04-04 19:46:25 -0400
committerAaron Bentley <aaron.bentley@utoronto.ca>2006-04-04 19:46:25 -0400
commit2225a378d84f77c3512ee407af1aeb355b463084 (patch)
treebfd0ef4b969bfdcd723e405f69599107b0931bd9 /becommands
parent4dda0decb88c6bc987d3d55a1ac757104e9d0ba9 (diff)
parentc1f60d534fbc5496a0e3df2cb7c0d053e5fa40a8 (diff)
downloadbugseverywhere-2225a378d84f77c3512ee407af1aeb355b463084.tar.gz
Merge both lines
Diffstat (limited to 'becommands')
-rw-r--r--becommands/assign.py11
-rw-r--r--becommands/close.py12
-rw-r--r--becommands/comment.py12
-rw-r--r--becommands/help.py6
-rw-r--r--becommands/inprogress.py12
-rw-r--r--becommands/open.py12
-rw-r--r--becommands/set.py10
-rw-r--r--becommands/severity.py11
-rw-r--r--becommands/show.py27
-rw-r--r--becommands/target.py11
-rw-r--r--becommands/upgrade.py11
11 files changed, 113 insertions, 22 deletions
diff --git a/becommands/assign.py b/becommands/assign.py
index f3db6aa..2308a12 100644
--- a/becommands/assign.py
+++ b/becommands/assign.py
@@ -37,6 +37,7 @@ def execute(args):
True
>>> tests.clean_up()
"""
+ options, args = get_parser().parse_args(args)
assert(len(args) in (0, 1, 2))
if len(args) == 0:
print help()
@@ -51,10 +52,11 @@ def execute(args):
bug.assigned = args[1]
bug.save()
+def get_parser():
+ parser = cmdutil.CmdOptionParser("be assign bug-id [assignee]")
+ return parser
-def help():
- return """be assign bug-id [assignee]
-
+longhelp = """
Assign a person to fix a bug.
By default, the bug is self-assigned. If an assignee is specified, the bug
@@ -65,3 +67,6 @@ appears in Creator fields.
To un-assign a bug, specify "none" for the assignee.
"""
+
+def help():
+ return get_parser().help_str() + longhelp
diff --git a/becommands/close.py b/becommands/close.py
index 04ae4ba..3ced7eb 100644
--- a/becommands/close.py
+++ b/becommands/close.py
@@ -29,7 +29,19 @@ def execute(args):
u'closed'
>>> tests.clean_up()
"""
+ options, args = get_parser().parse_args(args)
assert(len(args) == 1)
bug = cmdutil.get_bug(args[0])
bug.status = "closed"
bug.save()
+
+def get_parser():
+ parser = cmdutil.CmdOptionParser("be close bug-id")
+ return parser
+
+longhelp="""
+Close the bug identified by bug-id.
+"""
+
+def help():
+ return get_parser().help_str() + longhelp
diff --git a/becommands/comment.py b/becommands/comment.py
index 37fd37d..4f0bf3b 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -46,7 +46,7 @@ def execute(args):
options, args = get_parser().parse_args(args)
if len(args) < 1:
raise cmdutil.UsageError()
- bug = cmdutil.get_bug(args[0])
+ bug, parent_comment = cmdutil.get_bug_and_comment(args[0])
if len(args) == 1:
try:
body = utility.editor_string()
@@ -61,15 +61,21 @@ def execute(args):
body+='\n'
comment = bugdir.new_comment(bug, body)
+ if parent_comment is not None:
+ comment.in_reply_to = parent_comment.uuid
comment.save()
def get_parser():
- parser = cmdutil.CmdOptionParser("be comment BUG-ID COMMENT")
+ parser = cmdutil.CmdOptionParser("be comment ID COMMENT")
return parser
longhelp="""
-Add a comment to a bug.
+To add a comment to a bug, use the bug ID as the argument. To reply to another
+comment, specify the comment name (as shown in "be show" output).
+
+$EDITOR is used to launch an editor. If unspecified, no comment will be
+created.)
"""
def help():
diff --git a/becommands/help.py b/becommands/help.py
index cae8949..1402a2a 100644
--- a/becommands/help.py
+++ b/becommands/help.py
@@ -26,7 +26,11 @@ def execute(args):
if len(args) == 0:
print_command_list()
else:
- print cmdutil.help(args[0])
+ try:
+ print cmdutil.help(args[0])
+ except AttributeError:
+ print "No help available"
+
return
diff --git a/becommands/inprogress.py b/becommands/inprogress.py
index 214efa1..10d5cbd 100644
--- a/becommands/inprogress.py
+++ b/becommands/inprogress.py
@@ -29,7 +29,19 @@ def execute(args):
u'in-progress'
>>> tests.clean_up()
"""
+ options, args = get_parser().parse_args(args)
assert(len(args) == 1)
bug = cmdutil.get_bug(args[0])
bug.status = "in-progress"
bug.save()
+
+def get_parser():
+ parser = cmdutil.CmdOptionParser("be inprogress BUG-ID")
+ return parser
+
+longhelp="""
+Mark a bug as 'in-progress'.
+"""
+
+def help():
+ return get_parser().help_str() + longhelp
diff --git a/becommands/open.py b/becommands/open.py
index 19b8910..89067f8 100644
--- a/becommands/open.py
+++ b/becommands/open.py
@@ -29,7 +29,19 @@ def execute(args):
u'open'
>>> tests.clean_up()
"""
+ options, args = get_parser().parse_args(args)
assert(len(args) == 1)
bug = cmdutil.get_bug(args[0])
bug.status = "open"
bug.save()
+
+def get_parser():
+ parser = cmdutil.CmdOptionParser("be open BUG-ID")
+ return parser
+
+longhelp="""
+Mark a bug as 'open'.
+"""
+
+def help():
+ return get_parser().help_str() + longhelp
diff --git a/becommands/set.py b/becommands/set.py
index 2a977ca..6f40b5f 100644
--- a/becommands/set.py
+++ b/becommands/set.py
@@ -32,6 +32,7 @@ def execute(args):
None
>>> tests.clean_up()
"""
+ options, args = get_parser().parse_args(args)
if len(args) > 2:
raise cmdutil.UserError("Too many arguments.")
tree = cmdutil.bug_tree()
@@ -49,9 +50,11 @@ def execute(args):
del tree.settings[args[0]]
tree.save_settings()
-def help():
- return """be set [name] [value]
+def get_parser():
+ parser = cmdutil.CmdOptionParser("be set [name] [value]")
+ return parser
+longhelp="""
Show or change per-tree settings.
If name and value are supplied, the name is set to a new value.
@@ -66,3 +69,6 @@ target
To unset a setting, set it to "none".
"""
+
+def help():
+ return get_parser().help_str() + longhelp
diff --git a/becommands/severity.py b/becommands/severity.py
index 88d3f25..82ef7ca 100644
--- a/becommands/severity.py
+++ b/becommands/severity.py
@@ -35,6 +35,7 @@ def execute(args):
UserError: Invalid severity level: none
>>> tests.clean_up()
"""
+ options, args = get_parser().parse_args(args)
assert(len(args) in (0, 1, 2))
if len(args) == 0:
print help()
@@ -51,10 +52,11 @@ def execute(args):
raise cmdutil.UserError ("Invalid severity level: %s" % e.value)
bug.save()
+def get_parser():
+ parser = cmdutil.CmdOptionParser("be severity bug-id [severity]")
+ return parser
-def help():
- return """be severity bug-id [severity]
-
+longhelp="""
Show or change a bug's severity level.
If no severity is specified, the current value is printed. If a severity level
@@ -67,3 +69,6 @@ wishlist: A feature that could improve usefulness, but not a bug.
critical: A bug that prevents some features from working at all.
fatal: A bug that makes the package unusable.
"""
+
+def help():
+ return get_parser().help_str() + longhelp
diff --git a/becommands/show.py b/becommands/show.py
index 9e60586..8e83a1f 100644
--- a/becommands/show.py
+++ b/becommands/show.py
@@ -19,9 +19,10 @@ from libbe import bugdir, cmdutil, utility
import os
def execute(args):
- bug_dir = cmdutil.bug_tree()
+ options, args = get_parser().parse_args(args)
if len(args) !=1:
raise cmdutil.UserError("Please specify a bug id.")
+ bug_dir = cmdutil.bug_tree()
bug = cmdutil.get_bug(args[0], bug_dir)
print cmdutil.bug_summary(bug, list(bug_dir.list())).rstrip("\n")
if bug.time is None:
@@ -30,8 +31,22 @@ def execute(args):
time_str = "%s (%s)" % (utility.handy_time(bug.time),
utility.time_to_str(bug.time))
print "Created: %s" % time_str
- for comment in bug.list_comments():
- print "--------- Comment ---------"
- print "From: %s" % comment.From
- print "Date: %s\n" % utility.time_to_str(comment.date)
- print comment.body.rstrip('\n')
+ unique_name = cmdutil.unique_name(bug, bug_dir.list())
+ comments = []
+ name_map = {}
+ for c_name, comment in cmdutil.iter_comment_name(bug, unique_name):
+ name_map[comment.uuid] = c_name
+ comments.append(comment)
+ threaded = bugdir.thread_comments(comments)
+ cmdutil.print_threaded_comments(threaded, name_map)
+
+def get_parser():
+ parser = cmdutil.CmdOptionParser("be show bug-id")
+ return parser
+
+longhelp="""
+Show all information about a bug.
+"""
+
+def help():
+ return get_parser().help_str() + longhelp
diff --git a/becommands/target.py b/becommands/target.py
index d077da5..665efad 100644
--- a/becommands/target.py
+++ b/becommands/target.py
@@ -35,6 +35,7 @@ def execute(args):
No target assigned.
>>> tests.clean_up()
"""
+ options, args = get_parser().parse_args(args)
assert(len(args) in (0, 1, 2))
if len(args) == 0:
print help()
@@ -52,10 +53,11 @@ def execute(args):
bug.target = args[1]
bug.save()
+def get_parser():
+ parser = cmdutil.CmdOptionParser("be target bug-id [target]")
+ return parser
-def help():
- return """be target bug-id [target]
-
+longhelp="""
Show or change a bug's target for fixing.
If no target is specified, the current value is printed. If a target
@@ -66,3 +68,6 @@ milestone names or release numbers.
The value "none" can be used to unset the target.
"""
+
+def help():
+ return get_parser().help_str() + longhelp
diff --git a/becommands/upgrade.py b/becommands/upgrade.py
index 0cbffa1..3dcb4eb 100644
--- a/becommands/upgrade.py
+++ b/becommands/upgrade.py
@@ -17,9 +17,10 @@
"""Upgrade the bugs to the latest format"""
import os.path
import errno
-from libbe import bugdir, rcs
+from libbe import bugdir, rcs, cmdutil
def execute(args):
+ options, args = get_parser().parse_args(args)
root = bugdir.tree_root(".", old_version=True)
for uuid in root.list_uuids():
old_bug = OldBug(root.bugs_path, uuid)
@@ -98,5 +99,13 @@ class OldBug(object):
else:
rcs.set_file_contents(self.get_path(name), "%s\n" % value)
+def get_parser():
+ parser = cmdutil.CmdOptionParser("be upgrade")
+ return parser
+longhelp="""
+Upgrade the bug storage to the latest format.
+"""
+def help():
+ return get_parser().help_str() + longhelp