11.07.2015 Views

Version Control with Subversion - Login

Version Control with Subversion - Login

Version Control with Subversion - Login

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Customizing Your <strong>Subversion</strong> Experienceprovided a URL target, etc.), and <strong>Subversion</strong> will try to launch the editor automatically ifyou don't specify either of the --message (-m) or --file (-F) options. The svn propeditcommand is built almost entirely around the use of an external editor. And beginning in version1.5, <strong>Subversion</strong> will also use the configured external text editor when the user asks itto launch an editor during interactive conflict resolution. Oddly, there doesn't appear to be away to use external editors to interactively provide lock comments.Using External Differencing and Merge ToolsThe interface between <strong>Subversion</strong> and external two- and three-way differencing toolsharkens back to a time when <strong>Subversion</strong>'s only contextual differencing capabilities werebuilt around invocations of the GNU diffutils toolchain, specifically the diff and diff3 utilities.To get the kind of behavior <strong>Subversion</strong> needed, it called these utilities <strong>with</strong> more than ahandful of options and parameters, most of which were quite specific to the utilities. Sometime later, <strong>Subversion</strong> grew its own internal differencing library, and as a failover mechanism,the --diff-cmd and --diff3-cmd options were added to the <strong>Subversion</strong> command-lineclient so that users could more easily indicate that they preferred to use theGNU diff and diff3 utilities instead of the newfangled internal diff library. If those optionswere used, <strong>Subversion</strong> would simply ignore the internal diff library, and fall back to runningthose external programs, lengthy argument lists and all. And that's where things remaintoday.It didn't take long for folks to realize that having such easy configuration mechanisms forspecifying that <strong>Subversion</strong> should use the external GNU diff and diff3 utilities located at aparticular place on the system could be applied toward the use of other differencing tools,too. After all, <strong>Subversion</strong> didn't actually verify that the things it was being told to run weremembers of the GNU diffutils toolchain. But the only configurable aspect of using those externaltools is their location on the system—not the option set, parameter order, and so on.<strong>Subversion</strong> continues to throw all those GNU utility options at your external diff tool regardlessof whether that program can understand those options. And that's where things getunintuitive for most users.The key to using external two- and three-way differencing tools (other than GNU diff anddiff3, of course) <strong>with</strong> <strong>Subversion</strong> is to use wrapper scripts, which convert the input from<strong>Subversion</strong> into something that your differencing tool can understand, and then to convertthe output of your tool back into a format that <strong>Subversion</strong> expects—the format that theGNU tools would have used. The following sections cover the specifics of those expectations.The decision on when to fire off a contextual two- or three-way diff as part of alarger <strong>Subversion</strong> operation is made entirely by <strong>Subversion</strong> and is affected by,among other things, whether the files being operated on are human-readableas determined by their svn:mime-type property. This means, for example,that even if you had the niftiest Microsoft Word-aware differencing or mergingtool in the universe, it would never be invoked by <strong>Subversion</strong> as long as yourversioned Word documents had a configured MIME type that denoted that theywere not human-readable (such as application/msword). For more aboutMIME type settings, see the section called “File Content Type”<strong>Subversion</strong> 1.5 introduces interactive resolution of conflicts (described in the section called“Resolve Conflicts (Merging Others' Changes)”), and one of the options provided to usersis the ability to launch a third-party merge tool. If this action is taken, <strong>Subversion</strong> will consultthe merge-tool-cmd runtime configuration option to find the name of an externalmerge tool and, upon finding one, will launch that tool <strong>with</strong> the appropriate input files. Thisdiffers from the configurable three-way differencing tool in a couple of ways. First, the differencingtool is always used to handle three-way differences, whereas the merge tool isemployed only when three-way difference application has detected a conflict. Second, theinterface is much cleaner—your configured merge tool need only accept as command-lineparameters four path specifications: the base file, the “theirs” file (which contains upstream202

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!