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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
Conflict Types
==============
Some operations, like merge, revert and pull, modify the contents of your
working tree. These modifications are programmatically generated, and so they
may conflict with the current state of your working tree.
When conflicts are present in your working tree (as shown by ``bzr
conflicts``), you should resolve them and then inform bzr that the conflicts
have been resolved.
Resolving conflicts is sometimes not obvious. Either because the user that
should resolve them is not the one responsible for their occurrence, as is the
case when merging other people's work or because some conflicts are presented
in a way that is not easy to understand.
Bazaar tries to avoid conflicts ; its aim is to ask you to resolve the
conflict if and only if there's an actual conceptual conflict in the source
tree. Because Bazaar doesn't understand the real meaning of the files being
versioned, it can, when faced with ambiguities, fall short in either direction
trying to resolve the conflict itself. Many kinds of changes can be combined
programmatically, but sometimes only a human can determine the right thing to
do.
When Bazaar generates a conflict, it adds information into the working tree to
present the conflicting versions, and it's up to you to find the correct
resolution.
Whatever the conflict is, resolving it is roughly done in two steps::
- modify the working tree content so that the conflicted item is now in the
state you want to keep,
- inform Bazaar that the conflict is now solved and ask to cleanup any
remaining generated information (``bzr resolve <item>``).
For most conflict types, there are some obvious ways to modify the working
tree and put it into the desired state. For some types of conflicts, Bazaar
itself already made a choice, when possible.
Yet, whether Bazaar makes a choice or not, there are some other simple but
different ways to resolve the conflict.
Each type of conflict is explained below, and the action which must be done to
resolve the conflict is outlined.
Various actions are available depending on the kind of conflict, for some of
these actions, Bazaar can provide some help. In the end you should at least
inform Bazaar that you're done with the conflict with::
``bzr resolve FILE --action=done'
Note that this is the default action when a single file is involved so you can
simply use::
``bzr resolve FILE``
See ``bzr help resolve`` for more details.
Text conflicts
--------------
Typical message::
Text conflict in FILE
These are produced when a text merge cannot completely reconcile two sets of
text changes. Bazaar will emit files for each version with the extensions
THIS, OTHER, and BASE. THIS is the version of the file from the target tree,
i.e. the tree that you are merging changes into. OTHER is the version that you
are merging into the target. BASE is an older version that is used as a basis
for comparison.
In the main copy of the file, Bazaar will include all the changes that it
could reconcile, and any un-reconciled conflicts are surrounded by
"herringbone" markers like ``<<<<<<<``.
Say the initial text is "The project leader released it.", and THIS modifies it
to "Martin Pool released it.", while OTHER modifies it to "The project leader
released Bazaar." A conflict would look like this::
<<<<<<< TREE
Martin Pool released it.
=======
The project leader released Bazaar.
>>>>>>> MERGE-SOURCE
The correct resolution would be "Martin Pool released Bazaar."
You can handle text conflicts either by editing the main copy of the file, or
by invoking external tools on the THIS, OTHER and BASE versions. It's worth
mentioning that resolving text conflicts rarely involves picking one set of
changes over the other. More often, the two sets of changes must be
intelligently combined.
If you edit the main copy, be sure to remove the herringbone markers. When
you are done editing, the file should look like it never had a conflict, and be
ready to commit.
When you have resolved text conflicts, just run ``bzr resolve --auto``, and
Bazaar will auto-detect which conflicts you have resolved.
When the conflict is resolved, Bazaar deletes the previously generated
``.BASE``, ``.THIS`` and ``.OTHER`` files if they are still present in the
working tree.
Content conflicts
-----------------
Typical message::
Contents conflict in FILE
This conflict happens when there are conflicting changes in the working tree
and the merge source, but the conflicted items are not text files. They may
be binary files, or symlinks, or directories. It can even happen with files
that are deleted on one side, and modified on the other.
Like text conflicts, Bazaar will emit THIS, OTHER and BASE files. (They may be
regular files, symlinks or directories). But it will not include a "main copy"
of the file with herringbone conflict markers. It will appear that the "main
copy" has been renamed to THIS or OTHER.
To resolve that kind of conflict, you should rebuild FILE from either version
or a combination of both.
``bzr resolve`` recognizes the following actions:
- ``--action=take-this`` will issue ``bzr mv FILE.THIS FILE``,
- ``--action=take-other`` will issue ``bzr mv FILE.OTHER FILE``,
- ``--action=done`` will just mark the conflict as resolved.
Any action will also delete the previously generated ``.BASE``, ``.THIS`` and
``.OTHER`` files if they are still present in the working tree.
Bazaar cannot auto-detect when conflicts of this kind have been resolved.
Tag conflicts
-------------
Typical message::
Conflicting tags:
version-0.1
When pulling from or pushing to another branch, Bazaar informs you about tags
that conflict between the two branches; that is the same tag points to two
different revisions. You need not resolve these conflicts, but subsequent
uses of pull or push will result in the same message.
To resolve the conflict, you must apply the correct tags to either the target
branch or the source branch as appropriate. Use "bzr tags --show-ids -d
SOURCE_URL" to see the tags in the source branch. If you want to make the
target branch's tags match the source branch, then in the target branch do
``bzr tag --force -r revid:REVISION_ID CONFLICTING_TAG`` for each of the
CONFLICTING_TAGs, where REVISION_ID comes from the list of tags in the source
branch. You need not call "bzr resolve" after doing this. To resolve in
favor of the target branch, you need to similarly use ``tag --force`` in the
source branch. (Note that pulling or pushing using --overwrite will overwrite
all tags as well.)
Duplicate paths
---------------
Typical message::
Conflict adding file FILE. Moved existing file to FILE.moved.
Sometimes Bazaar will attempt to create a file using a pathname that has
already been used. The existing file will be renamed to "FILE.moved".
To resolve that kind of conflict, you should rebuild FILE from either version
or a combination of both.
``bzr resolve`` recognizes the following actions::
- ``--action=take-this`` will issue ``bzr rm FILE ; bzr mv FILE.moved FILE``,
- ``--action=take-other`` will issue ``bzr rm FILE.moved``,
- ``--action=done`` will just mark the conflict as resolved.
Note that you must get rid of FILE.moved before using ``--action=done``.
Bazaar cannot auto-detect when conflicts of this kind have been resolved.
Unversioned parent
------------------
Typical message::
Conflict because FILE is not versioned, but has versioned children.
Sometimes Bazaar will attempt to create a file whose parent directory is not
versioned. This happens when the directory has been deleted in the target,
but has a new child in the source, or vice versa. In this situation, Bazaar
will version the parent directory as well. Resolving this issue depends
very much on the particular scenario. You may wish to rename or delete either
the file or the directory. When you are satisfied, you can run "bzr resolve
FILE" to mark the conflict as resolved.
Missing parent
--------------
Typical message::
Conflict adding files to FILE. Created directory.
This happens when a directory has been deleted in the target, but has new
children in the source. This is similar to the "unversioned parent" conflict,
except that the parent directory does not *exist*, instead of just being
unversioned. In this situation, Bazaar will create the missing parent.
Resolving this issue depends very much on the particular scenario.
To resolve that kind of conflict, you should either remove or rename the
children or the directory or a combination of both.
``bzr resolve`` recognizes the following actions::
- ``--action=take-this`` will issue ``bzr rm directory`` including the children,
- ``--action=take-other`` will acknowledge Bazaar choice to keep the children
and restoring the directory,
- ``--action=done`` will just mark the conflict as resolved.
Bazaar cannot auto-detect when conflicts of this kind have been resolved.
Deleting parent
---------------
Typical message::
Conflict: can't delete DIR because it is not empty. Not deleting.
This is the opposite of "missing parent". A directory is deleted in the
source, but has new children in the target. Bazaar will retain the directory.
Resolving this issue depends very much on the particular scenario.
To resolve that kind of conflict, you should either remove or rename the
children or the directory or a combination of both.
``bzr resolve`` recognizes the following actions::
- ``--action=take-this`` will acknowledge Bazaar choice to keep the directory,
- ``--action=take-other`` will issue ``bzr rm directory`` including the
children,
- ``--action=done`` will just mark the conflict as resolved.
Bazaar cannot auto-detect when conflicts of this kind have been resolved.
Path conflict
-------------
Typical message::
Path conflict: PATH1 / PATH2
This happens when the source and target have each modified the name or parent
directory of a file. Bazaar will use the path elements from the source.
To resolve that kind of conflict, you just have to decide what name should be
retained for the file involved.
``bzr resolve`` recognizes the following actions::
- ``--action=take-this`` will revert Bazaar choice and keep ``PATH1`` by
issuing ``bzr mv PATH2 PATH1``,
- ``--action=take-other`` will acknowledge Bazaar choice of keeping ``PATH2``,
- ``--action=done`` will just mark the conflict as resolved.
Bazaar cannot auto-detect when conflicts of this kind have been resolved.
Parent loop
-----------
Typical message::
Conflict moving FILE into DIRECTORY. Cancelled move.
This happens when the source and the target have each moved directories, so
that, if the change could be applied, a directory would be contained by itself.
For example::
$ bzr init
$ bzr mkdir white
$ bzr mkdir black
$ bzr commit -m "BASE"
$ bzr branch . ../other
$ bzr mv white black
$ bzr commit -m "THIS"
$ bzr mv ../other/black ../other/white
$ bzr commit ../other -m "OTHER"
$ bzr merge ../other
In this situation, Bazaar will cancel the move, and leave ``white`` in
``black``. To resolve that kind of conflict, you just have to decide what
name should be retained for the directories involved.
``bzr resolve`` recognizes the following actions::
- ``--action=take-this`` will acknowledge Bazaar choice of leaving ``white``
in ``black``,
- ``--action=take-other`` will revert Bazaar choice and move ``black`` in
``white`` by issuing ``bzr mv black/white white ; bzr mv black white``,
- ``--action=done`` will just mark the conflict as resolved.
Bazaar cannot auto-detect when conflicts of this kind have been resolved.
Non-directory parent
--------------------
Typical message::
Conflict: foo.new is not a directory, but has files in it.
Created directory.
This happens when one side has added files to a directory, and the other side
has changed the directory into a file or symlink. For example::
$ bzr init
$ bzr mkdir foo
$ bzr commit -m "BASE"
$ bzr branch . ../other
$ rmdir foo
$ touch foo
$ bzr commit -m "THIS"
$ bzr mkdir ../other/foo/bar
$ bzr commit ../other -m "OTHER"
$ bzr merge ../other
To resolve that kind of conflict, you have to decide what name should be
retained for the file, directory or symlink involved.
``bzr resolve`` recognizes the following actions::
- ``--action=take-this`` will issue ``bzr rm --force foo.new`` and
``bzr add foo``,
- ``--action=take-other`` will issue ``bzr rm --force foo`` and
``bzr mv foo.new foo``,
- ``--action=done`` will just mark the conflict as resolved.
Bazaar cannot auto-detect when conflicts of this kind have been resolved.
MalformedTransform
------------------
It is possible (though very rare) for Bazaar to raise a MalformedTransform
exception. This means that Bazaar encountered a filesystem conflict that it was
unable to resolve. This usually indicates a bug. Please let us know if you
encounter this. Our bug tracker is at https://launchpad.net/bzr/+bugs
|