[codeface] [PATCH v2 04/24] Fix problem with feature blocks in a file from VCS

  • From: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Thu, 1 Dec 2016 17:10:58 +0100

When there was a single-line feature change in a file, the commit has
been added to the wrong feature. This is fixed by processing the
left/upcoming features (open_features) at the end of processing lines
changed by commits in a release range.

Signed-off-by: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
Acked-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
 codeface/cluster/cluster.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/codeface/cluster/cluster.py b/codeface/cluster/cluster.py
index d363ff3..a5844c4 100755
--- a/codeface/cluster/cluster.py
+++ b/codeface/cluster/cluster.py
@@ -333,6 +333,7 @@ def group_feature_lines(file_commit, file_state, cmt_list):
         next_line = lines[0]
         next_cmt_id = file_state[str(next_line)]
         curr_features = file_commit.findFeatureList(curr_line)
+        open_features = []
 
     for i in range(0, len(file_state) - 1):
         curr_line = lines[i]
@@ -362,10 +363,12 @@ def group_feature_lines(file_commit, file_state, 
cmt_list):
                                 curr_cmt_id, feature))
                 blk_start[feature] = next_line
                 blk_end[feature] = next_line
+                # collect features that are still open
+                open_features = next_features
 
     # boundary case for open code-blocks or a single line file_state.
     for feature in feature_blks:
-        if feature in curr_features:  # Close all open feature blocks
+        if feature in open_features:  # Close all open feature blocks
             feature_blks[feature].append(
                 codeBlock.codeBlock(
                     blk_start[feature], blk_end[feature],
-- 
2.10.2


Other related posts:

  • » [codeface] [PATCH v2 04/24] Fix problem with feature blocks in a file from VCS - Claus Hunsen