Merge lp:~cruzjbishop/loggerhead/fix-392668 into lp:loggerhead

Proposed by Cruz Bishop
Status: Merged
Approved by: j.c.sackett
Approved revision: 479
Merged at revision: 476
Proposed branch: lp:~cruzjbishop/loggerhead/fix-392668
Merge into: lp:loggerhead
Diff against target: 56 lines (+19/-1)
3 files modified
loggerhead/__init__.py (+10/-0)
loggerhead/templatefunctions.py (+4/-0)
loggerhead/templates/macros.pt (+5/-1)
To merge this branch: bzr merge lp:~cruzjbishop/loggerhead/fix-392668
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+104467@code.launchpad.net

Commit message

Adds revision number to footer release info, if available.

Description of the change

Fixes bug #392668, displaying the current Loggerhead revision number as well as the release

http://i.imgur.com/WPzkS.png

If the loggerhead instance is not in a branch (not pulled from launchpad, but copied from the folder without the .bzr folders), it only displays the version

http://i.imgur.com/oqOxJ.png

To post a comment you must log in.
477. By Cruz Bishop

No tabs

478. By Cruz Bishop

Please tell me there's no more tabs!

Revision history for this message
j.c.sackett (jcsackett) wrote :

This looks pretty good, but I think I would rather have the revision not be shown if it's unknown. You could just set __revision__ == None and then put a tal condition around the display.

My reasoning being that if there isn't a branch, it's probably being deployed via package of some sort, and "Revision Unknown" isn't really useful information in that instance (or any instance in which it's unknown, really).

review: Needs Fixing
Revision history for this message
Cruz Bishop (cruzjbishop) wrote :

Alright, I'll do that. Thanks :)

479. By Cruz Bishop

Don't show revision when it can't be found

Revision history for this message
Cruz Bishop (cruzjbishop) wrote :

I've applied your suggestion, thank you again.

Revision history for this message
j.c.sackett (jcsackett) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loggerhead/__init__.py'
2--- loggerhead/__init__.py 2012-02-08 01:50:02 +0000
3+++ loggerhead/__init__.py 2012-05-03 21:47:17 +0000
4@@ -23,6 +23,7 @@
5 import pkg_resources
6
7 __version__ = '1.18.1' # Keep in sync with ../info.py.
8+__revision__ = None
9 required_bzrlib = (1, 17)
10
11 pkg_resources.get_distribution('Paste>=1.6')
12@@ -31,3 +32,12 @@
13 except pkg_resources.DistributionNotFound:
14 # No paste.deploy is OK, but an old paste.deploy is bad.
15 pass
16+
17+try:
18+ from bzrlib.branch import Branch
19+ branch = Branch.open('./');
20+
21+ __revision__ = branch.revno()
22+
23+except:
24+ pass
25
26=== modified file 'loggerhead/templatefunctions.py'
27--- loggerhead/templatefunctions.py 2012-02-08 01:50:02 +0000
28+++ loggerhead/templatefunctions.py 2012-05-03 21:47:17 +0000
29@@ -143,6 +143,10 @@
30 @templatefunc
31 def loggerhead_version():
32 return loggerhead.__version__
33+
34+@templatefunc
35+def loggerhead_revision():
36+ return loggerhead.__revision__
37
38 _cached_generator_string = None
39
40
41=== modified file 'loggerhead/templates/macros.pt'
42--- loggerhead/templates/macros.pt 2011-11-04 18:16:32 +0000
43+++ loggerhead/templates/macros.pt 2012-05-03 21:47:17 +0000
44@@ -59,7 +59,11 @@
45 <div metal:define-slot="heading" />
46 <div metal:define-slot="content"></div>
47
48- <p id="footer" class="fl">Loggerhead <tal:version content="loggerhead_version" /> is a web-based interface for <a href="http://bazaar-vcs.org/">Bazaar</a> branches</p>
49+ <p id="footer" class="fl">
50+ Loggerhead is a web-based interface for <a href="http://bazaar-vcs.org/">Bazaar</a> branches
51+ <br />
52+ Version: <tal:version content="loggerhead_version" /><span tal:condition="loggerhead_revision">, Revision: <tal:revision content="loggerhead_revision" /></span>
53+ </p>
54 </div>
55 </body>
56 </html>

Subscribers

People subscribed via source and target branches