Reputation:
Is it possible to clone a part(a single folder or even a single file) of a repository?
Upvotes: 1
Views: 695
Reputation: 16858
Basically it's not possible, there is nothing like Subversion's svn checkout http://example.com/project/dir1
.
But you can get a partial clone by rewriting the changeset history with hg convert
. On the upside, it will be a partial clone. On the downside, the resulting repository will be not related any more to the initial one. The changeset IDs will be different and it will be very hard to continue interacting with the source repo.
An example of creating a partial clone. Suppose you want to clone only the doc
directory from the repo:
$ hg clone http://example.com/project local-project-repo
$ cat > filemap.txt << END
include doc
exclude .
END
$ hg convert --filemap filemap.txt local-project-repo docs-only-repo
Upvotes: 3
Reputation: 78350
Nope. That's called partial cloning (some file paths but not all) or shallow cloning (some revisions but not all), and not provided because the point of a DVCS is that everyone has a full copy of the full repository.
Some online repositories will let you download .tar.gz files of all the files in a specific revision or a specific file from a specific revision, but that's not done using the Mercurial tool.
Upvotes: 3