简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM