Mastery: Shifted-Code-Aware Structured Merging

Fengmin Zhu,Xingyu Xie,Dongyu Feng,Na Meng,Fei He
DOI: https://doi.org/10.1007/978-3-031-21213-0_5
2022-01-01
Abstract:Three-way merging is an essential infrastructure in version control systems. While the traditional line-based textual methods are efficient, syntax-based structured approaches have shown advantages in enhancing merge accuracy. Prior structured merging approaches visit abstract syntax trees in a top-down manner, which is hard to detect and merge shifted code in the general sense. This paper presents a novel methodology combining a top-down and a bottom-up visit of abstract syntax trees, which manipulates shifted code effectively and elegantly. This merge algorithm is order-preserving and linear-time. Compared with four representative merge tools in 40,533 real-world merge scenarios, our approach achieves the highest merge accuracy and 2.4x as fast as a state-of-the-art structured merge tool.
What problem does this paper attempt to address?