mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-17 21:16:57 +08:00
158 lines
5.9 KiB
HTML
158 lines
5.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>Make unified diff of two files</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.xdiff-file-diff" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">xdiff_file_diff</h1>
|
||
<p class="verinfo">(PECL xdiff >= 0.2.0)</p><p class="refpurpose"><span class="refname">xdiff_file_diff</span> — <span class="dc-title">Make unified diff of two files</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.xdiff-file-diff-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>xdiff_file_diff</strong></span>
|
||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$old_file</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$new_file</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$dest</code></span>
|
||
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$context</code><span class="initializer"> = 3</span></span>
|
||
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$minimal</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span>
|
||
]] ) : <span class="type">bool</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
Makes an unified diff containing differences between <code class="parameter">old_file</code> and
|
||
<code class="parameter">new_file</code> and stores it in <code class="parameter">dest</code> file. The
|
||
resulting file is human-readable. An optional <code class="parameter">context</code> parameter
|
||
specifies how many lines of context should be added around each change.
|
||
Setting <code class="parameter">minimal</code> parameter to true will result in outputting the shortest
|
||
patch file possible (can take a long time).
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.xdiff-file-diff-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">old_file</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
Path to the first file. This file acts as "old" file.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">new_file</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
Path to the second file. This file acts as "new" file.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">dest</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
Path of the resulting patch file.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">context</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
Indicates how many lines of context you want to include in diff
|
||
result.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">minimal</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
Set this parameter to <strong><code>TRUE</code></strong> if you want to minimalize size of the result
|
||
(can take a long time).
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.xdiff-file-diff-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功时返回 <strong><code>TRUE</code></strong>, 或者在失败时返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.xdiff-file-diff-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="inotify-init.example.basic">
|
||
<p><strong>Example #1 <span class="function"><strong>xdiff_file_diff()</strong></span> example</strong></p>
|
||
<div class="example-contents"><p>
|
||
The following code makes unified diff of two php files with context length of 2.
|
||
</p></div>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br />$old_version </span><span style="color: #007700">= </span><span style="color: #DD0000">'my_script.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$new_version </span><span style="color: #007700">= </span><span style="color: #DD0000">'my_new_script.php'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">xdiff_file_diff</span><span style="color: #007700">(</span><span style="color: #0000BB">$old_version</span><span style="color: #007700">, </span><span style="color: #0000BB">$new_version</span><span style="color: #007700">, </span><span style="color: #DD0000">'my_script.diff'</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 notes" id="refsect1-function.xdiff-file-diff-notes">
|
||
<h3 class="title">注释</h3>
|
||
<blockquote class="note"><p><strong class="note">Note</strong>:
|
||
<p class="para">
|
||
This function doesn't work well with binary files. To make diff of binary
|
||
files use <span class="function"><a href="xdiff_file_bdiff.html" class="function">xdiff_file_bdiff()</a></span>/<span class="function"><a href="xdiff_file_rabdiff.html" class="function">xdiff_file_rabdiff()</a></span> function.
|
||
</p>
|
||
</p></blockquote>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.xdiff-file-diff-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="xdiff_file_patch.html" class="function" rel="rdfs-seeAlso">xdiff_file_patch()</a> - Patch a file with an unified diff</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
</div></div></div></body></html> |