aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/show.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-11-21 14:56:05 -0500
committerW. Trevor King <wking@drexel.edu>2008-11-21 14:56:05 -0500
commit23179f50092d91dbeab97ad2b88cdaadb79b615f (patch)
tree4a5579d686c573d6d438214aa0d2100f01083bef /becommands/show.py
parenta2bdbab9ccd9ca24ce470d2beeea86afb7ede2ae (diff)
downloadbugseverywhere-23179f50092d91dbeab97ad2b88cdaadb79b615f.tar.gz
Another major rewrite. Now BugDir, Bug, and Comment are more distinct.
I pushed a lot of the little helper functions into the main classes, which makes it easier for me to keep track of what's going on. I'm now at the point where I can run through `python test.py` with each of the backends (by changing the search order in rcs.py _get_matching_rcs) without any unexpected errors for each backend (except Arch). I can also run `test_usage.sh` without non-Arch errors either. However, don't consider this a stable commit yet. The bzr backend is *really*slow*, and the other's aren't blazingly fast either. I think I'm rewriting the entire database every time I save it :p. Still, it passes the checks. and I don't like it when zounds of changes build up.
Diffstat (limited to 'becommands/show.py')
-rw-r--r--becommands/show.py39
1 files changed, 24 insertions, 15 deletions
diff --git a/becommands/show.py b/becommands/show.py
index 669a81d..ab296e3 100644
--- a/becommands/show.py
+++ b/becommands/show.py
@@ -15,26 +15,35 @@
# 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 cmdutil, names, utility
-from libbe.bug import thread_comments
-import os
+from libbe import cmdutil, bugdir
__desc__ = __doc__
def execute(args):
+ """
+ >>> import os
+ >>> bd = bugdir.simple_bug_dir()
+ >>> os.chdir(bd.root)
+ >>> execute (["a",])
+ ID : a
+ Short name : a
+ Severity : minor
+ Status : open
+ Assigned :
+ Target :
+ Creator : John Doe <jdoe@example.com>
+ Created : Wed, 31 Dec 1969 19:00 (Thu, 01 Jan 1970 00:00:00 +0000)
+ Bug A
+ <BLANKLINE>
+ """
options, args = get_parser().parse_args(args)
- if len(args) !=1:
+ if len(args) == 0:
raise cmdutil.UserError("Please specify a bug id.")
- bug_dir = cmdutil.bug_tree()
- bug = cmdutil.get_bug(args[0], bug_dir)
- print bug.string().rstrip("\n")
- unique_name = names.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 = thread_comments(comments)
- cmdutil.print_threaded_comments(threaded, name_map)
+ if len(args) > 1:
+ help()
+ raise cmdutil.UserError("Too many arguments.")
+ bd = bugdir.BugDir(loadNow=True)
+ bug = bd.bug_from_shortname(args[0])
+ print bug.string(show_comments=True)
def get_parser():
parser = cmdutil.CmdOptionParser("be show bug-id")