Version Control with Subversion - Copying Changes Between Branches - Tracking Merges Manually
Tracking Merges Manually
Merging changes sounds simple enough, but in practice it
can become a headache. The problem is that if you
repeatedly merge changes from one branch to another, you
might accidentally merge the same change
twice
. When this happens, sometimes
things will work fine. When patching a file, Subversion
typically notices if the file already has the change, and
does nothing. But if the already-existing change has been
modified in any way, you'll get a conflict.
Ideally, your version control system should prevent the
double-application of changes to a branch. It should
automatically remember which changes a branch has already
received, and be able to list them for you. It should use
this information to help automate merges as much as
possible.
Unfortunately, Subversion is not such a system. Like
CVS, Subversion does not yet record any information about
merge operations. When you commit local modifications, the
repository has no idea whether those changes came from
running
svn merge
, or from just
hand-editing the files.
What does this mean to you, the user? It means that
until the day Subversion grows this feature, you'll have to
track merge information yourself. The best place to do this
is in the commit log-message. As demonstrated in the
earlier example, it's recommended that your log-message
mention a specific revision number (or range of revisions)
that are being merged into your branch. Later on, you can
run
svn log
to review which changes your
branch already contains. This will allow you to carefully
construct a subsequent
svn merge
command
that won't be redundant with previously ported
changes.
In the next section, we'll show some examples of this
technique in action.
[an error occurred while processing this directive]
|