[PATCH V3] hgweb: teach archive how to handle file patterns

Kevin Bullock kbullock+mercurial at ringworld.org
Sat Feb 9 18:28:32 CST 2013

On 9 Feb 2013, at 11:15 PM, Brodie Rao wrote:

> On Sat, Feb 9, 2013 at 8:42 PM, Angel Ezquerra <angel.ezquerra at gmail.com> wrote:
>> # HG changeset patch
>> # User Angel Ezquerra <angel.ezquerra at gmail.com>
>> # Date 1360141605 -3600
>> # Node ID c0509330eb416104bed8cc7d0a4038f818dd5e5d
>> # Parent  b6c8e79948a05d01920392cd12ac5c8279d5c62b
>> hgweb: teach archive how to handle file patterns
>> The archive web command now takes into account the "file" request entry, if one
>> is provided.
>> The provided "file" is processed as a "path" pattern by default, which makes it
>> easy to only archive a certain file or directory. However, it is possible to
>> specify a different type of pattern, such as relglob by specifying it
>> explicitly on the query URL. Note that only "safe" patterns are allowed. Safe
>> patterns are 'path', 'relpath', 'glog' and 'relglob'. Other pattern types are
>> not allowed because they could be expensive to calculate.
>> With this change hgweb can to process requests such as:
>> 1. http://mercurial.selenic.com/hg/tip.zip/mercurial/templates
>>    This will download all files on the mercurial/templates directory as a zip
>>    file
> The format for this URL seems a little strange. What happens if you do
> 'curl -O http://mercurial.selenic.com/hg/tip.zip/mercurial/templates'?
> Does it figure out that the filename should be tip.zip? And what
> happens if you want to download an archive for a branch/bookmark/tag
> that has forward slashes in it?
> I wonder if making this a GET parameter might be cleaner.

The Content-Disposition: header should take care of this. But making the path/pattern a query string might be a slightly better fit, yeah.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock

More information about the Mercurial-devel mailing list