monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook


From: rghetta
Subject: Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook
Date: Fri, 10 Jun 2005 12:04:42 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511

Joel Crisp wrote:

> I'm not against programming, just against making everyone do it. If you can provide a framework which allows a registry > of common file types against the way of handling them and a library of shipped code fragments which can be incorporated without the end user having to do any coding, then that would be fine.
> Maybe something like:
> monotone types filetype --match=\*.xml --type=text/xml <--- Setup >initial default mappings I don't like much having a specialized monotone command just for that. Besides, this way you can't control the order of matching.
imho, a configuration file is a better solution.

> or
> monotone types filetype --file=foo.xml --type=x-rational-xmi  <---
> Change the type of the file

As I see it, there are three distinct issues to handle:
- mapping file extensions (and/or content) to mime-types
- mapping mime-types to merge/diff tools
- assigning mime-types to files, and handling them in monotone.

The first two tasks can be accomplished by using a bit of lua glue to read mappings from configuration files. These files could be in pure tabular form or, better, use the syntax proposed by graydon, i.e. something like
        file_mapping(".xml", "text/xml")
and/or
        content_mapping(offset, bytestring , mime-type)
The same goes for merging:
        merge_tool(mime-type, difftool, mergetool, automerge_allowed)

While the user sees only a collection of mapping directives, these lines effectively translate to lua functions calls, making customization both powerful and easy.

Storing mime-types in monotone should be done with file attributes, but currently this is a bit tricky, because you need a way to resolve conflicting mime-types *before* merging. This could be accomplished by merging .mt-attrs before other files, but introducing ordering into merges could be dangerous.
Anyway, there are ongoing developments that should make these things easier.

In the meantime, we could _partially_ resolve the issue by using only the mapping tables at merge/diff time, without explicitly assigning a mime-type to files. Per-file mapping is still possible by using the full filename instead of the extension
        file_mapping("model.xml", "application/xmi")

Cheers,
Riccardo







reply via email to

[Prev in Thread] Current Thread [Next in Thread]