views:

196

answers:

2

Is it possible to see a list of all tags on a remote mecurial repository, without cloning it first? In git I can run git ls-remote --tags.

+1  A: 

Tags are stored in the working directory in .hgtags - ie, in the working copy, not the local 'repository'. Since all remote operations take place on the remote repository, not the remote working copy, there is no way to list tags remotely.

In essence .hgtags just gives changesets convenient names, tags have nothing to do with repository metadata or version control.

Note that the design philosophy of Mercurial is that it should be scalable; in order for a distributed version control system to be scalable the 'hard work' has to be done on the machine that initiated the command, this is why you have to first obtain a clone to do anything difficult.

Autopulated
Would it be possible then, to check out just the `.hgtags` file somehow?
troelskn
Not as far as I know. It's just an ordinary file though, so if you're using hg over ssh, you ought to be able to scp it.
Autopulated
Ah .. I guess my question could be rephrased then to: Given a repository URI, what would the relative path to the HEAD's location of that file be? Can I just prepend the relative path?
troelskn
It's in the root of the working copy, but since it's a .dot file it won't normally show in directory listings, and it also won't be present if there aren't any tags: scp remote_host:path/to/working/dir/.hgtags ./
Autopulated
Tags aren't stored in the working directory - the set of tags defined for a repository is the union of the tags defined in the .hgtags files at all the heads in it. This makes a proper solution to this problem rather hard, because you'd have to retrieve the .hgtags from all heads, not just the tip or the working directory.
Tom Anderson
Bugger. Well then - Thanks for your help.
troelskn
+2  A: 

I don't think it's possible with a standard Mercurial repository. If you can ssh into the remote machine, just do so and run hg tags.

Tom Anderson