annotate rhodecode/model/comment.py @ 2434:f29469677319 codereview

Added basic models for saving open pull requests - added pull-request models - added pull-requests notifications into inbox
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 10 Jun 2012 02:08:10 +0200
parents 91fae60bf2b6
children ad19dfcdb1cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 """
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 rhodecode.model.comment
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 ~~~~~~~~~~~~~~~~~~~~~~~
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 comments model for RhodeCode
1789
17caf4efe15c implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents: 1734
diff changeset
7
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 :created_on: Nov 11, 2011
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 :author: marcink
1824
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1789
diff changeset
10 :copyright: (C) 2011-2012 Marcin Kuzminski <marcin@python-works.com>
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 :license: GPLv3, see COPYING for more details.
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 """
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 # This program is free software: you can redistribute it and/or modify
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 # it under the terms of the GNU General Public License as published by
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 # the Free Software Foundation, either version 3 of the License, or
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 # (at your option) any later version.
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 #
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 # This program is distributed in the hope that it will be useful,
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 # GNU General Public License for more details.
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22 #
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 # You should have received a copy of the GNU General Public License
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 import logging
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 import traceback
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
29 from pylons.i18n.translation import _
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
30 from sqlalchemy.util.compat import defaultdict
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
31
2178
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
32 from rhodecode.lib.utils2 import extract_mentioned_users, safe_unicode
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
33 from rhodecode.lib import helpers as h
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 from rhodecode.model import BaseModel
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
35 from rhodecode.model.db import ChangesetComment, User, Repository, Notification
1703
f23828b00b21 notification fixes and improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1681
diff changeset
36 from rhodecode.model.notification import NotificationModel
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 log = logging.getLogger(__name__)
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41 class ChangesetCommentsModel(BaseModel):
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42
1713
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
43 def __get_changeset_comment(self, changeset_comment):
1716
7d1fc253549e notification to commit author + gardening
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
44 return self._get_instance(ChangesetComment, changeset_comment)
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
46 def _extract_mentions(self, s):
1713
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
47 user_objects = []
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
48 for username in extract_mentioned_users(s):
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
49 user_obj = User.get_by_username(username, case_insensitive=True)
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
50 if user_obj:
1713
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
51 user_objects.append(user_obj)
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
52 return user_objects
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
53
1675
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
54 def create(self, text, repo_id, user_id, revision, f_path=None,
2296
e5c0f201ca0b Add changeset status change into emails
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
55 line_no=None, status_change=None):
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56 """
2296
e5c0f201ca0b Add changeset status change into emails
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
57 Creates new comment for changeset. IF status_change is not none
e5c0f201ca0b Add changeset status change into emails
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
58 this comment is associated with a status change of changeset
1789
17caf4efe15c implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents: 1734
diff changeset
59
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
60 :param text:
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
61 :param repo_id:
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
62 :param user_id:
1675
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
63 :param revision:
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
64 :param f_path:
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
65 :param line_no:
2296
e5c0f201ca0b Add changeset status change into emails
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
66 :param status_change:
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
67 """
2150
a8c9c0094ddf White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2109
diff changeset
68
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
69 if text:
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
70 repo = Repository.get(repo_id)
1716
7d1fc253549e notification to commit author + gardening
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
71 cs = repo.scm_instance.get_changeset(revision)
2178
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
72 desc = "%s - %s" % (cs.short_id, h.shorter(cs.message, 256))
2082
0e27da019f84 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 2077
diff changeset
73 author_email = cs.author_email
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
74 comment = ChangesetComment()
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
75 comment.repo = repo
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
76 comment.user_id = user_id
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
77 comment.revision = revision
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
78 comment.text = text
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
79 comment.f_path = f_path
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
80 comment.line_no = line_no
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
81
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
82 self.sa.add(comment)
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
83 self.sa.flush()
1703
f23828b00b21 notification fixes and improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1681
diff changeset
84 # make notification
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
85 line = ''
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
86 if line_no:
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1703
diff changeset
87 line = _('on line %s') % line_no
2178
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
88 subj = safe_unicode(
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
89 h.link_to('Re commit: %(commit_desc)s %(line)s' % \
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
90 {'commit_desc': desc, 'line': line},
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
91 h.url('changeset_home', repo_name=repo.repo_name,
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
92 revision=revision,
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
93 anchor='comment-%s' % comment.comment_id,
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
94 qualified=True,
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
95 )
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
96 )
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
97 )
989c137f26eb Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2150
diff changeset
98
1703
f23828b00b21 notification fixes and improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1681
diff changeset
99 body = text
2077
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
100
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
101 # get the current participants of this changeset
1703
f23828b00b21 notification fixes and improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1681
diff changeset
102 recipients = ChangesetComment.get_users(revision=revision)
2077
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
103
2082
0e27da019f84 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 2077
diff changeset
104 # add changeset author if it's in rhodecode system
0e27da019f84 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 2077
diff changeset
105 recipients += [User.get_by_email(author_email)]
1716
7d1fc253549e notification to commit author + gardening
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
106
2387
7d517a35b6c9 Don't send emails to person who comment on changeset
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
107 # create notification objects, and emails
2077
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
108 NotificationModel().create(
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
109 created_by=user_id, subject=subj, body=body,
2296
e5c0f201ca0b Add changeset status change into emails
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
110 recipients=recipients, type_=Notification.TYPE_CHANGESET_COMMENT,
e5c0f201ca0b Add changeset status change into emails
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
111 email_kwargs={'status_change': status_change}
2077
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
112 )
1703
f23828b00b21 notification fixes and improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1681
diff changeset
113
1717
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1716
diff changeset
114 mention_recipients = set(self._extract_mentions(body))\
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1716
diff changeset
115 .difference(recipients)
1716
7d1fc253549e notification to commit author + gardening
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
116 if mention_recipients:
7d1fc253549e notification to commit author + gardening
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
117 subj = _('[Mention]') + ' ' + subj
2077
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
118 NotificationModel().create(
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
119 created_by=user_id, subject=subj, body=body,
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
120 recipients=mention_recipients,
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2391
diff changeset
121 type_=Notification.TYPE_CHANGESET_COMMENT,
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2391
diff changeset
122 email_kwargs={'status_change': status_change}
2077
179604334d98 code garden
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
123 )
1716
7d1fc253549e notification to commit author + gardening
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
124
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
125 return comment
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
126
1713
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
127 def delete(self, comment):
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
128 """
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
129 Deletes given comment
1789
17caf4efe15c implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents: 1734
diff changeset
130
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
131 :param comment_id:
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
132 """
1713
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
133 comment = self.__get_changeset_comment(comment)
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
134 self.sa.delete(comment)
1713
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
135
1670
d2de0c2f02cd #77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
136 return comment
1675
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
137
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
138 def get_comments(self, repo_id, revision):
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
139 return ChangesetComment.query()\
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
140 .filter(ChangesetComment.repo_id == repo_id)\
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
141 .filter(ChangesetComment.revision == revision)\
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
142 .filter(ChangesetComment.line_no == None)\
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
143 .filter(ChangesetComment.f_path == None).all()
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
144
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
145 def get_inline_comments(self, repo_id, revision):
1675
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
146 comments = self.sa.query(ChangesetComment)\
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
147 .filter(ChangesetComment.repo_id == repo_id)\
1681
1bf03daafaf0 fixes inline comments double entries
Marcin Kuzminski <marcin@python-works.com>
parents: 1677
diff changeset
148 .filter(ChangesetComment.revision == revision)\
1bf03daafaf0 fixes inline comments double entries
Marcin Kuzminski <marcin@python-works.com>
parents: 1677
diff changeset
149 .filter(ChangesetComment.line_no != None)\
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2178
diff changeset
150 .filter(ChangesetComment.f_path != None)\
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2178
diff changeset
151 .order_by(ChangesetComment.comment_id.asc())\
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2178
diff changeset
152 .all()
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
153
1789
17caf4efe15c implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents: 1734
diff changeset
154 paths = defaultdict(lambda: defaultdict(list))
1675
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
155
7c487d2678c7 code refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1670
diff changeset
156 for co in comments:
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
157 paths[co.f_path][co.line_no].append(co)
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1675
diff changeset
158 return paths.items()