undo changes to a single file earlier in history with subsequent modifications

Wujek Srujek wujek.srujek at gmail.com
Thu Nov 22 14:49:47 UTC 2012


Hi. I didn't know backout could do that. Apart from a strange message:

hg backout -r 3883 -I file/to/revert
reverting file/to/revert
11 files updated, 0 files merged, 0 files removed, 0 files unresolved
(how the heck is it 11 when just one file gets changed?)

it works just fine and the working copy is in correct state.
Thank you very much.

wujek



On Thu, Nov 22, 2012 at 2:02 PM, Simon King <simon at simonking.org.uk> wrote:

> On Thu, Nov 22, 2012 at 11:35 AM, Wujek Srujek <wujek.srujek at gmail.com>
> wrote:
> > Hi. I needed to revert a change done to a single file only, and the
> > changeset was not the latest one, and after that change, the file was
> > further changed. What I did was sth like:
> > hg diff -r 194:193 file/to/change > ../reverse.diff
> > hg patch --no-commit ../reverse.diff
> >
> > The problem is that this is based on patches, and there could be some
> > rejects if the reverse diff was no longer consistent with the other
> changes
> > that were done later, right? (In my case, it applied cleanly, just
> asking.)
> >
> > Is there a better way to achieve what I wanted?
> >
> > wujek
> >
>
> I see "hg backout" takes a "--include" argument - would that do what you
> wanted?
>
> ie (untested).
>
>   hg backout --include file/to/change 194
>
> Simon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20121122/9320c4db/attachment-0002.html>


More information about the Mercurial mailing list