필터 지우기
필터 지우기

How do I resolve GIT merge conflicts in MLDATX test manager file ?

조회 수: 11 (최근 30일)
Michael Buhl
Michael Buhl 2023년 1월 17일
댓글: Luca Ferro 2023년 1월 17일
Hi, I have been trying to work cooperatively with some colleagues on creating Test harnesses tests. We create a test harness with some tests and add them to a Test Manager file (.mldatx) and it is with this Test Manager i have a question.
We are working with GIT and had a merge conflict in the test manager (we had both made changes to the file, so I halfway expected there to be trouble).
But my question is:
Is there a way to resolve merge conflicts in the Test Manager file in Matlab when working with GIT? and if there is no way what is a better way to work on tests cooperatively through GIT ? (Scripting the testmanager generation?)
I found that the internal Matlab diff and merge tools could only gave a binary comparison, when used in the same way as with a normal model file (.slx) and the merge tools I have for my other GIT work are not better.
For this instance the changes were not greater than that i could hand code them back, but it is tedious work with high risk of introducing bugs, so I would very much like to avoid it if possible.

답변 (1개)

Luca Ferro
Luca Ferro 2023년 1월 17일
편집: Luca Ferro 2023년 1월 17일
Lately i'm experimenting with Git as well.
The best, fastest and most reliable way to deal with conflicts is:
  • when setting up the environment, before starting to actually work on the script/model/..., set up a project from git:
  • then when you need to merge use branches > merge from the project source control bar
  • if it fails due to conflicts you will have a red icon under the git column in the git project (instead of the usual green/blue one) for each file in which a conflict was detected
  • always in the project windows, you can now right click > view conflicts
  • It will open the conflicts manager and from there you can fix the conflict in a visual and very quick way choosing which version of the code to keep, line by line
  • It will also show you which conflicts it automatically resolved and how
  • Once you are finished, accept the solved changes, commit and push
I would show you image by image what i mean but currently i dont have any conflict to show.
If you have any doubts just ask me.
edit: this workflow works very well with conflicts handling with both matlab scripts and simulink models.
  댓글 수: 4
Michael Buhl
Michael Buhl 2023년 1월 17일
Hi, I have tried to recreate the outputs i could get when i had the conflict (i solved the original problem in hand).
I when i have the mldatx Test Manager file in conflict. If i call mlmerge.exe tool from a cmd prompt i can get a diff view of the changes inside, but in this view i can only see headlines and not change anything.
Then if i enable Source Control in Matlab i can 'View Conflicts' as you mentioned.
And then i get the 'The files are different' binary compare i talked about, which does not help much either :p
If you have any other approaches i can try out, I would love to give them a try and see if I can get something to work :)
Thanks for the help
Luca Ferro
Luca Ferro 2023년 1월 17일
the only thing that comes to my mind is to try and use git bash/command line directly (?) even if clearly it's not the solution we are looking for.
Alternatively in the documentation i found this: Customize External Source Control to Use MATLAB for Diff and Merge - MATLAB & Simulink (mathworks.com), which may or may not help.
Other than that, i'm not quite sure on how to proceed.
Let me know if you find something, i'll update you as well while i experiment more with it.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Source Control in Projects에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by