diff options
author | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-05-09 20:11:08 +0000 |
---|---|---|
committer | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-05-09 20:11:08 +0000 |
commit | f72535d9a4d1e8143b0ae68e097adef2dabc73bf (patch) | |
tree | cd317726710c7996cb26582eb212c1839d24af9b | |
parent | cb9d4c77d8bd3d72cd61acdf940417fbfea1b3fc (diff) | |
download | bugseverywhere-f72535d9a4d1e8143b0ae68e097adef2dabc73bf.tar.gz |
Implemented bug tree diff
Modified bug reports:
f5c: Implement bug tree diff
status: open -> closed
-rw-r--r-- | .be/bugs/f5c06914-dc64-4658-8ec7-32a026a53f55/values | 2 | ||||
-rw-r--r-- | libbe/diff.py | 33 |
2 files changed, 30 insertions, 5 deletions
diff --git a/.be/bugs/f5c06914-dc64-4658-8ec7-32a026a53f55/values b/.be/bugs/f5c06914-dc64-4658-8ec7-32a026a53f55/values index 0d27be1..233e336 100644 --- a/.be/bugs/f5c06914-dc64-4658-8ec7-32a026a53f55/values +++ b/.be/bugs/f5c06914-dc64-4658-8ec7-32a026a53f55/values @@ -15,7 +15,7 @@ severity=minor -status=open +status=closed diff --git a/libbe/diff.py b/libbe/diff.py index 3c348a0..70bda69 100644 --- a/libbe/diff.py +++ b/libbe/diff.py @@ -38,15 +38,40 @@ def diff_report(diff_data, bug_dir): for bug in added: print cmdutil.bug_summary(bug, bugs, no_target=True) - if len(modified) > 0 and False: - print "modified bug reports:" - for old_bug, new_bug in modified: - print cmdutil.bug_summary(new_bug, bugs, no_target=True) + if len(modified) > 0: + printed = False + for old_bug, new_bug in modified: + change_str = bug_changes(old_bug, new_bug, bugs) + if change_str is None: + continue + if not printed: + printed = True + print "Modified bug reports:" + print change_str if len(removed) > 0: print "Removed bug reports:" for bug in removed: print cmdutil.bug_summary(bug, bugs, no_target=True) +def change_lines(old, new, attributes): + change_list = [] + for attr in attributes: + old_attr = getattr(old, attr) + new_attr = getattr(new, attr) + if old_attr != new_attr: + change_list.append("%s: %s -> %s" % (attr, old_attr, new_attr)) + if len(change_list) >= 0: + return change_list + else: + return None + +def bug_changes(old, new, bugs): + change_list = change_lines(old, new, ("time", "creator", "severity", + "target", "summary", "status", "assigned")) + if len(change_list) == 0: + return None + return "%s%s\n" % (cmdutil.bug_summary(new, bugs, shortlist=True), + "\n".join(change_list)) |