You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@apache.org> on 2015/12/17 11:10:12 UTC

[RFC] An element-based 'svn merge'

For the first practical application of element-based move tracking and
merging, I propose to write an element-based alternative to 'svn
merge'. This version of 'svn merge':

  * matches tree elements by path, like today...
  * ... except where the user specifies a different matching (aka a 'move')
  * uses the element-based merge algorithm (which handles moves)

This is like the implementation in 'svnmover' except it operates on a
real repository and WC, and has to be given the matching data
manually.

Most of the required pieces are in place now, in svnmover.

The benefits are:

  * a merge involving moves will Just Work, without the moves causing
any conflicts to be reported.

The initial implementation will work like this, as a minimum, with the
following limitations:

  * input: a requested merge from known, single-revision source trees,
    either discovered by 'automatic merge' or specified by user
  * input: a set of user-specified element matchings, each of the form
    (src-left-path, src-right-path, target-path)
  * assign EIDs (in memory) to the source-left, source-right and target trees
  * perform a tree merge, creating a temporary result (in memory)
  * check for (new style) conflicts in the result; if any, bail out
  * convert the result to a series of WC edits and apply those to the WC
  * forget all the EID metadata

Work needed:

1. A UI and data structure to input the user-specified matchings.
(Straightforward.)

2. A routine that assigns EIDs to the three trees based on the
user-specified matchings and path matching. (Straightforward.)

3. Fetching the contents of the source-side trees -- easiest would be
to fetch each tree separately in its entirety. A big performance
improvement would be to fetch src_left and diff(src_left:src_right),
and construct src_right from those. Better still, also construct
src_left from target and diff(target, src_left).

4. Conversion of the element-based result to a series of WC edits. The
code in branch_compat.c doesn't quite do this, as it assumes an Ev1
output (with only a 'copy' operation) whereas the WC API has a 'move'
operation that we probably need to use. In general it will need to
insert temporary moves e.g. to swap X and Y it may need to start by
moving X to temporary name Z. Unless the WC API moves can also be set
up using just 'copy' operations, in which case the approach in
branch_compat.c is on the right track although it is currently buggy.

Items 1 and 2 are straightforward, and 3 can also be straightforward
for an initial, crude implementation, and 4 is probably the hardest
part.

- Julian

Re: [RFC] An element-based 'svn merge'

Posted by Stefan Sperling <st...@elego.de>.
On Fri, Dec 18, 2015 at 01:49:08PM +0000, Philip Martin wrote:
> Julian Foad <ju...@apache.org> writes:
> 
> > I (Julian Foad) wrote:
> >
> >> 4. Conversion of the element-based result to a series of WC edits. The
> >> code in branch_compat.c doesn't quite do this, as it assumes an Ev1
> >> output (with only a 'copy' operation) whereas the WC API has a 'move'
> >> operation that we probably need to use. In general it will need to
> >> insert temporary moves e.g. to swap X and Y it may need to start by
> >> moving X to temporary name Z. Unless the WC API moves can also be set
> >> up using just 'copy' operations, in which case the approach in
> >> branch_compat.c is on the right track although it is currently buggy.
> >
> > Anyone willing to help write one of the other parts?
> 
> I'll start looking at 4.

I'm looking back at this thread now, trying to figure out to what
extend I should try to support moves in the new conflict resolver.

Did any of this element-based merge code make it into our repository?

Re: [RFC] An element-based 'svn merge'

Posted by Philip Martin <ph...@wandisco.com>.
Julian Foad <ju...@apache.org> writes:

> I (Julian Foad) wrote:
>
>> 4. Conversion of the element-based result to a series of WC edits. The
>> code in branch_compat.c doesn't quite do this, as it assumes an Ev1
>> output (with only a 'copy' operation) whereas the WC API has a 'move'
>> operation that we probably need to use. In general it will need to
>> insert temporary moves e.g. to swap X and Y it may need to start by
>> moving X to temporary name Z. Unless the WC API moves can also be set
>> up using just 'copy' operations, in which case the approach in
>> branch_compat.c is on the right track although it is currently buggy.
>
> Anyone willing to help write one of the other parts?

I'll start looking at 4.

-- 
Philip Martin
WANdisco

Re: [RFC] An element-based 'svn merge'

Posted by Julian Foad <ju...@apache.org>.
I (Julian Foad) wrote:
> Work needed:
>
> 1. A UI and data structure to input the user-specified matchings.
> (Straightforward.)
>
> 2. A routine that assigns EIDs to the three trees based on the
> user-specified matchings and path matching. (Straightforward.)
> trees
>
> 3. Fetching the contents of the source-side trees -- easiest would be
> to fetch each tree separately in its entirety. A big performance
> improvement would be to fetch src_left and diff(src_left:src_right),
> and construct src_right from those. Better still, also construct
> src_left from target and diff(target, src_left).

I've started working on this (2. and 3.) -- in the
assign_eids_to_trees() function. I think I will in fact use diffs,
because otherwise it would be hugely expensive which would make a bad
first impression, and anyway it seems to be just as easy to get the
info from diffs as from full tree walks.

> 4. Conversion of the element-based result to a series of WC edits. The
> code in branch_compat.c doesn't quite do this, as it assumes an Ev1
> output (with only a 'copy' operation) whereas the WC API has a 'move'
> operation that we probably need to use. In general it will need to
> insert temporary moves e.g. to swap X and Y it may need to start by
> moving X to temporary name Z. Unless the WC API moves can also be set
> up using just 'copy' operations, in which case the approach in
> branch_compat.c is on the right track although it is currently buggy.

Anyone willing to help write one of the other parts?

- Julian

Re: [RFC] An element-based 'svn merge'

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Dec 17, 2015 at 02:28:44PM +0000, Julian Foad wrote:
> On 17 December 2015 at 14:14, Stefan Sperling <st...@elego.de> wrote:
> > So I think we'll need some automated support for finding moves.
> > It doesn't need to be perfect, though.
> 
> Yes, that's all correct: this is only a first step, and one of the
> next steps is to provide mapping input semi-automatically, for example
> in the ways you mention.

Sounds great! I'm looking forward to helping out with integrating
this into update/merge/resolve, however we decide to proceed.
I hope we can join forces and work out an integrated solution together.

My new conflict resolver work is still not finished and I plan to continue
working on it over the course of the coming year, starting in January.
I didn't get to put a lot of time into it this year but I'll be able
to invest more time into that effort soon.

Re: [RFC] An element-based 'svn merge'

Posted by Julian Foad <ju...@gmail.com>.
On 17 December 2015 at 14:14, Stefan Sperling <st...@elego.de> wrote:
> On Thu, Dec 17, 2015 at 12:34:46PM +0000, Julian Foad wrote:
>> I mean that if the user doesn't explicitly specify any moves, then it
>> will match by path only, which will result in behaviour similar to
>> today. If the user specifies one or more 'moves', those will override
>> the path matching for the specified element(s). e.g. the user might
>> specify
>>
>>     svn merge ... \
>>         --match:(src_left="foo", src_right="x/bar", target="foo")
>>
>> to specify that there was a move from 'foo' to 'x/bar' in the source,
>> and this node corresponds to 'foo' in the target.
>
> This UI requires knowledge about moves prior to the merge and
> the question becomes: How does a user know which moves occured?
> This is a hard question for users to find answers for today.
> I'm not sure people are going to be happy while manually searching
> 'svn log -v' output for this information.
>
> So I think we'll need some automated support for finding moves.
> It doesn't need to be perfect, though.

Yes, that's all correct: this is only a first step, and one of the
next steps is to provide mapping input semi-automatically, for example
in the ways you mention.

> Would it be possible to make your new logic accessible from the conflict
> resolver somehow? If a tree conflict is found in the working copy after
> a merge by 'svn resolve', could we ask the user to specify moves, or try
> to auto-detect them (e.g. via move-scan-log heuristics) and offer an
> option to re-run the tree-conflicted merge with your move logic?
> We'd need to be careful however not to destroy local modifiations in
> this process since parts of the working copy may need to be reverted
> to run the merge again.

Yes, that is possible in principle.

> Or perhaps we could have an option which tells svn to try to find moves
> based on move-scan-log (or better server-side information once available)
> before even the first merge operation is attempted. Any moves found would
> be fed into 'svn merge' as you suggest.
>
>         svn merge --find-moves ^/trunk

Yes, that's definitely one way we could extend it.

> We could also default to your logic and provide a way to disable it so
> large merges where no conflicts are to be expected can be run without
> move detection overhead, but we provide move-detection by default:
>
>         svn merge --ignore-moves ^/trunk
>
> I don't think it's bad if a move-scan-log heuristic misdetects some moves
> or doesn't find all of them. It's going to be a vast improvement over the
> current situation in any case. We can fine-tune the heuristic over time,
> or try to make the server provide better information to the client once
> the client can handle moves this way. Users who want to be in full control
> can choose not to use the heuristics, much like they can still force a
> reintegrate merge today by passing --reintegrate.

Yup.

> Does your solution apply to update operations as well?

Yes, it certainly can and should. In this case, one half of the
mapping (BASE : WORKING) is already known because the WC tracks moves,
which means the user would only have to specify the (OLD_BASE :
NEW_BASE) mapping.

- Julian

Re: [RFC] An element-based 'svn merge'

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Dec 17, 2015 at 12:34:46PM +0000, Julian Foad wrote:
> I mean that if the user doesn't explicitly specify any moves, then it
> will match by path only, which will result in behaviour similar to
> today. If the user specifies one or more 'moves', those will override
> the path matching for the specified element(s). e.g. the user might
> specify
> 
>     svn merge ... \
>         --match:(src_left="foo", src_right="x/bar", target="foo")
> 
> to specify that there was a move from 'foo' to 'x/bar' in the source,
> and this node corresponds to 'foo' in the target.

This UI requires knowledge about moves prior to the merge and
the question becomes: How does a user know which moves occured?
This is a hard question for users to find answers for today.
I'm not sure people are going to be happy while manually searching
'svn log -v' output for this information.

So I think we'll need some automated support for finding moves.
It doesn't need to be perfect, though.

Would it be possible to make your new logic accessible from the conflict
resolver somehow? If a tree conflict is found in the working copy after
a merge by 'svn resolve', could we ask the user to specify moves, or try
to auto-detect them (e.g. via move-scan-log heuristics) and offer an
option to re-run the tree-conflicted merge with your move logic?
We'd need to be careful however not to destroy local modifiations in
this process since parts of the working copy may need to be reverted
to run the merge again.

Or perhaps we could have an option which tells svn to try to find moves
based on move-scan-log (or better server-side information once available)
before even the first merge operation is attempted. Any moves found would
be fed into 'svn merge' as you suggest.

	svn merge --find-moves ^/trunk

We could also default to your logic and provide a way to disable it so
large merges where no conflicts are to be expected can be run without
move detection overhead, but we provide move-detection by default:

	svn merge --ignore-moves ^/trunk

I don't think it's bad if a move-scan-log heuristic misdetects some moves
or doesn't find all of them. It's going to be a vast improvement over the
current situation in any case. We can fine-tune the heuristic over time,
or try to make the server provide better information to the client once
the client can handle moves this way. Users who want to be in full control
can choose not to use the heuristics, much like they can still force a
reintegrate merge today by passing --reintegrate.

Does your solution apply to update operations as well?

Re: [RFC] An element-based 'svn merge'

Posted by Julian Foad <ju...@gmail.com>.
Thanks for your comments, Stefan.

A patch to create a skeleton for this feature is attached. Running it
looks like this:

$ SVN_ELEMENT_MERGE=1 svn merge -v --ignore-ancestry -c1700035
^/subversion/trunk
--- Merging
--- Merging by elements: left=^/subversion/trunk@1700034,
right=^/subversion/trunk@1700035, matching={...}
--- Assigning EIDs to trees
--- Merging trees
--- Writing merge result to WC


Stefan Fuhrmann wrote:
> Julian Foad wrote:
>> For the first practical application of element-based move tracking and
>> merging, I propose to write an element-based alternative to 'svn
>> merge'. This version of 'svn merge':
>>
>>    * matches tree elements by path, like today...
>>    * ... except where the user specifies a different matching (aka a
>> 'move')
>>    * uses the element-based merge algorithm (which handles moves)
>
> That part is somewhat unclear to me. Possible interpretations include: [...]

I mean that if the user doesn't explicitly specify any moves, then it
will match by path only, which will result in behaviour similar to
today. If the user specifies one or more 'moves', those will override
the path matching for the specified element(s). e.g. the user might
specify

    svn merge ... \
        --match:(src_left="foo", src_right="x/bar", target="foo")

to specify that there was a move from 'foo' to 'x/bar' in the source,
and this node corresponds to 'foo' in the target.


>> This is like the implementation in 'svnmover' except it operates on a
>> real repository and WC, and has to be given the matching data
>> manually.
>>
>> Most of the required pieces are in place now, in svnmover.
>
> Excellent!  Good to see all the hard work you put into move tracking
> over the years to come to fruition.
>
>> The benefits are:
>>
>>    * a merge involving moves will Just Work, without the moves causing
>> any conflicts to be reported.
>
> Yay!  Do you think it is realistic to complete this within (less than)
> a year in time for 1.10?

Yes, actually I do.

>> The initial implementation will work like this, as a minimum, with the
>> following limitations:
>>
>>    * input: a requested merge from known, single-revision source trees,
>>      either discovered by 'automatic merge' or specified by user
>>    * input: a set of user-specified element matchings, each of the form
>>      (src-left-path, src-right-path, target-path)
>>    * assign EIDs (in memory) to the source-left, source-right and target
>> trees
>>    * perform a tree merge, creating a temporary result (in memory)
>>    * check for (new style) conflicts in the result; if any, bail out
>>    * convert the result to a series of WC edits and apply those to the WC
>>    * forget all the EID metadata
>>
>> Work needed:
>>
>> 1. A UI and data structure to input the user-specified matchings.
>> (Straightforward.)
>>
>> 2. A routine that assigns EIDs to the three trees based on the
>> user-specified matchings and path matching. (Straightforward.)
>
> A while ago I've been thinking about how to store the EID assignments
> in FSFS and FSX.  Adding (root, branchID, EID) -> (noderev, parent)
> and (root, path) -> EID mappings should be easy enough.  My guess
> is that it would take 1 week to do code + another one to get functional.
> And then X amount of time to test & stabilize.
>
> Is repo-side support for branches and EIDs even useful at this point?
> Do we know enough of what their semantics would be?  If so, I'd be
> happy to post a design sketch.

Can we take that to another thread please?

>> 3. Fetching the contents of the source-side trees -- easiest would be
>> to fetch each tree separately in its entirety. A big performance
>> improvement would be to fetch src_left and diff(src_left:src_right),
>> and construct src_right from those. Better still, also construct
>> src_left from target and diff(target, src_left).
>>
>> 4. Conversion of the element-based result to a series of WC edits. The
>> code in branch_compat.c doesn't quite do this, as it assumes an Ev1
>> output (with only a 'copy' operation) whereas the WC API has a 'move'
>> operation that we probably need to use. In general it will need to
>> insert temporary moves e.g. to swap X and Y it may need to start by
>> moving X to temporary name Z. Unless the WC API moves can also be set
>> up using just 'copy' operations, in which case the approach in
>> branch_compat.c is on the right track although it is currently buggy.
>>
>> Items 1 and 2 are straightforward, and 3 can also be straightforward
>> for an initial, crude implementation, and 4 is probably the hardest
>> part.
>
> I agree, 4 sounds messy - just because edit state is inherently
> complex.  OTOH, once you know where each element is and where it
> must end up, rebuilding the tree should not be too hard unless you
> try to be clever:
>
>     for-each path recursively do:
>         if final-eid(path) != current-eid(path)
>             if (current-exists(path))
>                 move-to-temp(current-contents(path))
>             if (final-exists(path))
>                 if (final-is-copy(path))
>                     copy-to-path(final-contents(path))
>                 else
>                     move-to-path(final-contents(path))
>             update-locations-recursively(path)
>     clear-temp
>
> So, you would always know where a specific contents is and never
> overwrite nor delete any until the very end.  Implementation
> details not shown is whether you use trees or maps, are how many
> of them and whether to key them by path or EID.
>
> I'm not even sure that this should be mapped onto the current
> working copy editor.  If the whole thing shall be transactional,
> then the following sequence is safer and adds less wc.db overhead:
>
>     for-each path recursively do:
>         if appears-somewhere-else(path)
>             move-to-temp(path)
>
>     for-each path recursively do:
>         if to-be-deleted(path)
>             if missing(path)
>                 schedule-metadata-removal(path)
>             else
>                 schedule-deletion(path)
>         else
>             if missing(path)
>                 schedule-install(path)
>
>     run-workqueue
>
> My 2¢; I'm not a working copy expert.

Thanks. Yes, I agree something like those formulations should do it.

- Julian

Re: [RFC] An element-based 'svn merge'

Posted by Stefan Fuhrmann <eq...@web.de>.
On 17.12.2015 11:10, Julian Foad wrote:
> For the first practical application of element-based move tracking and
> merging, I propose to write an element-based alternative to 'svn
> merge'. This version of 'svn merge':
>
>    * matches tree elements by path, like today...
>    * ... except where the user specifies a different matching (aka a 'move')
>    * uses the element-based merge algorithm (which handles moves)

That part is somewhat unclear to me. Possible interpretations include:

* New behaviour must be enabled by a e.g. "--move" option.
* New behaviour only kicks in when it encounters a "move" operation.
* Always operates based on element IDs but the effect is only
   visible with moves.

> This is like the implementation in 'svnmover' except it operates on a
> real repository and WC, and has to be given the matching data
> manually.
>
> Most of the required pieces are in place now, in svnmover.

Excellent!  Good to see all the hard work you put into move tracking
over the years to come to fruition.

> The benefits are:
>
>    * a merge involving moves will Just Work, without the moves causing
> any conflicts to be reported.

Yay!  Do you think it is realistic to complete this within (less than)
a year in time for 1.10?

> The initial implementation will work like this, as a minimum, with the
> following limitations:
>
>    * input: a requested merge from known, single-revision source trees,
>      either discovered by 'automatic merge' or specified by user
>    * input: a set of user-specified element matchings, each of the form
>      (src-left-path, src-right-path, target-path)
>    * assign EIDs (in memory) to the source-left, source-right and target trees
>    * perform a tree merge, creating a temporary result (in memory)
>    * check for (new style) conflicts in the result; if any, bail out
>    * convert the result to a series of WC edits and apply those to the WC
>    * forget all the EID metadata
>
> Work needed:
>
> 1. A UI and data structure to input the user-specified matchings.
> (Straightforward.)
>
> 2. A routine that assigns EIDs to the three trees based on the
> user-specified matchings and path matching. (Straightforward.)

A while ago I've been thinking about how to store the EID assignments
in FSFS and FSX.  Adding (root, branchID, EID) -> (noderev, parent)
and (root, path) -> EID mappings should be easy enough.  My guess
is that it would take 1 week to do code + another one to get functional.
And then X amount of time to test & stabilize.

Is repo-side support for branches and EIDs even useful at this point?
Do we know enough of what their semantics would be?  If so, I'd be
happy to post a design sketch.

> 3. Fetching the contents of the source-side trees -- easiest would be
> to fetch each tree separately in its entirety. A big performance
> improvement would be to fetch src_left and diff(src_left:src_right),
> and construct src_right from those. Better still, also construct
> src_left from target and diff(target, src_left).
>
> 4. Conversion of the element-based result to a series of WC edits. The
> code in branch_compat.c doesn't quite do this, as it assumes an Ev1
> output (with only a 'copy' operation) whereas the WC API has a 'move'
> operation that we probably need to use. In general it will need to
> insert temporary moves e.g. to swap X and Y it may need to start by
> moving X to temporary name Z. Unless the WC API moves can also be set
> up using just 'copy' operations, in which case the approach in
> branch_compat.c is on the right track although it is currently buggy.
>
> Items 1 and 2 are straightforward, and 3 can also be straightforward
> for an initial, crude implementation, and 4 is probably the hardest
> part.

I agree, 4 sounds messy - just because edit state is inherently
complex.  OTOH, once you know where each element is and where it
must end up, rebuilding the tree should not be too hard unless you
try to be clever:

     for-each path recursively do:
         if final-eid(path) != current-eid(path)
             if (current-exists(path))
                 move-to-temp(current-contents(path))
             if (final-exists(path))
                 if (final-is-copy(path))
                     copy-to-path(final-contents(path))
                 else
                     move-to-path(final-contents(path))
             update-locations-recursively(path)
     clear-temp

So, you would always know where a specific contents is and never
overwrite nor delete any until the very end.  Implementation
details not shown is whether you use trees or maps, are how many
of them and whether to key them by path or EID.

I'm not even sure that this should be mapped onto the current
working copy editor.  If the whole thing shall be transactional,
then the following sequence is safer and adds less wc.db overhead:

     for-each path recursively do:
         if appears-somewhere-else(path)
             move-to-temp(path)

     for-each path recursively do:
         if to-be-deleted(path)
             if missing(path)
                 schedule-metadata-removal(path)
             else
                 schedule-deletion(path)
         else
             if missing(path)
                 schedule-install(path)

     run-workqueue

My 2¢; I'm not a working copy expert.

-- Stefan^2.

Re: [RFC] An element-based 'svn merge'

Posted by Julian Foad <ju...@apache.org>.
I (Julian Foad) wrote:
>>>   * input: a set of user-specified element matchings, each of the form
>>>     (src-left-path, src-right-path, target-path)
>>>   * assign EIDs (in memory) to the source-left, source-right and target trees
[...]
> The UI input data structure from step 1 could represent the
> transformation that I think you have in mind with your 'svnmucc'
> example as:
>
> { 1: ("A/D/H", "A"), 2: (nil, "A/D"), 3: ("A", "A/D/H") }
>
> a Python dictionary of (EID : (initial path, final path)).

This script attempts to convert a list of (initial_path, final_path)
pairs to a pair (initial_map, final_map) of element mappings:

  subversion/trunk/notes/move-tracking/path_pairs_to_eid_map.py

Running it with Daniel's example as input:
[[[
$ notes/move-tracking/path_pairs_to_eid_map.py
Input:
  ('A/D/H', 'A')
  (None, 'A/D')
  ('A', 'A/D/H')
Input, as (intial, final) mappings by (parent-path, name):
  (1, [('A/D', 'H'), ('', 'A')])
  (2, [None, ('A', 'D')])
  (3, [('', 'A'), ('A/D', 'H')])
# converting e1: ('A/D', 'H') -> (4, 'H')
# converting e3: ('', 'A') -> (0, 'A')
# converting e1: ('', 'A') -> (0, 'A')
# converting e2: ('A', 'D') -> (1, 'D')
# converting e3: ('A/D', 'H') -> (2, 'H')
# converting e4: (3, 'D') already has a parent-eid
Output, as (initial, final) mappings by (parent-eid, name):
  (1, [(4, 'H'), (0, 'A')])
  (2, [None, (1, 'D')])
  (3, [(0, 'A'), (2, 'H')])
  (4, [(3, 'D'), (3, 'D')])
Output, as (initial, final) mappings by paths:
  1 A/D/H        A
  2 None         A/D
  3 A            A/D/H
  4 A/D          A/D/H/D
]]]

- Julian

Re: [RFC] An element-based 'svn merge'

Posted by Julian Foad <ju...@apache.org>.
On 19 December 2015 at 10:36, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> Julian Foad wrote on Thu, Dec 17, 2015 at 10:10:12 +0000:
>> The benefits are:
>>
>>   * a merge involving moves will Just Work, without the moves causing
>> any conflicts to be reported.
>>
>> The initial implementation will work like this, as a minimum, with the
>> following limitations:
>>
>>   * input: a requested merge from known, single-revision source trees,
>>     either discovered by 'automatic merge' or specified by user
>
> This seems like an arbitrary restriction: supposing I have
> a mixed-revision ${SRC} tree with local mods, and I do a wc-URL cp into
> a ${SRC′} tree, what is the difference between using ${SRC} or ${SRC′}
> as my merge source?  _Should_ there be any difference?

It is an unnecessary restriction, intended only to simplify the
initial implementation and to match the existing "svn merge SRC-LEFT
SRC-RIGHT wc" interface. There should be no reason in principle not to
support mixed-revision trees as inputs, except that we'll then have to
delve into exactly what "mixed-revision tree" means in the element
model and how it translates to existing Subversion. That's for later.

>>   * input: a set of user-specified element matchings, each of the form
>>     (src-left-path, src-right-path, target-path)
>>   * assign EIDs (in memory) to the source-left, source-right and target trees
>>   * perform a tree merge, creating a temporary result (in memory)
>>   * check for (new style) conflicts in the result; if any, bail out
>
> What does 'bail out' mean?  It sounds like "discard all the work
> computed in memory and return an error".  Is there a way to avoid doing
> work and then discarding it?  (I assume the "temporary result" is
> expensive to compute)

Correct. Later, we can work on storing the partial result, with
conflicts. In fact, I talked with Philip yesterday afternoon and he's
already thinking about that.

>>   * convert the result to a series of WC edits and apply those to the WC
>>   * forget all the EID metadata
>>
>> Work needed:
>>
>> 1. A UI and data structure to input the user-specified matchings.
>> (Straightforward.)
>>
>> 2. A routine that assigns EIDs to the three trees based on the
>> user-specified matchings and path matching. (Straightforward.)
>
> I wonder how straightforward computing the mapping would be with
> directory moves.  It sounds like nested moves would require some
> op_depth-like state?
>
> Example: Consider merging a commit that was created by 'svnmucc -m "r2"
> rm A cp 1 A/D/H A mkdir A/D cp 1 A A/D/H rm A/D/H/D/H'.  This commit
> consists of one mkdir and many renames, without any "node bifurcation"
> operations.  Is this commit situation something the branch is attempting
> to handle?  How would it be specified in terms of the data structure
> from step (1)?

Yes, it will handle this sort of situation, which we might say
involves "arbitrary moves" or "complex moves".

The UI input data structure from step 1 could represent the
transformation that I think you have in mind with your 'svnmucc'
example as:

{ 1: ("A/D/H", "A"), 2: (nil, "A/D"), 3: ("A", "A/D/H") }

a Python dictionary of (EID : (initial path, final path)).

- Julian

Re: [RFC] An element-based 'svn merge'

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Julian Foad wrote on Thu, Dec 17, 2015 at 10:10:12 +0000:
> The benefits are:
> 
>   * a merge involving moves will Just Work, without the moves causing
> any conflicts to be reported.
> 
> The initial implementation will work like this, as a minimum, with the
> following limitations:
> 
>   * input: a requested merge from known, single-revision source trees,
>     either discovered by 'automatic merge' or specified by user

This seems like an arbitrary restriction: supposing I have
a mixed-revision ${SRC} tree with local mods, and I do a wc-URL cp into
a ${SRC′} tree, what is the difference between using ${SRC} or ${SRC′}
as my merge source?  _Should_ there be any difference?

>   * input: a set of user-specified element matchings, each of the form
>     (src-left-path, src-right-path, target-path)
>   * assign EIDs (in memory) to the source-left, source-right and target trees
>   * perform a tree merge, creating a temporary result (in memory)
>   * check for (new style) conflicts in the result; if any, bail out

What does 'bail out' mean?  It sounds like "discard all the work
computed in memory and return an error".  Is there a way to avoid doing
work and then discarding it?  (I assume the "temporary result" is
expensive to compute)

>   * convert the result to a series of WC edits and apply those to the WC
>   * forget all the EID metadata
> 
> Work needed:
> 
> 1. A UI and data structure to input the user-specified matchings.
> (Straightforward.)
> 
> 2. A routine that assigns EIDs to the three trees based on the
> user-specified matchings and path matching. (Straightforward.)
> 

I wonder how straightforward computing the mapping would be with
directory moves.  It sounds like nested moves would require some
op_depth-like state?

Example: Consider merging a commit that was created by 'svnmucc -m "r2"
rm A cp 1 A/D/H A mkdir A/D cp 1 A A/D/H rm A/D/H/D/H'.  This commit
consists of one mkdir and many renames, without any "node bifurcation"
operations.  Is this commit situation something the branch is attempting
to handle?  How would it be specified in terms of the data structure
from step (1)?

Cheers,

Daniel
(The ′ character is entered in Vim as <Ctrl+K><1><'>.)