Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloning a Mercurial repository without .hg

How can I clone a Mercurial repository without the .hg folder to save time (the project is big)? I only need the tip files.

like image 479
oaziz Avatar asked Jul 01 '11 14:07

oaziz


People also ask

How do I clone a Mercurial repository?

Clone a remote Mercurial repositoryFrom the main menu, select Hg | Get from Version Control. The Get from Version Control dialog opens. In the dialog that opens, select Mercurial from the Version control list and specify the URL of the remote repository you want to clone. Click Clone.

How do you clone in Tortoise Hg?

To clone a repository you have to run the clone dialog. From the explorer context menu select TortoiseHg… ‣ Clone a repository or type thg clone. It is the path (or URL) of the repository that will be cloned.

How do I cancel my Mercurial repository?

Jonathan: Removing it is quite proper. We try to keep simple things simple in Mercurial: hg init creates . hg for you, and rm -r . hg will undo that.

What is a Mercurial repository?

What Is Mercurial? Mercurial is a free, distributed version control system. It's also referred to as a revision control system or Mercurial source control. It is used by software development teams to manage and track changes across projects.


1 Answers

The .hg directory is what stores your complete repository information. That is, information about all your files and their revisions tracked by the repository. As for storage, it usually is pretty efficient since it is compressed using binary differerencing.

When you clone a repository, the only thing that is cloned is the .hg directory. The working copy you will get after the clone is retrieved from that .hg.

If all you want to store is the repository information (say on a server), you can remove the working copy with hg update null.

If you want to create a clone of your repository without the revision information, you can use the hg archive command (see reference below). Be aware that this copy is just a "working copy" (to use some common svn terminology). You can't commit, nor do any other mercurial operation with it.

hg archive [OPTION]... DEST

create unversioned archive of a repository revision

By default, the revision used is the parent of the working
directory; use "-r" to specify a different revision.

To specify the type of archive to create, use "-t". Valid
types are:

"files" (default): a directory full of files
"tar": tar archive, uncompressed
"tbz2": tar archive, compressed using bzip2
"tgz": tar archive, compressed using gzip
"uzip": zip archive, uncompressed
"zip": zip archive, compressed using deflate

The exact name of the destination archive or directory is given
using a format string; see "hg help export" for details.

Each member added to an archive file has a directory prefix
prepended. Use "-p" to specify a format string for the prefix.
The default is the basename of the archive, with suffixes removed.

options:

--no-decode  do not pass files through decoders  -p --prefix    

directory prefix for files in archive -r --rev revision to distribute -t --type type of distribution to create -I --include include names matching the given patterns -X --exclude exclude names matching the given patterns

like image 113
Johannes Rudolph Avatar answered Sep 19 '22 21:09

Johannes Rudolph