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/10/16 02:36:27 UTC
svn commit: r1532607 - in /subversion/branches/invoke-diff-cmd-feature:
BRANCH-README subversion/include/svn_io.h subversion/libsvn_client/diff.c
subversion/libsvn_subr/io.c subversion/svn/svn.c
Author: gbg
Date: Wed Oct 16 00:36:26 2013
New Revision: 1532607
URL: http://svn.apache.org/r1532607
Log:
On the invoke-diff-cmd branch: Trivial changes.
Modified:
subversion/branches/invoke-diff-cmd-feature/BRANCH-README
subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h
subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_client/diff.c
subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c
subversion/branches/invoke-diff-cmd-feature/subversion/svn/svn.c
Modified: subversion/branches/invoke-diff-cmd-feature/BRANCH-README
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/BRANCH-README?rev=1532607&r1=1532606&r2=1532607&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/BRANCH-README (original)
+++ subversion/branches/invoke-diff-cmd-feature/BRANCH-README Wed Oct 16 00:36:26 2013
@@ -19,7 +19,7 @@ which are passed as the diff program via
What --invoke-diff-cmd and --invoke-diff3-cmd provide
-------------------------------------------------------
+=====================================================
Users can type 'free-style' command lines for their selected
diff/merge program, from 'svn help diff':
@@ -39,8 +39,9 @@ diff/merge program, from 'svn help diff'
The delimiter ';' can be escaped by adding a ';', which will be
consumed in the process. The delimiter can appear anywhere in the
- string, ie, file=;f1 will expand as expected and file=;;f1 will be
- rendered as file=;f1.
+ string, ie, file=;f1 will expand as expected and file=;;f1+ will be
+ rendered as file=;f1+.
+
Structure of the feature:
=========================
@@ -51,18 +52,17 @@ API components
./subversion/libsvn_subr/io.c:3030 __create_custom_diff_cmd()
transforms the user input 'invoke-diff-cmd' into a command line
- call by substitution the file names, whilst leaving everything else
- untouched. This is more of an internal routine and probably not
- well placed in the API. It will be reused for the merge part of
- this project.
+ call by substitution the labels and file names(where defined),
+ whilst leaving everything else untouched. This is more of an
+ internal routine and probably not well placed in the public API.
+ It will be reused for the merge part of this project.
- NOTE:
./subversion/libsvn_subr/io.c:3108 svn_io_run_external_diff()
- calls svn_io_create_custom_diff_cmd() and does all the error
- checking required, before routing the result to the actual call to
- the APR routine that makes it.
+ calls __create_custom_diff_cmd() and does all the error checking
+ required, before routing the result to the actual call to the APR
+ routine that makes it.
UI components
@@ -87,23 +87,22 @@ UI components
Changes to the existing code structure:
=======================================
-the original --diff-cmd parsing and routing code has been deprecated
+The original --diff-cmd parsing and routing code has been refactored
and the call to --diff-cmd is now handled by the
-svn_io_create_custom_diff_cmd() and svn_io_run_external_diff()
-routines. All the original functionality and user syntax has been
-retained.
+__create_custom_diff_cmd() and svn_io_run_external_diff() routines.
+All the original functionality and user syntax has been retained.
-TESTS
-=====
-The test for this feature is
+Tests
+=====
-/subversion/tests/cmdline/diff_tests.py diff_invoke_external_diffcmd
+The test for the 'invoke-diff-cmd' feature is
+ /subversion/tests/cmdline/diff_tests.py diff_invoke_external_diffcmd
The test for the updated --diff-cmd is
-/subversion/tests/cmdline/diff_tests.py diff_external_diffcmd
+ /subversion/tests/cmdline/diff_tests.py diff_external_diffcmd
TODO:
@@ -124,8 +123,27 @@ TODO:
http://subversion.tigris.org/issues/show_bug.cgi?id=3836
-Log messages of Salient Code changes with minor fixes and reverts omitted:
-==========================================================================
+Review tools
+============
+
+The entire code of the branch can be obtained thus:
+
+svn diff ^/subversion/trunk@1531612\
+ ^/subversion/branches/invoke-diff-cmd-feature
+
+To obtain a visitable list of files with line numbers in the Emacs
+compilation buffer:
+
+M-x cd /branches/invoke-diff-cmd-feature/
+M-x compile
+svn diff ^/subversion/trunk@1531612\
+ ^/subversion/branches/invoke-diff-cmd-feature |\
+ perl -ne '/Index: (.*)$/ && ($name = $1);
+ /^@@.*\+(\d+),/ && print "./$name:$1:diff\n";'
+
+
+Log messages of salient code changes
+====================================
* subversion/include/svn_client.h
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=1532607&r1=1532606&r2=1532607&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 Wed Oct 16 00:36:26 2013
@@ -1821,7 +1821,8 @@ svn_io_run_cmd(const char *path,
* @a diff_cmd must be non-NULL.
*
* Do all allocation in @a pool.
- * @since New in 1.6.0. */
+ * @since New in 1.6.0.
+ */
svn_error_t *
svn_io_run_diff2(const char *dir,
const char *const *user_args,
Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_client/diff.c?rev=1532607&r1=1532606&r2=1532607&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_client/diff.c Wed Oct 16 00:36:26 2013
@@ -833,7 +833,7 @@ diff_content_changed(svn_boolean_t *wrot
svn_io_file_del_on_pool_cleanup,
scratch_pool, scratch_pool));
- /* "." is a non-canonical path for the diff process's working directory. */
+ /* "." is a non-canonical path for the diff process's working directory. */
if (diff_cmd_baton->diff_cmd)
SVN_ERR(svn_io_run_diff2(".",
diff_cmd_baton->options.for_external.argv,
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=1532607&r1=1532606&r2=1532607&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 Wed Oct 16 00:36:26 2013
@@ -3071,7 +3071,6 @@ __create_custom_diff_cmd(const char *lab
word = svn_stringbuf_create_empty(scratch_pool);
svn_stringbuf_appendcstr(word, APR_ARRAY_IDX(words, item, char *));
-
if ( (word->data[0] == '"') && (word->data[word->len-1] != '"') )
{
@@ -3108,8 +3107,7 @@ __create_custom_diff_cmd(const char *lab
len = word->len - strlen(found) - 1;
/* if we find a protective semi-colon in front of this, consume it */
- if ( (len >= 0)
- && (word->data[len] == ';') )
+ if ( (len >= 0) && (word->data[len] == ';') )
svn_stringbuf_remove(word, len, 1);
else
{
@@ -3123,7 +3121,6 @@ __create_custom_diff_cmd(const char *lab
result[argv] = word->data;
}
result[argv] = NULL;
-
svn_pool_destroy(scratch_pool);
return result;
}
@@ -3155,6 +3152,16 @@ svn_io_run_external_diff(const char *dir
SVN_ERR(svn_io_run_cmd(dir, cmd[0], cmd, pexitcode, NULL, TRUE,
NULL, outfile, errfile, pool));
+ /* The man page for (GNU) diff describes the return value as:
+
+ "An exit status of 0 means no differences were found, 1 means
+ some differences were found, and 2 means trouble."
+
+ A return value of 2 typically occurs when diff cannot read its input
+ or write to its output, but in any case we probably ought to return an
+ error for anything other than 0 or 1 as the output is likely to be
+ corrupt.
+ */
if (*pexitcode != 0 && *pexitcode != 1)
{
int i;
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=1532607&r1=1532606&r2=1532607&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/svn/svn.c (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/svn/svn.c Wed Oct 16 00:36:26 2013
@@ -370,7 +370,9 @@ const apr_getopt_option_t svn_cl__option
" "
"appear anywhere in the string, ie, file=;f1 will expand\n"
" "
- "as expected and file=;;f1 will be rendered as file=;f1.\n"
+ "as expected and file=;;f1+ will be rendered as \n"
+ " "
+ "file=;f1+.\n"
)},
{"internal-diff", opt_internal_diff, 0,
N_("override diff-cmd specified in config file")},
@@ -2584,8 +2586,8 @@ sub_main(int argc, const char *argv[], a
return EXIT_ERROR(err);
}
- /* Disallow simultaneous use of both --diff-cmd, --invoke-diff-cmd
- and --internal-diff. */
+ /* Disallow simultaneous use of --diff-cmd, --invoke-diff-cmd and
+ --internal-diff. */
if (opt_state.diff.diff_cmd && opt_state.diff.internal_diff)
{
err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
@@ -2826,8 +2828,8 @@ sub_main(int argc, const char *argv[], a
svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
SVN_CONFIG_OPTION_DIFF_CMD, opt_state.diff.diff_cmd);
if (opt_state.diff.invoke_diff_cmd)
- svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
- SVN_CONFIG_OPTION_INVOKE_DIFF_CMD, opt_state.diff.invoke_diff_cmd);
+ svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
+ SVN_CONFIG_OPTION_INVOKE_DIFF_CMD, opt_state.diff.invoke_diff_cmd);
if (opt_state.merge_cmd)
svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
SVN_CONFIG_OPTION_DIFF3_CMD, opt_state.merge_cmd);