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

Re: Merge mode (Was Classifying files as binary or text)

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Wed, 18 Nov 2009 10:53:57 +0000

B. Smith-Mannschott wrote:
> After many years of using Subversion, I've come to the conclusion that
> svn:mime-type is best understood as a way to keep Apache happy and
> able to support read-only repository browsing. The fact that this
> property is also used to determine ability to merge, diff, and blame
> is an unfortunate wart.

Ah, yes, it is illogical to design the system such that mergeability
shall be determined from the MIME type alone. That is certainly not, and
never can be, a 100% indicator of mergeability.

I think there are two issues here.

(1) Subversion's MIME type recognition is severely deficient (lots of
common textual types not recognized), causing the use of MIME type for
this purpose to be seen as a poor choice of design. Would you ever have
considered it a "wart" if all registered MIME types were recognized so
that the current mechanism worked well in nearly all cases?

(2) MIME type can never be a 100% indicator of line-based text, much
less of line-wise mergability. It is just a useful clue that can get us
maybe 98% there. To get 100% there, other indicators are needed too,
including a way to independently and specifically indicate
blame/diff/merge behaviour to Subversion.

Here is a vision of a solution that doesn't treat MIME-type as "special"
but can still take advantage of it, both for 99% "Do The Right Thing"
without manual setting of another property, and also for backward
compatibility.

(1) Use of line-wise merge shall be determined by a set of rules of the
following kinds:

    * a specified property not existing, or existing and its value
matching a specified pattern

    * the file name matching a specified pattern

    * a content scan determining whether the content is predominantly
plain text

The rules for combining the rules are (something straight-forward, to be
decided).

The rules can be written to match svn:mime-type and svn:merge-mode, thus
achieving the best results that mime-type matching can provide and yet
also the explicit setting when it is wanted.

(2) Use of line-wise diff shall be determined by a set of rules of the
above kinds.

(3) Use of line-wise blame shall be determined by a set of rules of the
above kinds.

(4) Default rules should be supplied.

(5) The rules can be customised in the client's config. (Not that
client-side config is ideal, but that's the kind of config we have and
it is manageable.)

(6) The other issue is whether to store the results of that
determination in versioned properties on the file (svn:merge-mode,
svn:diff-mode, svn:blame-mode). If we leave the determination till run
time, then a client that has a better merge (or diff or blame) tool for
certain file types will be able to use it.

- Julian

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2419446
Received on 2009-11-18 11:54:23 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.