Untangling Composite Commits Untangling Composite Commits Using Program Slicing Using Program Slicing Ward Muylaert and Coen De Roover @wardmuylaert and @oniroi Sofuware Languages Lab SCAM 2018 Vrije Universiteit Brussel Madrid, Spain Brussels, Belgium
Two Types of Commits Single-task commit Composite commit
Composite Commit Difgiculties Revert Understand Integrate Research
Prevalence of Composite Commits K. Herzig et al., “The impact of tangled code “15%” changes on defect prediction models,” Empirical Sofuware Engineering , 2015. Y. Tao et al., “Partitioning Composite Code “17% - 29%” Changes to Facilitate Code Review,” in MSR , 2015. “11% - 39%” H. A. Nguyen et al., “Filtering Noise in Mixed- Purpose Fixing Commits to Improve Defect Prediction and Localization”, in ISSRE , 2013.
Ideal
Ideal Hypothesis Related changes afgect source code from the same program slice. A commit may be decomposed using the created program slices.
Overview of our Approach ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file p u b l i c F i g A c t i o n S t a t e ( ) { - _ b i g P o r t = n e w F i g R R e c t ( 1 0 + 1 , 1 0 + 1 , 9 0 - 2 , 2 5 - 2 , C o l o r . c y a n , C o l o r . c y a n ) ; + b i g P o r t = n e w F i g R R e c t ( 1 0 + 1 , 1 0 + 1 , 9 0 - 2 , 2 5 - 2 , C o l o r . c y a n , C o l o r . c y a n ) ; - _ b i g P o r t . s e t C o r n e r R a d i u s ( _ b i g P o r t . g e t H a l f H e i g h t ( ) ) ; + b i g P o r t . s e t C o r n e r R a d i u s ( b i g P o r t . g e t H a l f H e i g h t ( ) ) ; - _ c o v e r = n e w F i g R R e c t ( 1 0 , 1 0 , 9 0 , 2 5 , C o l o r . b l a c k , C o l o r . w h i t e ) ; + c o v e r = n e w F i g R R e c t ( 1 0 , 1 0 , 9 0 , 2 5 , C o l o r . b l a c k , C o l o r . w h i t e ) ; - _ c o v e r . s e t C o r n e r R a d i u s ( _ c o v e r . g e t H a l f H e i g h t ( ) ) ; + c o v e r . s e t C o r n e r R a d i u s ( _ c o v e r . g e t H a l f H e i g h t ( ) ) ; - _ b i g P o r t . s e t L i n e W i d t h ( 0 ) ; + b i g P o r t . s e t L i n e W i d t h ( 0 ) ; - a d d F i g ( _ b i g P o r t ) ; + a d d F i g ( b i g P o r t ) ; - a d d F i g ( _ c o v e r ) ; + a d d F i g ( c o v e r ) ; }
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file Edit operations ● Insert ● Move 1. Delete x ● Delete 2. Insert y ● Update x y AST before commit AST afuer commit R. Stevens et al., “Extracting executable transformations from distilled code changes,” in SANER , 2017. B. Fluri et al., “Change distilling: Tree AST tree difgerencing difgerencing for fine-grained source code change extraction,” IEEE Transactions on Sofuware Engineering , 2007.
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file U p d a t e S i m p l e N a m e o n l i n e 2 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 3 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 3 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 6 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 7 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 4 : _ c o v e r → c o v e r U p d a t e S i m p l e N a m e o n l i n e 5 : _ c o v e r → c o v e r U p d a t e S i m p l e N a m e o n l i n e 5 : _ c o v e r → c o v e r U p d a t e S i m p l e N a m e o n l i n e 8 : _ c o v e r → c o v e r
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file S. Horwitz et al., “Interprocedural Inter-procedural slicing using dependence graphs,” ACM Transactions on Programming Languages and Systems , 1990. TinyPDG Y. Higo et al., “Enhancing quality of code clone detection with program dependency graph,” in Working Conference on Reverse Engineering , 2009.
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file FigActionState _cover = new FigRRect() _bigport = new FigRRect() _bigPort.setLW(0) addFig(_cover) _cover.setCR(_cover.getHH()) _bigPort.setCR(_bigport.getHH()) addFig(_bigPort) Control dependence Data dependence
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file FigActionState _bigport = new FigRRect() _cover = new FigRRect() _bigPort.setCR(_bigport.getHH()) _bigPort.setLW(0) addFig(_cover) _cover.setCR(_cover.getHH()) addFig(_bigPort) U p d a t e S i m p l e N a m e o n l i n e 6 : _ b i g P o r t → b i g P o r t
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file FigActionState _bigport = new FigRRect() _cover = new FigRRect() _bigPort.setCR(_bigport.getHH()) _bigPort.setLW(0) addFig(_cover) _cover.setCR(_cover.getHH()) addFig(_bigPort) U p d a t e S i m p l e N a m e o n l i n e 6 : _ b i g P o r t → b i g P o r t
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file FigActionState _bigport = new FigRRect() _cover = new FigRRect() _bigPort.setCR(_bigport.getHH()) _bigPort.setLW(0) addFig(_cover) _cover.setCR(_cover.getHH()) addFig(_bigPort) U p d a t e S i m p l e N a m e o n l i n e 6 : _ b i g P o r t → b i g P o r t
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file U p d a t e S i m p l e N a m e o n l i n e 2 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 3 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 3 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 6 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 7 : _ b i g P o r t → b i g P o r t U p d a t e S i m p l e N a m e o n l i n e 4 : _ c o v e r → c o v e r U p d a t e S i m p l e N a m e o n l i n e 5 : _ c o v e r → c o v e r U p d a t e S i m p l e N a m e o n l i n e 5 : _ c o v e r → c o v e r U p d a t e S i m p l e N a m e o n l i n e 8 : _ c o v e r → c o v e r
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file U/L2: _bigPort → bigPort U/L4: _cover → cover U/L3: _bigPort → bigPort U/L5: _cover → cover U/L3: _bigPort → bigPort U/L6: _bigPort → bigPort U/L7: _bigPort → bigPort U/L5: _cover → cover U/L8: _cover → cover
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file U/L2: _bigPort → bigPort U/L4: _cover → cover U/L3: _bigPort → bigPort U/L5: _cover → cover U/L3: _bigPort → bigPort U/L6: _bigPort → bigPort U/L7: _bigPort → bigPort U/L5: _cover → cover U/L8: _cover → cover → Change is in the slice associated with the other change
ChangeDistiller per changed file Slice SDG Group Commit on each change changes SDG per changed file Cluster 1 Cluster 2 U/L2: _bigPort → bigPort U/L4: _cover → cover U/L3: _bigPort → bigPort U/L5: _cover → cover U/L3: _bigPort → bigPort U/L6: _bigPort → bigPort U/L7: _bigPort → bigPort U/L5: _cover → cover U/L8: _cover → cover → Transitive closure
Recommend
More recommend