How to merge .mlapp files with git

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 comentarios

Simone
Simone el 16 de Mayo de 2019
I have the same problem and am also interested in a solution.
Markus Leuthold
Markus Leuthold el 1 de Mayo de 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.

Iniciar sesión para comentar.

Respuestas (1)

Gypaets
Gypaets el 20 de Mayo de 2019
Editada: Gypaets el 23 de Mayo de 2020

0 votos

Add a hook which automatically unzips/zips the *.mlapp file before/after commiting. Not perfect, but it mostly works

10 comentarios

Julius Häuslein
Julius Häuslein el 20 de Mayo de 2019
Sounds interesting! It would be very nice if you could provide your script.
John Rogers
John Rogers el 18 de Jun. de 2019
I unzipped the ".mlapp" file and the embedded files also don't seem that "mergeable"...
Can you please explain your workflow?
Merge capability is very important for team developement... It would be nice to hear from Mathworks on this topic.
Nick Anthony
Nick Anthony el 27 de Jun. de 2019
+1. It's hard to understand why they have chosen to use a file format that isn't git compatible by default.
Daniel Lemus
Daniel Lemus el 20 de Sept. de 2019
Editada: Daniel Lemus el 20 de Sept. de 2019
Could you share the hook?. It looks like a nice idea, specially if you want to review/comment changes in github/gitlab.
svanimisetti
svanimisetti el 22 de Mayo de 2020
The zippng process corrupts the .mlapp file and is not editable in AppDesigner anymore. What kind of zip archiver needs to be used? I did a binary comparison right after unzipping+zipping process - and the resulting files is totally different from the original file. So I am assuming that Mathworks does some "special" zipping. If there are hints to what archiver to use (7-zip, WinZip, PKZIP) and the settings for compression, it would be helpful. Currently we are stuck with changes to .mlapp by two developers - and it seems to me like using .mlapp was a really bad choice.
Timothy Stewart
Timothy Stewart el 26 de Mayo de 2020
Editada: Timothy Stewart el 26 de Mayo de 2020
When re-zipping, you'll need to do it in a specific order. I've attached a shell command and the order to do this. Hope this helps, I really wish Mathworks would of thought of this. I am still cautious of this apporach, as Mathworks could change how they pack the .mlapp or ingest the .mlapp into app designer and then your code is broken and its out of your control.
#!/bin/sh
cat zip-this-way.txt | zip name.mlapp -@
Contents of zip-this-way.txt:
metadata/appMetadata.xml
metadata/coreProperties.xml
metadata/mwcoreProperties.xml
metadata/mwcorePropertiesExtension.xml
metadata/mwcorePropertiesReleaseInfo.xml
[Content_Types].xml
_rels/.rels
appdesigner/appModel.mat
matlab/document.xml
svanimisetti
svanimisetti el 28 de Mayo de 2020
Editada: svanimisetti el 28 de Mayo de 2020
Thanks Tim. That worked like a charm! I never imagined that the order of the files was important. Nonetheless, just leaving some notes here in case others end up at this thread.
I used 7-zip. In my case, couple of xml files were not present. So, I followed Tim's instructions and created a list file with following content.
metadata/coreProperties.xml
metadata/mwcoreProperties.xml
metadata/mwcorePropertiesExtension.xml
[Content_Types].xml
_rels/.rels
appdesigner/appModel.mat
matlab/document.xml
After that, I ran the following 7zip command on Windows command-line.
<path-to-7z.exe> a -tzip <appname>.mlapp @listfile.txt
For more info on 7zip command line switches, see following.
svanimisetti
svanimisetti el 28 de Mayo de 2020
Editada: svanimisetti el 28 de Mayo de 2020
The reason we are having go jump through hoops is that .mlapp files are not amenable to merging in Git. If two developers are working on a large project involving mlapp files - then this behavior prevents two developers from working on a single mlapp file together. I agree, I wish Mathworks puts in some effort to create stable and predictable development environments. We moved from GUIDE, only to find abysmal issues with AppDesigner - some of the features existing in GUIDE regressed in AppDesigner. Now, code management and revisioning on large projects using AppDesigner has become another big challenge.
Thomas Harfmann
Thomas Harfmann el 19 de Jul. de 2020
Editada: Thomas Harfmann el 19 de Jul. de 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 el 30 de Jul. de 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

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Productos

Versión

R2018b

Preguntada:

el 21 de En. de 2019

Comentada:

el 30 de Jul. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by