comparison rhodecode/controllers/changeset.py @ 2439:ad19dfcdb1cc codereview

Refactoring of changeset_file_comments for more generic usage. In both It enables sharing code between changeset, and pull requests discussions
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 10 Jun 2012 16:44:06 +0200
parents 91fae60bf2b6
children 1bc579bcd67a
comparison
equal deleted inserted replaced
2438:471ac5256400 2439:ad19dfcdb1cc
218 .get_status(c.rhodecode_db_repo.repo_id, 218 .get_status(c.rhodecode_db_repo.repo_id,
219 changeset.raw_id)]) 219 changeset.raw_id)])
220 220
221 c.comments.extend(ChangesetCommentsModel()\ 221 c.comments.extend(ChangesetCommentsModel()\
222 .get_comments(c.rhodecode_db_repo.repo_id, 222 .get_comments(c.rhodecode_db_repo.repo_id,
223 changeset.raw_id)) 223 revision=changeset.raw_id))
224 inlines = ChangesetCommentsModel()\ 224 inlines = ChangesetCommentsModel()\
225 .get_inline_comments(c.rhodecode_db_repo.repo_id, 225 .get_inline_comments(c.rhodecode_db_repo.repo_id,
226 changeset.raw_id) 226 revision=changeset.raw_id)
227 c.inline_comments.extend(inlines) 227 c.inline_comments.extend(inlines)
228 c.changes[changeset.raw_id] = [] 228 c.changes[changeset.raw_id] = []
229 try: 229 try:
230 changeset_parent = changeset.parents[0] 230 changeset_parent = changeset.parents[0]
231 except IndexError: 231 except IndexError:
293 c.changes[changeset.raw_id].append( 293 c.changes[changeset.raw_id].append(
294 ('removed', node, None, None, None, (0, 0)) 294 ('removed', node, None, None, None, (0, 0))
295 ) 295 )
296 296
297 # count inline comments 297 # count inline comments
298 for path, lines in c.inline_comments: 298 for _, lines in c.inline_comments:
299 for comments in lines.values(): 299 for comments in lines.values():
300 c.inline_cnt += len(comments) 300 c.inline_cnt += len(comments)
301 301
302 if len(c.cs_ranges) == 1: 302 if len(c.cs_ranges) == 1:
303 c.changeset = c.cs_ranges[0] 303 c.changeset = c.cs_ranges[0]