Merge lp:~rvb/maas/show-version-doc into lp:~maas-committers/maas/trunk

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 2258
Proposed branch: lp:~rvb/maas/show-version-doc
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 40 lines (+15/-1)
2 files modified
docs/_templates/maas/layout.html (+6/-1)
docs/conf.py (+9/-0)
To merge this branch: bzr merge lp:~rvb/maas/show-version-doc
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+215377@code.launchpad.net

Commit message

Add the bzr last revision, last revision date, and build date to the documentation pages.

Description of the change

We're about to change the docs on maas.ubuntu.com to publish the documentation for multiple versions. It will be very useful to have the bzr revision displayed on the doc pages to detect when the published documentation is outdated. I've added that info into the footer; here is how it looks like: http://people.canonical.com/~rvb/bzr-info.png.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

[1]

+bzr_last_revision_number = check_output(['bzr', 'revno'])
+bzr_last_revision_date = check_output(['bzr', 'version-info', '--template={date}','--custom'])
+bzr_build_date = check_output(['bzr', 'version-info', '--template={build_date}','--custom'])

Space after commas.

Strip whitespace from the outputs too?

[2]

It would be good to have the branch name too. Short name (i.e. lp...)
would be best, but I don't know if that's easy to get out of bzr.

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

> [1]
>
> +bzr_last_revision_number = check_output(['bzr', 'revno'])
> +bzr_last_revision_date = check_output(['bzr', 'version-info', '--
> template={date}','--custom'])
> +bzr_build_date = check_output(['bzr', 'version-info', '--
> template={build_date}','--custom'])
>
> Space after commas.

Right, done.

> Strip whitespace from the outputs too?

Why? The dates are fine as bzr outputs them I think.

> [2]
>
> It would be good to have the branch name too. Short name (i.e. lp...)
> would be best, but I don't know if that's easy to get out of bzr.

I agree, but I don't know how to get that. More importantly, I'm not sure this information is always available depending on how you created the branch.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On Friday 11 Apr 2014 09:29:20 you wrote:
> +# Gather information about the branch and the build date.
> +from subprocess import check_output
> +bzr_last_revision_number = check_output(['bzr', 'revno'])
> +bzr_last_revision_date = check_output(['bzr', 'version-info',
> '--template={date}','--custom']) +bzr_build_date = check_output(['bzr',
> 'version-info', '--template={build_date}','--custom'])

You know that bzr is written in Python and has an API right? :)

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On Friday 11 Apr 2014 09:37:35 you wrote:
> It would be good to have the branch name too. Short name (i.e. lp...)
> would be best, but I don't know if that's easy to get out of bzr.

*cough* bzrlib *cough*

:)

Revision history for this message
Raphaël Badin (rvb) wrote :

On 04/11/2014 01:54 PM, Julian Edwards wrote:
> On Friday 11 Apr 2014 09:29:20 you wrote:
>> +# Gather information about the branch and the build date.
>> +from subprocess import check_output
>> +bzr_last_revision_number = check_output(['bzr', 'revno'])
>> +bzr_last_revision_date = check_output(['bzr', 'version-info',
>> '--template={date}','--custom']) +bzr_build_date = check_output(['bzr',
>> 'version-info', '--template={build_date}','--custom'])
>
> You know that bzr is written in Python and has an API right? :)

I know. I deliberately used the command line because:
- I don't want to add yet another dependency (even a dev one) to maas
for such a small thing.
- I tried once to use bzrlib and the doc is absolutely horrible.
Couldn't figure out how to do the simplest operations.
- If someday we move to an other tool to manage the source code (and I
hope we'll do so sooner rather than later) it will be simpler to port
this stuff if we use the command line now.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On Friday 11 Apr 2014 12:03:14 you wrote:
> - If someday we move to an other tool to manage the source code (and I
> hope we'll do so sooner rather than later)

Blasphemy!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/_templates/maas/layout.html'
2--- docs/_templates/maas/layout.html 2014-04-08 20:58:05 +0000
3+++ docs/_templates/maas/layout.html 2014-04-11 09:43:00 +0000
4@@ -14,7 +14,12 @@
5 <footer class="global clearfix">
6 <div class="legal clearfix">
7 <p>&copy; Copyright {{ copyright }}. Ubuntu and Canonical are registered trademarks of
8- <a href="http://canonical.com">Canonical Ltd</a></p>
9+ <a href="http://canonical.com">Canonical Ltd</a>.
10+ </p>
11+ <p>
12+ Revision {{ bzr_last_revision_number}} ({{ bzr_last_revision_date }}).
13+ Documentation generation date: {{ bzr_build_date }}.
14+ </p>
15 </div>
16 </footer>
17 {%- endblock %}
18
19=== modified file 'docs/conf.py'
20--- docs/conf.py 2014-04-08 20:58:05 +0000
21+++ docs/conf.py 2014-04-11 09:43:00 +0000
22@@ -279,9 +279,18 @@
23 # Example configuration for intersphinx: refer to the Python standard library.
24 intersphinx_mapping = {'http://docs.python.org/': None}
25
26+# Gather information about the branch and the build date.
27+from subprocess import check_output
28+bzr_last_revision_number = check_output(['bzr', 'revno'])
29+bzr_last_revision_date = check_output(['bzr', 'version-info', '--template={date}', '--custom'])
30+bzr_build_date = check_output(['bzr', 'version-info', '--template={build_date}', '--custom'])
31+
32 # Populate html_context with the variables used in the templates.
33 html_context = {
34 'add_version_switcher': 'true' if add_version_switcher else 'false',
35 'versions_json_path': '/'.join(['', doc_prefix, versions_path]),
36 'doc_prefix': doc_prefix,
37+ 'bzr_last_revision_date': bzr_last_revision_date,
38+ 'bzr_last_revision_number': bzr_last_revision_number,
39+ 'bzr_build_date': bzr_build_date,
40 }