How to "push" manually?

skip at pobox.com skip at pobox.com
Sun Apr 5 17:28:52 CDT 2009


    Martin> If you have SSH access to the machine you can install Mercurial
    Martin> yourself. I'll use the 'make local' Makefile target and then
    Martin> simply symlink the hg executable to a directory in your PATH on
    Martin> the server.

    Martin> Then push to ssh://webserver.net/path/to/your/clone.

I do have ssh access and mercurial is installed there (it's an Ubuntu
machine with /usr/bin/hg).  I think I might have originally created the repo
using ssh://...  I just tried the following push commands:

    hg push ssh://www.smontanaro.net/public_html/python/lockfile
    hg push ssh://www.smontanaro.net/home/skip/public_html/python/lockfile
    hg push ssh://www.smontanaro.net//home/skip/public_html/python/lockfile

The first and last failed with

    pushing to ssh://...whatever...
    searching for changes
    abort: push creates new remote heads!
    (did you forget to merge? use push -f to force)

The second failed with

    remote: abort: There is no Mercurial repository here (.hg not found)!
    abort: no suitable response from remote hg!

It seems either the first or third one should work but doesn't for some
mystifying reason.  What is a "remote head"?  I don't think I forgot to
merge.  Was I supposed to merge something?

I moved my remote lockfile directory out of the way and executed both of
these commands:

    hg push ssh://www.smontanaro.net//home/skip/public_html/python/lockfile
    hg clone ssh://www.smontanaro.net//home/skip/public_html/python/lockfile

Both failed with

    remote: abort: There is no Mercurial repository here (.hg not found)!
    abort: no suitable response from remote hg!

So, stumbling around like a drunk in the dark I tried this on the web server:

    mv lockfile lockfile.save
    mkdir lockfile
    cd lockfile
    hg init

and then

    hg clone ssh://www.smontanaro.net//home/skip/public_html/python/lockfile

followed by

    hg push ssh://www.smontanaro.net//home/skip/public_html/python/lockfile

then back on the web server with

    hg update

That seems to have worked (I see changes to lockfile.py which I checked in
earlier today).  While that might be a workaround, I'm still left not
understanding how to sync the web server's repo with the repo on my laptop.
This seems like it ought to be a one-liner, but it's obviously not.

In general I still find myself overwhelmed by all the possible ways to shoot
myself in the foot (ummm... make that "all the possible workflows").  This
is made more complicated by the fact that there are several different dVCS's
competing for mind share and they all seem to do things differently.  If
you're not immersed in the technology all the time (I definitely am not) it
seems impossible to figure out what to do in any given situation.
CVS and Subversion are *so* much easier to do simple things with: checkout,
update, commit, diff, all quite predictable in their behavior.  More limited
to be sure, but certainly more straightforward for many common cases.

Is there not a simple Mercurial cheat sheet somewhere?

Thanks,

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


More information about the Mercurial mailing list