diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-23 10:10:36 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-23 10:10:36 -0400 |
commit | e4fb67ebd5dff9e33e0d2a842cbb102e7d66946d (patch) | |
tree | 57fcb37b9ded40850703b83e83dd6deb4d707554 /libbe/bug.py | |
parent | 9c4c86e387711f9c04d23ed58422c86c0dbaec8b (diff) | |
parent | 678d074ba2d20c22255abdcc8c41f3c0e2ec2c2a (diff) | |
download | bugseverywhere-e4fb67ebd5dff9e33e0d2a842cbb102e7d66946d.tar.gz |
Merged libbe.diff upgrades and libbe.tree.Tree.has_descendant from be.wtk-rr.
Also pulls "show referenced text" fix to "be comment".
Diffstat (limited to 'libbe/bug.py')
-rw-r--r-- | libbe/bug.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libbe/bug.py b/libbe/bug.py index f3448e2..c1e5481 100644 --- a/libbe/bug.py +++ b/libbe/bug.py @@ -494,8 +494,25 @@ cmp_assigned = lambda bug_1, bug_2 : cmp_attr(bug_1, bug_2, "assigned") # chronological rankings (newer < older) cmp_time = lambda bug_1, bug_2 : cmp_attr(bug_1, bug_2, "time", invert=True) +def cmp_comments(bug_1, bug_2): + """ + Compare two bugs' comments lists. Doesn't load any new comments, + so you should call each bug's .load_comments() first if you want a + full comparison. + """ + comms_1 = sorted(bug_1.comments(), key = lambda comm : comm.uuid) + comms_2 = sorted(bug_2.comments(), key = lambda comm : comm.uuid) + result = cmp(len(comms_1), len(comms_2)) + if result != 0: + return result + for c_1,c_2 in zip(comms_1, comms_2): + result = cmp(c_1, c_2) + if result != 0: + return result + return 0 + DEFAULT_CMP_FULL_CMP_LIST = \ - (cmp_status,cmp_severity,cmp_assigned,cmp_time,cmp_creator) + (cmp_status,cmp_severity,cmp_assigned,cmp_time,cmp_creator,cmp_comments) class BugCompoundComparator (object): def __init__(self, cmp_list=DEFAULT_CMP_FULL_CMP_LIST): |