Author: rinrab
Date: Tue Nov 26 20:17:15 2024
New Revision: 1922134
URL: http://svn.apache.org/viewvc?rev=1922134&view=rev
Log:
On the 'apply-processor' branch: Fix replace-style merge capability
for a single file.
This fixes test cmdline/merge_tests.py#52 (replace-style merge capability
for a single file) and implements TODO_REPLACE_SINGLE_FILE todo.
For this we'll be opening a directory with NULL, passed to the relpath
argument. This tells the apply processor to consider this directory as
"fake", which is opened, but doesn't exist either in the working copy or
the repository. In do_file_merge() function, we will use processor->dir_opened()
function to open the parent directory. For instance, before we were using the
open_dir_for_replace_single_file() function, that creates a new fake baton.
The updated implementation of dir_opened will check relpath for NULL, and
do easy-out if it is NULL. However, new_dir_baton will be initialized with
the a fake dir baton.
This replaces the open_dir_for_replace_single_file() function, so I'm going
to remove this function, because it is no longer referenced.
* subversion/libsvn_client/merge.c
(do_file_merge): Remove TODO_REPLACE_SINGLE_FILE, use processor->dir_opened()
instead of open_dir_for_replace_single_file() to open the dir baton, little
rearrangement of local variables.
* subversion/libsvn_client/merge_processor.c
(merge_dir_opened): Easy-out if relapth is NULL; Only creates a "fake" dir
baton.
(open_dir_for_replace_single_file): Remove function.
### I am not sure in that. This works, but probably it is not the best
### solution. If anyone want to express their opinion about this change,
### feel free to do so.
### Is NULL `relpath` conceptually correct? Does it follow
### svn_diff_tree_processor_t's conventions?
Modified:
subversion/branches/apply-processor/subversion/libsvn_client/merge.c
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c
Modified: subversion/branches/apply-processor/subversion/libsvn_client/merge.c
URL:
http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/libsvn_client/merge.c?rev=1922134&r1=1922133&r2=1922134&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_client/merge.c
(original)
+++ subversion/branches/apply-processor/subversion/libsvn_client/merge.c Tue
Nov 26 20:17:15 2024
@@ -5193,13 +5193,16 @@ do_file_merge(svn_mergeinfo_catalog_t re
do a text-n-props merge; otherwise, do a delete-n-add merge. */
if (! (merge_b->diff_ignore_ancestry || sources_related))
{
-#if TODO_REPLACE_SINGLE_FILE
- void *dir_baton = open_dir_for_replace_single_file(iterpool);
-#else
- void *dir_baton = NULL;
-#endif
- void *file_baton;
svn_boolean_t skip;
+ svn_boolean_t skip_dir = FALSE;
+ svn_boolean_t skip_children;
+ void *dir_baton;
+ void *file_baton;
+
+ SVN_ERR(processor->dir_opened(&dir_baton,
+ &skip_dir, &skip_children,
+ NULL, NULL, NULL, NULL, NULL,
+ processor, iterpool, iterpool));
/* Delete... */
file_baton = NULL;
Modified:
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c
URL:
http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c?rev=1922134&r1=1922133&r2=1922134&view=diff
==============================================================================
---
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c
(original)
+++
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c
Tue Nov 26 20:17:15 2024
@@ -1814,9 +1814,7 @@ merge_dir_opened(void **new_dir_baton,
merge_apply_processor_baton_t *merge_b = processor->baton;
struct merge_dir_baton_t *db;
struct merge_dir_baton_t *pdb = parent_dir_baton;
-
- const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
- relpath, scratch_pool);
+ const char *local_abspath;
db = apr_pcalloc(result_pool, sizeof(*db));
db->pool = result_pool;
@@ -1826,6 +1824,15 @@ merge_dir_opened(void **new_dir_baton,
*new_dir_baton = db;
+ /* Easy out: we are opening a fake directory, that doesn't have a relpath.
+ * This may be used as a directory of replace-single-file merge.
+ */
+ if (relpath == NULL)
+ return SVN_NO_ERROR;
+
+ local_abspath = svn_dirent_join(merge_b->target->abspath,
+ relpath, scratch_pool);
+
if (left_source)
db->tree_conflict_merge_left_node_kind = svn_node_dir;
else
@@ -2751,19 +2758,3 @@ svn_client__apply_processor_create(const
return merge_processor;
}
-
-/* Initialize minimal dir baton to allow calculating 'R'eplace
- from 'D'elete + 'A'dd. */
-/* TODO: doesn't yet works */
-static void *
-open_dir_for_replace_single_file(apr_pool_t *result_pool)
-{
- struct merge_dir_baton_t *dir_baton = apr_pcalloc(result_pool,
sizeof(*dir_baton));
-
- dir_baton->pool = result_pool;
- dir_baton->tree_conflict_reason = CONFLICT_REASON_NONE;
- dir_baton->tree_conflict_action = svn_wc_conflict_action_edit;
- dir_baton->skip_reason = svn_wc_notify_state_unknown;
-
- return dir_baton;
-}