svnmercurialsvn-export

Exporting an unversioned copy of a tag from Mercurial


I'm fairly comfortable with SVN, but have been looking at Mercurial for it's ability to perform offline commits. Something I haven't been able to figure out is how to do an unversioned export an old tagged rev. In SVN the tags would just live in a \tags folder in the repo, then I could just export something from there, but it doesn't seem like the same trunk-branches-tags directories are used for Hg projects (or are they?)

The best I can figure out is to just clone the repository at some rev then delete the .hg folder. TortoiseHg doesn't display the list of tags either, so I clone, browse through the log, update to whatever, then delete /.hg. This seems really clumsy, is there some preferred method?


Solution

  • Use '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
    

    The -r argument will accept tag names, and -t files will get a directory if you don't want an archive file.