diff options
Diffstat (limited to 'becommands/comment.py')
-rw-r--r-- | becommands/comment.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/becommands/comment.py b/becommands/comment.py index f350291..1e6ecd4 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -122,15 +122,21 @@ def execute(args, test=False): raise comment.InvalidXML( comment_list, "root element must be <bug> or <comment-list>") new_comments = [] - uuids = [c.uuid for c in bug.comment_root.traverse()] # unique uuid check should be unique alt_id check + ids = [] + for c in bug.comment_root.traverse(): + ids.append(c.uuid) + if c.alt_id != None: + ids.append(c.alt_id) for child in comment_list.getchildren(): if child.tag == "comment": new = comment.Comment(bug) new.from_xml(ElementTree.tostring(child)) - if new.uuid in uuids: + if new.alt_id in ids: raise cmdutil.UserError( - "Clashing comment uuids: %s" % new.uuid) - uuids.append(new.uuid) + "Clashing comment alt_id: %s" % new.alt_id) + ids.append(new.uuid) + if new.alt_id != None: + ids.append(new.alt_id) if new.in_reply_to == None: new.in_reply_to = parent.uuid new_comments.append(new) @@ -149,7 +155,7 @@ def get_parser(): parser.add_option("-c", "--content-type", metavar="MIME", dest="content_type", 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 (e.g. <content-type>) or auto-generated (e.g <uuid>). An exception is raised if <uuid> conflicts with an existing comment.") # Are comment UUIDs global? no. should match on alt_id anyway... + 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.") return parser longhelp=""" |