[darcs-users] Re: definition of "depends on"?

Ian Lynagh igloo at earth.li
Sun Apr 29 12:23:45 UTC 2007


On Sat, Apr 28, 2007 at 08:16:07PM -0700, Adam Megacz wrote:
> 
> The theory of patches says that "when two patches fail to commute, it
> is said that the second patch depends on the first".  Earlier it says
> that "the context of a patch consists of the set of patches that
> precede it".
> 
> Using the right-to-left (group-like?) notation, if I have a repository
> like this:
> 
>     P_3 P_2 P_1
> 
> We would say that "P_2 is in the context of P_3, and therefore P_3
> depends on P_2".  However, if P_3 and P_2 commute, then I can
> transform the repository to an equivalent state:
> 
>     P'_2 P'_3 P_1
> 
> In which the "changes caused by" P_3 (that is, P'_3) do not contain
> P_2 or P'_2 in their context.  So we can say that "it is possible to
> re-order the repository so that the changes embodied in P_3 do not
> depend on the changes embodied in P_2".
> 
> So it would seem that commuting patches changes what they depend on.

No, If P2 and P3 commute then neither depends on the other, no matter
what order they happen to be in in your repository.

To repeat your quote above, with added emphasis:

"when two patches *fail to commute*, it is said that the second patch
depends on the first"


The patch P2 doesn't have a context, but the representation P_2 of P2
has context {P1} and the representation P'_2 of P2 has context {P1, P3}.

> If everything up to this point is correct, then my question is this:
> if two patches commute, will darcs always be able to unpull one
> without unpulling the other?

Yes (assuming darcs is bug-free).

> Phrased another way, "can I get darcs to use its ability to commute
> patches to break dependencies?"

No, because a dependency means commutation fails, by definition.

> One other question: is there ever a case where a patch cannot be
> commuted past a pair of other patches, but the combination of the pair
> does commute?  In other words, is there a case where
> 
>     A B C <-/-> B' A' C <-/-> B' C' A''
> 
> (where one of the two <-/->'s fails) yet
> 
>     A (B C) <--> (B C)' A'

I think the only case is

    A (inv A) B (inv B) <->* B (inv B) A (inv A)

(and more complex scenarios that boil down to this).

Note that

    A (inv A) B <->* B A' (inv A')

does not work as, though B is fine (it is in the same context), we can't
find A' and (inv A') with B in their context.


Thanks
Ian




More information about the darcs-users mailing list