[darcs-devel] [issue1327] Failed to commute common patches

Ganesh Sittampalam bugs at darcs.net
Sun May 29 17:50:18 UTC 2016


Ganesh Sittampalam <ganesh at earth.li> added the comment:

> > The most obvious technical difficulty that this bug causes is that
> > it makes tags effectively mutable, in that you can replace the
> > patches a tag depends on without changing its identity.

> This would be very bad. But I cannot see how inconsistency of failure
> (which is what this bug is about) leads to that. Can you give an example?

Elaborating your example slightly, suppose you have this:

[patch 1] add file A
[patch 2] modify file A
[tag]

The tag will explicitly depend on patch 2. Since patch 2 implicitly depends on patch 1 there'll be no explicit 
dependency either from the tag or from patch 2. Here "implicitly depends" is exactly a failure to commute.

Now merge in

[patch 1A] add file A

The It merges as a duplicate with [patch 1] and cleanly with [patch 2] and [tag]. Commute it to before [patch 
1]. Now commute out [patch 1] which is allowed because of the presence of [patch 1A]. The tag is still there, 
explicitly depending on [patch 2] and indirectly/implicitly on [patch 1A].

> > I think consistency of failure breaks down in any case involving
> > dependency. If you replace "add file f" with "add line 10 in f"
> > and "modify f" with "modify line 10 in f", exactly the same issues
> > arise.

> In principle, perhaps, but not in Darcs as it is, since there is no
> separate 'line add' patch (AFAIK), just hunks. I think that for
> consistency of failure to break down there must be duplicates involved,
> however a similar scenario could perhaps be constructed with duplicate
> hunk patches.

A hunk patch is just "remove n lines at position k and add m lines at position k". "Add line 10" = "Remove 0 
lines at position 10 and add 1 line at position 10", and "Modify line 10" = "Remove 1 line at position 10 and 
add 1 line at position 10".

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1327>
__________________________________


More information about the darcs-devel mailing list