1
1
Exporting version information
2
2
=============================
7
This document describes ways of using ``bzr version-info`` as part of a
8
build process to embed version information into a final project.
14
TODO: Figure out how to attach into ``setup.py``
4
Getting the last revision number
5
--------------------------------
7
If you only need the last revision number in your build scripts, you can
8
use the ``revno`` command to get that value like this::
14
Getting more version information
15
--------------------------------
17
The ``version-info`` command can be used to output more information
18
about the lastest version like this::
21
revision-id: pqm@pqm.ubuntu.com-20071211175118-s94sizduj201hrs5
22
date: 2007-12-11 17:51:18 +0000
23
build-date: 2007-12-13 13:14:51 +1000
27
You can easily filter that output using operating system tools or
28
scripts. For example (on Linux/Unix)::
30
$ bzr version-info | grep ^date
31
date: 2007-12-11 17:51:18 +0000
33
The ``--all`` option will actually dump version information about
34
every revision if you need that information for more advanced
41
.. TODO: Figure out how to attach into ``setup.py``
17
44
If using a Makefile to build your project, you can generate the version
18
45
information file as simply as::
20
47
library/_version.py:
21
bzr version-info --format=python > library/_version.py
48
bzr version-info --format python > library/_version.py
23
50
This generates a file which contains 3 dictionaries:
39
66
map. This is also empty by default, and enabled only by ``--all``
40
67
or ``--include-file-revisions``.
70
Projects in other languages
71
---------------------------
73
Support for dumping version information in other languages in currently
74
in development. Please contact us on the mailing list about your
75
requirements in this area. (As of the Bazaar 1.0 release date, some patches
76
are available for other languages but are not yet merged into the core product.)