I just read:
http://git-scm.com/book/ch7-2.html (search for odt)
And realized we could become a much more useful part of the git ecosystem if we had a simple '--cat' mode that dumped most (if not all) formats as flat-odf to allow easier diffing (and logging?)
What we need (instead of that embarassing script) is something that handles doc and ODF and spreadsheets etc. and dumps text so:
loffice --cat <filename> | less
We will inevitably need to use a /tmp file and adapt the existing --convert-to txt code to do this easily, but - it'd be great to have that built-in.
Of course - the slight downer is that the factory process, and the command-line-arg parsing piece are separated by a process / factory barrier - so it's possible we'd need to add a round-trip reply that returns the /tmp filename and then cat that.
Thanks for poking !
CCing developer list to Easy Hacks missing this.
Please note that there will be lots of false differences between (flat) ODF exports of even only minimally edited versions of a document, though, thanks to gratuitous randomness in the ODF output. See my recent changes in master that check for the LIBO_ONEWAY_STABLE_ODF_EXPORT environment variable, and in case that is set, do ODF output in a more "stable" manner. Unfortunately, as the "ONEWAY" part of the env var name indicates, this is not intended to be roundtrip-safe, though, so that code path can not be made the default. It would be great if people who actually understand the issues involved would figure out roudtrip-safe ways to solve the problem (that task it likely not an EasyHack)
Sure - I think the flat-odf idea is prolly not a great one - instead we should just convert to text. Then of course we have a paragraph / line-wrapping problem instead: that small changes perturb that a lot, but ... c'est la vie.
I agree that ODF is hardly easy to read on the command-line; but plain-text: more so ;-)
Ah, I didn't read the linked article so I thought you meant flat ODF for storage of docs, but yeah, if just for diffing ,hen plain text obviously is better.
I'd like to work on this as my first open source contribution.
There is small problem with the idea, the --convert-to option prints out to stdout a string indicating the file names involved.
For example :
$ soffice --headless --convert-to txt:Text --outdir /tmp /tmp/filezBIL6j.odt
This prints out the following string to stdout :
convert /tmp/filezBIL6j.odt -> /tmp/filezBIL6j.txt using Text
If we are to reuse --convert-to code, this string will be present along with the --cat output.
Unfortunately, I could not find where this string gets printed in the code using http://opengrok.libreoffice.org/
(In reply to comment #6)
> Unfortunately, I could not find where this string gets printed in the code
> using http://opengrok.libreoffice.org/
We could of course add a different option to LibreOffice specific to this functionality (perhaps) eg. a --cat <file> parameter ? that could output the plain text on stdout - and avoid the necessity to manage /tmp files in shell - which is a bit horrible =)
Added my changes to gerrit for review.
deenafrancis committed a patch related to this issue.
It has been pushed to "master":
fdo#70625 Add --cat parameter to make git diffs pretty
The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
Nice patch Deena - thanks for that.
A few more things might be a good idea:
* perhaps auto-enable --headless on Linux - there are other settings to force windows not to show on Mac etc. I think ;-)
* work out what we want for spreadsheets / presentations - export as CSV ? or ... something there would be good I guess.
Then I guess we need to persuade someone to knock up some sample git config bits such that we can get nice human readable diffs easily - perhaps dropping that in the wiki ? [ and the 4.4 features wiki page I guess - perhaps the SparkleShare people would appreciate that too ? ].
Anyhow - a really great start; - oh ! and also can you send an E-mail like this:
so we get the auditing right =)
Thanks for verifying and accepting the patch.
I will work on improving the --cat feature for document formats other than those supported by swriter.
(In reply to comment #11)
> Nice patch Deena - thanks for that.
> A few more things might be a good idea:
> * perhaps auto-enable --headless on Linux - there are other settings to
> force windows not to show on Mac etc. I think ;-)
> * work out what we want for spreadsheets / presentations - export as CSV ?
> or ... something there would be good I guess.
> Then I guess we need to persuade someone to knock up some sample git config
> bits such that we can get nice human readable diffs easily - perhaps
> dropping that in the wiki ? [ and the 4.4 features wiki page I guess -
> perhaps the SparkleShare people would appreciate that too ? ].
> Anyhow - a really great start; - oh ! and also can you send an E-mail like
> so we get the auditing right =)
> Thanks !
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillCpp TopicCleanup )
JanI is default CC for Easy Hacks (Add Jan; remove LibreOffice Dev List from CC)
This needs extending to spreadsheet & impress formats I guess =) thanks though Deena ! =)