GrammaTech / resolve

Resolve software differencing and merging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resolve

TRL: 6

Software AST-based diff calculation, display, and automated resolution.

# Example output of git configured to use Resolve's ast-diff command
$ git diff HEAD~2..HEAD~1 -- src/event.js
ast-diff src/event.js
index cb70e8eb..b63b93b9 100644
line: 589
// synthetic events by interrupting progress until reinvoked in response to
// *native* events that it fires directly, ensuring that state changes have
// already occurred before other listeners are invoked.
function leverageNative( el, type, [-forceAdd, -]{+expectSync+}[-allowAsync-] ) {+{

// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add +}[-{

// Setup must go through jQuery.event.add-] if ( {+!expectSync+}[-forceAdd-] ) { jQuery.event.add( el, type, {+returnTrue+}[-forceAdd-] ); return; }

line: 603 // Register the controller as a special universal handler for all event namespaces dataPriv.set( el, type, {+false+}[-forceAdd-] ); jQuery.event.add( el, type, { namespace: false, handler: function( event ) { var {+notAsync+}[-maybeAsync-], result, saved = dataPriv.get( this, type );

Abstract

Resolve implements multi-lingual semantic differencing of software source code and implements an automated technique of merge conflict resolution. This provides developers with more meaningful views of software changes and it frees developers from the tedious manual task of merge conflict resolution.

Usage

You can get pre-built binaries of ast-diff and ast-merge for AMD64 from the [releases page][].

If you want to build them yourself:

  1. Check out the submodules for this repository. git submodule update --init --recursive
  2. Install SBCL and Quicklisp.
  3. In this repository, run make bin/ast-diff make bin/ast-merge

Use Cases

Improved difference calculation and view

Senior developers spend a significant portion of their time reviewing the work products of other developers. The primary mode of representing these work products are as differences against the existing code base. By calculating syntactically aware differences over software abstract syntax trees (ASTs) we provide more informative and meaningful views of software changes.

Limitations

Currently the reliability of printed diffs is limited. In particular irregular indentation may result in malformed diffs or errors during diff printing.

This is in consequence of the high-level representation of ASTs in Resolve: because the representation abstracts away details such as indentation and syntactic delimiters and separators, they have to be carefully reconstructed to present the result to humans.

Automated merge conflict resolution

On project with multiple developers, a significant portion of time is typically spent manually resolving conflicting changes between parallel branches of development. By automatically resolving merge conflicts we are able to save projects a significant amount of expensive developer time and free developers from the often tedious job of manual conflict resolution.

Tools

  • command-line AST differencing
  • web-based AST differencing
  • test-suite guided merge conflict resolution

Language Support

Resolve supports any language that can be parsed by tree-sitter and represented by SEL. This includes, but is not limited to:

  • C
  • C++
  • JavaScript
  • Python
  • TypeScript
  • Rust

Copyright and License

Copyright (c) 2020 GrammaTech, Inc.

See LICENSE.txt for more information.

We ask that all contributors complete our Contributor License Agreement (CLA), which can be found at GrammaTech-CLA-resolve.pdf, and email the completed form to CLA@GrammaTech.com. Under this agreement contributors retain the copyright to their work but grants GrammaTech unlimited license to the work.

Acknowledgment

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.

About

Resolve software differencing and merging

License:GNU Affero General Public License v3.0


Languages

Language:C++ 43.5%Language:Common Lisp 30.6%Language:C 13.9%Language:JavaScript 6.3%Language:Shell 3.0%Language:TeX 1.1%Language:Python 0.9%Language:Makefile 0.4%Language:Emacs Lisp 0.2%Language:CSS 0.0%