~bzr-pqm/bzr/bzr.dev

3104.2.4 by Ian Clatworthy
make it clear the Reference has the details of revision spec formats
1
Specifying revisions
2
====================
3
4
Revision identifiers and ranges
5
-------------------------------
6
7
Bazaar has a very expressive way to specify a revision or a range of revisions.
8
To specify a range of revisions, the upper and lower bounds are separated by the
3104.2.7 by Ian Clatworthy
feedback from poolie
9
``..`` symbol. For example::
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
10
11
    $ bzr log -r 1..4
12
13
You can omit one bound like::
14
15
    $ bzr log -r 1..
16
    $ bzr log -r ..4
17
3104.2.4 by Ian Clatworthy
make it clear the Reference has the details of revision spec formats
18
Some commands take only one revision, not a range. For example::
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
19
20
    $ bzr cat -r 42 foo.c
21
3104.2.4 by Ian Clatworthy
make it clear the Reference has the details of revision spec formats
22
In other cases, a range is required but you want the length of the range to
23
be one. For commands where this is relevant, the ``-c`` option is used like this::
24
25
    $ bzr diff -c 42
26
27
28
Available revision identifiers
29
------------------------------
30
31
The revision, or the bounds of the range, can be given using
32
different format specifications as shown below.
1610.2.2 by James Blackwell
Now they look good in rst2html
33
34
 +----------------------+------------------------------------+
35
 |  argument type       | description                        |
36
 +----------------------+------------------------------------+
37
 | *number*             | revision number                    |
38
 +----------------------+------------------------------------+
4569.2.6 by Matthew Fuller
'revno:X' can specify negative-counting just like 'X'.
39
 | **revno**:*number*   | revision number                    |
1610.2.2 by James Blackwell
Now they look good in rst2html
40
 +----------------------+------------------------------------+
41
 | **last**:*number*    | negative revision number           |
42
 +----------------------+------------------------------------+
4569.2.7 by Matthew Fuller
Adjust documentation in the user guide a bit to correspond to DWIM
43
 | *guid*               | globally unique revision id        |
44
 +----------------------+------------------------------------+
1610.2.2 by James Blackwell
Now they look good in rst2html
45
 | **revid**:*guid*     | globally unique revision id        |
46
 +----------------------+------------------------------------+
47
 | **before**:*rev*     | leftmost parent of ''rev''         |
48
 +----------------------+------------------------------------+
4569.2.7 by Matthew Fuller
Adjust documentation in the user guide a bit to correspond to DWIM
49
 | *date-value*         | first entry after a given date     |
50
 +----------------------+------------------------------------+
51
 | **date**:*date-value*| first entry after a given date     |
52
 +----------------------+------------------------------------+
53
 | *tag-name*           | revision matching a given tag      |
54
 +----------------------+------------------------------------+
55
 | **tag**:*tag-name*   | revision matching a given tag      |
3104.2.4 by Ian Clatworthy
make it clear the Reference has the details of revision spec formats
56
 +----------------------+------------------------------------+
1610.2.2 by James Blackwell
Now they look good in rst2html
57
 | **ancestor**:*path*  | last merged revision from a branch |
58
 +----------------------+------------------------------------+
59
 | **branch**:*path*    | latest revision on another branch  |
60
 +----------------------+------------------------------------+
3104.2.4 by Ian Clatworthy
make it clear the Reference has the details of revision spec formats
61
 | **submit**:*path*    | common ancestor with submit branch |
62
 +----------------------+------------------------------------+
63
64
A brief introduction to some of these formats is given below.
65
For complete details, see `Revision Identifiers`_ in the
66
Bazaar User Reference.
67
68
.. _Revision Identifiers: ../user-reference/bzr_man.html#revision-identifiers
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
69
70
Numbers
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
71
~~~~~~~
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
72
73
Positive numbers denote revision numbers in the current branch. Revision
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
74
numbers are labelled as "revno" in the output of ``bzr log``.  To display
1610.2.2 by James Blackwell
Now they look good in rst2html
75
the log for the first ten revisions::
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
76
77
    $ bzr log -r ..10
78
79
Negative numbers count from the latest revision, -1 is the last committed
80
revision.
81
82
To display the log for the last ten revisions::
83
84
    $ bzr log -r -10..
85
86
revid
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
87
~~~~~
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
88
2293.1.6 by Brad Crittenden
post review changes
89
**revid** allows specifying a an internal revision ID, as shown by ``bzr
90
log`` and some other commands.
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
91
92
For example::
93
94
    $ bzr log -r revid:Matthieu.Moy@imag.fr-20051026185030-93c7cad63ee570df
95
96
before
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
97
~~~~~~
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
98
1610.2.2 by James Blackwell
Now they look good in rst2html
99
**before**
100
    ''rev'' specifies the leftmost parent of ''rev'', that is the revision
101
    that appears before ''rev'' in the revision history, or the revision that
4031.3.3 by Matt Nordhoff
Review tweaks from Ben Finney
102
    was current when ''rev'' was committed.
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
103
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
104
''rev'' can be any revision specifier and may be chained.
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
105
106
For example::
107
108
    $ bzr log -r before:before:4
109
    ...
110
    revno: 2
111
    ...
112
113
date
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
114
~~~~
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
115
1610.2.2 by James Blackwell
Now they look good in rst2html
116
**date**
117
    ''value'' matches the first history entry after a given date, either at
118
    midnight or at a specified time.
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
119
120
Legal values are:
121
1610.2.2 by James Blackwell
Now they look good in rst2html
122
 * **yesterday**
123
 * **today**
124
 * **tomorrow**
125
 * A **YYYY-MM-DD** format date.
126
 * A **YYYY-MM-DD,HH:MM:SS** format date/time, seconds are optional (note the
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
127
   comma)
128
129
The proper way of saying "give me all the log entries for today" is::
130
131
    $ bzr log -r date:yesterday..date:today
132
133
Ancestor
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
134
~~~~~~~~
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
135
1610.2.2 by James Blackwell
Now they look good in rst2html
136
**ancestor**:*path*
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
137
    specifies the common ancestor between the current branch and a 
1610.2.2 by James Blackwell
Now they look good in rst2html
138
    different branch. This is the same ancestor that would be used for
139
    merging purposes.
140
141
*path* may be the URL of a remote branch, or the file path to a local branch.
142
143
For example, to see what changes were made on a branch since it was forked
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
144
off ``../parent``::
1610.2.2 by James Blackwell
Now they look good in rst2html
145
146
    $ bzr diff -r ancestor:../parent
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
147
148
Branch
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
149
~~~~~~
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
150
1610.2.2 by James Blackwell
Now they look good in rst2html
151
branch
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
152
   ``path`` specifies the latest revision in another branch.
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
153
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
154
``path`` may be the URL of a remote branch, or the file path to a local branch.
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
155
1610.2.2 by James Blackwell
Now they look good in rst2html
156
For example, to get the differences between this and another branch::
157
158
    $ bzr diff -r branch:http://example.com/bzr/foo.dev
159