Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to clone a repository from the web incrementally?

I'm on dialup in lousy place (yes, it still happens in 2011), and trying to clone a huge repository. It starts without problem, but every time the dialup disconnects (which is unavoidable, it seems), the !#%$* hg rolls everything back and I'm left again with an empty directory.

Is there a solution other than doing it on a remote PC and then downloading the whole thing by FTP or something?

like image 977
LostInTheWoods Avatar asked Jan 17 '11 17:01

LostInTheWoods


2 Answers

In a bash-like shell you could do something like this:

$ hg init myclone
$ cd myclone
$ for REV in `seq 10 10 100` ; do hg pull -r $REV <REMOTEREPO>; done

Starting at 10, each pull downloads the next 10 revisions, up to 100. In case of a lost connection, adjust the first argument to seq to match what you've already pulled.

like image 172
Oben Sonne Avatar answered Oct 21 '22 02:10

Oben Sonne


Depending on how flaky your connection is, there are two options for performing initial clones.

First, you can try so-called “streaming clones”. These minimize Time To First Byte, but do generally require a bit more data to be transferred.

Here’s how to do a streaming clone:

$ hg clone --uncompressed https://~~~~

Your second option will be a hg clone –-rev operation, followed by a number of incremental pulls. This behaves similarly to cloning a repository in some distant past and doing occasional updates.

$ hg clone --rev 5 https://~~~~
like image 32
Y. Leonce Eyog Avatar answered Oct 21 '22 01:10

Y. Leonce Eyog