<!---
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->

<h1 id="smart-apply-patch">smart-apply-patch</h1>

<p><code>smart-apply-patch</code> is a command to help apply patches easily.  It uses the same plug-ins and many of the same options as test-patch.  This means that it can, for example, fetch patches from JIRA and apply them to a local source tree.</p>

<h1 id="usage">Usage</h1>

<p>Its simplest form is used when a patch is stored in a local file:</p>

<div class="highlight"><pre class="highlight shell"><code><span class="nv">$ </span>smart-apply-patch patch
</code></pre></div>
<p>This will cause the command to run through various ways to verify and then apply the patch to the current repo, including deducing a patch level.</p>

<p>Perhaps you just want to see if the patch even applies without changing your local repo.  The <code>--dry-run</code> option will just test for applicability:</p>

<div class="highlight"><pre class="highlight shell"><code><span class="nv">$ </span>smart-apply-patch <span class="nt">--dry-run</span> patch
</code></pre></div>
<p>For committers of projects, there is a special mode:</p>

<div class="highlight"><pre class="highlight shell"><code><span class="nv">$ </span>smart-apply-patch <span class="nt">--committer</span> patch
</code></pre></div>
<p>that in addition to applying the patch will also attempt to:</p>

<ul>
  <li>use <code>--whitespace=fix</code> mode</li>
  <li>add all newly created files in the repo</li>
  <li>use <code>--signoff</code> and commit the change via git-am</li>
</ul>
