Howto: Enable git and SourceTree to diff Visual Paradigm projects
I use Visual Paradigm (VP) [1] as a suite for modeling on OS X, in particular for UML diagrams. It has some advantages over simple graphical editors like OmniGraffle [2], because of the underlying UML semantics - but that shall not be the topic of this post.
Models are an important means for communication within development teams, so you would want to collaborate and share models basically all the time.Â
At the same time, it is important to have your models under version control, to be able to track and undo changes, branch off and merge, as collaboration goes along.
When working with VP, I encountered two problems:
First, VP intrinsically supports SVN and some other source control systems, but it does not have support for git. IMHO, git is the best version control system currently out there - at least it is way better than any of those supported by VP. Second, to make things even worse, VP projects have a binary file format, which prevents people from simply adding VP projects to their git repositories.
I decided to tackle these problems, so here is how I came to my current solution.
When I checked the file format, I realized that it is an sqlite database file. So I went on to see how sqlite files could be handled when working with git. I found a great article [3], which made me get to the following solution:
Create a script in /usr/local/bin called dumpsqlite3 with the following content:
#!/bin/sh sqlite3 $1 .dump
Make the script executable, e.g. by using chmod 777 dumpsqlite3
cd into the .git folder of the repository where the VP project is hosted.
Edit the config file (nano). Add the following lines:
[diff "sqlite3"] textconv = /usr/local/bin/dumpsqlite3
cd into the .git/info folder
Edit (or create) the attributes file (nano). Add the following lines:
*.vpp diff=sqlite3
That's it. I could now issue a simple 'git diff' to see changes in the model. It took me a while to make sure that this would also work with Atlassian SourceTree [4], which I use occasionally to commit and push. As it turned out, it was important to specify the complete path to the dumpsqlite3 script in step 4, since SourceTree would not know the bash environment variables, including $PATH.
Hope this helps, Dennis.
[1] -Â http://www.visual-paradigm.com/
[2] -Â http://www.omnigroup.com/omnigraffle
[3] -Â http://ongardie.net/blog/sqlite-in-git/
[4] -Â http://www.sourcetreeapp.com/


















