从Mercurial导出一个未版本化的标签副本

8
我对SVN比较熟悉,但一直在研究Mercurial的离线提交功能。我还没有搞清楚如何对旧版本进行未加版本控制的导出。在SVN中,标签只存在于库的 \tags 文件夹中,然后我可以从那里导出一些内容,但是似乎Hg项目不使用相同的主干-分支-标记目录(或者它们是吗?)
我能找到的最好方法就是克隆某个版本的仓库,然后删除 .hg 文件夹。TortoiseHg 也不显示标签列表,所以我克隆,浏览日志,更新到任何版本,然后删除 /.hg。这种方法非常笨拙,是否有更好的方法?
2个回答

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
< p > -r参数接受标签名称,如果您不想要存档文件,则-t files将获取目录。请注意保留HTML标记。


TortoiseHg似乎不支持hg archive,有没有一些shell命令可以显示所有标签的列表? - Nick T
1
现在,TortoiseHg通过本地菜单“导出->归档”支持hg archive - Pino
当我尝试使用hg archive时,会出现以下提示: hg.exe:中止:存储库'https://hgserver/[...]'不是本地存储库。 这只能在本地存储库上工作吗?当我将其放在本地时,我可以直接复制,那我需要使用archive做什么?! - Mehrdad Mirreza
它只在本地工作。完全复制是可行的,但这样可以让您导出除您已检出的版本之外的版本,并且排除了尚未提交的本地编辑。如果您的远程服务器正在运行hgweb,则可以找到一些URL,让您获取任何标记、分支头或修订版的.tgz和.zip导出文件。也许这就是您要寻找的东西。 - Ry4an Brase

3

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

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接