Linear backout

Martin Geisler mg at aragost.com
Fri Jul 2 13:21:15 UTC 2010


Daniel Carrera <dcarrera at gmail.com> writes:

> On Fri, Jul 2, 2010 at 2:31 PM, Julian Cowley <julian at lava.net> wrote:
>> Maybe someone already suggested this or implied it, but why not just
>> use revert like the original backout does?  Instead of the equivalent
>> of "diff | patch", just revert --all to the parent of the revision
>> to be backed out.
>>
>> In other words, given Greg Ward's original steps:
>>
>>    1) let rev be the changeset you want to backout
>>    2) hg update -c $rev
>>    3) hg diff -c $rev --reverse | hg patch --no-commit -
>>    4) hg update
>>    5) hg commit -m"Backout $rev"
>>
>> Step 3) changes to:
>>
>>    3) hg revert --all --rev p1($rev)
>
> That sounds better than "hg diff | hg patch".

Both would work fine since we know the diff would apply.

> And it can be easily extended to backout/cancel a range of patches:
>
> # Cancel revisions <revx> to <revy>
> hg update -c <revy>
> hg revert --all --rev p1(<revx>)
> hg update
> hg commit

Yes, this works fine for a continous range of changesets.

If the range is not continous, then you'll need to apply reverse diffs
one by one and potentially deal with merge conflicts after each diff.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/mercurial/



More information about the Mercurial mailing list