The idea behind "merging" files, for those of you new to this sort of thing, is that you've got a file (the "base") that gets modified by two people at once ("them" and "you"). What a "merge tool" does is take that "base", look at "their" file and "your" file, and deduce (or help you in deducing) what should happen to produce a "merged" file which contains "their" changes AND "your" changes.
So with that in mind, let's take a look at this nice picture of a squid I drew in Paint:
Pretty sweet, eh? After I checked it in, I decided it could use a bit more color, so
I checked it out again and made a few changes:
At the same time I was doing that, though, somebody else (the elusive "they") decided
that my picture could use some kelp, some bubbles, and some anchovies:
So now I have two versions of this picture - one with the coloring I did, and one with
the kelp and anchovies, and what I really want is ONE picture that has them both, but
I don't want to have to redo either of those changes by hand. Well, here's where
CALAMARI comes in. As luck would have it, my squid doodle is checked into a
Perforce depot, and Perforce already knows about
these two "conflicting" changes, as well as what the "common base" is. So once I tell
it that I want to merge the two images together using CALAMARI, Perforce quietly runs
CALAMARI (giving it the common base, their file, and my file), and I get this:
The two images that I'm working from are on the left side, and the right side shows the image that I'm creating. The parts in red are "conflicts" between the source images that CALAMARI doesn't know what to do with--we'll be getting to those in a second.
To get my bearings I run the two diff commands from the "View" menu, and get a couple of
windows showing me the differences between the "base" file and the two files that I'm
That's right, I'm merging those new foreground objects with the color changes, and the
things in red are showing up as conflicts because those parts of the image have changed
in two different ways. One way I could try to resolve that would be to use the "Paint"
tool and blend the two images together:
but that doesn't look very seamless.
After hitting "Auto Merge" to undo my doodling, I use the "Conflict Stencil" to isolate
those conflicting sections from everything else:
and then I use the "Spray" tool to quickly paint the exposed areas:
dragging the slider to indicate that I want to fill those areas in with the colors from the top image:
Hey, this is looking pretty good.
On further reflection, I decide that the bubbles might look better if they were blended
a bit with the background, so as to make them look translucent. The stencil works with
the "Paint" tool just like it works with "Spray", so I select the "Paint" tool, set the
slider to a midway position, zoom in, and paint over just the bubbles:
Let's take the stencil off and have a look:
All that's left to do now is save the result:
Ta da! Our merged image.