从Mercurial导出标记的无版本副本

时间:2009-11-02 20:56:23

标签: svn mercurial svn-export

我对SVN很满意,但一直在寻找Mercurial,因为它能够执行离线提交。我无法弄清楚的是如何做一个无版本的导出旧的标记转。在SVN中,标签只会存在于repo中的\ tags文件夹中,然后我可以从那里导出一些东西,但看起来似乎没有相同的trunk-branches-tags目录用于Hg项目(或者它们是什么? )

我能想到的最好的方法是在某个转速下克隆存储库,然后删除.hg文件夹。 TortoiseHg也不显示标签列表,所以我克隆,浏览日志,更新到任何内容,然后删除/.hg。这看起来很笨拙,有一些首选的方法吗?

2 个答案:

答案 0 :(得分:11)

使用'hg archive'。

  hg archive [OPTION]... DEST

  create an unversioned archive of a repository revision

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

    To specify the type of archive to create, use -t/--type. 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/--prefix 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

-r参数将接受标记名称,如果您不想要存档文件,-t files将获取目录。

答案 1 :(得分:3)

也许您正在寻找“hg archive”?

要导出已标记的版本,请使用:hg archive -r mytag ../export-tagged