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/26 23:12:37 UTC
svn commit: r1536037 -
/subversion/branches/invoke-diff-cmd-feature/BRANCH-README
Author: gbg
Date: Sat Oct 26 21:12:37 2013
New Revision: 1536037
URL: http://svn.apache.org/r1536037
Log:
On the invoke-diff-cmd-feature branch: Update BRANCH-README file.
* BRANCH-README: Update.
Modified:
subversion/branches/invoke-diff-cmd-feature/BRANCH-README
Modified: subversion/branches/invoke-diff-cmd-feature/BRANCH-README
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/BRANCH-README?rev=1536037&r1=1536036&r2=1536037&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/BRANCH-README (original)
+++ subversion/branches/invoke-diff-cmd-feature/BRANCH-README Sat Oct 26 21:12:37 2013
@@ -7,8 +7,13 @@ expected to be reintegrated back thereto
See: http://subversion.tigris.org/issues/show_bug.cgi?id=2044 for the
original motivation for this project.
+
+======================================================================
+ INVOKE-DIFF-CMD SECTION
+======================================================================
+
--invoke-diff-cmd allows command line selection of an external diff
-program and will be extended to cover the existing diff3 option with
+program and will be extended to cover the existing diff3 option with a
similar --invoke-diff3-cmd option.
Currently this capability is provided by user written shell scripts
@@ -18,29 +23,42 @@ which are passed as the diff program via
'svnlook' and the config file.
-What --invoke-diff-cmd and --invoke-diff3-cmd provide
-------------------------------------------------------
+What --invoke-diff-cmd provides
+===============================
Users can type 'free-style' command lines for their selected
-diff/merge program, from 'svn help diff':
+diff/merge program, and optionally select a diff command file that
+applies stored commands to selected files. If the file diffed is not
+in the list, the given command will be used instead.
+
+from 'svn help diff':
--invoke-diff-cmd ARG:
- use ARG as format string for external diff command
- invocation.
-
- Substitutions: ;f1 original file
- ;f2 changed file
- ;l1 label of the original file
- ;l2 label of the changed file
- Examples: --invoke-diff-cmd="diff -y ;f1 ;f2"
- --invoke-diff-cmd="kdiff3 -auto -o /home/u/log \
- +;f1 ;l2 --L1 ;l1 --L2 "Custom Label" "
-
- 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.
+ : use ARG as format string for external diff command
+ invocation.
+
+ Substitutions: %svn_new% new file
+ %svn_old% old file
+ %svn_new_label% label of the new file
+ %svn_old_label% label of the old file
+ Examples:
+ --invoke-diff-cmd='diff -y %svn_new% %svn_old%'
+ --invoke-diff-cmd="kdiff3 -auto -o /home/u/log \
+ %svn_new% %svn_old% --L1 %svn_new_label% \
+ --L2 "Custom Label" '
+ Other constructs possible are:
+ +%svn_new%, %svn_new%- and +++%svn_new_label%+++
+ With optional switch given at the start of the command:
+ --svn-cfg-file=/path/to/config-file (automatic)
+ Read config file, apply the diff-cmds stored in there
+ --query-cfg-file=/path/to/config-file (interactive)
+ As above, but query interactively.
+ Example: svn diff --invoke-diff-cmd='--svn-cfg-file\
+ /home/user/diff_cmds diff -u %svn_new% %svn-old%'
+ Config file format: (accepts # comments)
+ relative/path/to/file/ = diff %svn_new% ...
+
Structure of the feature:
=========================
@@ -48,22 +66,27 @@ Structure of the feature:
API components
--------------
- ./subversion/libsvn_subr/io.c:3030 __create_custom_diff_cmd()
+ ./subversion/libsvn_subr/io.c __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.
-
- 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.
-
+ 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.
+
+
+ ./subversion/libsvn_subr/io.c svn_io_run_external_diff()
+
+ 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.
+
+
+ ./subversion/libsvn_subr/io.c svn_io_parse_diff_cmd_file()
+
+ temporary installation pending refactor of
+ svn_io_parse_mimetypes_file().
+
UI components
-------------
@@ -83,34 +106,54 @@ UI components
one of --invoke-diff-cmd, --diff-cmd or --internal-diff-cmd are
invoked.
+Issues with the current implementation
+======================================
+
+The --svn-cfg-query switch has not been implemented yet.
+
+The function that reads the file (svn_io_parse_diff_cmd_file) is
+currently copy pasta from (svn_io_parse_mimetypes_file) with slightly
+altered internal logic, and should be refactored to make a new general
+function svn_io_read_text_file() which delivers an apr_array_header_t
+object to the caller that contains all the lines read, who then can
+operate on that delivery in place.
+
+The diff_cmd_config file is read a-new again every time, it would
+probably be better to pass diff_baton directly into
+svn_io_run_external_diff and store the value there for re-use. Then
+again this might be a terrible idea if the diff_cmd_config file gets
+large.
+
+
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:
====
- * add invoke-diff-cmd option to the blame section
-
- * add help info to log, svnlook, blame
+ * refactor svn_io_parse_mimetypes_file() into a more general
+ svn_io_read_text_file().
+
+ * add code for the interactive switch, bearing in mind 3rd party
+ clients.(needs more research)
* Adding invoke-diff-cmd to merge:
add --invoke-diff-3-cmd using the svn_io_create_custom_diff_cmd()
@@ -125,4 +168,170 @@ TODO:
http://subversion.tigris.org/issues/show_bug.cgi?id=3836
+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 (not including the per file feature)
+=========================================================================
+
+* subversion/include/svn_client.h
+
+ (svn_client_diff7, svn_client_diff_peg7): Declare the new API. Like
+ svn_client_diff[_peg]6 but with invoke_diff_cmd parameter.
+
+ (svn_client_diff6, svn_client_diff_peg_6): Deprecate.
+
+
+* subversion/svn/log-cmd.c
+
+ (svn_client_diff_peg7): Update call to svn_client_diff_peg6 to
+ svn_client_diff_peg7.
+
+ (log_receiver_baton): New struct member invoke_diff_cmd.
+
+ (display_diff): New parameter 'invoke_diff_cmd' . Pass
+ invoke_diff_cmd parameter into svn_client_diff_peg7().
+
+ (log_entry_receiver): Pass invoke_diff_cmd into display_diff().
+
+ (svn_cl__log): Ensure mutual exclusions between invoke_diff_cmd and
+ quiet and diff-cmd, require 'diff' option. Populate
+ log_receiver_baton member invoke_diff_cmd.
+
+ (svn_cl__options): Expand help info for invoke-diff-cmd option.
+
+
+* subversion/include/svn_config.h
+
+ (SVN_CONFIG_OPTION_INVOKE_DIFF_CMD): New definition.
+
+
+* subversion/include/svn_io.h
+
+ (svn_io_create_custom_diff_cmd): New function.
+
+ (svn_io_run_external_diff): New function.
+
+ (svn_io_run_diff2): Deprecate function.
+
+
+* subversion/libsvn_client/deprecated.c
+
+ (svn_client_diff6, svn_client_diff_peg6): New deprecation wrappers.
+
+
+* subversion/libsvn_client/diff.c
+
+ (struct diff_cmd_baton): New member: 'invoke_diff_cmd'.
+
+ (diff_content_changed): Call svn_io_run_external_diff if
+ --invoke-diff-cmd option was specified, otherwise retain previous
+ behaviour.
+
+ (set_up_diff_cmd_and_options): Apply invoke-diff-cmd option
+ preferentially. Old behaviour unchanged.
+
+ (svn_client_diff_peg_7): Rename and update from
+ svn_client_diff_peg_6. Add new parameter: invoke_diff_cmd.
+
+ (svn_client_diff7): Rename and update from svn_client_diff6, add
+ new parameter 'invoke_diff_cmd'.
+
+ (): Update all comments mentioning 'svn_client_diff6' to
+ 'svn_client_diff7'.
+
+ (diff_content_changed): Raise an error if both diff_cmd and
+ invoke-diff-cmd are set.
+
+
+* subversion/libsvn_subr/config_file.c
+
+ (svn_config_ensure): New entry: invoke-diff-cmd.
+
+
+* subversion/libsvn_subr/io.c
+
+ (svn_io_create_custom_diff_cmd): New function.
+
+ (svn_io_run_external_diff): New function.
+
+
+* subversion/svn/cl.h
+
+ (struct svn_cl__opt_state_t.diff): New member: 'invoke_diff_cmd'.
+
+
+* subversion/svn/diff-cmd.c
+
+ (svn_cl__diff): Update call to svn_client_diff6 to svn_client_diff7.
+
+
+* subversion/svn/svn.c
+
+ (svn_cl__options[]): Add help info and new variable:
+ 'opt_invoke_diff_cmd'.
+
+ (svn_cl__cmd_table[]): New option: 'invoke-diff-cmd'.
+
+ (sub_main): Prohibit simultaneous usage of --invoke-diff-cmd and
+ --internal-diff. Add new opt_state.diff.invoke-diff-cmd option
+ to the option selector. Add call to svn_config_set.
+
+ (svn_cl__cmd_table): Add opt_invoke_diff_cmd to the list of valid
+ sub-commands.
+
+ (sub_main): Add guard against concurrent usage of incompatible diff
+ options. Remove previous guard code.
+
+
+* subversion/tests/cmdline/diff_tests.py
+
+ (diff_invoke_external_diffcmd): New function.
+
+ (test_list): Add new entry 'diff_invoke_external_diffcmd'.
+
+
+* subversion/include/svn_error_codes.h
+
+ (SVN_CLIENT_DIFF_CMD): New macro.
+
+
+* subversion/svnlook/svnlook.c
+
+ (enum): New variable svnlook__invoke_diff_cmd.
+
+ (options_table[]): New entry 'invoke-diff-cmd'.
+
+ (cmd_tablcmd[]): Add svnlook__invoke_diff_cmd to diff cmd table
+ entry.
+
+ (svnlook_opt_state): New member variable "invoke_diff_cmd".
+
+ (svnlook_ctxt_t): New member variable "invoke_diff_cmd".
+
+ (print_diff_tree): Modify if condition to include new
+ invoke_diff_cmd. Add conditional call to
+ /include/svn_io.c:svn_io_run_external_diff().
+
+ (get_ctxt_baton): Assign invoke_diff_cmd data.
+
+ (main): Assign opt_arg to opt_state.invoke_diff_cmd. Add
+ exclusiveness test for invoke_diff_cmd and diff_cmd.
+