How To Deal with KM Sync Conflicts in DropBox

Continuing the discussion from Macros not Syncing via DropBox:

###Summary

  • We can get notified when a Sync Conflict Happens
  • But how do we identify the real differences in Macros in the plist sync file?
    (details at the end)

###Discussion

KM does a great job of syncing your Macros with other Macs using Dropbox.
However, it is still possible to create a sync conflict if more than one Mac tries to update the KM sync file at the same time.

Dropbox is prepared to identify and handle this sync conflict. One Mac will be allowed to update the actual sync file, and Dropbox will create a copy of the sync file the other Mac(s) tried to upload. These "conflicted copy" (as Dropbox calls them) files look something like this:

Keyboard Maestro Macros (JMU-MBA-13-2's conflicted copy 2017-02-23).kmsync

adding the Mac Machine Name and date of conflict to the file name.

So, I wrote a KM Macro to detect and notify me when this happens:

###MACRO:   @Finder Get @DropBox @Conflicted Files When Added

~~~ VER: 1.0    2017-04-02 ~~~

####DOWNLOAD:
@Finder Get @DropBox @Conflicted Files When Added.kmmacros (4.1 KB)


###ReleaseNotes

The folder in the trigger needs to be set to the folder you use for DropBox KM Sync.
Macro was uploaded in DISABLED state.



So far, so good.

I thought I'd just do a file compare using BBEdit (or other tool) to identify the differences with the current KM sync file.  **Turns out that will NOT work.**
Here's an abbreviated example:

###BBEdit Compare Files

<img src="/uploads/default/original/2X/b/bc9a45c6d47371bf8aceef268dfe3e0f5c17d380.png" width="690" height="390">

###Issue
BBEdit technically provided the correct difference.
It doesn't know anything about XML, so it just starts showing the difference on the first non-matching line.

###How Do We Identify the Real Differences in Macro Plist Files?

@peternlewis and @DanThomas:

Do either of you guys have a way to compare two versions of a KM Macros Plist file (that's what the sync file is) and identify the real differences important to the user and KM?
1 Like

Just in case you're interested, I just noticed a cool feature of this macro:
It gives notification on all Macs where KM is installed and sync'd.

Your image looks incorrect - it appears you deleted the first block of text (the “All Macros” smart group), not the second one (the “Enable Macro” smart group).

Your comment remains valid, BBEdit compares by line, not by XML block.

That said, the diff will show you where the changes are so it is still pretty useful for the occasional case where you might have to resort to this.

I diff yesterday and today’s Keyboard Maestro Macros.plist file each day to check for systemic changes that I might have accidentally made in developing Keyboard Maestro.

There are more problems than just the line-by-line nature though. Every chunk of styled text changes subtly each time it’s saved so each of them show up as a bogus change.