~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/en/user-guide/version_info.txt

  • Committer: Alexander Belchenko
  • Date: 2008-03-12 21:07:46 UTC
  • mto: This revision was merged to the branch mainline in revision 3272.
  • Revision ID: bialix@ukr.net-20080312210746-39xx932qcb92g3lj
Significantly reducing execution time and network traffic for trivial case of `bzr missing`

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Exporting version information
 
2
=============================
 
3
 
 
4
Getting the last revision number
 
5
--------------------------------
 
6
 
 
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::
 
9
 
 
10
  $ bzr revno
 
11
  3104
 
12
 
 
13
 
 
14
Getting more version information
 
15
--------------------------------
 
16
 
 
17
The ``version-info`` command can be used to output more information
 
18
about the lastest version like this::
 
19
 
 
20
  $ bzr version-info
 
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
 
24
  revno: 3104
 
25
  branch-nick: bzr.dev
 
26
 
 
27
You can easily filter that output using operating system tools or
 
28
scripts. For example (on Linux/Unix)::
 
29
 
 
30
  $ bzr version-info | grep ^date
 
31
  date: 2007-12-11 17:51:18 +0000
 
32
 
 
33
The ``--all`` option will actually dump version information about
 
34
every revision if you need that information for more advanced
 
35
post-processing.
 
36
 
 
37
 
 
38
Python projects
 
39
---------------
 
40
 
 
41
.. TODO: Figure out how to attach into ``setup.py``
 
42
 
 
43
 
 
44
If using a Makefile to build your project, you can generate the version
 
45
information file as simply as::
 
46
 
 
47
  library/_version.py:
 
48
        bzr version-info --format python > library/_version.py
 
49
 
 
50
This generates a file which contains 3 dictionaries:
 
51
 
 
52
  * `version_info`: A dictionary containing the basic information about the
 
53
    current state.
 
54
 
 
55
  * `revisions`: A dictionary listing all of the revisions in the
 
56
    history of the tree, along with the commit times and commit
 
57
    message.  This defaults to being empty unless ``--all`` or
 
58
    ``--include-history`` is supplied. This is useful if you want to
 
59
    track what bug fixes, etc, might be included in the released
 
60
    version. But for many projects it is more information than needed.
 
61
 
 
62
  * `file_revisions`: A dictionary listing the last-modified revision
 
63
    for all files in the project. This can be used similarly to how
 
64
    ``$Id$`` keywords are used in CVS-controlled files. The last
 
65
    modified date can be determined by looking in the ``revisions``
 
66
    map. This is also empty by default, and enabled only by ``--all``
 
67
    or ``--include-file-revisions``.
 
68
 
 
69
 
 
70
Projects in other languages
 
71
---------------------------
 
72
 
 
73
Support for dumping version information in other languages is 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.)
 
77
 
 
78
 
 
79
Check clean
 
80
-----------
 
81
 
 
82
Most information about the contents of the project can be cheaply
 
83
determined by just reading the revision entry. However, it can be useful
 
84
to know if the working tree was completely up-to-date when it was
 
85
packaged, or if there was a local modification. By supplying either
 
86
``--all`` or ``--check-clean``, ``bzr`` will inspect the working tree, and
 
87
set the ``clean`` flag in ``version_info``, as well as set entries in
 
88
``file_revisions`` as ``modified`` where appropriate.
 
89
 
 
90
.. 
 
91
   vim: tw=74 ft=rst spell spelllang=en_us