tarball support v0.3

Jeff Sipek jeffpc at optonline.net
Tue Aug 23 14:28:44 CDT 2005


On Mon, Aug 22, 2005 at 11:24:27PM +0200, Wojciech Milkowski wrote:
> Hello,
> 
> I'm slowly improving support for tarballs in Mercurial. Attached patch 
> is made against current tip in Matt's repository - f859e9cba1b9, and 
> contains everything done so far.
> 
> Changes:
> - gzip and bzip2 tarballs are sent immediately without writing to 
> temporary files (I was wrong Matt, it can be done very easy)
> - hgrc customization, you can choose which type (if any) you will support

Cool, but...

> +    def tarballbuttons(self, m):
> +        s = ''
> +        if self.allowzip:
> +            s += '<a href="?cmd=tarball;manifest=%s;type=zip">zip</a>\n' % m
> +        if self.allowgz:
> +            s += '<a href="?cmd=tarball;manifest=%s;type=gz">gz</a>\n' % m
> +        if self.allowbz2:
> +            s += '<a href="?cmd=tarball;manifest=%s;type=bz2">bz2</a>\n' % m
> +        return s

Yuck! Use templates, eg.

in templates/map:

tarballentry = '<a href="?cmd=tarball;manifest=#manifest#;type=#type#">#type#</a>'

then create a generator function in hgweb.py, and use the new (post 0.6b
only) syntax: #files%tarballentry# which iterates though files and for
each it applies the tarballentry template.

Jeff.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.selenic.com/pipermail/mercurial/attachments/20050823/dab67a7d/attachment.pgp


More information about the Mercurial mailing list