17
17
Understanding revision numbers
18
18
------------------------------
20
All revisions in the mainline of a branch will have a simple increasing
20
All revisions in the mainline of a branch have a simple increasing
21
21
integer. (First commit gets 1, 10th commit gets 10, etc.) This makes them
22
22
fairly natural to use when you want to say "grab the 10th revision from my
23
23
branch", or "fixed in revision 3050".
128
128
When viewing the mainline like this, you only see high level commits
129
129
(instead of a large number of commits uninteresting at this level).
131
* If you have a large project with developers working on sub-teams,
132
you can give each team an integration branch and adopt a policy
133
where only integration branches get merged into the mainline.
134
This cascading hierarchy (project-team-change in this case)
135
will be shown correctly when viewing history.
137
131
* If required, it makes backing out a feature much easier.
139
133
* Continuous integration tools can be used to ensure that
142
136
every single commit as some tests will fail during development.
143
137
In fact, adding the tests first - TDD style - will guarantee it!)
145
In summary, the important point is this:
139
In summary, the important points are:
141
*Organize your work using branches.*
147
143
*Use merge+commit to integrate; use push and pull to mirror.*
145
*Ordered revision numbers and hierarchy make history easier to follow.*
149
148
Each branch has its own view of history
150
149
---------------------------------------
152
151
As explained above, Bazaar makes the distinction between top-level
153
152
revisions (ones you committed in your branch) and merged
154
153
revisions (ones added as ancestors by committing a merge). Each
155
branch effectively has its own "view" of history, i.e. different
156
branches can give the same revision a different "local revision number".
154
branch effectively has its own view of history, i.e. different
155
branches can give the same revision a different "local" revision number.
158
157
To extend the example above, here's what the revision history of
159
158
Mary's branch would look like had she decided to merge the project
160
mainline into her branch (and commit that merge) after completing it::
159
mainline into her branch (and commit that merge) after completing her
162
162
104: Merge mainline
163
163
100.2.1: Merge feature Y
170
170
101: Add code and tests for X
173
Once again, it's easy for Mary to look at just *her* top level of history
174
to see the steps she has taken to develop this change. In this context,
175
merging the mainline (and resolving any conflicts caused by doing that) is
176
just one step as far as the history of this branch is concerned.
173
178
It's important to remember that Bazaar is not changing history here, nor
174
179
is it changing the global revision identifiers. You can always use the
175
180
latter if you really want to. In fact, you can use the branch specific
176
181
revision numbers when communicating as long as you provide the branch
179
Revisions are numbered in a stable way, such that if two branches have the
180
same revision in their mainline, all revisions in the ancestry of that
181
revision will have the same revision numbers. (So if Alice and Bob's
182
URL as context. (In many Bazaar projects, developers imply the central
183
trunk branch if they exchange a revision number without a branch URL.)
185
Merges do not change revision numbers in a branch, though they do
186
allocate local revision numbers to newly merged revisions. The only time
187
Bazaar will change revision numbers in a branch is when you explicitly
188
ask it to mirror another branch.
190
Note: Revisions are numbered in a stable way: if two branches have
191
the same revision in their mainline, all revisions in the ancestry of that
192
revision will have the same revision numbers. For example, if Alice and Bob's
182
193
branches agree on revision 10, they will agree on all revisions before
183
that.) Future merges will not change revision numbers. However doing
184
``bzr pull`` can change revision numbers, because it changes the
199
Bazaar may *seem* similar to other distributed VCS tools (like Darcs, Git
200
and Mercurial) but it has a different internal model that encourages certain
201
ways of working. In general, if you follow the advice given earlier - organise
202
your work in branches and use merge to collaborate - you'll find Bazaar
203
generally does what you expect.
205
In coming chapters, we examine various ways of using Bazaar beginning with
206
the simplest: using Bazaar for personal projects.
188
209
vim: ft=rst tw=74 ai