Diffing two account files

AC gnucash at acarver.net
Thu Aug 13 11:57:49 EDT 2015


On 2015-08-13 08:42, Geert Janssens wrote:
> On Thursday 13 August 2015 08:27:05 AC wrote:
>> On 2015-08-13 02:12, John Ralls wrote:
>>>> On Aug 13, 2015, at 6:33 AM, Plutocrat <plutocrat at gmail.com> wrote:
>>>>
>>>> AC wrote on Thursday, 13 August, 2015 11:32 AM:
>>>>> Is it possible to generate some kind of difference output between
>>>>> a data file and one of its backups?  I'm trying to find an entry
>>>>> error and it would be ideal if I could make a diff.
>>>>
>>>> If you're not saving to an SQL database backend, then the files are
>>>> in XML format, either plain or gzipped. So yes, xml can be diffed.> 
>>> Note that GnuCash isn’t careful about keeping things in the same
>>> order from one save to the next so you’ll get a bunch of diffs just
>>> because of that.
>> Let's try that again except to the list:
>>
>> That's exactly what I was afraid of, order not preserved which makes
>> tracking down the change very difficult.
>>
>>
>> So diffing the XML is out.
> 
> I'm not sure about that. I heard people even use git to keep their 
> accounting history. And there have been requests in the past to do 
> deterministic sorting before writing out the data to xml. I seem to 
> remember this was mostly done.
> 
> There was also a bug report recently about an odd case where two 
> transactions swapped each time after a save. Still this suggests that 
> ordered save seems to be the default.
> 
> To be sure you can easily run a couple tests yourself.
> 
>> Is there a document somewhere that
>> describes the format of the data contained in the log files?
> 
> Unfortunately I'm not aware of any.
> 
> Geert
> 


I did test diffing the XML but the order wasn't fully preserved so diff
spat out a bunch of offending changes (this is 2.6.3) so that's why I
was going to use the log file to sort out the mess.

I was able to glean enough from the logs to figure out what happened but
it wasn't easy.  And I do see in the logs that the order of the accounts
swaps as you mention.  There are several places in the logs where the
accounts are rewritten  multiple times and the order flips each time.


More information about the gnucash-user mailing list