Am 08.09.20 um 21:47 schrieb James Cook:
>>>> In your case, for two adjacent /sequences/ A;B, and equivalences A~A',
>>>> B~B', we need to have that A;B commutes iff A';B' commutes. Now, suppose
>>>> you have patches a;b;b^;c, where none of the adjacent pairs commute.
>>>> You'd have to show that this implies that a;c commutes neither (taking
>>>> e.g. A=[a] and B=[b;b^;c]). But you can't, since it is not true. A
>>>> counter example consists of 3 hunks a, b, c, where a and b overlap, b
>>>> and c overlap, but a and c do not overlap. More concretely, take the
>>>> initial state as file f=[1,2,3] and
>>>>
>>>>   a=hunk f 1 [1] [1a]
>>>>   b=hunk f 1 [1,2,3] [1b,2b,3b]
>>>>   c=hunk f 3 [3] [3c]
>>>
>>> I'm still not sure I understand the problem. I agree that in your
>>> example, it's possible to commute [a] with [c] but not [a] with
>>> [b;b^;c]. But it is possible to "rearrange" a;b;b^;c into b;b^;c;a if
>>> "rearrange" is defined broadly enough to allow the following three
>>> steps: a;b;b^;c -> a;c -> c;a -> b;b^;c;a.
>>
>> Commutation means that we may have to re-arrange the /content/ of the
>> patches we commute, such that they make sense in their new context. You
>> abstracted that part away here. If we re-add it, the sequence becomes:
>>
>>   a;b;b^;c -> a;c -> c';a' -> b';b'^;c';a'
>>
>> But what is the new b'? It should be clear that, in general, it cannot
>> be the same as b: if b depends on a (which is what we assumed), then
>> that means that b makes no sense without having a before it.
>>
>> Take the above three hunk patches and tell me how b' should be defined
>> such that the resulting sequence b';b'^;c';a' makes sense.
> 
> Oops, I didn't pay enough attention to your concrete example.
> 
> Did you mean b = hunk f 1 [1a,2,3] [1b,2b,3b]? (I'm guessing hunk f n
> [u,v,w] [x,y,z] means lines n..n+2 of file f start out as [u,v,w] and
> end up as [x,y,z]; is that right?)

Yes to both, sorry I messed up the example. For reference, here is the
fixed example in full:

  a=hunk f 1 [1] [1a]
  b=hunk f 1 [1a,2,3] [1b,2b,3b]
  c=hunk f 3 [3] [3c]

> Then yes, I guess the order b;b^;c;a is not possible.
> 
> I really want this to work, though,

May I ask why? I mean, really, this is what commutation of patches is
all about: to determine if we /can/ re-arrange the internals of patches
in such a way that they make sense in a different context and in such a
way that the patch laws hold.

> so now I wonder what happens if we
> just accept the situation: even though c can be rearranged to b;b^;c,

The point is that you can /not/ do that. Yes, the /effect/ of b;b^;c is
the same as that of c, that is, you can apply both to the same tree and
get the same result. But with respect to commutation they are not
equivalent.

> and a;c can be rearranged to c;a

Remember that in the general commutation may result in a different pair
c';a'. (In my example above a=a' and c=c', but this is a special case.)

> it turns out we can't combine the
> two to rearrange a;c to b;b^;c;a.

This means "rearrangement" is not permutative. Permutivity is essential
for proving that merging is order-independent. This is *the* key feature
that distinguishes Darcs from e.g. git.

> I guess it's kind of ugly that changing the context can change what
> rearrangements are possible:

So far, patch theory has been designed precisely to avoid that, which is
why in Darcs we allow re-arrangement of a sequence only via commutation.

> in this case, the rearrangement c ->
> b;b^;c may be possible or not depending on whether a patch named "a"
> has been applied. This is cause to be suspicious, but is there an
> obvious reason it's unworkable?

I can't answer this question in any exact or precise way. My gut feeling
is that it's going to be an ugly mess, but I haven't tried it so I may
be wrong. I should perhaps also point out that there are some operations
in Darcs for which the context is important; for instance, conflict
markup in general requires access to the complete context.

Cheers
Ben

_______________________________________________
darcs-users mailing list
darcs-users@osuosl.org
https://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to