~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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
======================
Bazaar in five minutes
======================

Introduction
============

Bazaar is a distributed version control system that makes it easier for
people to work together on software projects.

Over the next five minutes, you'll learn how to put your files under
version control, how to record changes to them, examine your work, publish
it and send your work for merger into a project's trunk.


Installation
============

This guide doesn't describe how to install Bazaar but it's usually very
easy. You can find installation instructions at:

- **GNU/Linux:** Bazaar is probably in your GNU/Linux distribution already.
- **Windows:** `installation instructions for Windows`_.
- **Mac OS X:** `installation instructions for Mac OS X`_.

For other platforms and to install from source code, see the Download_
and Installation_ pages.

.. _installation instructions for Windows: http://wiki.bazaar.canonical.com/WindowsDownloads
.. _installation instructions for Mac OS X: http://wiki.bazaar.canonical.com/MacOSXBundle
.. _Download: http://wiki.bazaar.canonical.com/Download
.. _Installation: http://wiki.bazaar.canonical.com/InstallationFaq


Introducing yourself
====================

Bazaar records changes to source code, and it records who made the change.
The person is identified by their name and email address.  (If you're
concerned about spam, you don't need to use a real address that you
actually read, but the convention is that it looks like an email address.)

Before you start working, let's tell Bazaar who you are.  Using your name
and email address, instead of John Doe's, type::

  $ bzr whoami "John Doe <john.doe@gmail.com>"

You can check what identity is stored in Bazaar's configuration::

  $ bzr whoami
  John Doe <john.doe@gmail.com>


Starting a new project
======================

Let's suppose we want to store a new project under Bazaar.  First, we'll
make a directory to hold all our work related to this project.  We'll make
a *repository directory*, which means that the 

::

  bzr init-repo sample
  cd sample
  bzr init trunk
  cd trunk


Making changes to your files
============================

Let's change a file and commit that change to your branch.

Edit ``test1.txt`` in your favourite editor, then check what have you done::

 $ bzr diff
 === modified file 'test1.txt'
 --- test1.txt   2007-10-08 17:56:14 +0000
 +++ test1.txt   2007-10-08 17:46:22 +0000
 @@ -0,0 +1,1 @@
 +test test test

Commit your work to the Bazaar branch::

  $ bzr commit -m "Added first line of text"
  Committed revision 2.


Viewing the revision log
========================

You can see the history of your branch by browsing its log::

  $ bzr log
  ------------------------------------------------------------
  revno: 2
  committer: John Doe <john.doe@gmail.com>
  branch nick: myproject
  timestamp: Mon 2007-10-08 17:56:14 +0000
  message:
    Added first line of text
  ------------------------------------------------------------
  revno: 1
  committer: John Doe <john.doe@gmail.com>
  branch nick: myproject
  timestamp: Mon 2006-10-08 17:46:22 +0000
  message:
    Initial import


Publishing your branch on Launchpad
===================================

Launchpad is a suite of development and hosting tools for
software projects. You can use it to publish your branch.  (You can 
also publish branches onto your own server or other hosting services.)

If you don't have a Launchpad account, follow the `account signup guide`_
and `register an SSH key`_ in your new Launchpad account.

.. _account signup guide: https://help.launchpad.net/CreatingYourLaunchpadAccount
.. _register an SSH key: https://launchpad.net/people/+me/+editsshkeys

Replacing ``john.doe`` with your own Launchpad username, type::

 $ bzr push lp:~john.doe/+junk/myproject

**Note**: ``+junk`` is a place to store experimental branches not
associated with any particular project.  Normally, you should push a
project into an existing project, or register a new project through the
web interface.

Now, anyone can create their own copy of your branch by typing::

 $ bzr branch lp:~john.doe/+junk/myproject

You can also see information about your branch, including its revision
history, at https://code.launchpad.net/people/+me/+junk/myproject


Creating your own copy of another branch
========================================

To work with someone else's code, you can make your own copy of their
branch. Let's take a real-world example, Bazaar's GTK interface::

  $ bzr init-repo ~/bzr-gtk
  $ bzr branch lp:~bzr/bzr-gtk/trunk ~/bzr-gtk/john
  Branched 292 revision(s).

Bazaar will download all the files and complete revision history from the
bzr-gtk project's trunk branch and create a copy called ``john``.

Now, you have your own copy of the branch and can commit changes with
or without a net connection. You can share your branch at any time by
publishing it and, if the  bzr-gtk team want to use your work, Bazaar
makes it easy for them to merge your branch back into their trunk branch.


Updating your branch from the main branch
=========================================

While you commit changes to your branch, it's likely that other people will
also continue to commit code to the parent branch.

To make sure your branch stays up to date, you should merge changes from
the parent into your personal branch::

  $ bzr merge
  Merging from saved parent location: http://bazaar.launchpad.net/~bzr/bzr-gtk/trunk
  All changes applied successfully.

Check what has changed::

  $ bzr diff

If different branches have made changes to the same areas of the same
files, then merging them may generate conflicts.  When this happens,
Bazaar puts text markers like ``<<<<<<<`` into the files, and records them
in a list of conflicted files.  You should edit the files to reflect the
way you want to resolve the conflicts, use ``bzr diff`` to check the
changes, and then ``bzr resolve`` to mark them as resolved.

If you're happy with the changes, you can commit them to your personal
branch::

  $ bzr commit -m "Merge from main branch"
  Committed revision 295.


Learning more
=============

You can find out more about Bazaar in the
`Bazaar User Guide <../user-guide/index.html>`_.

To learn about Bazaar on the command-line::

  $ bzr help

To learn about the ''foo'' topic or command::

  $ bzr help foo

Licence
=======

Copyright 2007-2011 Canonical Ltd. Bazaar is free software, and you
may use, modify and redistribute both Bazaar and this document under
the terms of the GNU General Public License version 2 or later. See
<http://www.gnu.org/licenses/>.