hg 0.9.3: pull, revert to pre-merged version, pull expected behavior?
Matt Mackall
mpm at selenic.com
Thu Apr 26 19:15:16 UTC 2007
On Thu, Apr 26, 2007 at 02:43:26PM -0400, Allan Wind wrote:
> On 2007-04-26T11:06:16-0500, Matt Mackall wrote:
> > On Thu, Apr 26, 2007 at 08:43:05AM -0400, Allan Wind wrote:
> > > So if I cannot pull the changes in (because they were already merged
> > > into this branch), then how do I get those changes? diff/patch?
> >
> > You're still not Understanding Mercurial.
>
> Fair enough given that my experience with hg started last night night
> with a review of the website, mail archives and bug tracking system then
> working through the tutorial. I will humbly point out that:
> http://www.selenic.com/mercurial/wiki/index.cgi/UnderstandingMercurial
> does not explain how pull/merge interact with the store/repository and
> the working directory.
>
> > A repository is a collection of changesets, usually coupled with a
> > working directory. Push and pull syncronize changesets between
> > repositories with -no effect on your working directory-. So when you
> > did the first pull, you got all those changesets into your local
> > repository. You can see them with hg log and hg heads. There's no need
> > to pull them again.
> >
> > Merge brings changes from other parts of the repository into your
> > working directory with -no effect on your repository-.
>
> Thanks for your explanation. I am afraid that I am not able to phrase
> the question in a way that will elicit an answer. Perhaps an example
> will help:
>
> $ hg clone http://www.selenic.com/repo/hello my-hello
> $ cd !:3
> $ sed 's/world/world2/' hello.c > hello.c.tmp && mv hello.c.tmp hello.c
> $ hg commit -m '2'
>
> Now I want tip to contain the working directory we had in 1:
Why do you want to do that? To undo a change?
> $ hg update 1
> $ hg commit -m 'back to 1'
> nothing changed
And indeed, nothing changed. If this -had- succeeded, you would now
have two heads, which is probably not at all what you wanted.
> And the solution that I proposed was (continued from above):
>
> $ hg update
> $ hg diff -r2 -r1 | patch
> $ hg commit -m 'make working directory contain same data as 1'
That's called 'revert':
$ hg revert -r1
$ hg commit -m 'revert all changes back to rev 1'
You might also be interested in the backout command.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list