← Back to team overview

dolfin team mailing list archive

Re: Reverting?

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 11/16/2011 03:09 PM, Martin Sandve Alnæs wrote:
> On 15 November 2011 22:21, Anders Logg <logg@xxxxxxxxx> wrote:
>> On Tue, Nov 15, 2011 at 10:15:43PM +0100, Martin Sandve Alnæs
>> wrote:
>>> On 15 November 2011 22:05, Anders Logg <logg@xxxxxxxxx> wrote:
>>>> On Tue, Nov 15, 2011 at 09:51:06PM +0100, Anders Logg wrote:
>>>>> My recent work has broken the buildbot. Can anyone give a
>>>>> quick tip for how to revert the changes from the branch in
>>>>> such a way that I can reapply the changes + a proper fix
>>>>> later?
>>>>> 
>>>>> It should be fairly quick to resolve the issue but I might
>>>>> as well learn to revert the proper way.
>>>> 
>>>> I believe Marie has pushed a bug fix now, but if someone has
>>>> a good recipe please share. I can add it to the web docs for
>>>> future reference.
>>> 
>>> Revert the entire state to revision 19: bzr revert -r 19 bzr
>>> commit -m "Backout fix for bug #5"
>>> 
>>> Revert one or more previous commits: bzr merge -r 10..9   #
>>> backs out changes from commit 10 bzr merge -r 7..4   # backs
>>> out changes from commits 5,6,7
>>> 
>>> From 
>>> http://doc.bazaar.canonical.com/beta/en/user-guide/undoing_mistakes.html
>>>
>>>
>>> 
Note that the important point here is that changes that have been
>>> pushed somewhere else should be reverted or merged reversely
>>> like above, not e.g. using uncommit because that would mess up
>>> your history vs the already pushed history.
>> 
>> Thanks. And how does one add back the changes once they have
>> been fixed.
>> 
>> In the first case, I would do this in my local (checked out)
>> 1.0.x:
>> 
>> $ bzr revert -r 19 $ bzr commit -m "Backout fix for bug #5"
>> 
>> Then I would fix the bug in my local 1.0.x-logg.
>> 
>> How do I then get the changes from 1.0.x-logg (including the 
>> changesets that were reverted) from 1.0.x-logg into 1.0.x?
>> 
>> Just the usual way?
>> 
>> cd 1.0.x bzr merge ../1.0.x-logg bzr commit -m "Proper fix for
>> bug #5"
> 
> Since 1.0.x already contains the original commit, this shouldn't
> work. You'll need to somehow record a new commit with the proper
> changes. This will depend on the situation and could be messy, but
> assuming you want to re-introduce _all_ changes that were reverted
> previously, you should be able to reverse merge the commit which
> contains the old revert :)
> 
> Disclaimer: I haven't tested this yet!

It worked for me.

> 
> First: $ bzr revert -r 19 $ bzr commit -m "Backout fix for bug #5" 
> Say this introduces a commit -r25. <work work work gets us up to
> -r30>
> 
> Then: $ bzr merge -r25..24 # Reverse cherry-pick the backout commit
> from above

Did you mean "-r24..25" instead (to cherry-pick only from revision 25)?

- --
Andre

> $ bzr commit -m "Re-apply old incomplete fix for bug #5" <work work
> fixing bug properly> $ bzr commit -m "Proper fix for bug #5"
> 
> 
> By the way, I don't like this sentence from the manual: "Unlike a
> normal merge, Bazaar does not currently track cherrypicks." Not
> sure what kind of trouble that may cause. I recommend resolving
> tricky merge situations in a third branch which can safely be
> discarded, and inspecting the result with e.g. log, diff, missing.
> 
> Martin
> 
> _______________________________________________ Mailing list:
> https://launchpad.net/~dolfin Post to     :
> dolfin@xxxxxxxxxxxxxxxxxxx Unsubscribe :
> https://launchpad.net/~dolfin More help   :
> https://help.launchpad.net/ListHelp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOw88DAAoJEA79ggnbq9dmuKQIAI2pTxDHE7HjcBdLXzU0ERDd
/SXOCpRTryQ8k8GCneUSQfQa5sgK9duNGA+XQA1vGss4vJGmlm8kfcPq/7o43+MR
K7kkZGe6iDQCV8g2qan3MJFwwJAECbbUDi5hzCH334B9X0gIFA9iWe2j2NeRX/+h
vx3QmuoeFpLUlQyrypVhWifXT502vGw8K2VPPxJJS/zZ097bHAAQz1c/47uojs9P
K76iAjHu7x/Dfz7ap9w0qqPBtzYjjs24ir4hRx/1sgeFfcdpGT+UJQsRPlGUAMec
XQ8Ebmy9GChi3uQAjW93voXtaQl6MkBIaksOjE0cisoQXHoZe57jbd1STv6Dn74=
=MTaA
-----END PGP SIGNATURE-----


References