Compare versions of Scripts using Diff Library

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Compare versions of Scripts using Diff Library

Post by bn »

When developing I often save the whole stack with an increasing version number. When going back to a previous version it can be hard to detect the differences between two versions.
There are probably many solutions out there to tackle this problem.

I used the diff library that is included in LC since version 9 to make a GitHub style diff that helps to show the differences.

This might also be useful to others. Click on the question mark to see a help text.

Kind regards
Bernd
Attachments
Find Differences in code_0.4.livecode.zip
(7.78 KiB) Downloaded 118 times
maxwellhart89
Posts: 1
Joined: Fri Apr 03, 2026 7:35 am
Contact:

Re: Compare versions of Scripts using Diff Library

Post by maxwellhart89 »

That’s a useful approach, especially for tracking script changes across stack versions. Does your diff also handle object properties and UI changes, or mainly code differences?
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10507
Joined: Wed May 06, 2009 2:28 pm

Re: Compare versions of Scripts using Diff Library

Post by dunbarx »

Bernd.

Oooh. Will check this out.

Craig
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: Compare versions of Scripts using Diff Library

Post by bn »

The stack has 2 fields where you put the scripts to compare. You can use the whole scripts with all handlers and put them into their fields ("old" and "new"). If you put two completely different texts the diff can take a long time and you might want to interrupt it with command + ".".
The stack does not check whole stacks or anything else you want to compare.

Kind regards
Bernd
suhusfa
Posts: 2
Joined: Wed May 27, 2026 2:20 am
Contact:

Re: Compare versions of Scripts using Diff Library

Post by suhusfa »

This is a really useful idea. I’ve also found it difficult to track changes when working with multiple saved versions of a stack. A GitHub-style diff view makes comparing versions much faster and easier. Thanks for sharing this!
bwmilby
Posts: 467
Joined: Wed Jun 07, 2017 5:37 am
Contact:

Re: Compare versions of Scripts using Diff Library

Post by bwmilby »

maxwellhart89 wrote: Fri Apr 03, 2026 7:38 am That’s a useful approach, especially for tracking script changes across stack versions. Does your diff also handle object properties and UI changes, or mainly code differences?
I’m working on something that could be used to track other changes besides scripts. I have not added tracking yet to handle deleted objects, but it catches most changes. It needs to be used with a git repository.
https://github.com/Milby-Computer/hxt-bst
Post Reply