You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Stefan Weiss <sp...@foo.at> on 2005/06/09 01:14:11 UTC

Some questions about svn:mime-type and svn:eol-style

Hello list,

I am not a very experienced SVN user yet (we have only switched from CVS
a few weeks ago), so please bear with me. I have managed to set up the
server and repositories, and written a small howto for the other
developers, but I am still uncertain about some of the fine points of SVN.

In our current project, the developers use very different platforms
(Linux, Windows, and Mac), so eol-style=native would be the desired
setting for all text files. What's the default for svn:eol-style? If
it's undefined (or something other than "native"), will we need to
require all developers to enable auto-props and add all the necessary
mappings for all possible file extensions?. Or is there a way to tell
SVN that all "text" file types should have svn:eol-style=native (and
possibly other properties, like keywords)?

How do I ensure that all SVN clients are configured correctly? What if
some time in the future we decide to rename all template files to *.tpl,
how can I get everybody to edit their config files to add a mapping for
*.tpl? It looks possible to use a pre-commit hook to check the
properties on the server side. If this is the way to go, I would be very
 thankful for a sample pre-commit file.

On a related topic, I was wondering when the svn:mime-type should be
explicitly set using "svn propset", instead of relying on SVN's
auto-detection. There was a message on this list a while back, where
Dale Worley posted a clever script that checks for missing mime-type
properties in a working copy:

http://subversion.tigris.org/servlets/ReadMsg?listName=users&msgNo=30048

Is it necessary, or desirable, to always set the correct MIME type on
all files? In some cases that might even be counter-productive; some
text files would have to be assigned an "application/" type (like XML or
PHP), and that might skew the text/not-text decision. I'm not sure about
this, because I was unable to find out how Subversion determins which
files are text and which aren't - apart from some rather cryptic remarks
in the Subversion book, like
  | Subversion runs a very basic heuristic to determine if that file
  | consists of human-readable or non-human-readable content.
and
  | something that doesn't begin with text/, though there are exceptions

I'm guessing that the differentiation between "text" and "not text" will
be pretty reliable, but that no further attempt to assign the "correct"
MIME type will be made (BTW, what's the rationale for not using
/etc/mime.types and /etc/mime-magic when available?).

The auto-props section in my config file was disabled by default; and
the examples (commented out) only included a handful of file extensions.
Is this an indication that most users do _not_ use auto-props? Is there
any way to get a more complete auto-prop list of file extension mappings
to MIME types (other than going through /etc/mime.types)?

So many questions.


thanks in advance,
stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Some questions about svn:mime-type and svn:eol-style

Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Thu, 09 Jun 2005 20:43:06 +0200, Stefan Weiss <sp...@foo.at>
wrote:

>*Should* I force the developers to always set mime-type and eol-style on
>text files?

I'm afraid I can't answer that; that depends on your local policies,
practices and people.

>Will Subversion still treat a file as a text file after it has been
>assigned the type "application/xml-dtd" (or other "application/" types)?

Unfortunately not. Those svn commands that require text to make any
sense (svn diff, merge, blame, etc.) will no longer have any useful
output. There are other threads discussing this, though I don't think
there's been a consensus as to the best solution. If you need to have
the file treated as text, it will need to be set to one of the
recognised text svn:mime-type's (or no mime-type at all).

>Are pre-commit hooks the only way to ensure that everybody has the
>correct settings, or is there a way to share/spread these settings (per
>project or per server)?

Sharing settings on a per-repository basis has been mooted for a
future release, but there's nothing set in the milestones yet, AFAIK.

Greg
-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Some questions about svn:mime-type and svn:eol-style

Posted by Stefan Weiss <sp...@foo.at>.
Thanks for your reply.

On 2005-06-09 09:54, Greg Thomas wrote:
> No, but you could have a pre-commit hook that will reject any commits
> of text files that don't have svn:eol-style=native

Which means that all developers will have to set svn:eol-style manually
before committing added files, or use a config file that includes all
possible text file extensions.

> How you define 'text files' is up to you, but I'd suggest the easiest
> way would be by file extension of svn:mime-type.

OK. Coming back to my original questions:

*Should* I force the developers to always set mime-type and eol-style on
text files?

Will Subversion still treat a file as a text file after it has been
assigned the type "application/xml-dtd" (or other "application/" types)?

Are pre-commit hooks the only way to ensure that everybody has the
correct settings, or is there a way to share/spread these settings (per
project or per server)?


thanks,
stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Some questions about svn:mime-type and svn:eol-style

Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Thu, 09 Jun 2005 03:14:11 +0200, Stefan Weiss <sp...@foo.at>
wrote:

>Or is there a way to tell
>SVN that all "text" file types should have svn:eol-style=native (and
>possibly other properties, like keywords)?

No, but you could have a pre-commit hook that will reject any commits
of text files that don't have svn:eol-style=native

How you define 'text files' is up to you, but I'd suggest the easiest
way would be by file extension of svn:mime-type.

Greg
-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org