aboutsummaryrefslogtreecommitdiffstats
path: root/becommands
diff options
context:
space:
mode:
Diffstat (limited to 'becommands')
-rw-r--r--becommands/assign.py2
-rw-r--r--becommands/comment.py5
-rw-r--r--becommands/help.py2
-rw-r--r--becommands/list.py9
-rw-r--r--becommands/new.py6
-rw-r--r--becommands/severity.py23
-rw-r--r--becommands/show.py5
-rw-r--r--becommands/status.py (renamed from becommands/inprogress.py)53
-rw-r--r--becommands/upgrade.py3
9 files changed, 71 insertions, 37 deletions
diff --git a/becommands/assign.py b/becommands/assign.py
index 38ece52..d595c1d 100644
--- a/becommands/assign.py
+++ b/becommands/assign.py
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Assign an individual or group to fix a bug"""
-from libbe import bugdir, cmdutil, names
+from libbe import cmdutil, names
__desc__ = __doc__
def execute(args):
diff --git a/becommands/comment.py b/becommands/comment.py
index e3a1d93..d214a19 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Add a comment to a bug"""
-from libbe import bugdir, cmdutil, names, utility
+from libbe import cmdutil, names, utility
+from libbe.bug import new_comment
import os
def execute(args):
"""
@@ -62,7 +63,7 @@ def execute(args):
if not body.endswith('\n'):
body+='\n'
- comment = bugdir.new_comment(bug, body)
+ comment = new_comment(bug, body)
if parent_comment is not None:
comment.in_reply_to = parent_comment.uuid
comment.save()
diff --git a/becommands/help.py b/becommands/help.py
index aa4aa64..45d35ca 100644
--- a/becommands/help.py
+++ b/becommands/help.py
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Print help for given subcommand"""
-from libbe import bugdir, cmdutil, names, utility
+from libbe import cmdutil, names, utility
def execute(args):
"""
diff --git a/becommands/list.py b/becommands/list.py
index cf06ccd..9351840 100644
--- a/becommands/list.py
+++ b/becommands/list.py
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""List bugs"""
-from libbe import bugdir, cmdutil, names
+from libbe import cmdutil, names
+from libbe.bug import cmp_severity, cmp_time
import os
def execute(args):
options, args = get_parser().parse_args(args)
@@ -75,10 +76,8 @@ def execute(args):
other_bugs.append(bug)
def list_bugs(cur_bugs, title, no_target=False):
- def cmp_date(bug1, bug2):
- return -cmp(bug1.time, bug2.time)
- cur_bugs.sort(cmp_date)
- cur_bugs.sort(bugdir.cmp_severity)
+ cur_bugs.sort(cmp_time)
+ cur_bugs.sort(cmp_severity)
if len(cur_bugs) > 0:
print cmdutil.underlined(title)
for bug in cur_bugs:
diff --git a/becommands/new.py b/becommands/new.py
index 7bd2382..b22dd0a 100644
--- a/becommands/new.py
+++ b/becommands/new.py
@@ -15,7 +15,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Create a new bug"""
-from libbe import bugdir, cmdutil, names, utility
+from libbe import cmdutil, names, utility
+from libbe.bug import new_bug
+
def execute(args):
"""
>>> import os, time
@@ -41,7 +43,7 @@ def execute(args):
if len(args) != 1:
raise cmdutil.UserError("Please supply a summary message")
dir = cmdutil.bug_tree()
- bug = bugdir.new_bug(dir)
+ bug = new_bug(dir)
bug.summary = args[0]
bug.save()
bugs = (dir.list())
diff --git a/becommands/severity.py b/becommands/severity.py
index af99bf7..1a68c31 100644
--- a/becommands/severity.py
+++ b/becommands/severity.py
@@ -15,8 +15,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Show or change a bug's severity level"""
-from libbe import bugdir
from libbe import cmdutil
+from libbe.bug import severity_values, severity_description
+
__desc__ = __doc__
def execute(args):
@@ -46,7 +47,7 @@ def execute(args):
elif len(args) == 2:
try:
bug.severity = args[1]
- except bugdir.InvalidValue, e:
+ except ValueError, e:
if e.name != "severity":
raise
raise cmdutil.UserError ("Invalid severity level: %s" % e.value)
@@ -56,19 +57,21 @@ def get_parser():
parser = cmdutil.CmdOptionParser("be severity bug-id [severity]")
return parser
-longhelp="""
-Show or change a bug's severity level.
+longhelp=["""
+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.
-"""
+"""]
+longest_severity_len = max([len(s) for s in severity_values])
+for severity in severity_values :
+ description = severity_description[severity]
+ s = "%*s : %s\n" % (longest_severity_len, severity, description)
+ longhelp.append(s)
+longhelp = ''.join(longhelp)
+
def help():
return get_parser().help_str() + longhelp
diff --git a/becommands/show.py b/becommands/show.py
index 8e83a1f..e75c1ac 100644
--- a/becommands/show.py
+++ b/becommands/show.py
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Show a particular bug"""
-from libbe import bugdir, cmdutil, utility
+from libbe import cmdutil, utility
+from libbe.bug import thread_comments
import os
def execute(args):
@@ -37,7 +38,7 @@ def execute(args):
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)
+ threaded = thread_comments(comments)
cmdutil.print_threaded_comments(threaded, name_map)
def get_parser():
diff --git a/becommands/inprogress.py b/becommands/status.py
index 05da971..b57db4e 100644
--- a/becommands/inprogress.py
+++ b/becommands/status.py
@@ -14,35 +14,62 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""Bug fixing in progress"""
+"""Show or change a bug's status"""
from libbe import cmdutil
+from libbe.bug import status_values, status_description
+__desc__ = __doc__
+
def execute(args):
"""
>>> from libbe import tests
>>> import os
>>> dir = tests.simple_bug_dir()
>>> os.chdir(dir.dir)
- >>> dir.get_bug("a").status
- u'open'
>>> execute(["a"])
- >>> dir.get_bug("a").status
- u'in-progress'
+ open
+ >>> execute(["a", "closed"])
+ >>> execute(["a"])
+ closed
+ >>> execute(["a", "none"])
+ Traceback (most recent call last):
+ UserError: Invalid status: none
>>> tests.clean_up()
"""
options, args = get_parser().parse_args(args)
- if len(args) !=1:
- raise cmdutil.UserError("Please specify a bug id.")
+ assert(len(args) in (0, 1, 2))
+ if len(args) == 0:
+ print help()
+ return
bug = cmdutil.get_bug(args[0])
- bug.status = "in-progress"
- bug.save()
+ if len(args) == 1:
+ print bug.status
+ elif len(args) == 2:
+ try:
+ bug.status = args[1]
+ except ValueError, e:
+ if e.name != "status":
+ raise
+ raise cmdutil.UserError ("Invalid status: %s" % e.value)
+ bug.save()
def get_parser():
- parser = cmdutil.CmdOptionParser("be inprogress BUG-ID")
+ parser = cmdutil.CmdOptionParser("be status bug-id [status]")
return parser
-longhelp="""
-Mark a bug as 'in-progress'.
-"""
+longhelp=["""
+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:
+"""]
+longest_status_len = max([len(s) for s in status_values])
+for status in status_values :
+ description = status_description[status]
+ s = "%*s : %s\n" % (longest_status_len, status, description)
+ longhelp.append(s)
+longhelp = ''.join(longhelp)
def help():
return get_parser().help_str() + longhelp
diff --git a/becommands/upgrade.py b/becommands/upgrade.py
index 3dcb4eb..8f7c3a4 100644
--- a/becommands/upgrade.py
+++ b/becommands/upgrade.py
@@ -18,6 +18,7 @@
import os.path
import errno
from libbe import bugdir, rcs, cmdutil
+from libbe.bug import Bug
def execute(args):
options, args = get_parser().parse_args(args)
@@ -25,7 +26,7 @@ def execute(args):
for uuid in root.list_uuids():
old_bug = OldBug(root.bugs_path, uuid)
- new_bug = bugdir.Bug(root.bugs_path, None)
+ new_bug = Bug(root.bugs_path, None)
new_bug.uuid = old_bug.uuid
new_bug.summary = old_bug.summary
new_bug.creator = old_bug.creator