[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
三つのファイルを比較し,それらの間の差異を表示するため,プログラム
diff3
を使用してください(diff3
でファイルのマージも可
能です.see section 8. 共通の先祖からマージ).
"通常の"diff3
の出力書式は,周りの文を用いずに,それぞれの差
異部分のhunkを表示します.hunkには,それが二方向か三方向かに依存してラベ
ルが付けられてて,行には,入力ファイルの位置で注釈がつきます.
diff3
の実行方法の詳細は,See section 14. diff3
の呼び出し.
7.1 三番目の入力ファイルの見本 | Sample diff3 input for examples. | |
7.2 diff3 の通常の書式の詳細な説明 | A detailed description of normal output format. | |
7.3 diff3 のhunk | The format of normal output format. | |
7.4 diff3 の通常の書式の例 | Sample output in the normal format. |
diff3
の出力とオプションでそれを変更する様子を示す例で使用する
三番目のサンプルファイルは,以下のようになります.最初の二つのファイルは,
diff
で使用したものと同じです(see section 2.1 二つのサンプル入力ファイル).以下
は,`tao'という三番目のサンプルファイルです.
The Way that can be told of is not the eternal Way; The name that can be named is not the eternal name. The Nameless is the origin of Heaven and Earth; The named is the mother of all things. Therefore let there always be non-being, so we may see their subtlety, And let there always be being, so we may see their result. The two are the same, But after they are produced, they have different names. -- The Way of Lao-Tzu, tr. Wing-tsit Chan |
diff3
の通常の書式の詳細な説明 それぞれのhunkは`===='で印がついた行で始まります.三方向のhunkには, `===='行があり,二方向のhunkには,そのhunkに差異のある三つの入力ファ イルのいずれかを示す,`1',`2',または`3'が後置されます. hunkには,入力行がどこからのものかを示す一つまたは二つのコマンドが前置さ れている,入力行の二つまたは三つの組のコピーが含まれます.
通常,コマンドごとに異なる入力号のコピーに二つのスペースが前置されます.
しかし,`-T'や`--initial-tab'オプションを用いると,
diff3
は二つのスペースの代わりにタブを使用します.これでタブの
行揃えは正しくなります.詳細は,See section 5.1 タブストップの位置合わせを保持する.
コマンドは以下の形式となります.
入力行の組の最後の行が不完全な場合(see section 3. 不完全な行),出力とは区 別される`\'で始まる行が後置された完全な行になります.
diff3
のhunk
二つまたは三つの入力ファイルの差分の行のグループは,diff3 hunksと
呼ばれ,diff
のhunkに似ています(see section 1.1 Hunks).diff3
のhunkで三つの入力ファイルがすべて異なる場合,hunkは三方向の
hunk(three-way hunk)と呼ばれます.二つの入力ファイルだけが異なる場合,
それは二方向のhunk(two-way hunk).
diff
と同様に,いくつかの解が考えられます.ファイル`A',
`B',そして`C'を比較するとき, diff3
は通常,二つのコ
マンド`diff A B'と`diff A C'で出力される二方向のhunkをマージし
て,diff3
のhunkを見つけます.これでは,必ずしも出力が最小にな
るわけではありませんが,例外は滅多にないでしょう.
例えば,`F'には三行`a',`b',`f'が含まれていて, `G'に`g',`b',`g'という行が含まれていて,そして `H'に`a',`b',`h'という行が含まれていると仮定します. `diff3 F G H'の出力は以下のようになるでしょう.
====2 1:1c 3:1c a 2:1c g ==== 1:3c f 2:3c g 3:3c h |
その理由は,最初のファイルと三番目のファイルの`a'が含まれる二方向の hunkと二番目のファイルの`g'を見つけ,単一行の`b'が三つのファイ ルすべての共通行として見つかり,それぞれのファイルの最後の行に含まれる三 方向のhunkが見つかるためです.
diff3
の通常の書式の例 コマンド`diff3 lao tzu tao'の出力は以下のようになります(ファイルの 完全な内容はsee section 7.1 三番目の入力ファイルの見本).三つのファイル間で差異のある行 だけが表示されていることに注意してください.
====2 1:1,2c 3:1,2c The Way that can be told of is not the eternal Way; The name that can be named is not the eternal name. 2:0a ====1 1:4c The Named is the mother of all things. 2:2,3c 3:4,5c The named is the mother of all things. ====3 1:8c 2:7c so we may see their outcome. 3:9c so we may see their result. ==== 1:11a 2:11,13c They both may be called deep and profound. Deeper and more profound, The door of all subtleties! 3:13,14c -- The Way of Lao-Tzu, tr. Wing-tsit Chan |
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |