Handling OpenDocument (OpenOffice.org, Koffice, ...) files

To view plaintext diff of OpenDocument files in Mercurial, you can use the extdiff extension, provided with Mercurial.

[extensions]
extdiff =

You can now, for example, do

$ hg extdiff -p oodiff
making snapshot of 1 files from rev 89b7c9334dd5
making snapshot of 1 files from working dir
6c6
<   First version of second item
---
>   Second version of second item

Now, let's automate this a bit more. Add this to your ~/.hgrc:

[extdiff]
cmd.oodiff = oodiff
opts.oodiff = -u

And you can directly run

$ hg oodiff
making snapshot of 1 files from rev 89b7c9334dd5
making snapshot of 1 files from working dir
--- hg.89b7c9334dd5/presentation-expl.odp
+++ hg/presentation-expl.odp
@@ -3,7 +3,7 @@
 
   First item
 
-  First version of second item
+  Second version of second item
 
   Last item

(this is documented here too).


CategoryTipsAndTricks

HandlingOpenDocumentFiles (last edited 2009-05-19 19:31:03 by localhost)