Skip to content

Commit e1d7a36

Browse files
committed
Open patch file outside of the apply_patches() routine, but accept
svn_patch_file_t instead. * subversion/libsvn_client/patch.c (apply_patches): Change arguments so we require a patch_file instead of a local path and remove the code that opens and closes the patch file. (svn_client_patch): Open and intialise the patch file. No functional changes. Yet. git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1925477 13f79535-47bb-0310-9956-ffa450edef68
1 parent 038d2ea commit e1d7a36

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

subversion/libsvn_client/patch.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,8 +3613,8 @@ check_ancestor_delete(const char *deleted_target,
36133613

36143614
/* This function is the main entry point into the patch code. */
36153615
static svn_error_t *
3616-
apply_patches(/* The path to the patch file. */
3617-
const char *patch_abspath,
3616+
apply_patches(/* The descriptor of the patch file. */
3617+
svn_patch_file_t *patch_file,
36183618
/* The abspath to the working copy the patch should be applied to. */
36193619
const char *root_abspath,
36203620
/* Indicates whether we're doing a dry run. */
@@ -3636,12 +3636,8 @@ apply_patches(/* The path to the patch file. */
36363636
{
36373637
svn_patch_t *patch;
36383638
apr_pool_t *iterpool;
3639-
svn_patch_file_t *patch_file;
36403639
apr_array_header_t *targets_info;
36413640

3642-
/* Try to open the patch file. */
3643-
SVN_ERR(svn_diff_open_patch_file(&patch_file, patch_abspath, scratch_pool));
3644-
36453641
/* Apply patches. */
36463642
targets_info = apr_array_make(scratch_pool, 0,
36473643
sizeof(patch_target_info_t *));
@@ -3720,7 +3716,6 @@ apply_patches(/* The path to the patch file. */
37203716
}
37213717
while (patch);
37223718

3723-
SVN_ERR(svn_diff_close_patch_file(patch_file, iterpool));
37243719
svn_pool_destroy(iterpool);
37253720

37263721
return SVN_NO_ERROR;
@@ -3740,6 +3735,7 @@ svn_client_patch(const char *patch_abspath,
37403735
apr_pool_t *scratch_pool)
37413736
{
37423737
svn_node_kind_t kind;
3738+
svn_patch_file_t *patch_file;
37433739

37443740
if (strip_count < 0)
37453741
return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
@@ -3775,10 +3771,15 @@ svn_client_patch(const char *patch_abspath,
37753771
svn_dirent_local_style(wc_dir_abspath,
37763772
scratch_pool));
37773773

3774+
SVN_ERR(svn_diff_open_patch_file(&patch_file, patch_abspath, scratch_pool));
3775+
37783776
SVN_WC__CALL_WITH_WRITE_LOCK(
3779-
apply_patches(patch_abspath, wc_dir_abspath, dry_run, strip_count,
3777+
apply_patches(patch_file, wc_dir_abspath, dry_run, strip_count,
37803778
reverse, ignore_whitespace, remove_tempfiles,
37813779
patch_func, patch_baton, ctx, scratch_pool),
37823780
ctx->wc_ctx, wc_dir_abspath, FALSE /* lock_anchor */, scratch_pool);
3781+
3782+
SVN_ERR(svn_diff_close_patch_file(patch_file, scratch_pool));
3783+
37833784
return SVN_NO_ERROR;
37843785
}

0 commit comments

Comments
 (0)