# HG changeset patch # User Steve Losh # Date 1255565437 14400 # Node ID 5c62a1333e54a69e02d580baa5463c6d5d7eeea6 # Parent f8adc5c231f37d01dccfad06ef7057b9218b5f31 Add comments (with avatars) to diffs (not skipped lines yet). diff -r f8adc5c231f3 -r 5c62a1333e54 review/web_media/style.css --- a/review/web_media/style.css Wed Oct 14 19:39:07 2009 -0400 +++ b/review/web_media/style.css Wed Oct 14 20:10:37 2009 -0400 @@ -42,12 +42,9 @@ table tr.odd { background: #eee; } -table tr :last-child { +table tr td.last { text-align: right; } -table tr :first-child { - text-align: left !important; -} /* Diffs. */ div.diff { @@ -61,4 +58,22 @@ } table tr.rem { background: #FBDBDA; +} +table tr td.comment { + white-space: normal; + background: #F4FF68; + border-top: 1px dashed #666; + border-bottom: 1px dashed #666; + font-family: Consolas, Monaco, "Courier New", Courier, monospace; +} +table tr td.comment div.author { + +} +table tr td.comment div.message { + margin-top: 1.5em; + white-space: pre; +} +table tr td.comment div.avatar { + border: 1px solid black; + float: right; } \ No newline at end of file diff -r f8adc5c231f3 -r 5c62a1333e54 review/web_templates/review.html --- a/review/web_templates/review.html Wed Oct 14 19:39:07 2009 -0400 +++ b/review/web_templates/review.html Wed Oct 14 20:10:37 2009 -0400 @@ -9,9 +9,19 @@ $ max_line = diff['max'] $ content = diff['content'] + $ line_level_comments = filter(lambda c: c.filename == filename, rcset.comments) $for n, line in content: $ kind = 'rem' if line[0] == '-' else 'add' if line[0] == '+' else '' + $ line_comments = filter(lambda c: max(c.lines) == n, line_level_comments) + $for comment in line_comments: +
${ line[1:] or ' ' }
+
+
+
${ comment.author } said:
+
${ comment.message }
+
+
\ No newline at end of file diff -r f8adc5c231f3 -r 5c62a1333e54 review/web_ui.py --- a/review/web_ui.py Wed Oct 14 19:39:07 2009 -0400 +++ b/review/web_ui.py Wed Oct 14 20:10:37 2009 -0400 @@ -24,7 +24,9 @@ from mercurial.node import short -g = { 'node_short': short, 'basename': os.path.basename, } +from mercurial.util import email +from hashlib import md5 +g = { 'node_short': short, 'basename': os.path.basename, 'md5': md5, 'email': email } render = web.template.render(template_path, globals=g) LOG_PAGE_LEN = 15