aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/bugdir.py
diff options
context:
space:
mode:
authorAaron Bentley <aaron.bentley@utoronto.ca>2006-04-04 19:46:25 -0400
committerAaron Bentley <aaron.bentley@utoronto.ca>2006-04-04 19:46:25 -0400
commit2225a378d84f77c3512ee407af1aeb355b463084 (patch)
treebfd0ef4b969bfdcd723e405f69599107b0931bd9 /libbe/bugdir.py
parent4dda0decb88c6bc987d3d55a1ac757104e9d0ba9 (diff)
parentc1f60d534fbc5496a0e3df2cb7c0d053e5fa40a8 (diff)
downloadbugseverywhere-2225a378d84f77c3512ee407af1aeb355b463084.tar.gz
Merge both lines
Diffstat (limited to 'libbe/bugdir.py')
-rw-r--r--libbe/bugdir.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index b78ec06..b680d16 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -370,7 +370,27 @@ class Comment(object):
if name is None:
return my_dir
return os.path.join(my_dir, name)
-
+
+
+def thread_comments(comments):
+ child_map = {}
+ top_comments = []
+ for comment in comments:
+ child_map[comment.uuid] = []
+ for comment in comments:
+ if comment.in_reply_to is None or comment.in_reply_to not in child_map:
+ top_comments.append(comment)
+ continue
+ child_map[comment.in_reply_to].append(comment)
+
+ def recurse_children(comment):
+ child_list = []
+ for child in child_map[comment.uuid]:
+ child_list.append(recurse_children(child))
+ return (comment, child_list)
+ return [recurse_children(c) for c in top_comments]
+
+
def pyname_to_header(name):
return name.capitalize().replace('_', '-')