You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/09/29 15:36:36 UTC
svn commit: r1762797 - in /subversion/branches/resolve-incoming-add: ./
subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_wc/
Author: stsp
Date: Thu Sep 29 15:36:36 2016
New Revision: 1762797
URL: http://svn.apache.org/viewvc?rev=1762797&view=rev
Log:
Create the 'resolve-incoming-add' branch.
This branch aims to fix the 'incoming add' XFAILs in conflict resolver tests:
9 XFAIL merge incoming add dir merge
11 XFAIL merge incoming add dir merge with move history
13 XFAIL merge incoming add dir replace and merge
The basic idea is that since 'svn merge' won't merge added directories
which don't exist at merge-left and merge-right, but 'svn diff' will
display these correctly, we'll use a special-purpose diff-style merge
implementation to handle this case.
This code is not working yet and may take some time to complete.
Hence I'm putting it on a branch for now.
Added:
subversion/branches/resolve-incoming-add/ (props changed)
- copied from r1762796, subversion/trunk/
subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db_merge_incoming_add.c (with props)
Modified:
subversion/branches/resolve-incoming-add/subversion/include/private/svn_wc_private.h
subversion/branches/resolve-incoming-add/subversion/libsvn_client/conflicts.c
subversion/branches/resolve-incoming-add/subversion/libsvn_wc/conflicts.c
subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db.h
Propchange: subversion/branches/resolve-incoming-add/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Thu Sep 29 15:36:36 2016
@@ -0,0 +1,2 @@
+([Ii]ssues?:?(\s*(,|and)?\s*[#]?\d+)+)|(\bSVN-(\d+)\b)
+(\d+)
Propchange: subversion/branches/resolve-incoming-add/
------------------------------------------------------------------------------
bugtraq:url = http://subversion.apache.org/issue%BUGID%
Propchange: subversion/branches/resolve-incoming-add/
------------------------------------------------------------------------------
--- svn:auto-props (added)
+++ svn:auto-props Thu Sep 29 15:36:36 2016
@@ -0,0 +1,13 @@
+*.c = svn:eol-style=native
+*.cpp = svn:eol-style=native
+*.h = svn:eol-style=native
+*.hpp = svn:eol-style=native
+*.java = svn:eol-style=native
+*.py = svn:eol-style=native
+*.pl = svn:eol-style=native
+*.rb = svn:eol-style=native
+*.sql = svn:eol-style=native
+*.txt = svn:eol-style=native
+README = svn:eol-style=native
+BRANCH-README = svn:eol-style=native
+STATUS = svn:eol-style=native
Propchange: subversion/branches/resolve-incoming-add/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Sep 29 15:36:36 2016
@@ -0,0 +1,54 @@
+ChangeLog*
+Makefile
+config.cache
+config.log
+config.nice
+config.status
+configure
+libtool
+.gdb_history
+.swig_checked
+*.orig
+*.rej
+TAGS
+tags
+neon
+build-outputs.mk
+autogen-standalone.mk
+autom4te.cache
+gen-make.opts
+tests.log*
+fails.log*
+db4-win32
+db
+*.o
+*~
+.*~
+apr
+apr-util
+apr-iconv
+Release
+Debug
+ipch
+subversion_msvc.dsw
+subversion_msvc.ncb
+subversion_msvc.opt
+subversion_msvc.plg
+subversion_vcnet.*
+mkmf.log
+.project
+.classpath
+.cdtproject
+.settings
+.cproject
+zlib
+sqlite-amalgamation
+serf
+googlemock
+.git
+.gitignore
+.idea
+compile_commands.json
+.kdev4
+*.kdev4
+.vs
Propchange: subversion/branches/resolve-incoming-add/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Sep 29 15:36:36 2016
@@ -0,0 +1,98 @@
+/subversion/branches/1.10-cache-improvements:1669168-1694487
+/subversion/branches/1.5.x-r30215:870312
+/subversion/branches/1.7.x-fs-verify:1146708,1161180
+/subversion/branches/1.9-cache-improvements:1678948-1679863
+/subversion/branches/1.9.x:1735680
+/subversion/branches/10Gb:1388102,1388163-1388190,1388195,1388202,1388205,1388211,1388276,1388362,1388375,1388394,1388636,1388639-1388640,1388643-1388644,1388654,1388720,1388789,1388795,1388801,1388805,1388807,1388810,1388816,1389044,1389276,1389289,1389662,1389867,1390017,1390209,1390216,1390407,1390409,1390414,1390419,1390955
+/subversion/branches/atomic-revprop:965046-1000689
+/subversion/branches/authzperf:1615360
+/subversion/branches/auto-props-sdc:1384106-1401643
+/subversion/branches/bdb-reverse-deltas:872050-872529
+/subversion/branches/cache-server:1458643-1476567
+/subversion/branches/diff-callbacks3:870059-870761
+/subversion/branches/diff-optimizations:1031270-1037352
+/subversion/branches/diff-optimizations-bytes:1037353-1067789
+/subversion/branches/dont-save-plaintext-passwords-by-default:870728-871118
+/subversion/branches/double-delete:870511-872970
+/subversion/branches/dump-load-cross-check:1654853-1657295
+/subversion/branches/ev2-export:1325914,1332738,1413107
+/subversion/branches/explore-wc:875486,875493,875497,875507,875511,875514,875559,875580-875581,875584,875587,875611,875627,875647,875667-875668,875711-875712,875733-875734,875736,875744-875748,875751,875758,875782,875795-875796,875830,875836,875838,875842,875852,875855,875864,875870,875873,875880,875885-875888,875890,875897-875898,875905,875907-875909,875935,875943-875944,875946,875979,875982-875983,875985-875986,875990,875997
+/subversion/branches/file-externals:871779-873302
+/subversion/branches/fs-rep-sharing:869036-873803
+/subversion/branches/fsfs-format7:1426304,1430673,1433848,1438408,1438982,1441129,1442051,1442068,1442504,1442910,1443171,1443803,1444690,1444693,1444695,1445040,1445080,1446103,1451129,1453590,1454307,1460579,1461851,1461865,1462837,1462904,1463120,1467362,1467382,1469487,1471208,1477166,1478055,1481447,1489817,1489949,1490673-1490674,1491784,1493042,1498029,1498103,1498155,1500054,1507729-1507731,1507735-1507736
+/subversion/branches/fsfs-improvements:1499981-1547039
+/subversion/branches/fsfs-lock-many:1571740-1577217
+/subversion/branches/fsfs-pack:873717-874575
+/subversion/branches/fsx:1507845-1509914
+/subversion/branches/fsx-1.10:1658219-1694500
+/subversion/branches/fsx-id:1645603-1649011
+/subversion/branches/gnome-keyring:870558-871410
+/subversion/branches/gpg-agent-password-store:1005036-1150766
+/subversion/branches/gtest_addition:1452117-1502138
+/subversion/branches/http-protocol-v2:874395-876041
+/subversion/branches/in-memory-cache:869829-871452
+/subversion/branches/in-repo-authz:1414342-1424779
+/subversion/branches/inheritable-props:1297080-1395089
+/subversion/branches/integrate-cache-item-serialization:1068724-1068739
+/subversion/branches/integrate-cache-membuffer:998649-998852
+/subversion/branches/integrate-compression-level:1068651-1072287
+/subversion/branches/integrate-io-improvements:1068684-1072297
+/subversion/branches/integrate-is-cachable:1072568-1074082
+/subversion/branches/integrate-partial-getter:1072558-1076552
+/subversion/branches/integrate-readline-speedup:1072553-1072555
+/subversion/branches/integrate-stream-api-extensions:1068695-1072516
+/subversion/branches/integrate-string-improvements:1068251-1190617
+/subversion/branches/integrate-txdelta-caching:1072541-1078213
+/subversion/branches/issue-2779-dev:965496-984198
+/subversion/branches/issue-2843-dev:871432-874179
+/subversion/branches/issue-3000:871713,871716-871719,871721-871726,871728,871734
+/subversion/branches/issue-3067-deleted-subtrees:873375-874084
+/subversion/branches/issue-3148-dev:875193-875204
+/subversion/branches/issue-3220-dev:872210-872226
+/subversion/branches/issue-3242-dev:879653-896436
+/subversion/branches/issue-3334-dirs:875156-875867
+/subversion/branches/issue-3975:1152931-1160746
+/subversion/branches/issue-4116-dev:1424719-1425040
+/subversion/branches/issue-4194-dev:1410507-1414880
+/subversion/branches/javahl-ra:991978-1494640
+/subversion/branches/kwallet:870785-871314
+/subversion/branches/log-addressing:1509279-1546844
+/subversion/branches/log-g-performance:870941-871032
+/subversion/branches/merge-skips-obstructions:874525-874615
+/subversion/branches/move-tracking-2:1606692-1714632
+/subversion/branches/multi-layer-moves:1239019-1300930
+/subversion/branches/nfc-nfd-aware-client:870276,870376
+/subversion/branches/node_pool:1304828-1305388
+/subversion/branches/patch-exec:1692717-1705390
+/subversion/branches/performance:979193,980118,981087,981090,981189,981194,981287,981684,981827,982043,982355,983398,983406,983430,983474,983488,983490,983760,983764,983766,983770,984927,984973,984984,985014,985037,985046,985472,985477,985482,985487-985488,985493,985497,985500,985514,985601,985603,985606,985669,985673,985695,985697,986453,986465,986485,986491-986492,986517,986521,986605,986608,986817,986832,987865,987868-987869,987872,987886-987888,987893,988319,988898,990330,990533,990535-990537,990541,990568,990572,990574-990575,990600,990759,992899,992904,992911,993127,993141,994956,995478,995507,995603,998012,998858,999098,1001413,1001417,1004291,1022668,1022670,1022676,1022715,1022719,1025660,1025672,1027193,1027203,1027206,1027214,1027227,1028077,1028092,1028094,1028104,1028107,1028111,1028354,1029038,1029042-1029043,1029054-1029055,1029062-1029063,1029078,1029080,1029090,1029092-1029093,1029111,1029151,1029158,1029229-1029230,1029232,1029335-1029336,1029339-1029340,1029342,10
29344,1030763,1030827,1031203,1031235,1032285,1032333,1033040,1033057,1033294,1035869,1035882,1039511,1043705,1053735,1056015,1066452,1067683,1067697-1078365
+/subversion/branches/pin-externals:1643757-1659392
+/subversion/branches/py-tests-as-modules:956579-1033052
+/subversion/branches/ra-svn-tuning:1658201-1694489
+/subversion/branches/ra_serf-digest-authn:875693-876404
+/subversion/branches/reintegrate-improvements:873853-874164
+/subversion/branches/remote-only-status:1581845-1586090
+/subversion/branches/revprop-cache:1298521-1326293
+/subversion/branches/revprop-caching-ng:1620597,1620599
+/subversion/branches/revprop-packing:1143907,1143971,1143997,1144017,1144499,1144568,1146145
+/subversion/branches/subtree-mergeinfo:876734-878766
+/subversion/branches/svn-auth-x509:1603509-1655900
+/subversion/branches/svn-info-detail:1660035-1662618
+/subversion/branches/svn-mergeinfo-enhancements:870119-870195,870197-870288
+/subversion/branches/svn-mergeinfo-normalizer:1642232-1695991
+/subversion/branches/svn-patch-improvements:918519-934609
+/subversion/branches/svn_mutex:1141683-1182099
+/subversion/branches/svnpatch-diff:865738-876477
+/subversion/branches/svnraisetc:874709-875149
+/subversion/branches/svnserve-logging:869828-870893
+/subversion/branches/tc-issue-3334:874697-874773
+/subversion/branches/tc-merge-notify:874017-874062
+/subversion/branches/tc-resolve:874191-874239
+/subversion/branches/tc_url_rev:874351-874483
+/subversion/branches/tree-conflicts:868291-873154
+/subversion/branches/tree-conflicts-notify:873926-874008
+/subversion/branches/tristate-chunked-request:1502394-1502681
+/subversion/branches/tweak-build-take-two:1424288-1425049,1425051-1425613
+/subversion/branches/uris-as-urls:1060426-1064427
+/subversion/branches/verify-at-commit:1462039-1462408
+/subversion/branches/verify-keep-going:1439280-1546110
+/subversion/branches/wc-collate-path:1402685-1480384
Propchange: subversion/branches/resolve-incoming-add/
------------------------------------------------------------------------------
tsvn:logwidthmarker = 78
Propchange: subversion/branches/resolve-incoming-add/
------------------------------------------------------------------------------
tsvn:projectlanguage = 1033
Propchange: subversion/branches/resolve-incoming-add/
------------------------------------------------------------------------------
webviewer:revision = http://svn.apache.org/r%REVISION%
Modified: subversion/branches/resolve-incoming-add/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/resolve-incoming-add/subversion/include/private/svn_wc_private.h?rev=1762797&r1=1762796&r2=1762797&view=diff
==============================================================================
--- subversion/branches/resolve-incoming-add/subversion/include/private/svn_wc_private.h (original)
+++ subversion/branches/resolve-incoming-add/subversion/include/private/svn_wc_private.h Thu Sep 29 15:36:36 2016
@@ -2046,6 +2046,17 @@ svn_wc__read_conflict_descriptions2_t(co
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+svn_error_t *
+svn_wc__get_merge_incoming_add_diff_processor(
+ const svn_diff_tree_processor_t **diff_processor,
+ void **diff_processor_baton,
+ const char *target_abspath,
+ const char *prefix_relpath,
+ svn_boolean_t reverse_merge,
+ svn_wc_context_t *wc_ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/branches/resolve-incoming-add/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/resolve-incoming-add/subversion/libsvn_client/conflicts.c?rev=1762797&r1=1762796&r2=1762797&view=diff
==============================================================================
--- subversion/branches/resolve-incoming-add/subversion/libsvn_client/conflicts.c (original)
+++ subversion/branches/resolve-incoming-add/subversion/libsvn_client/conflicts.c Thu Sep 29 15:36:36 2016
@@ -38,6 +38,7 @@
#include "svn_hash.h"
#include "svn_sorts.h"
#include "client.h"
+#include "private/svn_ra_private.h"
#include "private/svn_sorts_private.h"
#include "private/svn_token.h"
#include "private/svn_wc_private.h"
@@ -5495,6 +5496,84 @@ unlock_wc:
return SVN_NO_ERROR;
}
+/* Merge a newly added directory into TARGET_ABSPATH in the working copy.
+ *
+ * This uses a diff-tree processor because our standard merge operation
+ * is not set up for merges where the merge-source anchor is itself an
+ * added directory (i.e. does not exist on one side of the diff).
+ * The standard merge will only merge additions of children of a path
+ * that exists across the entire revision range being merged.
+ * But in our case, SOURCE1 does not yet exist in REV1, but SOURCE2
+ * does exist in REV2. Thus we use a diff processor.
+ */
+static svn_error_t *
+merge_newly_added_dir(svn_client__conflict_report_t **conflict_report,
+ const char *source1,
+ svn_revnum_t rev1,
+ const char *source2,
+ svn_revnum_t rev2,
+ const char *target_abspath,
+ svn_boolean_t reverse_merge,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const svn_diff_tree_processor_t *diff_processor;
+ void *diff_processor_baton;
+ svn_ra_session_t *ra_session;
+ const char *corrected_url;
+ svn_ra_session_t *extra_ra_session;
+ const svn_ra_reporter3_t *reporter;
+ void *reporter_baton;
+ const svn_delta_editor_t *diff_editor;
+ void *diff_edit_baton;
+ const char *anchor1;
+ const char *anchor2;
+ const char *target1;
+ const char *target2;
+
+ svn_uri_split(&anchor1, &target1, source1, scratch_pool);
+ svn_uri_split(&anchor2, &target2, source2, scratch_pool);
+
+ SVN_ERR(svn_wc__get_merge_incoming_add_diff_processor(
+ &diff_processor, &diff_processor_baton,
+ target_abspath, target1, reverse_merge, ctx->wc_ctx,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, &corrected_url,
+ anchor2, NULL, NULL, FALSE,
+ FALSE, ctx,
+ scratch_pool, scratch_pool));
+ if (corrected_url)
+ anchor2 = corrected_url;
+
+ /* Extra RA session is used during the editor calls to fetch file contents. */
+ SVN_ERR(svn_ra__dup_session(&extra_ra_session, ra_session, anchor2,
+ scratch_pool, scratch_pool));
+
+ /* Create a repos-repos diff editor. */
+ SVN_ERR(svn_client__get_diff_editor2(
+ &diff_editor, &diff_edit_baton,
+ extra_ra_session, svn_depth_infinity, rev1, TRUE,
+ diff_processor, ctx->cancel_func, ctx->cancel_baton,
+ scratch_pool));
+
+ /* We want to switch our txn into URL2 */
+ SVN_ERR(svn_ra_do_diff3(ra_session, &reporter, &reporter_baton,
+ rev2, target1, svn_depth_infinity, TRUE, TRUE,
+ source2, diff_editor, diff_edit_baton, scratch_pool));
+
+ /* Drive the reporter; do the diff. */
+ SVN_ERR(reporter->set_path(reporter_baton, "", rev1,
+ svn_depth_infinity,
+ FALSE, NULL,
+ scratch_pool));
+
+ SVN_ERR(reporter->finish_report(reporter_baton, scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
/* Implements conflict_option_resolve_func_t. */
static svn_error_t *
resolve_merge_incoming_added_dir_merge(svn_client_conflict_option_t *option,
@@ -5513,9 +5592,9 @@ resolve_merge_incoming_added_dir_merge(s
struct conflict_tree_incoming_add_details *details;
svn_client__conflict_report_t *conflict_report;
const char *source1;
- svn_opt_revision_t revision1;
+ svn_revnum_t rev1;
const char *source2;
- svn_opt_revision_t revision2;
+ svn_revnum_t rev2;
svn_error_t *err;
local_abspath = svn_client_conflict_get_local_abspath(conflict);
@@ -5537,7 +5616,6 @@ resolve_merge_incoming_added_dir_merge(s
source1 = svn_path_url_add_component2(repos_root_url,
details->repos_relpath,
scratch_pool);
- revision1.kind = svn_opt_revision_number;
SVN_ERR(svn_client_conflict_get_incoming_old_repos_location(
&incoming_old_repos_relpath, &incoming_old_pegrev,
NULL, conflict, scratch_pool, scratch_pool));
@@ -5552,13 +5630,11 @@ resolve_merge_incoming_added_dir_merge(s
"added the repository"),
svn_dirent_local_style(local_abspath,
scratch_pool));
- revision1.value.number = details->added_rev;
-
+ rev1 = details->added_rev - 1;
source2 = svn_path_url_add_component2(repos_root_url,
incoming_new_repos_relpath,
scratch_pool);
- revision2.kind = svn_opt_revision_number;
- revision2.value.number = incoming_new_pegrev;
+ rev2 = incoming_new_pegrev;
}
else /* reverse-merge */
{
@@ -5568,13 +5644,11 @@ resolve_merge_incoming_added_dir_merge(s
"deleted from the repository"),
svn_dirent_local_style(local_abspath,
scratch_pool));
- revision1.value.number = details->deleted_rev;
-
+ rev1 = details->deleted_rev;
source2 = svn_path_url_add_component2(repos_root_url,
incoming_old_repos_relpath,
scratch_pool);
- revision2.kind = svn_opt_revision_number;
- revision2.value.number = incoming_old_pegrev;
+ rev2 = incoming_old_pegrev;
}
/* ### The following WC modifications should be atomic. */
@@ -5582,38 +5656,18 @@ resolve_merge_incoming_added_dir_merge(s
local_abspath,
scratch_pool, scratch_pool));
- /* Resolve to current working copy state. The merge requires this. */
- err = svn_wc__del_tree_conflict(ctx->wc_ctx, local_abspath, scratch_pool);
- if (err)
- return svn_error_compose_create(err,
- svn_wc__release_write_lock(ctx->wc_ctx,
- lock_abspath,
- scratch_pool));
-
- /* ### Should we do anything about mergeinfo? We need to run a no-ancestry
- * ### merge to get a useful result because mergeinfo-aware merges may split
- * ### this merge into several ranges and then abort early as soon as a
- * ### conflict occurs (which will happen invariably when merging unrelated
- * ### trees). The original merge which raised the tree conflict in the
- * ### first place created mergeinfo which also describes this merge,
- * ### unless 1) the working copy's mergeinfo was changed since, or
- * ### 2) the newly added directory's history has location segments with
- * ### paths outside the original merge source's natural history's path
- * ### (see the test_option_merge_incoming_added_dir_merge3() test). */
- err = svn_client__merge_locked(&conflict_report,
- source1, &revision1,
- source2, &revision2,
- local_abspath, svn_depth_infinity,
- TRUE, TRUE, /* do a no-ancestry merge */
- FALSE, FALSE, FALSE,
- TRUE, /* Allow mixed-rev just in case, since
- * conflict victims can't be updated to
- * straighten out mixed-rev trees. */
- NULL, ctx, scratch_pool, scratch_pool);
+ /* ### wrap in a transaction */
+ err = merge_newly_added_dir(&conflict_report, source1, rev1, source2, rev2,
+ local_abspath,
+ (incoming_old_pegrev > incoming_new_pegrev),
+ ctx, scratch_pool, scratch_pool);
err = svn_error_compose_create(err,
svn_client__make_merge_conflict_error(
conflict_report, scratch_pool));
+ if (!err)
+ err = svn_wc__del_tree_conflict(ctx->wc_ctx, local_abspath, scratch_pool);
+
err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
lock_abspath,
scratch_pool));
Modified: subversion/branches/resolve-incoming-add/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/resolve-incoming-add/subversion/libsvn_wc/conflicts.c?rev=1762797&r1=1762796&r2=1762797&view=diff
==============================================================================
--- subversion/branches/resolve-incoming-add/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/branches/resolve-incoming-add/subversion/libsvn_wc/conflicts.c Thu Sep 29 15:36:36 2016
@@ -3874,3 +3874,20 @@ svn_wc__guess_incoming_move_target_nodes
return SVN_NO_ERROR;
}
+
+svn_error_t *
+svn_wc__get_merge_incoming_add_diff_processor(
+ const svn_diff_tree_processor_t **diff_processor,
+ void **diff_processor_baton,
+ const char *target_abspath,
+ const char *prefix_relpath,
+ svn_boolean_t reverse_merge,
+ svn_wc_context_t *wc_ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_trace(svn_wc__db_get_merge_incoming_add_diff_processor(
+ diff_processor, diff_processor_baton,
+ target_abspath, prefix_relpath, reverse_merge,
+ wc_ctx->db, result_pool, scratch_pool));
+}
Modified: subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db.h?rev=1762797&r1=1762796&r2=1762797&view=diff
==============================================================================
--- subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db.h Thu Sep 29 15:36:36 2016
@@ -3493,6 +3493,18 @@ svn_wc__find_repos_node_in_wc(apr_array_
svn_revnum_t rev,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+
+svn_error_t *
+svn_wc__db_get_merge_incoming_add_diff_processor(
+ const svn_diff_tree_processor_t **diff_processor,
+ void **diff_processor_baton,
+ const char *target_abspath,
+ const char *prefix_relpath,
+ svn_boolean_t reverse_merge,
+ svn_wc__db_t *db,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/* @} */
typedef svn_error_t * (*svn_wc__db_verify_cb_t)(void *baton,
Added: subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db_merge_incoming_add.c
URL: http://svn.apache.org/viewvc/subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db_merge_incoming_add.c?rev=1762797&view=auto
==============================================================================
--- subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db_merge_incoming_add.c (added)
+++ subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db_merge_incoming_add.c Thu Sep 29 15:36:36 2016
@@ -0,0 +1,255 @@
+/*
+ * wc_db_merge_incoming_add.c: merge incoming adds during conflict resolution
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+/* This file implements a diff-tree processor which is driven by the conflict
+ * resolver in libsvn_client to resolve an "incoming directory add vs. local
+ * directory add" tree conflict raised during a merge operation.
+ *
+ * We use a diff-tree processor because our standard merge operation
+ * is not set up for merges where the merge-source anchor is itself an
+ * added directory (i.e. does not exist on one side of the diff).
+ * The standard merge will only merge additions of children of a path
+ * that exists across the entire revision range being merged.
+ * But in the add vs. add case, the merge-left side does not yet exist.
+ *
+ * The diff-tree processor merges an incoming directory tree into an
+ * existing directory tree in the working copy.
+ */
+
+/* ==================================================================== */
+
+
+/*** Includes. ***/
+
+#include "svn_types.h"
+#include "svn_dirent_uri.h"
+#include "svn_wc.h"
+
+#include "private/svn_diff_tree.h"
+
+#include "libsvn_wc/wc_db.h"
+
+struct merge_newly_added_dir_baton {
+ const char *target_abspath;
+ svn_wc__db_t *db;
+};
+
+/* An svn_diff_tree_processor_t callback. */
+static svn_error_t *
+diff_dir_added(const char *relpath,
+ const svn_diff_source_t *copyfrom_source,
+ const svn_diff_source_t *right_source,
+ apr_hash_t *copyfrom_props,
+ apr_hash_t *right_props,
+ void *dir_baton,
+ const struct svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct merge_newly_added_dir_baton *b = processor->baton;
+
+ SVN_DBG(("%s: %s\n", __func__, relpath));
+ if (copyfrom_source)
+ SVN_DBG(("%s: copyfrom source: %s@%lu\n", __func__,
+ copyfrom_source->repos_relpath, copyfrom_source->revision));
+ SVN_DBG(("%s: right source: %s@%lu\n", __func__,
+ right_source->repos_relpath, right_source->revision));
+
+ return SVN_NO_ERROR;
+}
+
+/* An svn_wc_diff_callbacks4_t function. */
+static svn_error_t *
+diff_dir_changed(const char *relpath,
+ const svn_diff_source_t *left_source,
+ const svn_diff_source_t *right_source,
+ apr_hash_t *left_props,
+ apr_hash_t *right_props,
+ const apr_array_header_t *prop_changes,
+ void *dir_baton,
+ const struct svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct merge_newly_added_dir_baton *b = processor->baton;
+
+ SVN_DBG(("%s: %s\n", __func__, relpath));
+ SVN_DBG(("%s: left source: %s@%lu\n", __func__,
+ left_source->repos_relpath, left_source->revision));
+ SVN_DBG(("%s: right source: %s@%lu\n", __func__,
+ right_source->repos_relpath, right_source->revision));
+
+ return SVN_NO_ERROR;
+}
+
+/* An svn_diff_tree_processor_t callback. */
+static svn_error_t *
+diff_dir_deleted(const char *relpath,
+ const svn_diff_source_t *left_source,
+ apr_hash_t *left_props,
+ void *dir_baton,
+ const struct svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct merge_newly_added_dir_baton *b = processor->baton;
+
+ SVN_DBG(("%s: %s\n", __func__, relpath));
+ SVN_DBG(("%s: left source: %s@%lu\n", __func__,
+ left_source->repos_relpath, left_source->revision));
+
+ return SVN_NO_ERROR;
+}
+
+/* An svn_diff_tree_processor_t callback. */
+static svn_error_t *
+diff_file_added(const char *relpath,
+ const svn_diff_source_t *copyfrom_source,
+ const svn_diff_source_t *right_source,
+ const char *copyfrom_file,
+ const char *right_file,
+ apr_hash_t *copyfrom_props,
+ apr_hash_t *right_props,
+ void *file_baton,
+ const struct svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct merge_newly_added_dir_baton *b = processor->baton;
+ const char *local_abspath;
+ svn_node_kind_t on_disk_kind;
+ svn_node_kind_t db_kind;
+
+ local_abspath = svn_dirent_join(b->target_abspath, relpath, scratch_pool);
+
+ SVN_ERR(svn_io_check_path(local_abspath, &on_disk_kind, scratch_pool));
+
+ if (on_disk_kind != svn_node_none)
+ {
+ SVN_DBG(("%s: obstructed: %s\n", __func__, local_abspath));
+ return SVN_NO_ERROR;
+ }
+
+ SVN_ERR(svn_wc__db_read_kind(&db_kind, b->db, local_abspath,
+ TRUE, FALSE, FALSE, scratch_pool));
+ if (db_kind != svn_node_none && db_kind != svn_node_unknown)
+ {
+ SVN_DBG(("%s: tree conflict: %s\n", __func__, local_abspath));
+ return SVN_NO_ERROR;
+ }
+
+ SVN_DBG(("%s: %s (%s: %s)\n", __func__, relpath,
+ svn_node_kind_to_word(on_disk_kind), local_abspath));
+ if (copyfrom_source)
+ SVN_DBG(("%s: copyfrom source: %s@%lu\n", __func__,
+ copyfrom_source->repos_relpath, copyfrom_source->revision));
+ SVN_DBG(("%s: right source: %s@%lu\n", __func__,
+ right_source->repos_relpath, right_source->revision));
+ SVN_DBG(("%s: right file: %s\n", __func__, right_file));
+
+ return SVN_NO_ERROR;
+}
+
+/* An svn_diff_tree_processor_t callback. */
+static svn_error_t *
+diff_file_changed(const char *relpath,
+ const svn_diff_source_t *left_source,
+ const svn_diff_source_t *right_source,
+ const char *left_file,
+ const char *right_file,
+ apr_hash_t *left_props,
+ apr_hash_t *right_props,
+ svn_boolean_t file_modified,
+ const apr_array_header_t *prop_changes,
+ void *file_baton,
+ const struct svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct merge_newly_added_dir_baton *b = processor->baton;
+
+ SVN_DBG(("%s: %s\n", __func__, relpath));
+ SVN_DBG(("%s: left source: %s@%lu\n", __func__,
+ left_source->repos_relpath, left_source->revision));
+ SVN_DBG(("%s: right source: %s@%lu\n", __func__,
+ right_source->repos_relpath, right_source->revision));
+ SVN_DBG(("%s: right file: %s\n", __func__, right_file));
+
+ return SVN_NO_ERROR;
+}
+
+/* An svn_diff_tree_processor_t callback. */
+static svn_error_t *
+diff_file_deleted(const char *relpath,
+ const svn_diff_source_t *left_source,
+ const char *left_file,
+ apr_hash_t *left_props,
+ void *file_baton,
+ const struct svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct merge_newly_added_dir_baton *b = processor->baton;
+
+ SVN_DBG(("%s: %s\n", __func__, relpath));
+ SVN_DBG(("%s: left source: %s@%lu\n", __func__,
+ left_source->repos_relpath, left_source->revision));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__db_get_merge_incoming_add_diff_processor(
+ const svn_diff_tree_processor_t **diff_processor,
+ void **diff_processor_baton,
+ const char *target_abspath,
+ const char *prefix_relpath,
+ svn_boolean_t reverse_merge,
+ svn_wc__db_t *db,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_diff_tree_processor_t *processor;
+ struct merge_newly_added_dir_baton *baton;
+
+ baton = apr_pcalloc(result_pool, sizeof(*baton));
+ baton->target_abspath = target_abspath;
+ baton->db = db;
+
+ processor = svn_diff__tree_processor_create(baton, scratch_pool);
+ processor->dir_added = diff_dir_added;
+ processor->dir_changed = diff_dir_changed;
+ processor->dir_deleted = diff_dir_deleted;
+ processor->file_added = diff_file_added;
+ processor->file_changed = diff_file_changed;
+ processor->file_deleted = diff_file_deleted;
+
+ *diff_processor = processor;
+ if (reverse_merge)
+ *diff_processor = svn_diff__tree_processor_reverse_create(*diff_processor,
+ NULL,
+ scratch_pool);
+
+ /* Filter the first path component using a filter processor, until we fixed
+ the diff processing to handle this directly */
+ *diff_processor = svn_diff__tree_processor_filter_create(
+ *diff_processor, prefix_relpath, scratch_pool);
+
+ *diff_processor_baton = baton;
+
+ return SVN_NO_ERROR;
+}
Propchange: subversion/branches/resolve-incoming-add/subversion/libsvn_wc/wc_db_merge_incoming_add.c
------------------------------------------------------------------------------
svn:eol-style = native