Disable backing out merges?

Arne Babenhauserheide arne_bab at web.de
Sat Oct 8 08:19:22 CDT 2011


Am Donnerstag, 6. Oktober 2011, 16:03:48 schrieb Matt Mackall:
> On Thu, 2011-10-06 at 22:45 +0200, Arne Babenhauserheide wrote:
> > The only way to get rid of them after subsequent pushed commits are
> > clean
> > backouts.
> 
> ..except we know this doesn't actually work for merges and causes lots
> of pain.
…
> > Or fix the backout logic?
 
> I have no idea how to do that, and I actually suspect that a
> satisfactory answer doesn't exist. If you know better, I'm ready to be
> impressed.

Essentially the problem is, that a merge is a special operation which affects 
later merges, right? A backout then only undoes the content changes, but not 
the graph changes. 

a-b-c-x ← broken
 \   /
   d

A backout of c would need to make x a valid changeset, so it would actually 
have to 
(a) rebase x on b or d und then close c-x, or cleaner but more complex
(b) do a new merge of d and b, rebase x on it and then merge x with that, 
discarding the changes from x.

(a)

a-b-c-x † ← closed
 \   /
   d-x' ← OK

(b)

a-b--\
 \   \  c'-x'-y ← OK
  \   X     /
   \ /  c-x ← broken
   d--/

y = x - c + c'

So essentially y is a rebase of x on c', followed by a dummy merge of x on x' 
to replicate the graph change.

If I did not miss something, future merges should then work without problems.

So actually a backout of a merge is either
(a) a rebase + close (there should never have been a merge in the first place), 
or
(b) a remerge + rebase + dummy merge (merging was the right thing to do, but 
the exact merge was bad).

(a) and (b) should warn everyone who wants to push ancestors of the bad merge, 
because they would introduce a new non-closed head.

Is this correct? 

Best wishes, 
Arne
--
A man in the streets faces a knife.
Two policemen are there it once. They raise a sign:

    “Illegal Scene! Noone may watch this!”

The man gets robbed and stabbed and bleeds to death.
The police had to hold the sign.

…Welcome to Europe, citizen. Censorship is beautiful.

   ( http://draketo.de/stichwort/censorship )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 316 bytes
Desc: This is a digitally signed message part.
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20111008/e823524a/attachment.pgp>


More information about the Mercurial-devel mailing list