How to merge .mlapp files with git
20 ビュー (過去 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!