What should be the Subversion properties for the * .xml file?

What are the correct / best properties assigned to * .xml files in Subversion?

I am particularly interested in the svn:mime-type and svn:needs-lock properties.

I think there are two answers, but I'm not sure which one to choose. The first one is to treat XML files as text files, allowing Subversion to control text merges in them. For this, I would use svn:mime-type=text/xml and would not use svn:needs-lock .

Second, consider XML files as binary files, preventing Subversion from performing automatic merges and insisting on lock behavior before editing. For this, I would use svn:mime-type=application/xml and set svn:needs-lock .

I think itโ€™s normal to treat XML as text if it is a kind of XML file that can be edited directly in a text editor, because the user will be able to resolve any possible merge conflicts manually. However, the XML files generated by the tool cannot be easily edited manually and therefore Subversion should not be automatically combined so that the user is not in a situation where he has to resolve the conflict in a (essentially) binary file.

Being conservative, I treat XML files as binary. But I always have to explain this to developers who would prefer to be able to edit some XML files directly, without having to block earlier.

I would like to know what others think about it, and whether there really is a danger associated with the tools generated by XML files or not.

SEQUENCE:

After reading the first three answers, I realized that the above question is not clear enough.

My doubt is what properties should be configured for *.xml in the [auto-props] section of the Subversion configuration file ( ~/.subversion/config )?

The problem is that there can only be one configuration. So, should I be conservative and treat all XML files as binary, or do I like users who edit their XML files manually and treat all XML files as default text?

+7
xml mime-types svn
source share
3 answers

We use both text / xml and application / xml in our Subversion repository. XML, which is manually edited, is human-readable, and thus can be merged usefully, we consider it as text. This includes things like maven pom files and build.xml files, docbook files, xhtml documents, etc.

 svn:eol-style=native svn:mime-type="text/xml; charset=utf-8" /* so apache sends the right encoding */ 

For XML, which is a complex file format for some tool, we consider it as binary. Examples of this are * .fodt (flat ODT), OmniGraffle files, XMI (UML models), and the like. The user cannot reasonably be excised to merge such a file, and indeed often the differences for even trivial changes are large and erratic.

 svn:mime-type="application/xml" svn:needs-lock="*" 

Giving this distinction has served us well.

+8
source share

If XML is generated, you should ask why it is in Subversion in the first place. I am with the developers on this, but the obvious solution, if you must manage the versions, the generated files must provide them with extensions other than .xml.

+3
source share

If XML is well read and well understood, there is no harm treating it like any other text. If this is only machine-readable or not something that your developers understand well, you should consider it as binary data; your level of understanding and the ability to manually manipulate it will be the same.

0
source share

All Articles