How to "push" manually?

Mads Kiilerich mads at kiilerich.com
Sun Apr 5 20:34:14 CDT 2009


[Trying to not repeat what Peter just posted, but adding something extra:]

skip at pobox.com wrote, On 04/06/2009 02:01 AM:
> Working from clues in your email, I executed hg heads:
>
>     % hg heads
>     changeset:   82:20939e395812
>     tag:         tip
>     user:        Skip Montanaro <skip at pobox.com>
>     date:        Sun Apr 05 14:43:05 2009 -0500
>     summary:     a couple more python 2/3 diffs
>
>     changeset:   78:0e57ad532602
>     user:        Ben Finney <ben+python at benfinney.id.au>
>     date:        Wed Mar 11 20:56:17 2009 +1100
>     summary:     Test and implement PIDLockFile.read_pid().
>
>   

Oh. You had two heads in your local repo, not just a line of development
diverging from the one on the web server.


If having two heads was intentional:

If you only want to push one head then you must specify which one to
push, just like you suggested.

Having several branches in one repo makes it easy to make errors. You
can do it, and you can use extensions and named branches to handle it,
but I prefer to keep it simple and have one "branch" in each repo.

Bens changeset could be kept in another local repo cloned from the
original and newer pulled/pushed back.


If having two heads wasn't intentional:

The problem wasn't on the web server but in your local repo. Somehow you
had ended up with two lines of development. There can be many good
reasons for having two heads (at least temporarily), but Mercurial _did_
show a warning when the extra line was introduced. When you tried to
push them it complained again and stopped you. If the two heads had been
merged before you pushed you wouldn't have had any problems.

> Then over on my web server:
>
>     $ hg heads
>     changeset:   82:20939e395812
>     tag:         tip
>     user:        Skip Montanaro <skip at pobox.com>
>     date:        Sun Apr 05 14:43:05 2009 -0500
>     summary:     a couple more python 2/3 diffs
>
>     changeset:   78:0e57ad532602
>     user:        Ben Finney <ben+python at benfinney.id.au>
>     date:        Wed Mar 11 20:56:17 2009 +1100
>     summary:     Test and implement PIDLockFile.read_pid().
>   

When you pushed your local repo with two heads to the new empty repo on
the server then it uploaded both heads without complaining, just like
push -f would have done.

The changesets in the two repos have exactly the same hash, so it _is_
the same changeset that has been pushed/pulled.

> That's a
> rhetorical question.  A little poking around showed me that it comes with
> Mercurial.  How do I find out what other extensions came with Mercurial but
> are disabled by default?  Is there a common set of "unbelievably handy"
> extensions the Mercurial aficianados always enable?
>   

http://www.selenic.com/mercurial/wiki/index.cgi/UsingExtensions

But it would perhaps be a good idea to keep it simple and ignore all
advices of smart extensions until you are familiar with the core
functionality.

> Could I have simply removed Ben's head from the web server repo (that sounds
> violent - thankfully it's only a virtual decapitation)?
>   

IF the problem was that Bens change was on the web server, yes.
But like in real life: removing heads is always violent and often not a
good idea. Mercurial focus on tracking history, and like in real life it
is not easy to undo things. Often it is better to just move on. In
Mercurial heads can be merged without any mess, and you decide how they
should be resolved. That is often the simplest solution.

/Mads

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3435 bytes
Desc: S/MIME Cryptographic Signature
Url : http://selenic.com/pipermail/mercurial/attachments/20090406/c4deb888/attachment.bin 


More information about the Mercurial mailing list