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)
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="""
elif verbose == True:
print >> sys.stderr, "Ignoring unknown tag %s in %s" \
% (child.tag, comment.tag)
- if self.alt_id == None and uuid != None:
+ if self.alt_id == None and uuid not in [None, self.uuid]:
self.alt_id = uuid
def string(self, indent=0, shortname=None):