mergedroid: a bot to solve conflicts in pull requests

Friday, February 16, 2018 0 Comments

How often do you have to stop what you are doing to solve a conflict in a pull request? How long does it take before you get refocused on the task at hand? Wouldn't it be great if a bot was able to automatically solve most of those merges so you don't have to waste time in context switching?

Well, that's precisely what we are working on. We call it mergedroid and it is a way to apply our Semantic Merge technology to the server side to reduce manual intervention when merging pull requests. It is the same merge tech that comes with gmaster, but applied to solve GitHub pull requests.

We found that between 16 to 30% of conflictive pull requests can be fully automated by mergedroid, saving tons of precious time.

This is what it can do with the Git repo itself:

Almost 27% less manual merges required. Check the full report here.

Do you want to learn more about mergedroid? Go to gmaster.io/mergedroid.

Analyze your repos first

Together with mergedroid, we have developed a tool to analyze your repos and find how many past merges could have been automated. In fact, if you visit mergedroid today, it will send you to the analyzer because we are gathering some stats before we release the merge bot.

Check a sample report from a public repository here.

Can I use mergedroid today?

Yes, we will contact you as soon as you submit some of your repos for analysis. We'll send you instructions on how to install it in your repo. (It's super simple, just a URL and a few clicks.)

It's not still available for everyone since we want to test it in batches with users before we go live publicly.

What is the cost?

It's in beta, so we still haven't figure that out. Most likely, it will be something based on the number of merges it solves, so you only pay for when it really helped you to save you time.

How mergedroid works?

It's quite simple. It installs a webhook in the GitHub repos you choose (public or private) so mergedroid is notified each time a pull request can't be automatically merged by GitHub.

When that happens, mergedroid pulls your repo, (that's why it asks you to grant access to it), tries to solve the merge with semantic tech, and if it succeeds, it commits the merge result and pushes back to GitHub, so your pull request gets updated. Then, GitHub will be able to automatically merge the updated pull request.

As you can see in the screenshot below, the history of the pull request will show the new commit made by mergedroid, resolving the conflict:

How are the pull request conflicts resolved?

Suppose I have a pull request as follows:

But, it can't be merged to master because of manual conflicts.

mergedroid tries to merge master into pull-request:

To do that, mergedroid uses our entire merge tech, including Semantic and also cross-file semantic merge resolution. (Check this video for more info). If it can solve the merge without manual intervention, it will commit locally and will push the updated branch to GitHub.

Then, GitHub will be able to automatically merge the pull-request without any manual intervention.

mergedroid will send an email to the author of the pull-request notifying them whether it was successful or not.

Merge down instead of rebase?

As I explained above, mergedroid "merges down" the master branch into pull-request. Another option will be to simply rebase the pull request. We will consider this in the future depending on user feedback.

Between 16% and 30% of conflicts in pull requests can be automated

What we found so far running "merge replays" in public repos is that between 16 and 30% of branches that currently need manual intervention can be merged automatically by mergedroid.

And, it happens in repos where authors are trying to avoid complex refactors because they know merging the code later can be a nightmare. We expect this number to increase as soon as more teams adopt mergedroid, semanticmerge and gmaster.

Don't hesitate to contact us

Contact us if you have any questions about how mergedroid can help you or if you want to give it a try. You can use @gmasterscm on Twitter or simply drop us an email to mergedroid@gmaster.io.

We develop gmaster, a Git GUI with semantic superpowers. It parses the code to really understand how it was refactored and then diff it and merge it as a human would do, matching methods instead of lines.

If you want to try it, download it from here.

We are also the developers of SemanticMerge and Plastic SCM, a full-featured version control.

0 comments: