diff options
author | W. Trevor King <wking@drexel.edu> | 2008-11-23 09:50:56 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2008-11-23 09:50:56 -0500 |
commit | 510c9f33393c1f222ee56732c026f229ed8ae49d (patch) | |
tree | ba51973a3fd3eb5893d413f6c8b5a721867d26dc /libbe/diff.py | |
parent | 333fc7968794deff9aa7a7a91d72cf17763df855 (diff) | |
download | bugseverywhere-510c9f33393c1f222ee56732c026f229ed8ae49d.tar.gz |
Go back to lazy bug loading to get execution speed back up.
Fixes bug b3c6da51-3a30-42c9-8c75-587c7a1705c5
Diffstat (limited to 'libbe/diff.py')
-rw-r--r-- | libbe/diff.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libbe/diff.py b/libbe/diff.py index 470a864..f147bce 100644 --- a/libbe/diff.py +++ b/libbe/diff.py @@ -24,15 +24,17 @@ def diff(old_bugdir, new_bugdir): added = [] removed = [] modified = [] - for old_bug in old_bugdir: - new_bug = new_bugdir.bug_map.get(old_bug.uuid) - if new_bug is None : - removed.append(old_bug) - else: + for uuid in old_bugdir.list_uuids(): + old_bug = old_bugdir.bug_from_uuid(uuid) + try: + new_bug = new_bugdir.bug_from_uuid(uuid) if old_bug != new_bug: modified.append((old_bug, new_bug)) - for new_bug in new_bugdir: + except KeyError: + removed.append(old_bug) + for uuid in new_bugdir.list_uuids(): if not old_bugdir.bug_map.has_key(new_bug.uuid): + new_bug = new_bugdir.bug_from_uuid(uuid) added.append(new_bug) return (removed, modified, added) @@ -82,7 +84,9 @@ def bug_changes(old, new, bugs): change_list = change_lines(old, new, ("time", "creator", "severity", "target", "summary", "status", "assigned")) + old.load_comments() old_comment_ids = [c.uuid for c in old.comment_root.traverse()] + new.load_comments() new_comment_ids = [c.uuid for c in new.comment_root.traverse()] change_strings = ["%s: %s -> %s" % f for f in change_list] for comment_id in new_comment_ids: |