When cloning a repository in Mercurial, is there a way to create a target folder based on the latest changeset? Example:
$ hg clone http://hg.repo.com:8000/myrepo 'myrepo-$VERSION'
The folder should be named after the version of the project, e.g., myrepo-1.3.
If you are okay with using the changeset hash, then you can start with
to get the ID of the tip changeset. You can combine this with clone like this in a Unix shell:
To make it more convenient to use, I would create an alias for this:
This let’s you do
hg vclone footo get afoo-<ID>clone.In the alias I took care of computing a suitable basename from the clone URL and to print the destination in the same way that
hg clonenormally does when you don’t give an explicit destination. Finally, I took care to quote the arguments so that you can clone a directory with spaces in the name. (If you also have characters like"in your names, well then you’re out of luck without better support for quoting in Mercurial shell aliases.)