Avoid redundant Comment.alt_ids
authorW. Trevor King <wking@drexel.edu>
Mon, 30 Nov 2009 11:26:49 +0000 (06:26 -0500)
committerW. Trevor King <wking@drexel.edu>
Mon, 30 Nov 2009 11:26:49 +0000 (06:26 -0500)
libbe/comment.py

index 9502adf0f63e14288619afe789e5605ea7e9e334..c5f1cc9c36b6d7d6f9c434dfc4ee33aa1bea8fe2 100644 (file)
@@ -366,7 +366,7 @@ class Comment(Tree, settings_object.SavedSettingsObject):
             elif verbose == True:
                 print >> sys.stderr, 'Ignoring unknown tag %s in %s' \
                     % (child.tag, comment.tag)
-        if self.alt_id == None:
+        if uuid != self.uuid and self.alt_id == None:
             self.explicit_attrs.append('alt_id')
             self.alt_id = uuid
         if body != None:
@@ -437,6 +437,8 @@ class Comment(Tree, settings_object.SavedSettingsObject):
                     raise ValueError, \
                         'Merge would change %s "%s"->"%s" for comment %s' \
                         % (attr, old, new, self.uuid)
+        if self.alt_id == self.uuid:
+            self.alt_id = None
         for estr in other.extra_strings:
             if not estr in self.extra_strings:
                 if accept_extra_strings == True: