[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Extra options for libsvn_diff

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2006-02-15 23:44:54 CET

Hi,

I've been spending some time in libsvn_diff/diff_file.c implementing
options to ignore whitespace, eol-style and the -p option of GNU diff
(--show-c-function).

The patch is nearly complete. Some cleanups are remaining and I'll write
some tests. I've tested it with very small chunk sizes to shake out most
bugs (I hope), but since this gets rather hairy (at least for me), some
more eyes would really be appreciated. Oh, and ofcourse, the patch was
produced using the -p option:-)

[[[
### NOTE: Nearly complete patch; don't commit yet!

Add options to ignore whitespace (all whitespace and changes in sequences
of whitespace), to ignore EOL style and to output the most recent C
function (or similar) to our internal diff library. Use this functionality
in the client diff functions.

This commit also supports ignoring whitespace and EOL style for the diff3
and diff4 implementations, which is not used yet. Coming commits will
use this new stuff in blame and merge as well.

* subversion/include/svn_diff.h
  (svn_diff_file_ignore_space_t): New enum.
  (svn_diff_file_options_t): New struct.
  (svn_diff_file_options_create, svn_diff_file_options_parse): New functions.
  (svn_diff_file_diff_2, svn_diff_file_diff3_2, svn_diff_file_diff4_2): New
  version of the corresponding existing function, with an options argument.
  (svn_diff_file_diff, svn_diff_file_diff3, svn_diff_file_diff4): Deprecate.

* subversion/libsvn_diff/diff_file.c
  (svn_diff__file_token_t): Add raw_length field. Add docstrings.
  (normalize_state_t): New enum.
  (svn_diff__file_baton_t): Add options and normalize_state fields.
  Add some docstrings.
  (normalize): New function.
  (svn_diff__file_datasource_get_next_token): Normalize the read token.
  Initialize raw_length of the token.
  (svn_diff__file_token_compare): Normalize chunks when read from disk.
  (SVN_DIFF__OPT_IGNORE_EOL_STYLE): New macro.
  (diff_options): New array of options.
  (svn_diff_file_options_create, svn_diff_file_options_parse): New functions.
  (svn_diff_file_diff_2, svn_diff_file_diff3_2, svn_diff_file_diff4_2): New
  versions of the old APIs. Take care of the options.
  (svn_diff_file_diff, svn_diff_file_diff3, svn_diff_file_diff4): Wrap the
  new functions.
  (SVN_DIFF__EXTRA_CONTEXT_LENGTH): New macro.
  (svn_diff__file_output_baton_t): Add options, extra_context and
  hunk_extra_context fields.
  (svn_diff__file_output_unified_line): Keep track of an extra context line
  if show_c_function is set.
  (svn_diff__file_output_unified_flush_hunk): Output the extra context line
  in the @@ line if available.
  (svn_diff__file_output_unified_diff_modified): When initializing a new
  hunk, copy the extra context line and adjust it for output.
  (svn_diff_file_output_unified3): New version of the old API, taking care of
  the options and using them instead of the header_encoding argument.
  Initalize baton.extra_context.
  (svn_diff_file_output_unified2): Wrap the new API with default options.
  (svn_diff3__file_output_common): Output lines from the modified file instead
  of the original.

* subversion/libsvn_client/diff.c
  (diff_content_changed): Use the new APIs to support the new options.
]]]

Thanks,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Wed Feb 15 23:46:41 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.