~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2009-10-02 20:32:50 UTC
  • mto: (4679.6.1 2.1-export-c-api)
  • mto: This revision was merged to the branch mainline in revision 4735.
  • Revision ID: john@arbash-meinel.com-20091002203250-q6iv6o2mwjqp4g53
Add __iter__ support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
=============================
2
 
Specifying revision in Bazaar
3
 
=============================
4
 
 
5
 
Description of the subarguments for ``-r`` as used by commands such as
6
 
**bzr log** and **bzr merge**.
7
 
 
8
 
Revision specs and ranges
9
 
=========================
10
 
 
11
 
**bzr** has a very expressive way to specify a revision, or a range of revisions.
12
 
We'll take the example of the **log** command.
13
 
 
14
 
To specify a range of revisions, use for example::
 
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
 
9
``..`` symbol. For example::
15
10
 
16
11
    $ bzr log -r 1..4
17
12
 
20
15
    $ bzr log -r 1..
21
16
    $ bzr log -r ..4
22
17
 
23
 
Note::
24
 
    Omitting the lower bound doesn't work on currently released versions.
25
 
 
26
 
Other commands, like **bzr cat** take only one revision, not a range, like::
 
18
Some commands take only one revision, not a range. For example::
27
19
 
28
20
    $ bzr cat -r 42 foo.c
29
21
 
30
 
Available revision specs
31
 
========================
32
 
 
33
 
The revision, or the bounds of the range, can be one of
 
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.
34
33
 
35
34
 +----------------------+------------------------------------+
36
35
 |  argument type       | description                        |
47
46
 +----------------------+------------------------------------+
48
47
 | **date**:*value*     | first entry after a given date     |
49
48
 +----------------------+------------------------------------+
 
49
 | **tag**:*value*      | revision matching a given tag      |
 
50
 +----------------------+------------------------------------+
50
51
 | **ancestor**:*path*  | last merged revision from a branch |
51
52
 +----------------------+------------------------------------+
52
53
 | **branch**:*path*    | latest revision on another branch  |
53
54
 +----------------------+------------------------------------+
 
55
 | **submit**:*path*    | common ancestor with submit branch |
 
56
 +----------------------+------------------------------------+
 
57
 
 
58
A brief introduction to some of these formats is given below.
 
59
For complete details, see `Revision Identifiers`_ in the
 
60
Bazaar User Reference.
 
61
 
 
62
.. _Revision Identifiers: ../user-reference/bzr_man.html#revision-identifiers
54
63
 
55
64
Numbers
56
 
-------
 
65
~~~~~~~
57
66
 
58
67
Positive numbers denote revision numbers in the current branch. Revision
59
 
numbers are labelled as "revno" in the output of **bzr log**.  To display
 
68
numbers are labelled as "revno" in the output of ``bzr log``.  To display
60
69
the log for the first ten revisions::
61
70
 
62
71
    $ bzr log -r ..10
68
77
 
69
78
    $ bzr log -r -10..
70
79
 
71
 
revno, last
72
 
-----------
73
 
 
74
 
**revno**:*number*
75
 
    The same as *number*, except that negative numbers are not allowed.
76
 
 
77
 
**last**:*number*
78
 
    The same as -''number''. **last:1** means the last commited revision.
79
 
 
80
80
revid
81
 
-----
 
81
~~~~~
82
82
 
83
 
**revid** allows specifying a an internal revision ID, as show by **bzr
84
 
testament** and some other commands.
 
83
**revid** allows specifying a an internal revision ID, as shown by ``bzr
 
84
log`` and some other commands.
85
85
 
86
86
For example::
87
87
 
88
88
    $ bzr log -r revid:Matthieu.Moy@imag.fr-20051026185030-93c7cad63ee570df
89
89
 
90
 
 
91
90
before
92
 
------
 
91
~~~~~~
93
92
 
94
93
**before**
95
94
    ''rev'' specifies the leftmost parent of ''rev'', that is the revision
96
95
    that appears before ''rev'' in the revision history, or the revision that
97
 
    was current when ''rev'' what comitted.
 
96
    was current when ''rev'' was committed.
98
97
 
99
 
''rev'' can be any revision specifier.
 
98
''rev'' can be any revision specifier and may be chained.
100
99
 
101
100
For example::
102
101
 
106
105
    ...
107
106
 
108
107
date
109
 
----
 
108
~~~~
110
109
 
111
110
**date**
112
111
    ''value'' matches the first history entry after a given date, either at
126
125
    $ bzr log -r date:yesterday..date:today
127
126
 
128
127
Ancestor
129
 
--------
 
128
~~~~~~~~
130
129
 
131
130
**ancestor**:*path*
132
 
    specifies the common ancestor between the current branch,and a 
 
131
    specifies the common ancestor between the current branch and a 
133
132
    different branch. This is the same ancestor that would be used for
134
133
    merging purposes.
135
134
 
136
135
*path* may be the URL of a remote branch, or the file path to a local branch.
137
136
 
138
137
For example, to see what changes were made on a branch since it was forked
139
 
off **../parent**::
 
138
off ``../parent``::
140
139
 
141
140
    $ bzr diff -r ancestor:../parent
142
141
 
143
142
Branch
144
 
------
 
143
~~~~~~
145
144
 
146
145
branch
147
 
   ''path'' specifies the latest revision in another branch.
 
146
   ``path`` specifies the latest revision in another branch.
148
147
 
149
 
''path'' may be the URL of a remote branch, or the file path to a local branch.
 
148
``path`` may be the URL of a remote branch, or the file path to a local branch.
150
149
 
151
150
For example, to get the differences between this and another branch::
152
151