Re: [PATCH] Split up the reintegrate merge API: first find what to do, then do it - v2
From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Sun, 11 Dec 2011 19:35:04 +0000 (GMT)
This version of the patch is much shorter and gets back to the essentials. I found that yes the existing 'svn_client_merge4()' API can be called as the final step, so all I am doing here now is providing a simplified reintegrate API that just checks the target WC is suitable and then finds and returns the two URLs and revisions for the two-URL merge. The caller then calls svn_client_merge4() with the two URLs and revisions that we found. Like this:
The svn client reintegrate merge code calls:
svn_client_find_reintegrate_merge(&url1, &rev1, &url2, &rev2, ...);
svn_client_merge4(url1, rev1, url2, rev2, ...);
In between those two calls, I print a message telling the user what the equivalent two-URL merge command is.
I cut out the stuff about getting a WC write lock around the whole caboodle, becausealthough it's theoretically correct to do soI don't think it's particularly important, given that there are so many other ways and means by which a client can get into the same kind of scenario.
I cut out the code for pretty-printing the URLs in "^/repos-relpath" style because that was not fundamental but just an additional nicety.
If no objections I plan to commit this, without the extra messages about two-url-command (which I'll come back to later).
I (Julian Foad) wrote:> I want them to be reusable, and I expect that there should be
> opportunities for re-use sooner or later. For example, the client
> should be able to use ensure_wc_is_suitable_...() before other kinds
> of merge, and even in other non-merge contexts. The second stage,
> find_reintegrate_merge() obviously has a purpose that is specific to
> a reintegrate merge, but still it should as far as possible return
> results that have some meaning to the caller rather than an opaque
> set of outputs that are only suitable for feeding into
> do_reintegrate_merge(). And I'll investigate now whether and how
> the third stage can call the existing two-URL merge API instead of
> introducing a reintegrate-specific API function.
This is an archived mail posted to the Subversion Dev mailing list.