Show your Oracle Forms and Reports diffs from Git

See diff for your Forms and Reports modules with tools from ORCL Toolbox and Git difftool wrapper

Posted by Torsten Kleiber on October 02, 2020 Tags: Oracle Forms Reports Git ORCL-Toolbox FormsAPI-Master FormsTool

You have successfully versioned your Oracle Forms & Reports module with git. What if you could see the diff for your module after changes from your working copy or between two commits? See my solution with the tools from ORCL Toolbox and a Git difftool wrapper.

At first you need a licence for FormsAPI Master or FormsTool from ORCL Toolbox. If you know another tool, please add a comment below! As long as it have a CLI for diff, it should be implemented in similar way.

Install the tool, in my case FormsAPI Master.

Then create a file git-difftool-wrapper.cmd in you Git installation, eg. in C:\Program Files\Git\cmd.

C:\Program Files\Git\cmd\git-difftool-wrapper.cmd
@echo off
rem call FormsAPI Master only for binary oracle forms and reports modules
if "%~x1"==".fmb" goto CheckFormsAPIMaster
if "%~x1"==".mmb" goto CheckFormsAPIMaster
if "%~x1"==".olb" goto CheckFormsAPIMaster
if "%~x1"==".pll" goto CheckFormsAPIMaster
if "%~x1"==".rdf" goto CheckFormsAPIMaster
goto NoExternalDiff

:CheckFormsAPIMaster
rem check if the installation of FormsAPI Master exists
if exist "C:/Oracle/FormsAPIMaster40b450/FapiMaster.exe" goto FormsAPIMaster
goto NoExternalDiff

:FormsAPIMaster
rem call FormsAPI Master
"C:/Oracle/FormsAPIMaster40b450/FapiMaster.exe" /COMPARE /MODULE1=%1 /MODULE2=%2
goto end

:NoExternalDiff
rem inform the user that no other external diff tools are defined
C:\Windows\System32\msg.exe * "No external diff tool found for this file extension!"

:end

Next you edit your Git configuration. I recommend to do this as local administrator in the in git system configuration for all computer users:

git-difftool-wrapper-setup.cmd
git config --system diff.tool git-difftool-wrapper
git config --system --replace-all difftool.prompt false
git config --system --replace-all difftool.git-difftool-wrapper.cmd ^
  "\"C://Program Files//Git//cmd//git-difftool-wrapper.cmd\" \"$LOCAL\" \"$REMOTE\"

This should result in following configuration:

C:\Program Files\Git\mingw64\etc\gitconfig
[diff]
  tool = git-difftool-wrapper
[difftool "git-difftool-wrapper"]
  cmd = \"C://Program Files//Git//cmd//git-difftool-wrapper.cmd\" \"$LOCAL\" \"$REMOTE\"
[difftool]
  prompt = false

If you now change to your working copy you can test the following:

C:\Program Files\Git\cmd\git-difftool-wrapper.cmd
X:\test_forms_compare>git diff customers.fmb
diff --git a/customers.fmb b/customers.fmb
index e28d88f..f31930c 100644
Binary files a/customers.fmb and b/customers.fmb differ (1)

X:\test_forms_compare>git difftool customers.fmb (2)
1 Standard diff shows further only that there is a difference.
2 But difftool now opens FormsAPI Master and show your differences:
oracle forms git difftool formsapimaster diff output

And this work too from graphical tools like Atlassian Sourcetree, which use the installed and configured Git version and can call external diff tools.

That’s it!