Combining Example-Based and Rule-Based Program Transformations to Resolve Build Conflicts
Sheikh Shadab Towqir, Fei He, Todd Mytkowicz, Na Meng
TL;DR
This paper presents BuCoR, a Build Conflict Resolver that tackles build conflicts arising during three-way merges by combining static conflict detection with two complementary resolution strategies: example-based transformation (BuCoR-E) and rule-based transformation (BuCoR-R). It detects conflicts using a static analysis of base, left, and right versions, constructs a four-way graph including the naïvely merged version, and applies context-aware edits learned from exemplar branch edits or from predefined rules. In experiments on 88 real-world conflicts, BuCoR achieved 74% coverage and 52% overall accuracy, with BuCoR-E excelling at unconventional, project-specific resolutions and BuCoR-R providing higher coverage for conventional cases. The work demonstrates that a hybrid approach leveraging both exemplar-based learning and rule-based patterns can effectively assist developers in resolving complex build conflicts and suggests directions for more intelligent, automated merge tools.
Abstract
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.
