Renaming and shifted code in structured merging: looking ahead for precision and performance
Abstract
Diffing and merging of source-code artifacts is an essential task when integrating changes in software versions. While state-of-the-art line-based merge tools (e.g., git merge) are fast and independent of the programming language used, they have only a low precision. Recently, it has been shown that the precision of merging can be substantially improved by using a language-aware, structured approach that works on abstract syntax trees. But, precise structured merging is NP hard, especially, when considering the notoriously difficult scenarios of renamings and shifted code. To address these scenarios without compromising scalability, we propose a syntax-aware, heuristic optimization for structured merging that employs a lookahead mechanism during tree matching. The key idea is that renamings and shifted code are not arbitrarily distributed, but their occurrence follows patterns, which we address with a syntax-specific lookahead. Our experiments with 48 real-world open-source projects (4,878 merge scenarios with over 400 million lines of code) demonstrate that we can significantly improve matching precision in 28 percent of cases while maintaining performance.
BibTeX
@inproceedings{Lessenich-al:ASE17,
author = {Olaf Le{\ss}enich and
Sven Apel and
Christian K{\"{a}}stner and
Georg Seibt and
Janet Siegmund},
title = {Renaming and shifted code in structured merging: looking ahead for precision and performance},
booktitle = {ASE},
pages = {543--553},
publisher = {{IEEE} Computer Society},
year = {2017},
}