diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-12 14:32:55 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-12 14:32:55 -0400 |
commit | b5c4896d7ffd219a3118a3e6885db5956bf79e55 (patch) | |
tree | 1c09b1ce9989073027683409e5c028ae608bb29e /becommands/comment.py | |
parent | 37c4e7f0f0d012e8df88b94022bc9a9d75373831 (diff) | |
download | bugseverywhere-b5c4896d7ffd219a3118a3e6885db5956bf79e55.tar.gz |
Added "be comment --xml --ignore-missing-references ID COMMENT".
Now you don't have to edit them out by hand.
Diffstat (limited to 'becommands/comment.py')
-rw-r--r-- | becommands/comment.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/becommands/comment.py b/becommands/comment.py index 9a1e2ec..da82854 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -144,7 +144,11 @@ def execute(args, test=False): else: print >> sys.stderr, "Ignoring unknown tag %s in %s" \ % (child.tag, comment_list.tag) - comment.list_to_root(new_comments,bug,root=parent) # link new comments + try: + comment.list_to_root(new_comments,bug,root=parent, # link new comments + ignore_missing_references=options.ignore_missing_references) + except comment.MissingReference, e: + raise cmdutil.UserError(e) # Protect against programmer error causing data loss: kids = [c.uuid for c in parent.traverse()] for nc in new_comments: @@ -157,6 +161,9 @@ def get_parser(): help="Set comment content-type (e.g. text/plain)", default=None) parser.add_option("-x", "--xml", action="store_true", default=False, dest='XML', help="Use COMMENT to specify an XML comment description rather than the comment body. The root XML element should be either <bug> or <comment-list> with one or more <comment> children. The syntax for the <comment> elements should match that generated by 'be show --xml COMMENT-ID'. Unrecognized tags are ignored. Missing tags are left at the default value. The comment UUIDs are always auto-generated, so if you set a <uuid> field, but no <alt-id> field, your <uuid> will be used as the comment's <alt-id>. An exception is raised if <alt-id> conflicts with an existing comment.") + parser.add_option("-i", "--ignore-missing-references", action="store_true", + dest="ignore_missing_references", + help="For XML import, if any comment's <in-reply-to> refers to a non-existent comment, ignore it (instead of raising an exception).") return parser longhelp=""" |