[PATCH] rawnative file view in hg

Kurt Garloff garloff at suse.de
Tue Sep 6 17:22:07 CDT 2005


On Tue, Sep 06, 2005 at 11:47:24AM -0700, Matt Mackall wrote:
> Hmm. Yes, this is a good concept but obviously has some portability 
> issues.

Like the file command not being available everywhere?

> But I think there's a straightforward solution:
> 
> >>> import mimetypes
> >>> mimetypes.guess_type("foo.html")
> ('text/html', None)
> >>> mimetypes.guess_type("foo.tar")
> ('application/x-tar', None)
> >>> mimetypes.guess_type("foo.c")
> ('text/x-csrc', None)
> >>> mimetypes.guess_type("foo")
> (None, None)
> >>>

Hmm, this looks better indeed.
I don't really know the mimetypes module.
Will this work for e.g. image/jpeg etc.?

Best,
-- 
Kurt Garloff, Director SUSE Labs, Novell Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.selenic.com/pipermail/mercurial/attachments/20050907/61efe461/attachment.pgp


More information about the Mercurial mailing list