How should I save a file in OpenOffice so that it is not a binary file in Subversion?
Asked Answered
L

7

5

I'm working on an Open Office document with a partner and we are using subversion to collaborate on it. However, we are saving the document as a .odt file and subversion reads this as a binary file type. Therefore it has me worrying that when we go to merge the files and the diff pops up that we will not be able to adequately perform the merges if there are conflicts; we won't be able to understand the raw .odt file.

So my question is "How do I save a document in Open Office so that it retains all of the formatting you would expect and want but does save as a binary file and therefore can be easily merged?"

Or am I using the wrong method to do this? (Which is more than likely)

Lodmilla answered 24/4, 2009 at 4:17 Comment(1)
Since Opendocument uses compressed xml-files like usually today for office-suites, you won't be able to do this merge with subversion. Use the features of OpenOffice to achive this.Tittup
B
13

As much as you might hate it, LaTeX provides you a means to create documents, but maintain them in subversion as text, which is easily merged.

Aside from LaTeX or just keeping txt documents, setting a Lock on the file with Subversion is your best bet.

Boyla answered 24/4, 2009 at 4:28 Comment(3)
Actually svn was the reason why I started to use LaTeX again... And you can add small scripts that add "svn info" right into the LaTeX document so you know what version you are using.Kenakenaf
That svn info stuff sounds really handy.Lodmilla
A jump to LaTeX is a bit too radical for many businesses unfortunately.Dinerman
J
7

For complex binary file formats (of which .odt is one), I have found that it is a good idea to use locking in Subversion and not try to merge changes. Set the Subversion property svn:needs-lock on the file and you will then be required to request a lock on the file before you edit it (see Locking in the Subversion book for more details). This has worked well in my situation but it depends on your level of collaboration whether it will work well for you.

Jean answered 24/4, 2009 at 4:22 Comment(1)
A good answer, so +1, but I've already done that and the thing I really want is a way to have a file that is man-readable at the raw level while still playing host to the formatting provided in .odt files. (I'll mark someone with the answer if there is no way to do what I want)Lodmilla
D
6

A file doesn't have to be a text format to be diffed and merged—as long as the vendor provides a good diff and merge tool. And as long as the VCS can be configured to use these external diff/merge tools. However it's rare to have such diff and merge tools provided for proprietary doc formats.

TortoiseSVN can diff Word docs and that's extremely handy. It can apparently merge too, although I've never tried that. I think it may be able to diff and merge OpenOffice docs, but I've never tried it.

TortoiseSVN can "sort of" diff Excel docs, but it's not very nice to use. No merging.

At my company, we set svn:needs-lock on Word and Excel docs to avoid merge troubles. Even then I find it very handy to be able to diff previous revisions and see what changed.

Dinerman answered 19/5, 2009 at 0:55 Comment(1)
I did not know that TortoiseSVN could do that. +1Lodmilla
F
4

The .odt files are AFAIK zipped XML files. However even if you would save them as unzipped XML I seriously doubt that you could do merges of anything but the smallest changes.

Fencing answered 24/4, 2009 at 4:24 Comment(1)
I'll look into it but I bet you're right. It would be unlikely that I could spot the changes; still atleast I know what I'm doing now. Thanks for the (AFAIK info +1)Lodmilla
S
2

The .odt format is actually a zip file format (in most cases), which packages up your document and possibly other binary resources. The fact that it's a zip file, means it's inherently binary. There may be a way to save the document in plain-text XML using OpenOffice I'm not sure.

If you really need the ability to merge changes, you'll probably be better off with a plain text format.

Syndesmosis answered 24/4, 2009 at 4:26 Comment(0)
T
1

Merging a complex page will be a problem, as subversion won't be able to do a good job.

By locking, only one person can work on it at a time.

You could save it as an html page each time, if you don't like the LaTex or .txt suggestions.

You could write some plugin for OpenOffice that will allow collaborative work, perhaps.

Thimbleweed answered 24/4, 2009 at 4:42 Comment(0)
C
0

Complex machine-maintained files will always be hard to merge in a version control system, even if they're stored as text. What if it were uncompressed OpenOffice.org XML? A simple change you make will modify lots of lines throughout the XML file, resulting in possible conflicts.

Your best bet would be to use a simpler format, such Markdown, because a simple format leads to less changes, which leads to more reliable merging. Many writers use Markdown and it's easy to learn.

There are tons of editors that support this markup language, but you may have to modify your workflow a bit. There is for example a ODT to txt conversion script, that converts ODF to txt with markdown formatting. Also, pandoc can convert between many formats, such as Markdown and ODF.

So there are two options:

  1. Change to an editor that directly supports Markdown (a simple text editor will do, but you could go for a more advanced text editor with Markdown mode such as VIM Markdown mode)
  2. Insert a conversion step between Markdown and OpenOffice.org format. (make sure to test the viability first)
Couchman answered 13/6, 2009 at 16:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.