<?xml version="1.0" encoding="utf-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Using External Editors</title> <link rel="stylesheet" type="text/css" href="styles.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /> <style type="text/css"> body { background-image: url('images/draft.png'); background-repeat: no-repeat; background-position: top left; /* The following properties make the watermark "fixed" on the page. */ /* I think that's just a bit too distracting for the reader... */ /* background-attachment: fixed; */ /* background-position: center center; */ }</style> <link rel="home" href="index.html" title="Version Control with Subversion [DRAFT]" /> <link rel="up" href="svn.customization.html" title="Chapter 7. Customizing Your Subversion Experience" /> <link rel="prev" href="svn.advanced.l10n.html" title="Localization" /> <link rel="next" href="svn.advanced.externaldifftools.html" title="Using External Differencing and Merge Tools" /> </head> <body> <div xmlns="" id="vcws-version-notice"> <p>This text is a work in progress—highly subject to change—and may not accurately describe any released version of the Apache™ Subversion® software. Bookmarking or otherwise referring others to this page is probably not such a smart idea. Please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a> for stable versions of this book.</p> </div> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">Using External Editors</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="svn.advanced.l10n.html">Prev</a> </td> <th width="60%" align="center">Chapter 7. Customizing Your Subversion Experience</th> <td width="20%" align="right"> <a accesskey="n" href="svn.advanced.externaldifftools.html">Next</a></td> </tr> </table> <hr /> </div> <div class="sect1" title="Using External Editors"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="svn.advanced.externaleditors"></a>Using External Editors</h2> </div> </div> </div> <p>The most obvious way to get data into Subversion is through the addition of files to version control, committing changes to those files, and so on. But other pieces of information besides merely versioned file data live in your Subversion repository. Some of these bits of information—commit log messages, lock comments, and some property values—tend to be textual in nature and are provided explicitly by users. Most of this information can be provided to the Subversion command-line client using the <code class="option">--message</code> (<code class="option">-m</code>) and <code class="option">--file</code> (<code class="option">-F</code>) options with the appropriate subcommands.</p> <p>Each of these options has its pros and cons. For example, when performing a commit, <code class="option">--file</code> (<code class="option">-F</code>) works well if you've already prepared a text file that holds your commit log message. If you didn't, though, you can use <code class="option">--message</code> (<code class="option">-m</code>) to provide a log message on the command line. Unfortunately, it can be tricky to compose anything more than a simple one-line message on the command line. Users want more flexibility—multiline, free-form log message editing on demand.</p> <p>Subversion supports this by allowing you to specify an external text editor that it will launch as necessary to give you a more powerful input mechanism for this textual metadata. There are several ways to tell Subversion which editor you'd like use. Subversion checks the following things, in the order specified, when it wants to launch such an editor:</p> <div class="orderedlist"> <ol class="orderedlist" type="1"> <li class="listitem"> <p><code class="literal">--editor-cmd</code> command-line option</p> </li> <li class="listitem"> <p><code class="literal">SVN_EDITOR</code> environment variable</p> </li> <li class="listitem"> <p><code class="literal">editor-cmd</code> runtime configuration option</p> </li> <li class="listitem"> <p><code class="literal">VISUAL</code> environment variable</p> </li> <li class="listitem"> <p><code class="literal">EDITOR</code> environment variable</p> </li> <li class="listitem"> <p>Possibly, a fallback value built into the Subversion libraries (not present in the official builds)</p> </li> </ol> </div> <p>The value of any of these options or variables is the beginning of a command line to be executed by the shell. Subversion appends to that command line a space and the pathname of a temporary file to be edited. So, to be used with Subversion, the configured or specified editor needs to support an invocation in which its last command-line parameter is a file to be edited, and it should be able to save the file in place and return a zero exit code to indicate success.</p> <p>As noted, external editors can be used to provide commit log messages to any of the committing subcommands (such as <span class="command"><strong>svn commit</strong></span> or <span class="command"><strong>import</strong></span>, <span class="command"><strong>svn mkdir</strong></span> or <span class="command"><strong>delete</strong></span> when provided a URL target, etc.), and Subversion will try to launch the editor automatically if you don't specify either of the <code class="option">--message</code> (<code class="option">-m</code>) or <code class="option">--file</code> (<code class="option">-F</code>) options. The <span class="command"><strong>svn propedit</strong></span> command is built almost entirely around the use of an external editor. And beginning in version 1.5, Subversion will also use the configured external text editor when the user asks it to launch an editor during interactive conflict resolution. Oddly, there doesn't appear to be a way to use external editors to interactively provide lock comments.</p> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="svn.advanced.l10n.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="svn.customization.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="svn.advanced.externaldifftools.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">Localization </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> Using External Differencing and Merge Tools</td> </tr> </table> </div> <div xmlns="" id="vcws-footer"> <hr /> <img src="images/cc-by.png" style="float: right;" /> <p>You are reading <em>Version Control with Subversion</em> (for Subversion 1.8), by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato.</p> <p>This work is licensed under the <a href="http://creativecommons.org/licenses/by/2.0/">Creative Commons Attribution License v2.0</a>.</p> <p>To submit comments, corrections, or other contributions to the text, please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a>.</p> </div> </body> </html>