How to merge .mlapp files with git
조회 수: 23 (최근 30일)
이전 댓글 표시
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
Markus Leuthold
2020년 5월 1일
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.
답변 (1개)
Gypaets
2019년 5월 20일
편집: Gypaets
2020년 5월 23일
Add a hook which automatically unzips/zips the *.mlapp file before/after commiting. Not perfect, but it mostly works
댓글 수: 10
Thomas Harfmann
2020년 7월 19일
편집: Thomas Harfmann
2020년 7월 19일
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
2020년 7월 30일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Source Control에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!