aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/show.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-06-19 14:42:15 -0400
committerW. Trevor King <wking@drexel.edu>2009-06-19 14:42:15 -0400
commit89b2ba997492895328203c3d80cfd8a66dd17363 (patch)
tree7e2eaf73205bf83a6d78dcc6880d9489729ee486 /becommands/show.py
parent8949c86542fcabbe1ddea8e9936c4436698654db (diff)
parentbd8d5fdc0d37970824daac68f8d7c76975e9d36d (diff)
downloadbugseverywhere-89b2ba997492895328203c3d80cfd8a66dd17363.tar.gz
Merged Thomas Habets 2009-01-07 XML output for "be show".
I rewrote a few of his routines, e.g. generalizing Comment.string_thread to run a caller-specified method avoided the need for some duplicate code in Comment.xml_thread. There was also a reasonable reorganization of libbe.settings_object.versioned_property because the <in_reply_to> field of the Comment.xml output was giving me `-1' (= old settings_object.EMPTY) instead of None, even after I had set comm.in_reply_to to None. The rewritten versioned_property avoids the ambiguity of UNPRIMED vs EMPTY, and avoids the stupididy of my using EMPTY=-1 ;).
Diffstat (limited to 'becommands/show.py')
-rw-r--r--becommands/show.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/becommands/show.py b/becommands/show.py
index 87b890f..7c48257 100644
--- a/becommands/show.py
+++ b/becommands/show.py
@@ -35,6 +35,19 @@ def execute(args, test=False):
Created : Wed, 31 Dec 1969 19:00 (Thu, 01 Jan 1970 00:00:00 +0000)
Bug A
<BLANKLINE>
+ >>> execute (["--xml", "a"], test=True)
+ <bug>
+ <uuid>a</uuid>
+ <short-name>a</short-name>
+ <severity>minor</severity>
+ <status>open</status>
+ <assigned><class 'libbe.settings_object.EMPTY'></assigned>
+ <target><class 'libbe.settings_object.EMPTY'></target>
+ <reporter><class 'libbe.settings_object.EMPTY'></reporter>
+ <creator>John Doe <jdoe@example.com></creator>
+ <created>Wed, 31 Dec 1969 19:00 (Thu, 01 Jan 1970 00:00:00 +0000)</created>
+ <summary>Bug A</summary>
+ </bug>
"""
parser = get_parser()
options, args = parser.parse_args(args)
@@ -45,12 +58,17 @@ def execute(args, test=False):
bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
for bugid in args:
bug = bd.bug_from_shortname(bugid)
- print bug.string(show_comments=True)
- if bugid != args[-1]:
- print "" # add a blank line between bugs
+ if options.dumpXML:
+ print bug.xml(show_comments=True)
+ else:
+ print bug.string(show_comments=True)
+ if bugid != args[-1]:
+ print "" # add a blank line between bugs
def get_parser():
- parser = cmdutil.CmdOptionParser("be show BUG-ID [BUG-ID ...]")
+ parser = cmdutil.CmdOptionParser("be show [options] BUG-ID [BUG-ID ...]")
+ parser.add_option("-x", "--xml", action="store_true",
+ dest='dumpXML', help="Dump as XML")
return parser
longhelp="""