Hi
So I posted a message a while back about managing version controlling/source code changes between two instances of jam.py. Below is the Python script I've written which has been working for me.
The entire process is completely upside down, I develop the application in a Development instance of my jam.py application, run the Python script to create 'source code' (this is incremental) and then commit this to my GitLab repo which handles only committing what's changed.
I can then use the GitLab UI to show me the diffs between production and development. It means I have point in time backups of the application so if I wreck something then I can go back to it. Mostly this is to give me visibility of which bits of the application I "touched" when I made changes because often this is multiple items, plus database changes representing permissions, form layouts, indexes etc.
The Python script is relatively straight-forward, you pass the location of the installed jam.py application, the folder where you want to create your source repository, and a message for Git to commit the changes like this:
/bin/python3 /home/applications/codestash/codestash.py -j ../training-dev -o ../training-dev-src -m "Initial work on competency management"
It does the following:
- creates a copy of the CSS and index.html files
- creates a copy of the admin.sqlite database with a date/time stamp (these aren't committed to the repo)
- Runs sqldiff for each of the tables in the current jam.py admin.sqlite compared to the one from the time before (defined at the top of the script) and outputs individual SQL files for each table showing what's changed so these can be shown in GitLab
- Gets the categories (catalogs, journals, details etc.) from the jam.py sqlite
- Pulls the JSON, JS and Python code for each item out of the database into files named after the item and in folders based on the category
- Commits it to GitLab
Some screenshots which hopefully explain a bit better...
**diffs** is the SQL diffs from the tables in admin.sqlite which have changed - here I added some indices to some tables so the sqldiff process shows what changed
GitLab
**Source code**
Here is the output from generating a "src" tree
In GitLab:
If anyone wants to ask any questions etc. then feel free. The script is attached but provided as-is, no warranty express or implied, under the MIT License.