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

Angel Ezquerra angel.ezquerra at gmail.com
Sat Feb 9 17:31:36 CST 2013


On Sat, Feb 9, 2013 at 11:15 PM, Brodie Rao <brodie at sf.io> 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.

Actually the commit message is wrong. The actual address would be:

http://mercurial.selenic.com/hg/archive/tip.tar.gz/relglob:*.py

Which makes it unique, since we could already do:

http://mercurial.selenic.com/hg/archive/tip.tar.gz

I'll fix the commit message (using evolve! :-) when I resend the series.

Cheers,

Angel


More information about the Mercurial-devel mailing list