~bzr-pqm/bzr/bzr.dev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Browsing history
================

bzr log
-------

The ``bzr log`` command shows a list of previous revisions.

As with ``bzr diff``, ``bzr log`` supports the ``-r`` argument::

    % bzr log -r 1000..          # Revision 1000 and everything after it
    % bzr log -r ..1000          # Everything up to and including r1000
    % bzr log -r 1000..1100      # changes from 1000 to 1100
    % bzr log -r 1000            # The changes in only revision 1000

Viewing merged revisions
------------------------

As distributed VCS tools like Bazaar make merging much easier than
it is in central VCS tools, the history of a branch may often contain
lines of development splitting off the mainline and merging back
in at a later time. Technically, the relationship between the
numerous revision nodes is known as a Directed Acyclic Graph or
DAG for short.

In many cases, you typically want to see the mainline first and drill
down from there. The default behaviour of log is therefore to show
the mainline and indicate which revisions have nested merged revisions.
To explore the merged revisions for revision X, use the following command::

  bzr log -n0 -rX

To see all revisions and all their merged revisions::

  bzr log -n0

Note that the -n option is used to indicate the number of levels to display
where 0 means all. If that is too noisy, you can easily adjust the number
to only view down so far. For example, if your project is structured with
a top level gatekeeper merging changes from team gatekeepers, ``bzr log``
shows what the top level gatekeeper did while ``bzr log -n2`` shows what
the team gatekeepers did. In the vast majority of cases though, ``-n0``
is fine.

Tuning the output
-----------------

The ``log`` command has several options that are useful for tuning
the output. These include:

 * ``--forward`` presents the log in chronological order, i.e. the
   most recent revisions are displayed last.

 * the ``--limit`` option controls the maximum number of revisions displayed.

See the online help for the log command or the User Reference for more
information on tuning the output.

Viewing the history for a file
------------------------------

It is often useful to filter the history so that it only
applies to a given file. To do this, provide the filename
to the ``log`` command like this::

  bzr log foo.py

Viewing an old version of a file
--------------------------------

To get the contents of a file at a given version, use the
``cat`` command like this::

  bzr cat -r X file

where ``X`` is the revision identifier and ``file`` is
the filename. This will send output to the standard output
stream so you'll typically want to pipe the output through
a viewing tool (like ``less`` or ``more``) or redirect it
like this::

  bzr cat -r -2 foo.py | less
  bzr cat -r 1 foo.py > /tmp/foo-1st-version.py

Graphical history viewers
-------------------------

History browsing is one area where GUI tools really make life easier.
Bazaar has numerous plug-ins that provide this capability including
QBzr and bzr-gtk. See `Using plugins`_ for details on how to install
these if they are not already installed.

To use the graphical viewer from QBzr::

  bzr qlog

To use the graphical viewer from bzr-gtk::

  bzr viz

``viz`` is actually a built-in alias for ``visualize`` so use the longer
command name if you prefer.