How to merge .mlapp files with git

32 views (last 30 days)
Julius Häuslein
Julius Häuslein on 21 Jan 2019
Commented: Ferenc on 30 Jul 2020
I am developing an application with AppDesigner and assumed that it was possible to merge these files with the Matlab merge tool. Now, having two branches with different versions, I tried to use the merge tool, but it seems like there is just the possibility to compare different versions. Manual merging with three windows opened is very time consuming and the absence of a possibility to merge these files renders the AppDesigner pretty useless for productive development. Is there any workaround for easier merging? Is the merge functionality of .mlapp file likely to be included in the next release?
  2 Comments
Simone
Simone on 16 May 2019
I have the same problem and am also interested in a solution.
Markus Leuthold
Markus Leuthold on 1 May 2020
Mathworks, please provide a solution on how to work with app designer files and git
Specifically how do I
  • check what changed in a specific commit
  • check the diff of a staged *.mlapp file
  • merging branches
  • interactive rebasing
This is not comparable with a Word docx file. In an app designer file, I provide my own code which needs support from git. This is not the case for a word document.

Sign in to comment.

Answers (1)

Gypaets
Gypaets on 20 May 2019
Edited: Gypaets on 23 May 2020
Add a hook which automatically unzips/zips the *.mlapp file before/after commiting. Not perfect, but it mostly works
  10 Comments
Thomas Harfmann
Thomas Harfmann on 19 Jul 2020
Edited: Thomas Harfmann on 19 Jul 2020
How far did you test this Timothy Stewart and svanimisetti?
I tried your approach on Windows. I testet it in the git bash and used 7zip. On my reasearch i noticed that 7zip doesn't keeps the order of the zip-this-way.txt in the output zip (confirmed with zipinfo).
The generated mlapp file does still work, no error from matlab.
But this was just for the simple test: unpack a original mlapp file, then repack it with 7zip.
If i put my own document.xml in there with the merged code it was still loaded fine but my changes weren't present, as if i had loaded the original file. I think that the appModell.mat file overwrote my changes in document.xml when loaded.
When I omitted the appModell.mat file while packing, the resulting mlapp file led to an error when i tried to open it with matlab appdesigner.
I then tried to enforce the ordering like Timothy Stewart originally suggested. With 7zip that means i prefixed everything with the pattern "\d\d<originalFileOrFolderName>" (e.g. 00metadata/appMetadata.xml) (7ziped everything and then renamed it inside the zip to the destination file or folder name.
Unfortunately despite in right order this led to the same results. I also tried switching the ordering of appModel.mat and document.xml... same result.
If i would have to change the contents of appModel.mat as well for a simple merge ... it's not worth the effort.
Used Matlab Version R2020 Update 4(9.8.0.1417392)
Hope i did something wrong and there is indeed such a simple solution like unzip, merge and rezip...
In any case i hope this information will help someone.
Contents of zip-this-way.txt:
00metadata/appMetadata.xml
00metadata/appScreenshot.png
00metadata/coreProperties.xml
00metadata/mwcoreProperties.xml
00metadata/mwcorePropertiesExtension.xml
00metadata/mwcorePropertiesReleaseInfo.xml
01[Content_Types].xml
02_rels/.rels
03appdesigner/appModel.mat
04matlab/document.xml
Contents of my zip script:
7z a -tzip myApp.mlapp @zip-this-way.txt
7z rn myApp.mlapp "00metadata" "metadata"
7z rn myApp.mlapp "01[Content_Types].xml" "[Content_Types].xml"
7z rn myApp.mlapp "02_rels" "_rels"
7z rn myApp.mlapp "03appdesigner" "appdesigner"
7z rn myApp.mlapp "04matlab" "matlab"
Ferenc
Ferenc on 30 Jul 2020
Hi all! Could one of you share the hook and describe in a few lines how to make it work? I have never had something to do with hooks... I'm on a Mac, so everything, what is command line related should work easily.
Thanks

Sign in to comment.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!