[darcs-users] Patch dependency question
droundy at abridgegame.org
Wed Nov 3 11:48:21 UTC 2004
On Mon, Nov 01, 2004 at 05:21:29PM +0000, Catalin Marinas wrote:
> I understand how darcs determines the patch dependencies but there are
> some cases which I do not find being consistent.
> Let's say that the P1 patch adds 2 lines at the end of a file. The file
> P2 adds another line at the end of the file:
> P1 and P2 can easily commute and so one can only pull P2 to his branch.
> If P2 really depends on P2, one can probably set a manual dependency.
> Now, if P3 adds a line which splits P1's hunk, the file becomes:
> Darcs thinks that P3 is dependent on P1. There are cases where this is
> not the case (i.e. adding a new definition in a C header file, sorted
> alphabetically or by other criteria). One can say that 'ddd' is an
> addition to P1 but the same can be said about 'ccc' added by P3.
> I think darcs should allow P1 and P3 commuting. At the moment, darcs can
> only commute two patches applied to the same file if the hunks as a
> whole can commute. In this case, the commuted P1' patch would have two
> separate hunks, aaa and bbb.
> There should be two types of dependencies - (1) a weak dependency, as
> described above, and the user could choose whether to pull the other
> patches and (2) a strong dependency where a patch removes/modifies lines
> from an existing patch.
> Does this sound correct or I'm missing something?
Yes, in theory these two patches could be made to commute. However, note
that this is a special case where both patches only add lines, and don't
remove or modify any lines. If either P1 or P3 were to remove some lines
as well, the question would be moot, since commutation would no longer be
In practice, it's hard to see a need to add special commutation behavior
for this situation. On the other hand, perhaps there are scenarios
(e.g. makefiles) where addition of lines is common, and you *really* would
like to avoid conflicts. On the third hand, this particular commutation
will never avoid a conflict, since there's no ways for two patches created
in parallel to get into this situation.
More information about the darcs-users