/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2977.1.3 by Ian Clatworthy
1st cut at the 'Personal version control' chapter
1
Browsing history
2
================
3
4
bzr log
5
-------
6
7
The ``bzr log`` command shows a list of previous revisions.
8
9
As with ``bzr diff``, ``bzr log`` supports the ``-r`` argument::
10
11
    % bzr log -r 1000..          # Revision 1000 and everything after it
12
    % bzr log -r ..1000          # Everything up to and including r1000
13
    % bzr log -r 1000..1100      # changes from 1000 to 1100
14
    % bzr log -r 1000            # The changes in only revision 1000
15
4206.1.1 by Ian Clatworthy
log mainline by default
16
Viewing merged revisions
17
------------------------
2977.1.3 by Ian Clatworthy
1st cut at the 'Personal version control' chapter
18
19
As distributed VCS tools like Bazaar make merging much easier than
4206.1.1 by Ian Clatworthy
log mainline by default
20
it is in central VCS tools, the history of a branch may often contain
2977.1.3 by Ian Clatworthy
1st cut at the 'Personal version control' chapter
21
lines of development splitting off the mainline and merging back
22
in at a later time. Technically, the relationship between the
23
numerous revision nodes is known as a Directed Acyclic Graph or
24
DAG for short.
25
4206.1.1 by Ian Clatworthy
log mainline by default
26
In many cases, you typically want to see the mainline first and drill
27
down from there. The default behaviour of log is therefore to show
28
the mainline and indicate which revisions have nested merged revisions.
29
To explore the merged revisions for revision X, use the following command::
30
31
  bzr log -n0 -rX
32
33
To see all revisions and all their merged revisions::
34
35
  bzr log -n0
36
37
Note that the -n option is used to indicate the number of levels to display
38
where 0 means all. If that is too noisy, you can easily adjust the number
39
to only view down so far. For example, if your project is structured with
40
a top level gatekeeper merging changes from team gatekeepers, ``bzr log``
41
shows what the top level gatekeeper did while ``bzr log -n2`` shows what
42
the team gatekeepers did. In the vast majority of cases though, ``-n0``
43
is fine.
2977.1.3 by Ian Clatworthy
1st cut at the 'Personal version control' chapter
44
45
Tuning the output
46
-----------------
47
48
The ``log`` command has several options that are useful for tuning
49
the output. These include:
50
51
 * ``--forward`` presents the log in chronological order, i.e. the
52
   most recent revisions are displayed last.
53
54
 * the ``--limit`` option controls the maximum number of revisions displayed.
55
56
See the online help for the log command or the User Reference for more
57
information on tuning the output.
58
59
Viewing the history for a file
60
------------------------------
61
62
It is often useful to filter the history so that it only
63
applies to a given file. To do this, provide the filename
64
to the ``log`` command like this::
65
66
  bzr log foo.py
67
68
Viewing an old version of a file
69
--------------------------------
70
71
To get the contents of a file at a given version, use the
72
``cat`` command like this::
73
74
  bzr cat -r X file
75
76
where ``X`` is the revision identifier and ``file`` is
77
the filename. This will send output to the standard output
78
stream so you'll typically want to pipe the output through
79
a viewing tool (like ``less`` or ``more``) or redirect it
80
like this::
81
82
  bzr cat -r -2 foo.py | less
3495.3.2 by Martin Pool
doc typo correction from Fabian Kössel
83
  bzr cat -r 1 foo.py > /tmp/foo-1st-version.py
2977.1.3 by Ian Clatworthy
1st cut at the 'Personal version control' chapter
84
85
Graphical history viewers
86
-------------------------
87
88
History browsing is one area where GUI tools really make life easier.
89
Bazaar has numerous plug-ins that provide this capability including
4634.39.41 by Ian Clatworthy
Fix the broken links in the User Guide
90
QBzr and bzr-gtk. See `Using plugins <plugins.html>`_ for details on how to install
2977.1.3 by Ian Clatworthy
1st cut at the 'Personal version control' chapter
91
these if they are not already installed.
92
93
To use the graphical viewer from QBzr::
94
95
  bzr qlog
96
97
To use the graphical viewer from bzr-gtk::
98
99
  bzr viz
100
101
``viz`` is actually a built-in alias for ``visualize`` so use the longer
102
command name if you prefer.
103