Merging
Merging sources is an inevitable task that arises from developing with more than one person (and even when working solo). This article collects some tips, practical examples, and general policies or procedures for handling merges.
Finding the Delta
When merging, you'll need to inspect the differences between to versions (and possibly different trees) of source. Finding and visualizing the differences between different releases of a software package can be very useful.
Subversion
Websvn is a repository browser for Subversion that can be used to visualize differences. The command-line tool svnlook can also be used on Subversion repositories (remember this tool operates on the local repository path and not a URL so you need to have file system access to the repository).
svnlook history /var/repos/svn/myrepo some/path/in/the/repo/
For each of these relevant revisions, we can show what has changed:
svnlook changed -r7560 /var/repos/svn/myrepo
We can also look closely at the changes using svnlook diff. Adding the optional --no-diff-deleted and --no-diff-added will supress showing differences for those types of events.
svnlook diff -r7560 --no-diff-deleted --no-diff-added /var/repos/svn/myrepo
We can look at just what happened using 'diff' to show the file differences. In this example, we'll use the external visual diff tool 'kdiff3' which is a lot easier to see compared with command-line diff output.
svn diff --diff-cmd kdiff3 \
http://svn.example.com/svn/path/to/file.txt@7560 \
http://svn.example.com/svn/path/to/file.txt@HEAD
Merging
Merge functionality, and the lack thereof, is something that Linux Torvalds ranted about in his Google Tech Talk about git (note that Linus *really* emphasizes Distributed Version Control Systems and thinks anything else is insane, brain damaged, ugly and stupid).
Development of Subversion's own merge tracking support is functionality included in Subversion 1.5 (basic). Additional features may follow in subsequent releases.
Because of the deficiency, many developers have migrated to more advanced SCMs such as Git that offer merging.