merging special txt files
TK Soh
teekaysoh at gmail.com
Fri Oct 15 04:31:06 UTC 2010
On Mon, Sep 13, 2010 at 5:56 PM, Mads Kiilerich <mads at kiilerich.com> wrote:
> On 09/13/2010 03:07 AM, TK Soh wrote:
>>
>> If possible, I'd like to ride on the support of merge-tools and
>> merge-patterns. The issue that I am facing is that merge-patterns
>> depend on file name pattern (normally file extension) to differentiate
>> file type.
>
> Yes, merge-patterns works on file names, and merge-tools selection is based
> on few other characteristics. That has turned out to be a very elegant
> solution to most use cases.
>
> If that isn't what you want then don't ride on it.
>
>> What I need it's a way to tell the 'type' of the file base
>> on it's content, since they carry the same .txt extension (and the
>> rest of the file name is not reliable for the purpose of detection
>> also). Kind of like MIME type, but this is not supported in mercurial,
>> unfortunately.
>
> It is not a common request and thus (and fortunately) not something that
> bloats core Mercurial.
>
> Mercurial supports two ways of achieving that anyway: Using a hgmerge script
> in your favorite scripting language or by creating an extension.
>
> You could create an extension that chooses merge tool based on the guessed
> mime type, but I doubt it will be sufficiently reliable.
One thing I can think of is to add a --merge-tool option to 'hg
resolve'. In my case, most the time the merge will result in conflicts
(or I can perhaps fake one if necessary), so I can then try resolve
the conflict using the custom merge tool via --merge-tool option. To
me this option sound like a reasonable one, since most conflict
probably mean the default (pre-configured) tools are not able to
handled it, and hence another tool or solution is required.
If no one else think this is too ridiculous, I can add the request to
the tracker. Even though it doesn't quite solve my problem now.
TK
p/s: sorry for the long delay on the follow up.
More information about the Mercurial
mailing list