How to "push" manually?

skip at pobox.com skip at pobox.com
Sun Apr 5 19:01:31 CDT 2009


    >> Apparently so. You have one or more heads in your local repository
    >> that the remote repository doesn't.  If you pushed everything, the
    >> remote repository would have heads that it previously didn't. That's
    >> $,1r|(Bcreating remote heads$,1r}(B.

I don't get it.  Is a Mercurial head like a branch?  I did incorporate some
changes another guy made available for me a week or two ago (some sort of
blah.hg file).  From my bash history:

    hg pull ~/tmp/lockfile.pidlockfile.r76.hg

I recall having trouble after that as well.  (Look back through the list
archives.)

    >> Ordinarily, you're supposed to merge these heads back into a single
    >> line, then push. Alternatively (with the rebase extension), you can
    >> rebase the divergent line of history onto the one you consider
    >> primary, assuming you haven't previously pushed any part of that
    >> line.  If you really do want to create remote heads, you can use push
    >> -f.

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().

then hg identify:

    % hg identify
    20939e395812 tip

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().

I want the changeset from Ben Finney in my local repository, but not on my
web server.  Going back to my original attempt to push, should I have
explicitly just pushed rev/changeset 82:20939e395812?

    >> Is there not a simple Mercurial cheat sheet somewhere?

    >> What good is knowing commands without understanding the concepts  
    >> behind them?

Ok.  Is there not a simple Mercurial concept sheet somewhere?

    >> Note that head #1 and head #2 both descend from revision X, and are
    >> the heads of separate lines of history since X. Graphically:

    >>          o #1
    >>          |
    >>          |
    >> o #2    o
    >> |       |
    >> |       |
    >> o       o
    >> |       |
    >> |       |
    >> o       o
    >>   \     /
    >>    \   /
    >>     \ /
    >>      o X

    >> (The glog command from the graphlog extension will give you a similar
    >> graph. It's unbelievably handy.)

If it's unbelievably handy, why isn't it enabled by default?  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?

    >> So, again, your choices:

    >> 1. Leave this alone: You meant to do this (either at the time, or  
    >> retroactively starting now). Force the push, since you really do want  
    >> this second, separate line of history.
    >> 2. Cover your tracks: Rebase the #2 line (starting from its first  
    >> commit after X) onto #1. Requires that you have not pushed (and no-one  
    >> has pulled) any part of the #2 line. Also requires that you turn on  
    >> the rebase extension.
    >> 3. Merge #2 into #1 (or vice versa).

*sigh* Again, I remind you that this whole thing is not Mother's Milk to me.
What is "rebase"?  Now I know why scientists trying to write software get so
frustrated with us software types.  They just have a job to do, and for the
most part don't need to become software experts.  They have enough to do
being experts in chemistry, biology, whatever.

At this point we've established that I somehow messed up my repo (at least
w.r.t. the repo on my web server).  It appears all I wanted to do was

    hg push -r 20939e395812 ssh://www.smontanaro.net//home/skip/public_html/python/lockfile

After getting rid of the repo on my web server and moving the old one back
in place, the above command worked.  So I'm back in business.  For now.
Could I have simply removed Ben's head from the web server repo (that sounds
violent - thankfully it's only a virtual decapitation)?

Thanks,

-- 
Skip Montanaro - skip at pobox.com - http://www.smontanaro.net/
        "XML sucks, dictionaries rock" - Dave Beazley


More information about the Mercurial mailing list