基于令牌的通用文本合并策略:用于版本控制系统
A Universal Textual Merge Strategy Based on Tokens for Version Control Systems
AI总结:
本文提出Summer算法,通过令牌级变更生成字符串重写规则和移动规则,实现跨格式的文本合并,实验显示其在精确度和语义准确度上表现优异。
摘要:
合并是版本控制系统如Git中的核心操作,但传统基于行的算法在重构或并行编辑时易产生虚假冲突。本文提出Summer,一种基于令牌的文本合并算法,通过将文本分割为令牌,将分支中的令牌级变更转换为字符串重写规则和移动规则,应用于另一分支文本以构建合并。尽管不依赖编程语言,移动规则仍能建模函数提取和内联。在ConflictBench基准上,Summer在精确复现开发者合并的准确度上达到36%,在语义准确度上排名第二。
英文摘要:
Merging is a core operation in version control systems such as Git, but traditional line-based algorithms often yield spurious conflicts, particularly in the presence of refactorings or parallel edits. While syntax- and semantics-aware merging approaches can reduce conflicts, they introduce drawbacks such as loss of formatting, dependence on language-specific parsers, and limited flexibility across heterogeneous artifacts. To address this gap, we present Summer, a novel textual token-based merge algorithm independent of document formats. Dividing text into tokens, our approach formulates token-level changes in one branch into string-rewriting rules and move rules, and applies these rules to the text of the other branch to construct a merge. Despite being independent on programming languages, our move rules model extracting and inlining functions. We evaluated Summer on ConflictBench, a large benchmark of real-world merge scenarios, comparing it with five pioneering merge tools across Java and non-Java files. Experimental results show that Summer achieved the highest 36% accuracy in reproducing merges verbatim identical to developers', and ranked second in semantic accuracy.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。