You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gb...@apache.org on 2013/07/04 17:37:24 UTC
svn commit: r1499791 - in
/subversion/branches/invoke-diff-cmd-feature/subversion: include/svn_io.h
libsvn_subr/config_file.c libsvn_subr/io.c svn/svn.c
tests/cmdline/diff_tests.py
Author: gbg
Date: Thu Jul 4 15:37:23 2013
New Revision: 1499791
URL: http://svn.apache.org/r1499791
Log:
On the invoke-diff-cmd branch: Change %fn% syntax to ;fn. Update
documentation. Fix faulty variable declaration.
* subversion/include/svn_io.h
(svn_io_create_custom_diff_cmd): Document change of %fn% syntax to
;fn and how to escape the parse tokens.
* subversion/libsvn_subr/config_file.c
(svn_config_ensure): Change %fn% syntax to ;fn.
* subversion/libsvn_subr/io.c
(svn_io_create_custom_diff_cmd): Fix faulty variable declaration.
Change token_list from %fn% syntax to ;fn. Update comments to
reflect changes.
* subversion/svn/svn.c
(apr_getopt_option_t): Change %fn% syntax to ;fn. Document the
syntax.
* subversion/tests/cmdline/diff_tests.py
(diff_invoke_external_diffcmd): Change %fn% syntax to ;fn.
Modified:
subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h
subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/config_file.c
subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c
subversion/branches/invoke-diff-cmd-feature/subversion/svn/svn.c
subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/diff_tests.py
Modified: subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h?rev=1499791&r1=1499790&r2=1499791&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h Thu Jul 4 15:37:23 2013
@@ -2284,10 +2284,10 @@ svn_io_file_readline(apr_file_t *file,
*
* When used in a diff context: (responding parse tokens in braces)
*
- * @a label1 (%l1%) refers to the label of @a tmpfile1 (%f1) which is
+ * @a label1 (;l1) refers to the label of @a tmpfile1 (;f1) which is
* the pristine copy.
*
- * @a label2 (%l2%) refers to the label of @a tmpfile2 (%f2%) which
+ * @a label2 (;l2) refers to the label of @a tmpfile2 (;f2) which
* is the altered copy.
*
* When used in a diff3 context:
@@ -2298,15 +2298,18 @@ svn_io_file_readline(apr_file_t *file,
* @a label2 refers to the label of @a tmpfile2 which is the 'older'
* copy.
*
- * @a label3 (%l3%) refers to the label of @a base (%f3%) which is
+ * @a label3 (;l3) refers to the label of @a base (;f3) which is
* the 'base' copy.
*
+ * A parse token can be escaped by prefixing a ';'. Any other
+ * strings containing ';' are not affected.
+ *
* In general:
*
* @a cmd is a user defined string containing 0 or more parse tokens
* which are expanded by the required labels and filenames.
*
- * @a scratch_pool is used for temporary allocations.
+ * @a pool is used for temporary allocations.
*
* @return A NULL-terminated character array.
*
@@ -2320,7 +2323,7 @@ svn_io_create_custom_diff_cmd(const char
const char *tmpfile2,
const char *base,
const char *cmd,
- apr_pool_t *scratch_pool);
+ apr_pool_t *pool);
/** Run the external diff command defined by the invoke-diff-cmd
* option.
Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/config_file.c?rev=1499791&r1=1499790&r2=1499791&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/config_file.c Thu Jul 4 15:37:23 2013
@@ -1088,7 +1088,7 @@ svn_config_ensure(const char *config_dir
"### program." NL
"### This will override the compile-time default, which is to use" NL
"### Subversion's internal diff implementation." NL
- "# invoke-diff-cmd = \"diff -y --label %l1% %f1% --label %l2% %f2%\""NL
+ "# invoke-diff-cmd = \"diff -y --label ;l1 ;f1 --label ;l2 ;f2\"" NL
"### Set merge-tool-cmd to the command used to invoke your external" NL
"### merging tool of choice. Subversion will pass 5 arguments to" NL
"### the specified command: base theirs mine merged wcfile" NL
Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c?rev=1499791&r1=1499790&r2=1499791&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c Thu Jul 4 15:37:23 2013
@@ -2931,10 +2931,10 @@ svn_io_create_custom_diff_cmd(const char
const char *cmd,
apr_pool_t *pool)
{
- apr_pool_t *scratch_pool = svn_pool_create(pool);;
apr_array_header_t *tmp;
const char ** result;
int argv;
+ apr_pool_t *scratch_pool = svn_pool_create(pool);;
tmp = svn_cstring_split(cmd, " ", TRUE, scratch_pool);
@@ -2953,7 +2953,7 @@ svn_io_create_custom_diff_cmd(const char
for (i = 0; i < 6 /* sizeof(token_list) */; i++)
{
static const char *token_list[] =
- {"%f1%","%f2%", "%f3%", "%l1%", "%l2%","%l3%" };
+ {";f1",";f2", ";f3", ";l1", ";l2",";l3" };
svn_stringbuf_t *token;
int len;
char *found;
@@ -2967,26 +2967,26 @@ svn_io_create_custom_diff_cmd(const char
{
len = strlen(found);
- /* if we find a % in front of this, consume it */
+ /* if we find a semi-colon in front of this, consume it */
if (found > 0 && /* ensure there is a char in front */
- (com->data[com->len - (len-1)] == '%'))
+ (com->data[com->len - (len-1)] == ';'))
svn_stringbuf_remove(com, len-1, 1);
- else if (i == 0) /* %f1 */
+ else if (i == 0) /* f1 */
svn_stringbuf_replace(com, com->len - len, token->len,
tmpfile1, strlen(tmpfile1));
- else if (i == 1) /* %f2 */
+ else if (i == 1) /* f2 */
svn_stringbuf_replace(com, com->len - len, token->len,
tmpfile2, strlen(tmpfile2));
- else if (i == 2) /* %f3 */
+ else if (i == 2) /* f3 */
svn_stringbuf_replace(com, com->len - len, token->len,
base, strlen(base));
- else if (i == 3) /* %l1 */
+ else if (i == 3) /* l1 */
svn_stringbuf_replace(com, com->len - len, token->len,
label1, strlen(label1));
- else if (i == 4) /* %l2 */
+ else if (i == 4) /* l2 */
svn_stringbuf_replace(com, com->len - len, token->len,
label2, strlen(label2));
- else if (i == 5) /* %l3 */
+ else if (i == 5) /* l3 */
svn_stringbuf_replace(com, com->len - len, token->len,
label3, strlen(label3));
}
Modified: subversion/branches/invoke-diff-cmd-feature/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/svn/svn.c?rev=1499791&r1=1499790&r2=1499791&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/svn/svn.c (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/svn/svn.c Thu Jul 4 15:37:23 2013
@@ -342,23 +342,29 @@ const apr_getopt_option_t svn_cl__option
" "
"invocation. \n \n"
" "
- "Substitutions: %f1% original file \n"
+ "Substitutions: ;f1 original file \n"
" "
- " %f2% changed file \n"
+ " ;f2 changed file \n"
" "
- " %l1% label of the original file \n"
+ " ;l1 label of the original file \n"
" "
- " %l2% label of the changed file \n"
+ " ;l2 label of the changed file \n"
" "
- "Examples: --invoke-diff-cmd=\"diff -y %f1% %f2%\" \n"
+ "Examples: --invoke-diff-cmd=\"diff -y ;f1 ;f2\" \n"
" "
" --invoke-diff-cmd=\"kdiff3 -auto -o /home/u/log \\ \n"
" "
- " +%f1% %f2% --L1 %l1% --L2 \"Custom Label\" \" \n"
+ " +;f1 ;l2 --L1 ;l1 --L2 \"Custom Label\" \" \n"
" "
- "The switch symbol '%' can be escaped in the usual way \n"
+ "The delimiter ';' can be escaped in case ';f1', ';f2',\n"
" "
- "using the '%' character: %%f1% will be passed as %f1%. \n"
+ "';l1' and ';l2' should be preserved. Ie. ';;f1' will \n"
+ " "
+ "be rendered as ';f1' and ';;;;f1' as ';;;f1'. \n"
+ " "
+ "Any other instances of ';' or multiples thereof not \n"
+ " "
+ "accompanied by f1, f2, l1 or l3 will not be modified. \n"
)},
{"internal-diff", opt_internal_diff, 0,
N_("override diff-cmd specified in config file")},
Modified: subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/diff_tests.py?rev=1499791&r1=1499790&r2=1499791&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/diff_tests.py Thu Jul 4 15:37:23 2013
@@ -3288,7 +3288,7 @@ def diff_invoke_external_diffcmd(sbox):
svntest.actions.run_and_verify_svn(None, expected_output, [],
'diff',
- '--invoke-diff-cmd='+diff_script_path+' %l1% %f1% %l2% %f2%',
+ '--invoke-diff-cmd='+diff_script_path+' ;l1 ;f1 ;l2 ;f2',
iota_path)
#----------------------------------------------------------------------