MergeResolver — Automatic Merge Conflict Resolution

栏目: IT技术 · 发布时间: 4年前

Large projects get a lot of pull requests. On busy projects, these pull requests can fall behind. The farther they fall behind, the less likely they become to ever get merged.

You've seen this for yourself. Pull request #6 on a project working on pull request #600, still open because it's a good idea – just not quite good enough for anyone to do the tedious manual work of reconciling it with the master branch. Other common failure modes include delaying responding to merges with conflicts, or installing tools like "pager duty" to ensure rapid manual response to conflicts (see more in The life-cycle of merge conflicts ).

"Tedious manual work"? A phrase to make any programmer's ears prick up. There should be some way to automate that.

MergeResolver is an experimental GitHub application for JavaScript projects. When you install MergeResolver on a repository, it waits for a conflict to happen. Conflicts can happen with new pull requests, or when a new commit to master conflicts with one or more open pull requests.

If a conflict happens, MergeResolver clones your repository and sets to work. First, it tries to avoid the conflict by retrying the merge, but on the Abstract Syntax Tree (AST) level.

MergeResolver — Automatic Merge Conflict Resolution

By treating code as ASTs rather than simply a string of characters, MergeResolver recognizes code's structure and semantics. This ensures all potential conflict resolutions will parse as valid code, and in some cases cleanly reconciles changes that would conflict under Git's built-in, line-oriented merge algorithms (as in the above example).

MergeResolver — Automatic Merge Conflict Resolution

If AST merging fails, things get more interesting. MergeResolver understands different strategies for reconciling merge conflicts – strategies mined from large datasets of real-world merge conflict resolutions (see On the nature of merge conflicts ). With this knowledge it can generate possible conflict resolutions.

But how does it know which generated conflict resolutions are viable? MergeResolver relies on the only source of truth about a program's requirements: its test suite. MergeResolver finds a viable resolution by looking for a resolution that passes your program's test suite.

Once MergeResolver finds a resolution that passes your test suite, it uses GitHub's Checks API to provide a button (under the Checks tab on the pull request) that can be used to accept the resolution.

MergeResolver — Automatic Merge Conflict Resolution

If you want to inspect the conflict resolution before accepting it, a link is provided to a diff of the merge resolution commit.

MergeResolver is currently available for direct installation . It is free for open-source projects to try. You can add MergeResolver to your Node-based JavaScript repository here .

Please let us know what works well or not for you, and we'll strive to make it useful enough that it becomes a staple of your team's development workflow.

This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Contract No. D17PC00096. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Defense Advanced Research Projects Agency (DARPA); or its Contracting Agent, the U.S. Department of the Interior, Interior Business Center, Acquisition Services Directorate, Division III.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

大数据时代

大数据时代

[英] 维克托•迈尔•舍恩伯格(Viktor Mayer-Schönberger) / 周涛 / 浙江人民出版社 / 2012-12 / 49.90元

《大数据时代》是国外大数据研究的先河之作,本书作者维克托•迈尔•舍恩伯格被誉为“大数据商业应用第一人”,拥有在哈佛大学、牛津大学、耶鲁大学和新加坡国立大学等多个互联网研究重镇任教的经历,早在2010年就在《经济学人》上发布了长达14页对大数据应用的前瞻性研究。 维克托•迈尔•舍恩伯格在书中前瞻性地指出,大数据带来的信息风暴正在变革我们的生活、工作和思维,大数据开启了一次重大的时代转型,并用三......一起来看看 《大数据时代》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具