Merged in ChrisNielsen/hg-review (pull request #7)
Update windows contrib script for current TortoiseHg version (2.6.2).
author |
Christophe de Vienne <cdevienne@gmail.com> |
date |
Sat, 22 Nov 2014 15:31:01 +0100 |
parents |
66463ec963b6
(diff)
fc97fabaf28d
(current diff)
|
children |
e5cc5cf29c7e
|
branches/tags |
(none) |
files |
|
Changes
--- a/review/static/styles/style.less Fri Jan 18 11:51:36 2013 -0500
+++ b/review/static/styles/style.less Sat Nov 22 15:31:01 2014 +0100
@@ -263,6 +263,10 @@
overflow: hidden;
text-overflow: ellipsis;
}
+ &.user {
+ text-align: center;
+ white-space: nowrap;
+ }
&.desc {
a {
display: inline-block;
--- a/review/templates/index.html Fri Jan 18 11:51:36 2013 -0500
+++ b/review/templates/index.html Sat Nov 22 15:31:01 2014 +0100
@@ -13,8 +13,14 @@
<tr>
<td class="node"><span class="rev">{{ rev.rev() }}</span><span class="sep">:</span><span class="hash">{{ node_short }}</span></td>
+ <td class="user">{{ utils['person'](rev.user()) }}</td>
<td class="desc">
- <a class="changeset-link" href="{{ link }}">{{ rev.description().splitlines()[0] }}</a>
+ <a class="changeset-link" href="{{ link }}">
+ {% if rev.branch() != 'default' %}
+ [{{ rev.branch() }}]
+ {%endif%}
+ {{ rev.description().splitlines()[0] }}
+ </a>
</td>
<td class="stats">
{% with %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/review/tests/test_web.py Sat Nov 22 15:31:01 2014 +0100
@@ -0,0 +1,38 @@
+import unittest
+
+from nose.tools import eq_
+
+import util
+
+from .. import web
+
+NON_EXISTENT_REV = 999999
+
+class WebTestCase(unittest.TestCase):
+ """Simple web tests. Currently only checks for correct status codes."""
+
+ def setUp(self):
+ util.setup_reviewed_sandbox()()
+ ui = util.get_ui()
+ repo = util.get_sandbox_repo()
+ web._configure_app(ui, repo)
+ web.app.config['TESTING'] = True
+ self.app = web.app.test_client()
+
+ def tearDown(self):
+ util.teardown_sandbox()
+
+ def test_index_no_rev(self):
+ rv = self.app.get('/')
+ eq_(rv.status_code, 200)
+
+ def test_index_high_rev(self):
+ rv = self.app.get('/%s/' % NON_EXISTENT_REV)
+ eq_(rv.status_code, 200)
+
+ def test_index_known_rev(self):
+ rv = self.app.get('/0/')
+ eq_(rv.status_code, 200)
+
+if __name__ == '__main__':
+ unittest.main()
--- a/review/web.py Fri Jan 18 11:51:36 2013 -0500
+++ b/review/web.py Sat Nov 22 15:31:01 2014 +0100
@@ -231,23 +231,29 @@
return _render('500.html'), 500
+def _configure_app(ui, repo, read_only=False, allow_anon=False):
+ """Configure the web app.
+
+ This happens in a distinct function to reuse these steps in tests.
+
+ """
+ app.read_only = read_only
+ app.debug = ui.debugflag
+ app.allow_anon = allow_anon
+ app.site_root = ''
+ if app.allow_anon:
+ ui.setconfig('ui', 'username', 'Anonymous <anonymous@example.com>')
+ app.ui = ui
+ app.repo = repo
+ app.title = os.path.basename(repo.root)
+ app.project_url = None
+
def load_interface(ui, repo, read_only=False, allow_anon=False,
open=False, address='127.0.0.1', port=8080):
if open:
import webbrowser
webbrowser.open('http://localhost:%d/' % port)
- app.read_only = read_only
- app.debug = ui.debugflag
- app.allow_anon = allow_anon
- app.site_root = ''
-
- if app.allow_anon:
- ui.setconfig('ui', 'username', 'Anonymous <anonymous@example.com>')
-
- app.ui = ui
- app.repo = repo
- app.title = os.path.basename(repo.root)
- app.project_url = None
+ _configure_app(ui, repo, read_only, allow_anon)
app.run(host=address, port=port)