私は同僚のパッチを見直したいと思います。レビューツールは使用できません。だから彼が作ったパッチファイルにコメントしたいと思います。インラインコメントを(svn)パッチファイルに書き込むことは可能ですか?パッチ/差分ファイルにコメントを書き込む方法は?
svn red bookの情報が見つかりませんでした。パッチファイルの文法を見つけられなくても、自分自身を理解することができませんでした。
私は同僚のパッチを見直したいと思います。レビューツールは使用できません。だから彼が作ったパッチファイルにコメントしたいと思います。インラインコメントを(svn)パッチファイルに書き込むことは可能ですか?パッチ/差分ファイルにコメントを書き込む方法は?
svn red bookの情報が見つかりませんでした。パッチファイルの文法を見つけられなくても、自分自身を理解することができませんでした。
差分形式はちょうどunified diff formatです。あなたが望むなら、範囲情報の後ろにテキストを置くことができます。コマンドsvn diff -c 1544711 https://svn.apache.org/repos/asf/subversion/trunk
で生成この差分を考えてみましょう:
Index: subversion/mod_dav_svn/mod_dav_svn.c
===================================================================
--- subversion/mod_dav_svn/mod_dav_svn.c (revision 1544710)
+++ subversion/mod_dav_svn/mod_dav_svn.c (revision 1544711)
@@ -1097,7 +1097,8 @@
/* Fill the filename on the request with a bogus path since we aren't serving
* a file off the disk. This means that <Directory> blocks will not match and
- * that %f in logging formats will show as "svn:/path/to/repo/path/in/repo". */
+ * %f in logging formats will show as "dav_svn:/path/to/repo/path/in/repo".
+ */
static int dav_svn__translate_name(request_rec *r)
{
const char *fs_path, *repos_basename, *repos_path;
@@ -1146,7 +1147,7 @@
if (repos_path && '/' == repos_path[0] && '\0' == repos_path[1])
repos_path = NULL;
- /* Combine 'svn:', fs_path and repos_path to produce the bogus path we're
+ /* Combine 'dav_svn:', fs_path and repos_path to produce the bogus path we're
* placing in r->filename. We can't use our standard join helpers such
* as svn_dirent_join. fs_path is a dirent and repos_path is a fspath
* (that can be trivially converted to a relpath by skipping the leading
@@ -1154,7 +1155,7 @@
* repository is 'trunk/c:hi' this results in a non canonical dirent on
* Windows. Instead we just cat them together. */
r->filename = apr_pstrcat(r->pool,
- "svn:", fs_path, repos_path, SVN_VA_NULL);
+ "dav_svn:", fs_path, repos_path, SVN_VA_NULL);
/* Leave a note to ourselves so that we know not to decline in the
* map_to_storage hook. */
あなたがそのコマンドにオプション-x-p
を追加する場合は、あなたが得られます:関数は、範囲の行に@@
後に追加されるか
Index: subversion/mod_dav_svn/mod_dav_svn.c
===================================================================
--- subversion/mod_dav_svn/mod_dav_svn.c (revision 1544710)
+++ subversion/mod_dav_svn/mod_dav_svn.c (revision 1544711)
@@ -1097,7 +1097,8 @@ static int dav_svn__handler(request_rec *r)
/* Fill the filename on the request with a bogus path since we aren't serving
* a file off the disk. This means that <Directory> blocks will not match and
- * that %f in logging formats will show as "svn:/path/to/repo/path/in/repo". */
+ * %f in logging formats will show as "dav_svn:/path/to/repo/path/in/repo".
+ */
static int dav_svn__translate_name(request_rec *r)
{
const char *fs_path, *repos_basename, *repos_path;
@@ -1146,7 +1147,7 @@ static int dav_svn__translate_name(request_rec *r)
if (repos_path && '/' == repos_path[0] && '\0' == repos_path[1])
repos_path = NULL;
- /* Combine 'svn:', fs_path and repos_path to produce the bogus path we're
+ /* Combine 'dav_svn:', fs_path and repos_path to produce the bogus path we're
* placing in r->filename. We can't use our standard join helpers such
* as svn_dirent_join. fs_path is a dirent and repos_path is a fspath
* (that can be trivially converted to a relpath by skipping the leading
@@ -1154,7 +1155,7 @@ static int dav_svn__translate_name(request_rec *r)
* repository is 'trunk/c:hi' this results in a non canonical dirent on
* Windows. Instead we just cat them together. */
r->filename = apr_pstrcat(r->pool,
- "svn:", fs_path, repos_path, SVN_VA_NULL);
+ "dav_svn:", fs_path, repos_path, SVN_VA_NULL);
/* Leave a note to ourselves so that we know not to decline in the
* map_to_storage hook. */
注意を。行のこの部分は、diffを処理するソフトウェアによって無視されます。だから、自由にあなたが望むものを置くことができます。そこにあなたのコメントを置くことができます。
unidiff(unified diff)でなければハンクは除去ラインを意味するように追加された行、または'-'
を意味する'+'
、(不変の線のように)コンテキストを意味する' '
(空間)との各ラインを開始します。多くのパーサー(Subversionのsvn patchコマンドを含む)は他の文字で始まる行を破棄します。したがって、他の文字で始まる行を単純に挿入することができます。しかし、それは上記の方法と同じくらいポータブルであることは保証されていません。
+1コメントに '@@@'を使用すると便利ですので、コメントに含まれるものは 'patch'によって誤って重要であると解釈されないようにしたいと付け加えたいと思います。 –
これは実際にはSVN固有のものではなく、 '.patch' /' .diff'ファイルで動作します。だから私はSVNタグを削除しました。これはより多くの視聴者にこれをより明白な方法で役立てるためです。 –