<?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>pre-commit</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.ref.reposhooks.html" title="Subversion Repository Hook Reference" /> <link rel="prev" href="svn.ref.reposhooks.start-commit.html" title="start-commit" /> <link rel="next" href="svn.ref.reposhooks.post-commit.html" title="post-commit" /> </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">pre-commit</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="svn.ref.reposhooks.start-commit.html">Prev</a> </td> <th width="60%" align="center">Subversion Repository Hook Reference</th> <td width="20%" align="right"> <a accesskey="n" href="svn.ref.reposhooks.post-commit.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="pre-commit"> <a id="svn.ref.reposhooks.pre-commit"></a> <div class="titlepage"></div> <a id="idp25971728" class="indexterm"></a> <div class="refnamediv"> <h2>Name</h2> <p>pre-commit — Notification just prior to commit completion.</p> </div> <div class="refsynopsisdiv" title="Synopsis"> <h2>Synopsis</h2> <p> <code class="literal">pre-commit <em class="replaceable"><code>REPOS-PATH</code></em> <em class="replaceable"><code>TXN-NAME</code></em></code> </p> </div> <div class="refsect1" title="Description"> <a id="idp25976736"></a> <h2>Description</h2> <p>The <code class="literal">pre-commit</code> hook is run just before a commit transaction is promoted to a new revision. Typically, this hook is used to protect against commits that are disallowed due to content or location (e.g., your site might require that all commits to a certain branch include a ticket number from the bug tracker, or that the incoming log message is nonempty).</p> <p>If the <code class="literal">pre-commit</code> hook program returns a nonzero exit value, the commit is aborted, the commit transaction is removed, and anything printed to <code class="filename">stderr</code> is marshalled back to the client.</p> </div> <div class="refsect1" title="Input parameter(s)"> <a id="idp25981360"></a> <h2>Input parameter(s)</h2> <p>The command-line arguments passed to the hook program, in order, are:</p> <div class="orderedlist"> <ol class="orderedlist" type="1"> <li class="listitem"> <p>Repository path</p> </li> <li class="listitem"> <p>Commit transaction name</p> </li> </ol> </div> <p>Additionally, Subversion passes any lock tokens provided by the committing client to the hook script via standard input. When present, these are formatted as a single line containing the string <code class="literal">LOCK-TOKENS:</code>, followed by additional lines—one per lock token—which contain the lock token information. Each lock token information line consists of the URI-escaped repository filesystem path associated with the lock, followed by the pipe (<code class="literal">|</code>) separator character, and finally the lock token string.</p> </div> <div class="refsect1" title="Common uses"> <a id="idp25987920"></a> <h2>Common uses</h2> <p>Change validation and control</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="svn.ref.reposhooks.start-commit.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="svn.ref.reposhooks.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="svn.ref.reposhooks.post-commit.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">start-commit </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> post-commit</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>