Daniel Näslund <daniel@longitudo.com>

Patch Suggested
r907089, r907043, r906588, r905750, r904280, r904186, r903181, r902116, r902093, r892903, r887867, r883643, r880566, r880565, r880543, r880519, r880515, r880489, r880463, r880446, r879584, r879385, r879047, r879040, r878967, r878852, r878826, r878770, r878695, r878642 r880469

r907089 | stsp | 2010-02-05 15:01:27 -0600 (Fri, 05 Feb 2010)

* subversion/tests/cmdline/patch_tests.py
  (patch_with_fuzz): For determining fuzz we have an algorithm that
   should only check for trailing and leading context. Make this test
   verify that this property of the algorithm holds by adding context
   in the middle of one of the hunks. Also fix an indentation error.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r907043 | cmpilato | 2010-02-05 12:41:47 -0600 (Fri, 05 Feb 2010)

On the '1.6.x-issue3390' branch, feign a backport of the issue 3390
fix by applying Daniel Näslund's backport patch, and then using 'svn
merge --record-only' to claim that this was a merge of r877016 and
r902093 from trunk.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r906588 | stsp | 2010-02-04 12:06:55 -0600 (Thu, 04 Feb 2010)

Fix bug with 'svn patch' not recognizing hunks with missing newline at
end of patch file.

* subversion/libsvn_diff/parse-diff.c
  (parse_next_hunk): Don't stop reading lines until we've reached eof
    and the line read is empty.

* subversion/tests/cmdline/patch_tests.py
  (patch_with_fuzz): Make this test check for regression by removing
   the newline from the end of the patch used in this test.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r905750 | stsp | 2010-02-02 13:12:45 -0600 (Tue, 02 Feb 2010)

Add notifications for hunks applied with fuzz.

* subversion/tests/cmdline/patch_tests.py
  (patch_with_fuzz): Add a line to the target to cause one hunk to apply
    with offset and fuzz. With that we have all kinds of currently known
    patch notifications tested.

* subversion/svn/notify.c
  (notify): Print a message for three different cases; fuzz, offset and

* subversion/include/svn_wc.h
  (svn_wc_notify_t): Add a new field hunk_fuzz.

* subversion/libsvn_client/patch.c
  (maybe_send_patch_notifications): Set the value of hunk_fuzz.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r904280 | stsp | 2010-01-28 16:20:32 -0600 (Thu, 28 Jan 2010)

Fix #3460 - svn patch is not fuzzy when applying unidiffs.

* subversion/include/private/svn_diff_private.h
  (svn_hunk_t): Add fields leading_context and trailing_context. They are
   used for determining if there is enough context to apply a patch
   with fuzz.

* subversion/libsvn_client/patch.c
  (hunk_info_t): Add field FUZZ.
  (match_hunk): Add new parameter FUZZ, specifying how many lines
   at the beginning and end of the hunk will always match.
   Ignore FUZZ if there isn't enough context to do fuzzy matching.
  (scan_for_match): Add new parameter FUZZ. Call match_hunk() with FUZZ.
  (get_hunk_info): Add new parameter FUZZ. Call scan_for_match() with
   FUZZ. Save FUZZ in HI for later use. Set HI->rejected to TRUE
   if no line can be found where the hunk applies.
  (copy_hunk_text): Remove. This interface cannot cope well enough
   with hunks applied with fuzz.
  (reject_hunk): Re-implement parts of copy_hunk_text() inline,
   copying the hunk's diff text to the target's reject stream.
  (apply_one_hunk): Rename to ...
  (apply_hunk): ... this, because it is the brother-in-law of reject_hunk().
   Re-implement parts of copy_hunk_text inline, copying hunk's modified
   text to the patched result. Except lines which matched with fuzz, because
   those must be copied verbatim from the target to retain the local changes
   which made fuzzy matching necessary.
  (apply_one_patch): Call get_hunk_info() repeatedly with increasing
   fuzz factor until either the hunk matches or the maximum fuzz
   factor is reached. Track renaming and removal of functions.

* subversion/libsvn_diff/parse-diff.c
  (parse_next_hunk): Count number of lines of context at start and end
   of hunk and save the information in hunk. Refactored some if
   statements for increased readability.

* subversion/tests/cmdline/patch_tests.py
  (patch_with_fuzz): New.
  (test_list): Add new test.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
Review by: julianfoad (older version)

r904186 | stsp | 2010-01-28 11:53:42 -0600 (Thu, 28 Jan 2010)

* subversion/libsvn_client/patch.c
  (maybe_send_patch_notification): Fix reporting of modified_length during
   hunk notifications.

* subversion/tests/cmdline/patch_tests.py
  (patch_offset): Adjust expected_output.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r903181 | stsp | 2010-01-26 05:35:56 -0600 (Tue, 26 Jan 2010)

Fix issue #3493 - svn patch skips missing dirs.
Also use wc-ng-style write locks as much as possible,
and add drops of coding-style improvements here and there.

* subversion/libsvn_client/patch.c
  (): Include client.h for svn_client__make_local_parents().
  (patch_target_t): New field PARENT_DIR_EXISTS.
  (resolve_target_path): Use WC APIs rather than svn_io to get
   information about nodes. Skip obstructed and ignored targets
   as well as unversioned targets. Replace use of entry_t with
   use of wc-ng node APIs. If the target's parent directory does
   not exist or is scheduled for deletion, set
   TARGET->PARENT_DIR_EXISTS to false instead of skipping the target.
   Also let this function determine TARGET->ADDED, rather than doing
   that near the end of the patching process.
 (maybe_send_patch_notification): Cope with target node-kinds of
  svn_node_unknown, which the wc-ng APIs can return.
 (apply_one_patch): Un-constify CTX parameter. Exit early if
  the target is skipped, so we can snip an indentation level
  from code below this check. Remove a useless comment.
  Don't set TARGET->ADDED anymore since that's now handled by
  resolve_target_path(). If the parent directory of the target
  does not exist, create it during normal runs. During dry-runs,
  just check if it could be created.
  Grab an adm_access lock in case we're deleting the target,
  since svn_wc_delete4() fails otherwise.
 (apply_patches_baton_t): New baton.
 (apply_textdiffs): Rename to  ...
 (apply_patches): ... this, and relocate all arguments passed to
  this function into the above-mentioned baton so we can call the
  function with a wc-ng-style write lock held.
 (svn_client_patch): Replace use of adm_access with wc-ng-style
  write locks.

* subversion/tests/cmdline/patch_tests.py
  (patch_add_new_dir): New. Tests for adding files with missing dirs,
   and the case where one of the dirs above the target is scheduled
   for deletion.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r902116 | stsp | 2010-01-22 09:27:13 -0600 (Fri, 22 Jan 2010)

Replace deprecated svn_wc_{crawl_revisions4(),get_update_editor3()}.
Remove a call to svn_wc_edited_externals().

* subversion/libsvn_client/update.c
  (svn_client__update_internal): Use the new get_update_editor4()
    and crawl_revisions5() with wc_ctx and external_func.
    Remove a call to svn_wc_edited_externals() since we already
    have the hashtables from our external_func.

Patch by: <daniel{_AT_}longitudo.com>

r902093 | stsp | 2010-01-22 08:23:45 -0600 (Fri, 22 Jan 2010)

Fix issue #3390, relative externals not updated during switch. As a side
effect - allow externals hash diff functionality to be used with abspaths.

* subversion/libsvn_client/switch.c
  (svn_client__switch_internal): Pass in an external_func to

* subversion/libsvn_client/externals.c
  (handle_externals_desc_change): Get the url for parent_dir with
    svn_wc__node_get_url(). Does not work for export where the
    parent_dir has no url. Then we resort to the old way of adding the
    parent_dir to the from_url.

* subversion/tests/cmdline/externals_tests.py
  (test_list): Remove XFail from switch_relative_external.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
Review by: stsp
           philip (older version)

r892903 | philip | 2009-12-21 11:48:06 -0600 (Mon, 21 Dec 2009)

Use recursive locking when deleting an external. No need to make a
distinction between files and dirs as the previous code did.

* subversion/libsvn_client/externals.c
  (handle_external_item_change): Remove the adm_access functions and use
    svn_wc_{acqurire,release}write_lock instead and svn_wc_locked2()

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
Review by: me

r887867 | philip | 2009-12-07 03:39:52 -0600 (Mon, 07 Dec 2009)

When updating to lose an external, the code should handle a locally missing
externals item, and it does. Add a test for this in an existing test case.

* subversion/tests/cmdline/externals_tests.py
  (update_lose_external): Remove one externals wc dir.

Patch by: Daniel Näslund <daniel@longitudo.com>

r883643 | stsp | 2009-11-24 04:18:54 -0600 (Tue, 24 Nov 2009)

* subversion/svn/main.c
  (svn_cl__cmd_table): In the svn:externals documentation of 'svn help
   propset', provide an example for using a peg revision, and also document
   that it is possible to put comments into externals definitions.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
(tweaked by me)

r880566 | julianfoad | 2009-11-12 17:37:51 -0600 (Thu, 12 Nov 2009)

Replace deprecated svn_path_join().

* subversion/svn/cl.h
  (svn_cl__path_join): New.

* subversion/svn/util.c
  (svn_cl__path_join): Wrap svn_path_join().

* subversion/svn/diff-cmd.c
  (svn_cl__diff, summarize_xml, summarize_regular): Replace svn_path_join()
    with svn_cl__path_join() since the resulting path is allowed to be both
    uri and dirent.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
Suggested by: julianfoad

r880565 | stsp | 2009-11-12 15:51:55 -0600 (Thu, 12 Nov 2009)

* subversion/svn/conflict-callbacks.c                                           
  (svn_cl__conflict_handler): Add error message when trying to launch           
    an external merge tool for a property conflict.                             
Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>                            
(error message tweaked by me)

r880543 | julianfoad | 2009-11-11 13:06:19 -0600 (Wed, 11 Nov 2009)

Fix failing three way diff for properties when invoking diff-full (df)
in the interactive conflict resolver. Fix potential null-pointer
dereferences in the same code.

* subversion/libsvn_wc/util.c
  (svn_wc__cd2_to_cd, svn_wc__cd_to_cd2): For a property conflict, make
    available all the usual files needed in a three way diff, as well as
    markers for binary format and mime-type. Check for NULL before
    duplicating fields that may be NULL.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r880519 | julianfoad | 2009-11-10 11:44:55 -0600 (Tue, 10 Nov 2009)

Remove use of the deprecated svn_path_join().

* subversion/libsvn_client/merge.c
  (record_mergeinfo_for_dir_merge, find_unmerged_mergeinfo):
    Replace svn_path_join() with svn_uri_join(). All "base" parameters
    are repos relative paths.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r880515 | julianfoad | 2009-11-10 08:38:01 -0600 (Tue, 10 Nov 2009)

Remove some uses of deprecated svn_path_join().

* subversion/libsvn_client/mergeinfo.c
  (svn_client__adjust_mergeinfo_source_paths): Replace svn_path_join()
    with svn_uri_join(). An svn_mergeinfo_t key is the "base" parameter.
  (svn_client__get_wc_mergeinfo): Replace svn_path_join() with
    svn_relpath_join(). The "base" parameter is created with a relative
    path from svn_dirent_dirname().
  (svn_client_mergeinfo_get_merged): Replace svn_path_join() with
    svn_uri_join(). target_repos_root is the "base" parameter.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
Suggested by: dlr

r880489 | dlr | 2009-11-06 15:30:29 -0600 (Fri, 06 Nov 2009)

Remove use of the deprecated svn_path_canonicalize() API.

* subversion/libsvn_client/repos_diff.c
 (make_dir_baton, make_file_baton, delete_entry): Replace
   svn_path_join() with svn_dirent_join(). An eb->target WC directory
   is the "base" parameter for each call.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r880469 | dlr | 2009-11-05 18:24:22 -0600 (Thu, 05 Nov 2009)

* subversion/libsvn_client/deprecated.c
  (wrap_pre_blame3_receiver): Replace use of strlen(3) with sizeof.

Suggested by: Daniel Näslund <daniel{_AT_}longitudo.com>

r880463 | julianfoad | 2009-11-05 12:51:32 -0600 (Thu, 05 Nov 2009)

Avoid passing a variable as the format-string argument of printf functions,
to avoid compiler warnings about 'format not a string literal'.

* subversion/libsvn_client/diff.c
  (display_prop_diffs): Move the printf format specifiers out of the variable
    part of the string, into a literal format argument.

* subversion/libsvn_client/export.c
  (copy_one_versioned_file): Move the printf format specifiers out of the
    variable part of the string, into a literal format argument.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
          Julian Foad

r880446 | neels | 2009-11-04 05:34:51 -0600 (Wed, 04 Nov 2009)

* notes/sparse-directories.txt: Remove obsolete warning.
Patch by: Daniel Näslund <daniel@longitudo.com>
Tweaked by: me

r879584 | stsp | 2009-09-22 04:58:21 -0500 (Tue, 22 Sep 2009)

Use less adm_access in 'svn patch'.

* subversion/libsvn_client/patch.c
  (init_patch_target): Update docstring.
  (apply_one_patch): Remove ADM_ACCESS parameter. Use svn_wc_add4() and
   svn_wc_delete4(). Open an access baton internally for svn_wc_merge3().
  (apply_textdiffs): Remove ADM_ACCESS parameter.
  (svn_client_patch): Put a comment here explaining why we cannot remove
   adm_access usage from this function just yet. Track parameter removal.

Patch by: Daniel Näslund <daniel@longitudo.com>
(tweaked and log message by me)

r879385 | stsp | 2009-09-14 14:25:09 -0500 (Mon, 14 Sep 2009)

Fix issue 3459: "svn patch does not tolerate empty lines of context
in unidiff"

As a side effect, libsvn_client is shielded from the notion of leading
diff symbols on lines coming from modified and original texts.

* subversion/libsvn_diff/parse_diff.c
  (remove_leading_char_transformer): New. Line-transformer callback that
   shaves leading diff symbols.
  (svn_diff__parse_next_hunk): Tolerate empty lines of context in hunks.
   Set line-transformer callback on original_text and modified_text.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (unidiff): While here, fix a faulty hunk header in the test diff.
  (test_parse_unidiff): Change assertions to compare lines without
   leading diff symbols.

* subversion/tests/cmdline/patch_tests.py
  (patch_chopped_leading_spaces): New. Same as patch_unidiff() but with
   leading empty spaces removed on empty lines.
  (test_list): Add patch_chopped_leading_spaces().

* subversion/libsvn_client/patch.c
  (match_hunk, copy_hunk_text): Compare whole lines since there are no
   leading diff symbols anymore.

Patch by: Daniel Näslund <daniel@longitudo.com>
(tweaked by me)

r879047 | stsp | 2009-08-27 15:35:11 -0500 (Thu, 27 Aug 2009)

Create a new callback for svn_stream_readline() that can perform
arbitrary transformations on a line before it is returned to the
caller of svn_stream_readline().

* subversion/include/svn_io.h
  (svn_io_line_transformer_cb_t): New callback type.
  (svn_stream_set_line_transformer_callback): Declare.
  (svn_stream_readline): Document the new line transformation feature.

* subversion/libsvn_subr/stream.c
  (svn_stream_t): Add new field 'transformer_cb'.
  (svn_stream_create): Initialize the new field.
  (svn_stream_set_line_transformer_callback): New function to set the
    line transformer callback on a stream.
  (line_transformer): New helper function for svn_stream_readline().
  (svn_stream_readline): Invoke the line transformation callback if defined.
    Also, add a comment explaining that the iterpool is on purpose not
    destroyed right after the loop has exited.

* subversion/tests/libsvn_subr/stream-tests.c
  (line_transformer): An implementation of svn_io_line_transformer_cb_t,
   reverses the supplied line.
  (test_stream_line_transformer): New test, testing line transformations
    on a stream.
  (test_stream_line_filter_and_transformer): New test, testing line
    transformations as well as line filtering on a stream.
  (test_funcs): Add the 2 new tests.

Patch by: Daniel Näslund <daniel@longitudo.com>

r879040 | rhuijben | 2009-08-27 08:02:24 -0500 (Thu, 27 Aug 2009)

Create a new function that fetches an adm_access for a path from

* subversion/include/private/svn_wc_private.h
   (svn_wc__adm_retrieve_from_context): New function.

* subversion/libsvn_wc/lock.c
   (svn_wc__adm_retrieve_from_context): New function that fetches an
      existing adm_access baton for a path from wc_ctx.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

r878967 | hwright | 2009-08-20 15:44:45 -0500 (Thu, 20 Aug 2009)

As part of getting rid of adm_access batons for WC-NG, replace some
calls to svn_wc_entry() with svn_wc__maybe_get_entry().

Patch by: Daniel Näslund <daniel@longitudo.com>
Tweaked by: me

* subversion/include/private/svn_wc_private.h
 (svn_wc__maybe_get_entry): Declare.

* subversion/libsvn_wc/entries.c
 (svn_wc__maybe_get_entry): New. Wrapper for
   svn_wc__get_entry_versioned() with error and return semantics like

* subversion/libsvn_client/patch.c
 (merge_file_changed, merge_file_added, merge_file_deleted,
  merge_dir_added, init_patch_target): Replaced svn_wc_entry() with
   svn_wc__maybe_get_entry(). Use absolute paths.

r878852 | hwright | 2009-08-17 10:58:36 -0500 (Mon, 17 Aug 2009)

Use svn_wc_cleanup3() in svn_client_cleanup().

Patch by: Daniel Näslund <daniel@longitudo.com>

* subversion/libsvn_client/update.c
  (svn_client_cleanup): Use svn_wc_cleanup3() with svn_wc_context_t
    parameter. Remove use of diff3_cmd.

r878826 | hwright | 2009-08-14 10:48:09 -0500 (Fri, 14 Aug 2009)

Use svn_wc_context_t and absolute paths in svn_wc_cleanup3(). Remove
diff3_cmd parameter.

Patch by: Daniel Näslund <daniel@longitudo.com>

* subversion/include/svn_wc.h
 (svn_wc_cleanup3): New.
 (svn_wc_cleanup2): Deprecate.

* subversion/libsvn_wc/deprecated.c
 (svn_wc_cleanup2): Reimplement as a wrapper.

* subversion/libsvn_wc/log.c
 (svn_wc_cleanup3): New. Use absolute paths. No diff3_cmd. Add
   svn_wc_context_t parameter
 (svn_wc_cleanup2): Remove.

r878770 | julianfoad | 2009-08-12 11:27:53 -0500 (Wed, 12 Aug 2009)

Fix issue #3342: Summary of conflicts printed at end of up/sw/merge.
Print the summary after the whole operation, rather than after each target.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>

* subversion/svn/merge-cmd.c
  (svn_cl__merge): Call svn_cl__print_conflict_stats.

* subversion/svn/cl.h
  (svn_cl__print_conflict_stats): Declare.

* subversion/svn/update-cmd.c
  (svn_cl__update): Call svn_cl__print_conflict_stats.

* subversion/svn/switch-cmd.c
  (svn_cl__switch): Call svn_cl__print_conflict_stats.

* subversion/svn_notify.c
  (svn_cl__print_conflict_stats): Changed name from print_conflict_stats.
  (notify): Remove references to print_conflict_stats. Do not clear
    counters for conflicts.

* subversion/tests/cmdline/basic_tests.py
  (basic_update): Changed tests involving skipping to include summary.

r878695 | stsp | 2009-08-07 12:01:01 -0500 (Fri, 07 Aug 2009)

Follow-up to r38568: Fix two svnlook tests which were marked XFAIL.

* subversion/tests/cmdline/svnlook_tests.py
  (test_print_property_diffs, diff_ignore_eolstyle): Remove XFAIL.

* subversion/svnlook/main.c
  (maybe_append_eol): New helper function for display_prop_diffs().
  (display_prop_diffs): Use libsvn_diff for diffing property values.

Patch by: Daniel Näslund <daniel@longitudo.com>

r878642 | stsp | 2009-08-05 09:03:44 -0500 (Wed, 05 Aug 2009)

Partly fix issue 1493: Property diffs/merge should use libsvn_diff.

This commit makes 'svn diff' display property diffs generated by libsvn_diff.
It does not implement merging of property values via libsvn_diff, however.

Two tests are marked XFAIL by this commit, they will be fixed soon.

Patch by: Daniel Näslund <daniel@longitudo.com>

* subversion/libsvn_diff/diff_memory.c
  (output_unified_flush_hunk): New parameter for choosing hunk delimiter.
  (output_unified_diff_modified): Track above parameter addition.
  (svn_diff_mem_string_output_unified2): Rev this function, adding
   parameters specifying whether a diff header should be generated,
   and for choosing the hunk delimiter. Pass the latter parameter down
   to output_unified_flush_hunk().
  (svn_diff_mem_string_output_unified): Re-implement as a wrapper around
   the new revision.

* subversion/include/svn_diff.h
  (svn_diff_mem_string_output_unified2): Declare.

* subversion/libsvn_client/diff.c
  (maybe_append_eol): New helper function for display_prop_diffs().
  (display_prop_diffs): Use libsvn_diff for diffing property values.

* subversion/tests/cmdline/diff_tests.py,
  (diff_only_property_change, diff_prop_change_local_edit,
   diff_prop_on_named_dir, diff_property_changes_to_base,
   diff_prop_change_local_propmod, diff_repos_wc_add_with_props,
   diff_with_depth, diff_in_depthy_wc, merge_in_new_file_and_diff,
   diff_symlink_to_dir): Update expected output to new property diff format.

* subversion/tests/cmdline/svnlook_tests.py
   (test_print_property_diffs, diff_ignore_eolstyle): Mark XFAIL until
    new-style prop diffs are implemented in svnlook.