I have commits A, B, C, D, and E. I realize that something very bad happened in commit B, so I want to revert back to A, make the change correctly this time that screwed up B before, and then reapply C, D, and E automatically.
You may be wondering why I don't revert back to B and make the fix there, then remerge back in to E (is this ever a good idea?). The reason is not well understood by me, but it has something to do with the problem occurring in a set of special visual studio files (that should only be edited via some GUI screens in visual studio) that don't play well with simply correcting the file after an error occurred... I would give more details if I knew them
Just make a backout of what you did in B and commit it as F. This way, history will be intact, and your peers will get the change without having to know about it.
If B is a service release, do make the change there and merge it into F afterwards.
This can be done using Mercurial Queues (mq). You want to:
This is done as follows:
cd <project>hg qinithg qimport --rev B:Ehg qpop --allhg qpush <patch name for B>hg qrefreshhg qpush --allhg qfinish --appliedThis all assumes that B through E have not been pushed to any public repositories. If they have already been pushed, then your best bet is to simply fix the problem in a new changeset (F).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With