[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: special property for text types (was: RFC: Am I being a hardass?)

From: Kevin Grover <kevin_at_kevingrover.net>
Date: Thu, 7 Feb 2008 16:05:46 -0800

On Feb 7, 2008 9:51 AM, Karl Fogel <kfogel_at_red-bean.com> wrote:

> John Peacock <john.peacock_at_havurah-software.org> writes:
> > I got involved in several discussion on users (which I know you don't
> > all read regularly) about changing the various "application/xml*"
> > types to be text by default, the longest of which is here:
> >
> > http://svn.haxx.se/users/archive-2008-02/0096.shtml
> >
> > I still believe that I'm right and that Subversion shouldn't have an
> > ever increasing set of exceptions enshrined in
> > svn_mime_type_is_binary() for all of eternity. I can pursue the
> > not-so-simple task of adding a new svn:text-type (a boolean flag) that
> > would override the normal MIME handling for purposes of diff/merge
> > only.
> >
> > It would only be a small patch to add a whole bunch of exceptions to
> > svn_mime_type_is_binary(). Is that the wiser course? Am I just being
> > a pedant and a crank to insist that because some XML files should be
> > treated as binary that we can't make that sort of overarching
> > assumption, just because it will help most people?
>
> I don't think we should add "exceptions" to svn_mime_type_is_binary().
> We should put mime types there that are known to be (almost always)
> texty; if people want files with other mime types to be treated as
> text, there should be a special property they can set.
>
> IOW, Subversion should do the right thing as often as possible without
> the user having to do anything special -- but the special thing should
> be available for those cases where the user knows something Subversion
> doesn't.
>
> We should think carefully about how this property solution would work.
> Instead of a simple boolean, let's think about what we need the
> information for:
>
> 1) Displaying diffs via diff2
> 2) Merging via diff3
> 3) Is there anything else...?
>
> Is one knob enough to indicate all the things we need to indicate? Is
> it always the case that (1) and (2) travel together? If so, a boolean
> 'svn:is-text' property would be enough. But the things we need to
> indicate might be disjoint, in which case either multiple properties
> or one property with multiple possible values may be needed.
>
> (Note: don't use "svn:text-type" for the name -- people would think it
> works the way "svn:mime-type" does, i.e., that they'd have to specify
> one of a bazillion "text types" as the value.)
>
>
As someone else suggested in another post, I think that the svn:eol-style,
if present, should make the file be treated like text (regardless of the
svn:mime-type, or perhaps as a user-configurable option
'eol-style-text-detect'). This, to me, seems to be a very clean and elegant
solution. It will allow people to keep correct mime types and still being
able to diff XML (for example) files.

Another, more robust solution could be to have an svn:plug-in property that
would be set to 'text-diff', 'xml-diff', 'winword-diff'. Things like
text-diff could be configured to standard diff (and XML-diff, if present by
default, could be the same). The rest could come from a user's config
files. This would also allow the 'plug-ins' to be extended for other uses.
The plug-ins could be further mapped to files by wildcard name, mime-type,
or specific file.

Perhaps an better name would be diff-plug-in?

Anyway, just thinking...

- Kevin
Received on 2008-02-08 01:06:00 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.