Download subdirectory from remote repository

Paul Boddie paul.boddie at biotek.uio.no
Wed Dec 5 12:54:57 UTC 2012


On 04/12/12 22:45, Matt Mackall wrote:
> IIRC, the last time patches to grab archives of subdirectories were 
> proposed (~4 years ago?), it was rejected for failing to fit into our 
> URL schema cleanly. Today, I'd probably insist that any such feature 
> also come with a request-rate limiting mechanism. "It is useful to 
> fetch dependencies" sounds too much like "We plan on abusing this with 
> inefficient automation". 

On the latter point, I think that rate-limiting is probably best solved 
at the front-end server level.

As far as the URL scheme is concerned, I imagine that something close to 
the existing "file" or "raw-file" mode is best. For example:

http://selenic.com/repo/hg/file/5cafcac2414c/doc (currently shows the 
doc directory as HTML)
http://selenic.com/repo/hg/raw-file/5cafcac2414c/doc (currently shows 
the doc directory as text)
http://selenic.com/repo/hg/archive/5cafcac2414c.tar.gz (currently 
provides all files as an archive)
http://selenic.com/repo/hg/archive/5cafcac2414c/doc.tar.gz (would 
provide the doc directory as an archive)

There's always the matter of the resource name and whether it's good 
enough, but I suppose the "Content-Disposition" header could be sent 
with something like "5cafcac2414c-doc.tar.gz" and the archive would 
actually unpack to a directory called "5cafcac2414c-doc" so that the 
client could take the opportunity to use the appropriate name.

Paul

P.S. Seeing how the raw form of a directory is a textual listing, it 
reminds me of how with a bit of content preference magic and the ability 
to generate XML listings, one could support WebDAV and have a Web 
repository navigable in a suitably capable file manager, but I'm not 
volunteering to make that happen. ;-)



More information about the Mercurial mailing list