At work I am using a svn
repository shared among 7 people.
To avoid plaguing my mistakes with commits and breaking the builds for everyone and to avoid
Well, yes and no.
I know that your question indicates you're using a remote repository as the source, but the title of the question is a bit broader, so I'm answering the broader question.
The seemingly apparent end-result is the same. Though the files inside the two repositories are not binary identical (note, I'm not talking about the files you track, I'm talking about the "database" that Mercurial uses to track those files in), the history, changesets, etc. are all the same.
So in that respect, yes, those two seem to do the same thing.
However, they do it in different ways.
If you do this:
hg clone REMOTE_URL
hg init && hg pull REMOTE_URL
Then there is no real difference.
However, if you do this:
hg clone LOCAL_PATH
hg init && hg pull LOCAL_PATH
(note, this clone/pull is from another repository already on your disk)
Then there might be a difference. A local clone will, if possible, use hardlinks for the repository. In other words, you're not making a new distinct copy of all the files in the repository, you're creating new links on disk for them, which runs vastly quicker and requires almost no space.
Then, when you start modifying the history, ie. committing new changesets, those files are unlinked and made full copies, on a on-demand basis.
Note that the exact heuristics for which files it does and does not make such hardlinks for is not known to me. You can read more about this feature in the Mercurial wiki, Hardlinked Clones.
Pulling will not do this. It will read from the other repository and create/update new files in the target repository. This takes more time, and more disk-space.
So to summarize:
hg clone LOCAL_PATH
can use a lot less disk-space and run a whole lot quicker than a hg init && hg pull LOCAL_PATH
The only difference is that if you run hg init && hg pull <remote>
, then you must also:
hg update default
to checkout a working copypush
and pull
hg clone
does all this in one command.