2977.1.5
by Ian Clatworthy
added chapter on Sharing with a peer |
1 |
Resolving conflicts |
2 |
=================== |
|
3 |
||
4 |
Workflow |
|
5 |
-------- |
|
6 |
||
7 |
Unlike some other tools that force you to resolve each conflict during |
|
8 |
the merge process, Bazaar merges as much as it can and then reports the |
|
9 |
conflicts. This can make conflict resolution easier because the contents |
|
10 |
of the whole post-merge tree are available to help you decide how things |
|
11 |
ought to be resolved. You may also wish to selectively run tests as you go |
|
12 |
to confirm each resolution or group or resolutions is good. |
|
13 |
||
14 |
Listing conflicts |
|
15 |
----------------- |
|
16 |
||
17 |
As well as being reported by the ``merge`` command, the list of outstanding |
|
18 |
conflicts may be displayed at any time by using the ``conflicts`` |
|
19 |
command. It is also included as part of the output from the ``status`` |
|
20 |
command. |
|
21 |
||
22 |
Resolving a conflict |
|
23 |
-------------------- |
|
24 |
||
25 |
When a conflict is encountered, the ``merge`` command puts embedded |
|
26 |
markers in each file showing the areas it couldn't resolve. It also |
|
27 |
creates 3 files for each file with a conflict: |
|
28 |
||
29 |
* foo.BASE |
|
30 |
* foo.THIS |
|
31 |
* foo.OTHER |
|
32 |
||
33 |
where ``foo`` is the name of the conflicted file. |
|
34 |
In many cases, you can resolve conflicts by simply manually editing |
|
35 |
each file in question, fixing the relevant areas and removing the |
|
36 |
conflict markers as you go. |
|
37 |
||
4853.1.1
by Patrick Regan
Removed trailing whitespace from files in doc directory |
38 |
After fixing all the files in conflict, and removing the markers, |
3250.1.1
by Martin Albisetti
Small tweak to make resolving conflicts a bit clearer |
39 |
ask Bazaar to mark them as resolved using the ``resolve`` command like this:: |
2977.1.5
by Ian Clatworthy
added chapter on Sharing with a peer |
40 |
|
41 |
bzr resolve |
|
42 |
||
43 |
Alternatively, after fixing each file, you can mark it as resolved |
|
44 |
like this:: |
|
45 |
||
46 |
bzr resolve foo |
|
47 |
||
48 |
Among other things, the ``resolve`` command cleans up the BASE, |
|
49 |
THIS and OTHER files from your working tree. |
|
50 |
||
51 |
Using the remerge command |
|
52 |
------------------------- |
|
53 |
||
54 |
In some cases, you may wish to try a different merge algorithm on a |
|
55 |
given file. To do this, use the ``remerge`` command nominating |
|
56 |
the file like this:: |
|
57 |
||
58 |
bzr remerge --weave foo |
|
59 |
||
60 |
where ``foo`` is the file and ``weave`` is one of the available |
|
3074.1.3
by Ian Clatworthy
more feedback from jameinel |
61 |
merge algorithms. This algorithm is particularly useful when a |
62 |
so-called ``criss-cross`` merge is detected, e.g. when two branches |
|
63 |
merge the same thing then merge each other. See the online help for |
|
64 |
``criss-cross`` and ``remerge`` for further details. |
|
2977.1.5
by Ian Clatworthy
added chapter on Sharing with a peer |
65 |
|
66 |
Using external tools to resolve conflicts |
|
67 |
----------------------------------------- |
|
68 |
||
69 |
If you have a GUI tool you like using to resolve conflicts, be sure |
|
70 |
to install the *extmerge* plugin. Once installed, it can be used |
|
71 |
like this:: |
|
72 |
||
73 |
bzr extmerge foo |
|
74 |
||
75 |
where ``foo`` is the conflicted file. Rather than provide a list of |
|
76 |
files to resolve, you can give the ``--all`` option to implicitly |
|
77 |
specify all conflicted files. |
|
78 |
||
79 |
The ``extmerge`` command uses the tool specified by the |
|
80 |
``external_merge`` setting in your ``bazaar.conf`` file. |
|
81 |
If not set, it will look for some popular merge tools such |
|
82 |
as ``kdiff3`` or ``opendiff``, the latter being a command |
|
83 |
line interface to the FileMerge utility in OS X. |