diff options
author | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-11 18:39:26 +0000 |
---|---|---|
committer | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-11 18:39:26 +0000 |
commit | 20a48a1ad3f720d915084d6d139b3790cd4630eb (patch) | |
tree | 4b89c9694971033355bb018af36ddbb578024f65 /becommands | |
parent | 51c729fdfd03369e2ad7dc6752034469cfbdf253 (diff) | |
download | bugseverywhere-20a48a1ad3f720d915084d6d139b3790cd4630eb.tar.gz |
Modularized commands into files
Diffstat (limited to 'becommands')
-rw-r--r-- | becommands/__init__.py | 0 | ||||
-rw-r--r-- | becommands/close.py | 4 | ||||
-rw-r--r-- | becommands/list.py | 18 | ||||
-rw-r--r-- | becommands/new.py | 13 | ||||
-rw-r--r-- | becommands/open.py | 4 | ||||
-rw-r--r-- | becommands/set_root.py | 6 | ||||
-rw-r--r-- | becommands/severity.py | 37 | ||||
-rw-r--r-- | becommands/show.py | 9 |
8 files changed, 91 insertions, 0 deletions
diff --git a/becommands/__init__.py b/becommands/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/becommands/__init__.py diff --git a/becommands/close.py b/becommands/close.py new file mode 100644 index 0000000..184e2e1 --- /dev/null +++ b/becommands/close.py @@ -0,0 +1,4 @@ +from libbe import cmdutil +def execute(args): + assert(len(args) == 1) + cmdutil.get_bug(args[0]).status = "closed" diff --git a/becommands/list.py b/becommands/list.py new file mode 100644 index 0000000..b608629 --- /dev/null +++ b/becommands/list.py @@ -0,0 +1,18 @@ +from libbe import bugdir, cmdutil +import os +def execute(args): + active = True + severity = ("minor", "serious", "critical", "fatal") + def filter(bug): + if active is not None: + if bug.active != active: + return False + if bug.severity not in severity: + return False + return True + all_bugs = list(bugdir.tree_root(os.getcwd()).list()) + bugs = [b for b in all_bugs if filter(b) ] + if len(bugs) == 0: + print "No matching bugs found" + for bug in bugs: + print cmdutil.bug_summary(bug, all_bugs) diff --git a/becommands/new.py b/becommands/new.py new file mode 100644 index 0000000..2e78524 --- /dev/null +++ b/becommands/new.py @@ -0,0 +1,13 @@ +from libbe import bugdir, cmdutil, names +def execute(args): + if len(args) != 1: + raise cmdutil.UserError("Please supply a summary message") + dir = bugdir.tree_root(".") + bugs = (dir.list()) + bug = dir.new_bug() + bug.creator = names.creator() + bug.severity = "minor" + bug.status = "open" + bug.summary = args[0] + + diff --git a/becommands/open.py b/becommands/open.py new file mode 100644 index 0000000..db89035 --- /dev/null +++ b/becommands/open.py @@ -0,0 +1,4 @@ +from libbe import cmdutil +def execute(args): + assert(len(args) == 1) + cmdutil.get_bug(args[0]).status = "open" diff --git a/becommands/set_root.py b/becommands/set_root.py new file mode 100644 index 0000000..bf1d495 --- /dev/null +++ b/becommands/set_root.py @@ -0,0 +1,6 @@ +from libbe import bugdir, cmdutil + +def execute(args): + if len(args) != 1: + raise cmdutil.UserError("Please supply a directory path") + bugdir.create_bug_dir(args[0]) diff --git a/becommands/severity.py b/becommands/severity.py new file mode 100644 index 0000000..a421dd2 --- /dev/null +++ b/becommands/severity.py @@ -0,0 +1,37 @@ +"""Show or change a bug's severity level""" +from libbe import bugdir +from libbe import cmdutil +__desc__ = __doc__ + +def execute(args): + assert(len(args) in (0, 1, 2)) + if len(args) == 0: + print help() + return + bug = cmdutil.get_bug(args[0]) + if len(args) == 1: + print bug.severity + elif len(args) == 2: + try: + bug.severity = args[1] + except bugdir.InvalidValue, e: + if e.name != "severity": + raise + raise cmdutil.UserError ("Invalid severity level: %s" % e.value) + + +def help(): + return """be severity bug-id [severity] + +Show or change a bug's severity level. + +If no severity is specified, the current value is printed. If a severity level +is specified, it will be assigned to the bug. + +Severity levels are: +wishlist: A feature that could improve usefulness, but not a bug. + minor: The standard bug level. + serious: A bug that requires workarounds. +critical: A bug that prevents some features from working at all. + fatal: A bug that makes the package unusable. +""" diff --git a/becommands/show.py b/becommands/show.py new file mode 100644 index 0000000..8b38386 --- /dev/null +++ b/becommands/show.py @@ -0,0 +1,9 @@ +from libbe import bugdir, cmdutil +import os + +def execute(args): + bug_dir = bugdir.tree_root(os.getcwd()) + if len(args) !=1: + raise cmdutil.UserError("Please specify a bug id.") + print cmdutil.bug_summary(cmdutil.get_bug(args[0], bug_dir), + list(bug_dir.list())) |