function.svn-commit.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 194 行

HTML
194
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Sends changes from the local working copy to the repository</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.svn-client-version.html">svn_client_version</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.svn-diff.html">svn_diff</a></div> <div class="up"><a href="ref.svn.html">SVN Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.svn-commit" class="refentry"> <div class="refnamediv">  <h1 class="refname">svn_commit</h1>  <p class="verinfo">(PECL svn:0.1-0.2)</p><p class="refpurpose"><span class="refname">svn_commit</span> &mdash; <span class="dc-title">Sends changes from the local working copy to the repository</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">array</span> <span class="methodname"><b><b>svn_commit</b></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$log</tt></span>   , <span class="methodparam"><span class="type">array</span> <tt class="parameter">$targets</tt></span>   [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$dontrecurse</tt></span>  ] )</div>  <p class="para rdfs-comment">   Commits changes made in the local working copy files enumerated in   the <i><tt class="parameter">targets</tt></i> array to the repository, with the   log message <i><tt class="parameter">log</tt></i>. Directories in the <i><tt class="parameter">targets</tt></i>   array will be recursively committed unless <i><tt class="parameter">dontrecurse</tt></i>   is set to true.  </p>  <blockquote><p><b class="note">Note</b>:    <span class="simpara">    This function does not have any parameters for specifying authentication,    so a username and password must be set using <a href="function.svn-auth-set-parameter.html" class="function">svn_auth_set_parameter()</a>   </span>  </p></blockquote> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">log</tt></i></span>     <dd>      <p class="para">       String log text to commit      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">targets</tt></i></span>     <dd>      <p class="para">       Array of local paths of files to be committed      </p>      <div class="warning"><b class="warning">Warning</b>       <p class="simpara">        This parameter must be an array, a string for a single        target is not acceptable.       </p>      </div>      <blockquote><p><b class="note">Note</b>: <span class="simpara">Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script&#039;s working directory, use <a href="function.realpath.html" class="function">realpath()</a> or dirname(__FILE__).</span></p></blockquote>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">dontrecurse</tt></i></span>     <dd>      <p class="para">       Boolean flag to disable recursive committing of       directories in the <i><tt class="parameter">targets</tt></i> array.       Default is <b><tt>FALSE</tt></b>.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns array in form of:  </p>    <div class="example-contents"><pre><div class="cdata"><pre>array(    0 =&gt; integer revision number of commit    1 =&gt; string ISO 8601 date and time of commit    2 =&gt; name of committer)</pre></div>    </pre></div>  <p class="para">   Returns <b><tt>FALSE</tt></b> on failure.  </p> </div> <div class="refsect1 notes">  <h3 class="title">Notes</h3>  <div class="warning"><b class="warning">Warning</b><p class="simpara">This function is<em class="emphasis">EXPERIMENTAL</em>. The behaviour of this function, its name, andsurrounding documentation may change without notice in a future release of PHP.This function should be used at your own risk.</p></div> </div>   <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 Basic example</b></p>    <div class="example-contents"><p>     This example commits the calculator directory to a repository, using     the username Bob and the password abc123 (hopefully, his password is     stronger):    </p></div>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />svn_auth_set_parameter</span><span style="color: #007700">(</span><span style="color: #0000BB">SVN_AUTH_PARAM_DEFAULT_USERNAME</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Bob'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">svn_auth_set_parameter</span><span style="color: #007700">(</span><span style="color: #0000BB">SVN_AUTH_PARAM_DEFAULT_PASSWORD</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'abc123'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">svn_commit</span><span style="color: #007700">(</span><span style="color: #DD0000">'Log&nbsp;message&nbsp;of&nbsp;Bob\'s&nbsp;commit'</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'calculator'</span><span style="color: #007700">))));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>    <div class="example-contents"><p>The above example will output:</p></div>    <div class="example-contents"><pre><div class="cdata"><pre>array(  0 =&gt; 1415,  1 =&gt; &#039;2007-05-26T01:44:28.453125Z&#039;,  2 =&gt; &#039;Bob&#039;)</pre></div>    </pre></div>   </div>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.svn-auth-set-parameter.html" class="function" rel="rdfs-seeAlso">svn_auth_set_parameter()</a></li>    <li class="member"><a href="http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.commit.html" class="link external">&raquo; SVN documentation on svn commit</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.svn-client-version.html">svn_client_version</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.svn-diff.html">svn_diff</a></div> <div class="up"><a href="ref.svn.html">SVN Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?