Checkout Tools
  • last updated 1 hour ago
Constraints: committers
Constraints: files
Constraints: dates
Fix 'svn patch' setting UNIX permissions to 0600 on patched files with props.

* subversion/libsvn_client/patch.c

(init_patch_target): Use the working copy's own temp directory to store

temporary files for patching, instead of using the system-wide temp dir.

With a system-wide dir, permission paranoia in svn_io_open_unique_file3()

may kick in and result in patched files with permissions not matching the

umask. Generally, any temp files that may end up as user-visible files

in the working copy should be created in the working copy's temp dir.

Reported by: Doug Robinson at wandisco com

Use gettext plurals for better messages.

* subversion/libsvn_client/conflicts.c

(describe_incoming_edit_list_modified_revs): Message plural.

* subversion/libsvn_client/patch.c

(strip_path): Likewise.

* subversion/libsvn_wc/props.c

(svn_wc_canonicalize_svn_prop): Likewise.

Approved by: julianfoad

  1. … 2 more files in changeset.
* subversion/libsvn_client/patch.c

(reject_hunk): Don't ignore error return from svn_stream_printf().

Found by: danielsh

using tools/dev/

* subversion/libsvn_client/patch.c

(apply_one_patch): Fix doc string.

* subversion/libsvn_client/patch.c

(init_patch_target): Fix indentation.

* subversion/libsvn_client/patch.c

(init_patch_target): Remove duplicated check.

Improve the behaviour of 'svn patch' when a reject file cannot be created.

* subversion/libsvn_client/patch.c

(write_out_rejected_hunks): Add 'root_abspath' argument. If the reject

file cannot be created because an intermediate directory is missing,

try to create the reject file in the working copy root instead.

Previously, this was a fatal error condition and aborted patching.

This problem can happen when trying to apply a patch to the wrong directory.

(apply_patches): Pass root_abspath to write_out_rejected_hunks().

Following up on r1720351, fix handling patch files that have more context

than the diff headers tell us in the same way as a shortage of context.

This change makes a bad patch in our testsuite visible, where we expected

bad behavior. This patch fixes that test and adds more testing.

* subversion/libsvn_client/patch.c

(hunk_info_t): Separate reported fuzz from matching fuzz as mixing them

causes errors.

(get_hunk_info): Store both fuzz values.

(apply_hunk): Use match fuzz for apply-magic.

(send_hunk_notification): Report fuzz with penalty.

* subversion/libsvn_diff/parse-diff.c

(parse_next_hunk): Parse extra context when that exists. Report this case

as fuzz penalty, like a fuzz shortage.

* subversion/tests/cmdline/

(patch_empty_file): Fix patch to work as document. Expect the proper result.

Extract the original version as new test.

(missing_trailing_context): Extend test with reverse patching and too much

trailing context.

(patch_missed_trail): New test, with the original case of patch_empty_file.

Expect that it no longer ignores the 'replacement' line.

(test_list): Add patch_missed_trail.

  1. … 2 more files in changeset.
Resolve issue #4609, by extending the diff parser with some additional

verifications and a match penalty.

Temporarily keep this as private api to allow backporting this patch.

[Note: This introduces some new issues applying certain bad patches. These

issues are fixed in r1720359]

* subversion/include/private/svn_diff_private.h

(svn_diff_hunk__get_fuzz_penalty): New function.

* subversion/libsvn_client/patch.c

(match_hunk): Check for fuzz penalties.

* subversion/libsvn_diff/parse-diff.c

(svn_diff_hunk_t): Add two fields.

(add_or_delete_single_line): Safely initialize everything to 0.

(parse_next_hunk): Handle missing context lines by updating the number

of lines in the hunk and applying a fuzz penalty.

(svn_diff_hunk__get_fuzz_penalty): New function.

* subversion/tests/cmdline/

(missing_trailing_context): Remove XFail. Expect fuzz.

  1. … 3 more files in changeset.
Use svn_io_file_get_offset() instead of svn_io_file_seek(APR_CUR) where it

makes sense.

* subversion/libsvn_client/patch.c

* subversion/libsvn_diff/parse-diff.c

* subversion/libsvn_repos/dump.c

* subversion/libsvn_subr/io.c

* subversion/libsvn_subr/stream.c

* subversion/tests/libsvn_subr/io-test.c

(tell_file, read_handler_base85, hunk_readline_original_or_modified,

svn_diff_hunk_readline_diff_text, parse_next_hunk, parse_binary_patch,

svn_diff_parse_next_patch, store_delta, svn_io_file_readline,

mark_handler_apr, test_file_readline, aligned_seek): Use

svn_io_file_get_offset() instead of svn_io_file_seek(0, APR_CUR).

  1. … 5 more files in changeset.
Describe adds and removes in the 'svn patch' reject file headers.

* subversion/libsvn_client/patch.c

(init_patch_target): Tweak reject file header based on whether we

are trying to add or remove the file.

* subversion/tests/cmdline/



patch_like_git_symlink): Update expected rejectfile.

  1. … 1 more file in changeset.
Extend the 'svn patch' handling of moves to detect recorded moves that are

already applied.

* subversion/libsvn_client/patch.c

(init_patch_target): Verify if a move can be applied before opening the

target file. If the target is already moved to this exact location just

apply the patch to the target.

* subversion/tests/cmdline/


patch_move_and_change): Retry applying the move patch.

  1. … 1 more file in changeset.
Fix the interaction between moves and property changes during 'svn patch'.

Before this patch property changes would be applied to the source of the move,

which would cause an error because it is not possible to set properties on

a deleted file.

To make it easier to test this also fix move issues in the dry run mode.

* subversion/libsvn_client/patch.c

(resolve_target_path): Allow to disable the following of local moves to

allow tree changes on the pre-move target.

(init_patch_target): Allow adding new nodes in place of something that is

moved away. Detect interactions with previously recorded patches.

(send_patch_notification): Don't notify a delete when the add was skipped.

(install_patched_prop_targets): Apply property changes to the right target.

* subversion/tests/cmdline/

(patch_git_rename): Extend test.

(patch_move_and_change): New test.

(test_list): Add patch_move_and_change.

  1. … 1 more file in changeset.
Make the filter function of 'svn patch' actually provide the rejection file

and patched files that it promises in the documentation. Before this patch

the patched path and the rejection file were always empty, because nothing

of the patch was applied to the actual targets at this stage.

* subversion/libsvn_client/patch.c

(patch_target_t): Remove boolean.

(apply_one_patch): Remove patch_func handling.

(apply_patches): Apply filtering here after the patch was applied to a

temporary file, but before the result is installed

Make the 'svn patch' notification use 'U' when a patch has been applied,

instead of forcing a 'G' status whenever there were local changes before

applying the patch. Also improve obstruction notifications a bit.

This shows the result of the patch instead of just what running status

might have shown if you didn't apply the patch. (The patch might have

removed the modification).

This patch doesn't affect the patch algorithms.

* subversion/libsvn_client/patch.c

(patch_target_t): Track skip caused by obstruction. Drop local mods info.

(resolve_target_path): Update initialization.

(send_patch_notification): Update notifications.

(install_patched_target): Handle invalid type obstructions.

* subversion/tests/cmdline/



patch_reverse_revert): Tweak expected output.

(patch_apply_no_fuz): Use standard patch runner. Tweak expected output.


patch_binary_file) Tweak expected output.

(patch_final_eol): Update expected result. Add some comments.




patch_add_one_line): Update expected result.

  1. … 1 more file in changeset.
Extend the 'svn patch' logic to more accurately detect patches that are already

applied in the very specific case of a patch that adds something at the start

or end of the file.

* subversion/libsvn_client/patch.c

(get_hunk_info): Extend scope of some easy to obtain values. Check for

corner case.

* subversion/tests/cmdline/

(patch): Extend test with retry.

(patch_same_twice): Update expected result.

(patch_reverse_revert): Extend with retries.

(patch_empty_file): Use standard test runner.

(patch_add_one_line): New test.

(test_list): Add test.

  1. … 1 more file in changeset.
* subversion/libsvn_client/patch.c

(apply_one_patch): Following up on r1706623 remove variable that is only set.

Calculate whether a patch should add or delete nodes based on the patch and the

working copy state instead of the size of the resulting patchfile.

* subversion/libsvn_client/patch.c

(init_patch_target): Check if files must be added from unified diff hunks

and property change types.

(send_patch_notification): Provide property notifications in lexical order.

(apply_one_patch): Apply not-adding, not deleting before property changes.

Reject property changes when there is no node to apply them to.

* subversion/tests/cmdline/

(patch_with_properties): Update expected result.

  1. … 1 more file in changeset.
* subversion/libsvn_client/patch.c

(init_prop_target): Add target argument to avoid querying wc_db on non

existing targets.

(init_patch_target): Update caller.

* subversion/libsvn_client/patch.c

(apply_one_patch): Following up on r1706598, add brackets.

Properly create 'svn patch' reject files with a unique name, instead of

blindly overwriting pre-existing .svnpatch.rej files. Just like how we

create other conflict markers.

* subversion/libsvn_client/patch.c

(patch_target_t): Use a stream for rejection info.

(init_patch_target): Update creation.

(reject_hunk): Use stream helpers for writing.

(write_out_rejected_hunks): Create final file using

svn_io_open_uniquely_named(), to ensure a unique name.

* subversion/tests/cmdline/

(patch_closest): Remove reject file before creating a new one.

  1. … 1 more file in changeset.
Apply a minor theoretical consistency fix. (Property operations are ram->ram)

* subversion/libsvn_client/patch.c

(apply_one_patch): On error copying the property, only skip the property.

In 'svn patch' only handle property changes as a file addition if all the

property changes on the node are property additions.

When there is a combination of adds and modifications we shouldn't just

create a 0 byte file.

* subversion/libsvn_client/patch.c

(apply_one_patch): Only handle a set of property adds as a trigger to

potentially mark a file as added.

* subversion/tests/cmdline/

(patch_with_properties): Extend test.

  1. … 1 more file in changeset.
Following up on r1706217, revert a change in pool in which some intermediate

values are stored. I hope this fixes the breakage on the openbsd buildbot.

* subversion/libsvn_client/patch.c

(create_missing_parents): Store variable that is used in next iteration in


Following up on r1706446, improve calculation on when a symlink was

transformed into a file.

* subversion/libsvn_client/patch.c

(apply_one_patch): Don't assume that the presence of a SVN_PROP_SPECIAL

hunk implies that the resulting node is a symlink.

(install_patched_target): Just check for is_special, to allow changing type.

* subversion/tests/cmdline/

(patch_symlink_madness): New test.

(test_list): Add patch_symlink_madness.

  1. … 1 more file in changeset.
Make 'svn patch' capable of handling git-like symlink changes.

* subversion/libsvn_client/patch.c

(patch_target_t): Add boolean.

(readline_symlink_git): New function.

(write_symlink): Remove function. Assume intermediate file is always text.

(contradictory_executability): Remove function. Fold in single caller.

(init_patch_target): Detect when to use git like symlinks. Create

intermediate always as normal file to simplify processing. Detect when to

set svn:special. Simplify svn:executable handling.

(apply_one_patch): Create svn:special hunk if necessary. Always close patch


* subversion/tests/cmdline/

(patch_git_symlink): Update expected results. Assume links are handled.

(patch_like_git_symlink): New test. Based on patch_git_symlink but with mode

specifying a regular file.

  1. … 1 more file in changeset.
Even on platforms that don't have native symlink support, use the proper

symlink functions to write symlinks.

This exposed a bug in the patch_symlink_add test where a symlink got an

extra newline attached.

* subversion/libsvn_client/patch.c

(resolve_target_path): Handle the local representation of symlinks on

platforms that we don't support real symlinks on.

* subversion/tests/cmdline/

(patch_add_symlink): Our internal symlink format doesn't have an EOL.

  1. … 1 more file in changeset.
In the diff parser: parse the symlink status from the mode flags.

* subversion/include/svn_diff.h

(svn_patch_t): Rename executable bits to _bits and add

symlink bit variables.

* subversion/libsvn_client/patch.c

(contradictory_executability): Update caller.

(init_patch_target): Don't call contradictory_executability when no

executable change is described in the mode change. Update caller.

(apply_one_patch): Update caller.

* subversion/libsvn_diff/parse-diff.c

(parse_bits_into_executability): Rename to...

(parse_git_mode_bits): ... this and also parse symlink info.




git_deleted_file): Update caller.

(svn_diff_parse_next_patch): Update initialization. Reverse new bits

when using a reverse diff.

* subversion/tests/libsvn_diff/parse-diff-test.c


test_parse_git_tree_and_text_diff): Update caller. Add assertions.

  1. … 3 more files in changeset.
* subversion/libsvn_client/patch.c

(apply_patches): Following up on r1706221, revert accidentally left hunk.

Properly handle rejections in patches that describe an explicit file delete.

* subversion/libsvn_client/patch.c

(apply_one_patch): When a delete doesn't match, don't handle it as a delete.

(apply_patches): Accidental change. Reverted in r1706222.

* subversion/tests/cmdline/

(patch_git_symlink): Enable repeat run. Expect reject file.

  1. … 1 more file in changeset.