aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2006-03-31 17:53:50 -0500
committerAaron Bentley <abentley@panoramicfeedback.com>2006-03-31 17:53:50 -0500
commit60163698839aaac434dbda848a92326fab7cdf6c (patch)
tree189117d1e755cf1aebee4bc4ecc716c987f162c8 /libbe
parent699beb1ee5fd3a511cbf0c61fe67206a39f6dfe3 (diff)
downloadbugseverywhere-60163698839aaac434dbda848a92326fab7cdf6c.tar.gz
Implemented basic comment diff
Diffstat (limited to 'libbe')
-rw-r--r--libbe/diff.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/libbe/diff.py b/libbe/diff.py
index 82dc219..c1dc429 100644
--- a/libbe/diff.py
+++ b/libbe/diff.py
@@ -16,6 +16,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Compare two bug trees"""
from libbe import cmdutil, bugdir
+from libbe.utility import time_to_str
def diff(old_tree, new_tree):
old_bug_map = old_tree.bug_map()
@@ -85,9 +86,25 @@ def change_lines(old, new, attributes):
def bug_changes(old, new, bugs):
change_list = change_lines(old, new, ("time", "creator", "severity",
"target", "summary", "status", "assigned"))
- if len(change_list) == 0:
+
+ old_comment_ids = list(old.iter_comment_ids())
+ new_comment_ids = list(new.iter_comment_ids())
+ change_strings = ["%s: %s -> %s" % f for f in change_list]
+ for comment_id in new_comment_ids:
+ if comment_id not in old_comment_ids:
+ summary = comment_summary(new.get_comment(comment_id), "new")
+ change_strings.append(summary)
+ for comment_id in old_comment_ids:
+ if comment_id not in new_comment_ids:
+ summary = comment_summary(new.get_comment(comment_id), "removed")
+ change_strings.append(summary)
+
+ if len(change_strings) == 0:
return None
return "%s%s\n" % (cmdutil.bug_summary(new, bugs, shortlist=True),
- "\n".join(["%s: %s -> %s" % f for f in change_list]))
+ "\n".join(change_strings))
+def comment_summary(comment, status):
+ return "%8s comment from %s on %s" % (status, comment.From,
+ time_to_str(comment.date))