Merge conflicts often arise when developers integrate changes from different software branches. The conflicts can result from overlapping edits in programs (i.e., textual conflicts) or cause build and test errors (i.e., build and test conflicts). They degrade software quality and hinder programmer productivity. While several tools detect build conflicts, few offer meaningful support for resolving them. To overcome limitations of existing tools, we introduce BuCoR (Build Conflict Resolver), a new conflict resolver. BuCoR first detects conflicts by comparing three versions related to a merging scenario: base b, left l, and right r. To resolve conflicts, it employs two complementary strategies: example-based transformation (BuCoR-E) and rule-based transformation (BuCoR-R). BuCoR-R applies predefined rules to resolve conflicts in frequently suggested or conventional ways. BuCoR-E mines branch versions (l and r) for exemplar edits applied to fix related build errors. From these examples, it infers and generalizes program transformation patterns to resolve conflicts in project-specific or unconventional ways. We evaluated BuCoR on 88 real-world build conflicts spanning 21 distinct conflict types. BuCoR generated at least one solution for 65 cases and correctly resolved 34 conflicts. We observed that this hybrid approach--combining context-aware, example-based learning with structured, rule-based resolution--can effectively help resolve conflicts. Our research sheds light on future directions for more intelligent and automated merge tools.
翻译:在开发者集成不同软件分支的变更时,常出现合并冲突。这些冲突可能源于程序中的重叠编辑(即文本冲突),也可能导致构建与测试错误(即构建与测试冲突)。此类冲突会降低软件质量并阻碍程序员工作效率。尽管已有多种工具能够检测构建冲突,但鲜有工具能为解决这些冲突提供有效支持。为克服现有工具的局限,我们引入了BuCoR(构建冲突解决器),一种新型冲突解决工具。BuCoR首先通过比较与合并场景相关的三个版本——基础版本b、左侧版本l和右侧版本r——来检测冲突。为解决冲突,它采用两种互补策略:基于示例的转换(BuCoR-E)与基于规则的转换(BuCoR-R)。BuCoR-R应用预定义规则,以频繁建议或常规方式解决冲突。BuCoR-E则从分支版本(l与r)中挖掘用于修复相关构建错误的示例编辑,并从中推断和泛化程序转换模式,以项目特定或非常规方式解决冲突。我们在涵盖21种不同冲突类型的88个真实构建冲突上对BuCoR进行了评估。BuCoR在65个案例中至少生成了一个解决方案,并正确解决了34个冲突。我们观察到,这种将上下文感知的基于示例学习与结构化基于规则解决相结合的混合方法,能有效协助解决冲突。本研究为开发更智能、自动化的合并工具指明了未来方向。