# Re: Ev2 as a move-aware editor

From: Branko Čibej <brane_at_wandisco.com>
Date: Thu, 27 Jun 2013 20:29:47 +0200

On 27.06.2013 19:42, Julian Foad wrote:
> What
> if (B) has a child named "B" already? Two possible options are the
> rotation is not allowed or the child gets deleted and replaced. These
> options both impose an additional ordering constraint: if we want to
> keep that node and move it to somewhere else, we have to do it *before*
> this rotation. But there are cases where we cannot do that. Perhaps
> the simplest is swapping 'A' with 'A/B' while keeping 'A/B/B' in place:
>
> "A" | -- -> "A" |
> (A) \/ (B)
> "B" | /\ "B" |
> (B) -- -> (A)
> "B" | "B" |
> (B2) -----> (B2)
>
> Note
> that node (B2) needs to be 'moved' although it remains at the same
> absolute path, because our definition of 'move' says that it would
> otherwise go with its parent. In this case, we cannot move A/B/B before
> the rotate because it would need to go to A/B which is already
> occupied. If we try to do it after the rotate, we find it has already
> been deleted and replaced, as explained in the previous paragraph.
>
> Thus the model does not satify the constraints.

But you cannot achieve this in a working copy without doing more than
just the equivalent of the rotate; you have to perform other operations
as well. So I suspect your example is not realistic.

We are talking here about optimizing the number of operations required
to reproduce a tree state. Some sequences of operations are irreducible
-- so it doesn't help to invent such sequences and then try to define
"rotate" such that it represents the results.

> == Rotate Without Children ==

This bit is an interesting theoretical exercise but doesn't help us much
given that Subversion manipulates trees of objects. The operation you
describe does not have an equivalent in the working copy; or rather, one
can imagine creating this state by swapping all the children of the
rotated nodes, which is decidedly not a single operation. Reducing the
result of such an operation to your childless rotate is of course
possible, but IMO makes no sense because the situation too rare.

In other words, if rotate were defined to operate on nodes without
children, you'd almost never actually use it.

-- Brane

--
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane_at_wandisco.com