Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloning mercurial repo to the remote host

Tags:

mercurial

Mercurial supports push-style cloning of repositories to remote hosts, however newly cloned repositories don't contain working copies. Is there any 'hidden' option to make mercurial call update upon these cloned repos?

Here is an example:

1) hg init hello

2) hg clone hello ssh://somehost/hello

ssh://somehost/hello only contains .hg directory and I have to execute the following command in the shell in order to fill the working copy:

3) ssh somehost 'cd hello && hg update'

Is there any way to avoid step 3) ?

like image 961
pachanga Avatar asked May 06 '09 20:05

pachanga


2 Answers

You can create a hook on the receiving side. Add the following section to your repo/.hg/hgrc

[hooks]
changegroup = hg update

That should do it. Note that hooks are not cloned.

like image 170
Nick Zalutskiy Avatar answered Oct 19 '22 19:10

Nick Zalutskiy


There is no hidden option to force an update of a remote repository. Only one condition determines whether the update is performed (e.g., line 239 of hg.py in the Mercurial 1.0.1 source):

if dest_repo.local():

If you're going to do some work in the working copy, you're going to log in anyway, at which point running "hg update" is pretty easy, so there's not much motivation to relax the current constraint on remote clones.

like image 20
Nathan Kitchen Avatar answered Oct 19 '22 21:10

Nathan Kitchen