Author: julianfoad
Date: Fri Dec 4 12:56:31 2015
New Revision: 1717957
URL: http://svn.apache.org/viewvc?rev=1717957&view=rev
Log:
A small step towards making 'svnmover merge' operate into a new temporary
txn first.
* tools/dev/svnmover/svnmover.h
(svnmover_branch_merge): Take the branch to be edited as a parameter,
instead of making edits in the 'target' branch.
* tools/dev/svnmover/merge3.c
(merge_subbranch,
branch_merge_subtree_r,
svnmover_branch_merge): Same.
* tools/dev/svnmover/svnmover.c
(do_switch,
do_merge): Update callers: for now, just pass the target branch as the
branch to be edited.
(execute): Enforce that the specified target of a merge must be the
working copy, not a revision.
Modified:
subversion/trunk/subversion/libsvn_delta/branch.c
subversion/trunk/tools/dev/svnmover/merge3.c
subversion/trunk/tools/dev/svnmover/svnmover.c
subversion/trunk/tools/dev/svnmover/svnmover.h
Modified: subversion/trunk/subversion/libsvn_delta/branch.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/branch.c?rev=1717957&r1=1717956&r2=1717957&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/branch.c (original)
+++ subversion/trunk/subversion/libsvn_delta/branch.c Fri Dec 4 12:56:31 2015
@@ -673,6 +673,7 @@ svn_branch__txn_get_branch_by_id(const s
if (strcmp(svn_branch__get_id(b, scratch_pool), branch_id) == 0)
{
branch = b;
+ return branch;
break;
}
}
Modified: subversion/trunk/tools/dev/svnmover/merge3.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/dev/svnmover/merge3.c?rev=1717957&r1=1717956&r2=1717957&view=diff
==============================================================================
--- subversion/trunk/tools/dev/svnmover/merge3.c (original)
+++ subversion/trunk/tools/dev/svnmover/merge3.c Fri Dec 4 12:56:31 2015
@@ -840,6 +840,7 @@ element_merge(svn_element__content_t **r
static svn_error_t *
branch_merge_subtree_r(svn_branch__txn_t *edit_txn,
+ svn_branch__state_t *edit_branch,
conflict_storage_t **conflict_storage_p,
const svn_branch__el_rev_id_t *src,
const svn_branch__el_rev_id_t *tgt,
@@ -851,6 +852,7 @@ branch_merge_subtree_r(svn_branch__txn_t
*/
static svn_error_t *
merge_subbranch(svn_branch__txn_t *edit_txn,
+ svn_branch__state_t *edit_branch,
const svn_branch__el_rev_id_t *src,
const svn_branch__el_rev_id_t *tgt,
const svn_branch__el_rev_id_t *yca,
@@ -886,9 +888,22 @@ merge_subbranch(svn_branch__txn_t *edit_
if (subbr_src && subbr_tgt && subbr_yca) /* ?edit vs. ?edit */
{
conflict_storage_t *conflict_storage;
+ const char *new_branch_id
+ = svn_branch__id_nest(svn_branch__get_id(edit_branch, scratch_pool),
+ eid, scratch_pool);
+ svn_branch__rev_bid_eid_t *from
+ = svn_branch__rev_bid_eid_create(tgt_subbranch->txn->rev,
+ svn_branch__get_id(tgt_subbranch,
+ scratch_pool),
+ svn_branch__root_eid(tgt_subbranch),
+ scratch_pool);
+ svn_branch__state_t *edit_subbranch;
+
+ SVN_ERR(svn_branch__txn_branch(edit_txn, &edit_subbranch, from,
+ new_branch_id, scratch_pool,
scratch_pool));
/* subbranch possibly changed in source => merge */
- SVN_ERR(branch_merge_subtree_r(edit_txn,
+ SVN_ERR(branch_merge_subtree_r(edit_txn, edit_subbranch,
&conflict_storage,
subbr_src, subbr_tgt, subbr_yca,
scratch_pool, scratch_pool));
@@ -909,7 +924,7 @@ merge_subbranch(svn_branch__txn_t *edit_
else if (subbr_src) /* added on source branch */
{
const char *new_branch_id
- = svn_branch__id_nest(svn_branch__get_id(tgt->branch, scratch_pool),
+ = svn_branch__id_nest(svn_branch__get_id(edit_branch, scratch_pool),
eid, scratch_pool);
svn_branch__rev_bid_eid_t *from
= svn_branch__rev_bid_eid_create(src_subbranch->txn->rev,
@@ -923,7 +938,18 @@ merge_subbranch(svn_branch__txn_t *edit_
}
else if (subbr_tgt) /* added on target branch */
{
- /* nothing to do */
+ const char *new_branch_id
+ = svn_branch__id_nest(svn_branch__get_id(edit_branch, scratch_pool),
+ eid, scratch_pool);
+ svn_branch__rev_bid_eid_t *from
+ = svn_branch__rev_bid_eid_create(tgt_subbranch->txn->rev,
+ svn_branch__get_id(tgt_subbranch,
+ scratch_pool),
+ svn_branch__root_eid(tgt_subbranch),
+ scratch_pool);
+
+ SVN_ERR(svn_branch__txn_branch(edit_txn, NULL /*new_branch_p*/, from,
+ new_branch_id, scratch_pool,
scratch_pool));
}
else if (subbr_yca) /* double delete */
{
@@ -1138,6 +1164,7 @@ detect_orphans(apr_hash_t **orphans_p,
*/
static svn_error_t *
branch_merge_subtree_r(svn_branch__txn_t *edit_txn,
+ svn_branch__state_t *edit_branch,
conflict_storage_t **conflict_storage_p,
const svn_branch__el_rev_id_t *src,
const svn_branch__el_rev_id_t *tgt,
@@ -1166,7 +1193,7 @@ branch_merge_subtree_r(svn_branch__txn_t
svn_branch__get_id(yca->branch, scratch_pool), yca->eid));*/
svnmover_notify_v("merging into branch %s",
- svn_branch__get_id(tgt->branch, scratch_pool));
+ edit_branch->bid);
/*
for (eid, diff1) in element_differences(YCA, FROM):
diff2 = element_diff(eid, YCA, TO)
@@ -1231,7 +1258,8 @@ branch_merge_subtree_r(svn_branch__txn_t
/* Still need to merge any subbranch linked to this element.
There were no changes to the link element but that doesn't
mean there were no changes to the linked branch. */
- SVN_ERR(merge_subbranch(edit_txn, src, tgt, yca, eid, iterpool));
+ SVN_ERR(merge_subbranch(edit_txn, edit_branch,
+ src, tgt, yca, eid, iterpool));
continue;
}
@@ -1299,7 +1327,8 @@ branch_merge_subtree_r(svn_branch__txn_t
if (result)
{
- SVN_ERR(merge_subbranch(edit_txn, src, tgt, yca, eid, iterpool));
+ SVN_ERR(merge_subbranch(edit_txn, edit_branch,
+ src, tgt, yca, eid, iterpool));
}
}
}
@@ -1329,6 +1358,7 @@ branch_merge_subtree_r(svn_branch__txn_t
svn_error_t *
svnmover_branch_merge(svn_branch__txn_t *edit_txn,
+ svn_branch__state_t *edit_branch,
conflict_storage_t **conflict_storage_p,
svn_branch__el_rev_id_t *src,
svn_branch__el_rev_id_t *tgt,
@@ -1345,7 +1375,7 @@ svnmover_branch_merge(svn_branch__txn_t
/*SVN_ERR(verify_not_subbranch_root(to, scratch_pool));*/
/*SVN_ERR(verify_not_subbranch_root(yca, scratch_pool));*/
- SVN_ERR(branch_merge_subtree_r(edit_txn,
+ SVN_ERR(branch_merge_subtree_r(edit_txn, edit_branch,
&conflicts,
src, tgt, yca,
result_pool, scratch_pool));
Modified: subversion/trunk/tools/dev/svnmover/svnmover.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/dev/svnmover/svnmover.c?rev=1717957&r1=1717956&r2=1717957&view=diff
==============================================================================
--- subversion/trunk/tools/dev/svnmover/svnmover.c (original)
+++ subversion/trunk/tools/dev/svnmover/svnmover.c Fri Dec 4 12:56:31 2015
@@ -1758,7 +1758,8 @@ do_switch(svnmover_wc_t *wc,
tgt = svn_branch__el_rev_id_create(wc->working->branch,
svn_branch__root_eid(wc->working->branch),
SVN_INVALID_REVNUM, scratch_pool);
- SVN_ERR(svnmover_branch_merge(wc->edit_txn, &wc->conflicts,
+ SVN_ERR(svnmover_branch_merge(wc->edit_txn, tgt->branch,
+ &wc->conflicts,
src, tgt, yca, wc->pool, scratch_pool));
if (svnmover_any_conflicts(wc->conflicts))
@@ -1793,7 +1794,7 @@ do_merge(svnmover_wc_t *wc,
src->eid, tgt->eid, yca->eid);
}
- SVN_ERR(svnmover_branch_merge(wc->edit_txn,
+ SVN_ERR(svnmover_branch_merge(wc->edit_txn, tgt->branch,
&wc->conflicts,
src, tgt, yca,
wc->pool, scratch_pool));
@@ -3511,6 +3512,7 @@ execute(svnmover_wc_t *wc,
{
VERIFY_EID_EXISTS("merge", 0);
VERIFY_EID_EXISTS("merge", 1);
+ VERIFY_REV_UNSPECIFIED("merge", 1);
VERIFY_EID_EXISTS("merge", 2);
SVN_ERR(do_merge(wc,
@@ -3525,6 +3527,7 @@ execute(svnmover_wc_t *wc,
{
VERIFY_EID_EXISTS("merge", 0);
VERIFY_EID_EXISTS("merge", 1);
+ VERIFY_REV_UNSPECIFIED("merge", 1);
SVN_ERR(do_auto_merge(wc,
arg[0]->el_rev /*from*/,
Modified: subversion/trunk/tools/dev/svnmover/svnmover.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/dev/svnmover/svnmover.h?rev=1717957&r1=1717956&r2=1717957&view=diff
==============================================================================
--- subversion/trunk/tools/dev/svnmover/svnmover.h (original)
+++ subversion/trunk/tools/dev/svnmover/svnmover.h Fri Dec 4 12:56:31 2015
@@ -161,12 +161,12 @@ struct conflict_storage_t
apr_hash_t *orphan_conflicts;
};
-/* Merge SRC into TGT, using the common ancestor YCA.
+/* Three-way-merge the changes from YCA to SRC and YCA to TGT. YCA is
+ * notionally the youngest common ancestor of SRC and TGT.
*
* The elements to merge are the union of the elements in the three input
* subtrees (SRC, TGT, YCA). For each such element, merge the two changes:
- * YCA -> SRC and YCA -> TGT, applying the result to TGT which is assumed
- * to be a branch in EDIT_TXN.
+ * YCA -> SRC and YCA -> TGT, applying the result to EDIT_TXN:EDIT_BRANCH.
*
* If conflicts arise, return them in *CONFLICT_STORAGE_P; otherwise set
* that to null.
@@ -179,6 +179,7 @@ struct conflict_storage_t
*/
svn_error_t *
svnmover_branch_merge(svn_branch__txn_t *edit_txn,
+ svn_branch__state_t *edit_branch,
conflict_storage_t **conflict_storage_p,
svn_branch__el_rev_id_t *src,
svn_branch__el_rev_id_t *tgt,