How a bot can reduce pull request merges in the ASP.NET Core repo
When a contributor submits a pull request to a repository, this is a gift to an open source maintainer. But it can also contain a big challenge if there are merge conflicts.
A merge conflict indicates that the contributor changed files that others have changed in the main branch. When you attempt to merge two branches where people changed the same, Git attempts to merge those changes cleanly.
However, it’s not always possible for Git to reconcile those changes, resulting in merge conflicts. In those cases, it’s up to the maintainer to manually and painstakingly merge the changes. Or, as is often the case, they’ll ask the contributor to do it and push to the branch again. This is a lot of time-consuming tedious work.
mergedroid is a small GitHub app that connects to your repo and tries to automatically resolve merge conflicts in pull requests that GitHub can't. This saves tons of manual work. And it seems mergedroid can do a pretty good job, as the results in the ASP.NET Core repo show:
https://gmaster.io/mergedroid/analyze/report/violetaGitHub/AspNetCoreAccording to these results, almost 20% of the pull requests that required manual intervention, could have been automated by mergedroid.
Also, if you look at the file level, up to 45% of the files with merge conflicts could be automatically merged using a tool like gmaster Git GUI (this is not the job of mergedroid but its gmaster.io Git GUI evil twin. This is because the "bot" in mergedroid must solve the entire branch or nothing, even if just 1 of 99 files can't be automatically merged. When that happens, human interaction is required and then a good merge tool helps).
Do you want to deep inside how one of those merges that can be automated looks like? Keep reading.
A cross-file merge successfully automated by mergedroid
Let's go for a real case.
This was a merge that happened between these two commits:
- source commit: 3f7ee338d4cdd1c49bb965338ad7b118fa070a83 "Change SelfHostDeployer to use dynamic ports by default (#1383)"
- destination commit: b195e36cc35fbae20842440b47baafe1f5270886 "Update dependencies.props"
- The merge of these two commits resulted in the commit: 13d9774e7afe5bcdc7ed9186e4815d5b3aed429c "Merge remote-tracking branch 'origin/release/2.1' into release/2.2".
Basically, as the comment of 13d9774e7afe5bcdc7ed9186e4815d5b3aed429c says:
Merge remote-tracking branch 'origin/release/2.1' into release/2.2
This was a manual merge. Here’s a visual representation of what happened...
Remember:
- src/theirs is the 2.1 branch.
- dst/yours is the destination, the 2.2 branch.
- base is the common ancestor of the two branches.
The method GetNextPort
in TestUriHelper.cs
was modified on the 2.1 branch . At the same time, the same method was also modified on the master branch, but also moved to a different file (TestPortHelper
). Uh-oh! This results in a conflict that Git doesn’t know how to resolve.
Let’s take a closer look at the changes in each branch. This is the change that was done in the 2.1 branch:
This shows that the author deleted a comment inside of the method body and added a comment just before the method.
These are the changes made in parallel in master. Remember, the method was moved to a different file too:
It is exactly the same change, but applied to a different file since the method was moved.
Git doesn’t have semantic understanding of code, so it doesn’t realize that this change represents a method being moved with a comment change. It just sees the fact that the text here has conflicting changes and reports a merge conflict. The good news is mergedroid does understand code and can merge this automatically!
What else might have happened
In this case the method was modified in exactly the same way in both contributors. In practice, you often run into situations where:
- The method was renamed after being moved to the new file.
- And only one of the contributors modified the actual body.
mergedroid can still handle that situation with an automatic and correct merge.
How the GUI can help?
Well, suppose that both contributors moved the method to two different files. This is what we call a "divergent merge case". Even if mergedroid can't solve this because it needs human intervention, gmaster, the GUI that shares the same semantic technology, can help you detect and fix this type of conflict that bare Git can't, because it doesn't look for methods moved across files during merge as gmaster and its semantic merge tech do.
You need to advertise on your homepage where to get support, preferably github perhaps? In any case gmaster doesn't install on my win10 machine. Installing at default location I got permission denied in the last step, running as admin and installing again results in the installer ending at "The parameter is incorrect".
ReplyDeleteHow do I install and activate Webroot on your computer?
ReplyDeleteavg activation code
ReplyDeleteactivation code for avg
avg activate
avg product key
avg antivirus key
AVG activation key
I always used to read smaller articles that as well clear their motive, and that is also happening with this post which I am reading at this place.
ReplyDeleteParallels Desktop Crack
Crack Software
Crack Software
Hello, its nice article regarding media print, we all be aware of media is a fantastic
ReplyDeletesource of facts.
고스톱
I have recently started a web site, the information you provide on this site has helped me tremendously. Thank you for all of your time & work.
ReplyDelete스포츠토토
Admiring the hard work you put into your blog and detailed information you provide. Great read! I’ve bookmarked your site and I’m including your RSS feeds to my Google account.
ReplyDelete한국야동
I am really grateful towards the owner on this web page who has
ReplyDeleteshared this enormous post at here.
토토사이트
Traditional bookstores have always existed on high streets, but in the digital age, the internet is proving to become a serious competitor to traditional brick and mortar stores. This article examines both sides of the coin and provides an appropriate insight into the phenomenon of shopping of books online. 메이저사이트추천
ReplyDeleteThe Eight-Wheel Classic - TITIAN Arts
ReplyDeleteThe eight-wheel classic bicycle is herzamanindir.com/ available in six apr casino sizes. The Bicycle Wheel titanium flat iron is a classic bicycle made in USA, but wooricasinos.info there are three variations in
Postingan poker online terbaik serta terpercaya di indonesia
ReplyDeleteKala kamu jalani dewapoker satu taruhan dengan benar dan cocok nyatanya. Sebagian pemain yang menginginkan bermain poker88 asia mesti mendapatkan satu. Diantara keuntungan yang begitu besar dalam bermain lapak303 bukan? Jadi kala tersebut kamu yang menginginkan rasakan keuntungan. Dalam bermain mesti dengan benar dan cocok dalam jalani satu taruhan karena memanglah. Umumnya game judi dengan bandar online sendiri pula hendak. Buat kamu natural bermacam - macam keuntungan dominobet yang dapat kamu nikmati dan mesti kamu.
Well done! Also visit my site
ReplyDelete토토사이트
바카라
This is a good tip particularly to those fresh to the blogosphere. Brief but very accurate information… Many thanks for sharing this one. A must read post! 먹튀검증
ReplyDeleteWay cool! Some very valid points! I appreciate you penning this article plus the rest of the site is also really good. 온라인경마
ReplyDelete
ReplyDeletenice information shared
mangoes online