Philip Martin wrote: > Julian Foad <julianf...@btopenworld.com> writes: >> Example 3: Swapping two directory levels >> >> | | >> +--A --\ /--> +--A >> | X | >> +--B --/ \--> +--B >> >> 1. alter-dir A (children={}) ### Needed? >> >> 2. mv-away A/B (id=”original A/B”) >> >> 3. alter-dir / (children={A}) >> >> 4. mv-away A (id=”original A”) >> >> 5. mv-here A (id=”original A/B”) >> >> 6. alter-dir A (children={B}) ### Second alter-dir on same path, if >> (1) was needed. >> >> 7. mv-here A/B (id=”original A”) > > That's inconsistent: for A alter-dir is before mv-away while for A/B > alter-dir is after mv-away.
In what I wrote here, alter-dir(/) is before mv-away(A), and there are two calls to alter-dir(A), in steps 1 and 6, before and after mv-away(A/B). But anyway, yes, it's messed up, and your suggestion below is neater. > A more consistent set of steps would be: > > 1. alter-dir A/B (children={A}) > > 2. alter-dir A (children={}) > > 3. mv-away A/B (id="original A/B") > > 4. mv-away A (id="original A") > > 5. mv-here A (id="original A/B") > > 6. mv-here A/B (id="original A") Yes, that's nicer. Yes, you can probably drop the alter-dir(/) like you have done, on the basis that the list of child names in (/) does not change even though their identities do change. That's an under-specified part of the rules. > Not sure whether 1 and 2 have any particular order. In the working copy > receiver the alter-dir for A/B causes A to be added as incomplete in > A/B; it becomes complete at step 6. I'm not sure whether the alter-dir > for A that deletes a child causes anything to be marked. > >> There are two potential problems here: >> >> * We make an edit within subtree A (the “move-away A/B”) before moving A >> >> * The “alter-dir A” is performed twice > > In this case there is no need to perform alter-dir on A twice. Right, good. > As you pointed out when a copy replaces a mv-away it is still necessary > to alter-dir two different nodes at the same path: > > 1. alter-dir A (children={...}) > 2. mv-away A (id=...) > 3. copy A (src=...) > 4. alter-dir A (children={...}) Well, that depends. There may be no need to issue the alter-dir on the original 'A' at this stage, we could wait until it arrives at its final path (move-here B (id="original A"), then alter-dir B). - Julian