jbonofre commented on code in PR #39215:
URL: https://github.com/apache/arrow/pull/39215#discussion_r1444897408
##########
dev/release/test-helper.rb:
##########
@@ -83,15 +83,60 @@ def parse_patch(patch)
when /\A@@/
in_hunk = true
diffs.last[:hunks] << []
- when /\A[-+]/
+ when /\A-/
next unless in_hunk
diffs.last[:hunks].last << line.chomp
+ when /\A\+/
+ next unless in_hunk
+ diffs.last[:hunks].last <<
normalize_added_line(line.chomp)
end
end
diffs.sort_by do |diff|
diff[:path]
end
end
+
+ def generate_hunks(lines)
+ git_diff_context = 3 # The default of Git's diff.context
+ max_lines_for_same_hunk = git_diff_context * 2 + 1
+ previous_i = nil
+ grouped_change_blocks = []
+ lines.each_with_index do |line, i|
+ deleted, added = yield(line)
+ next if deleted.nil? and added.nil?
+ if previous_i.nil? or (i - previous_i) > max_lines_for_same_hunk
+ grouped_change_blocks << []
+ end
+ if i - 1 != previous_i
+ grouped_change_blocks.last << []
+ end
+ grouped_change_blocks.last.last << [deleted, added]
+ previous_i = i
+ end
+ grouped_change_blocks.collect do |change_blocks|
+ hunk = []
+ change_blocks.each do |continuous_changes|
+ continuous_changes.each do |deleted, _|
+ hunk << "-#{deleted}" if deleted
+ end
+ continuous_changes.each do |_, added|
+ hunk << "+#{added}" if added
+ end
+ end
+ hunk
+ end
+ end
+
+ def normalize_pom_xml_output_timestamp(line)
+ line.gsub(/<project\.build\.outputTimestamp>.+?</) do
+ "<project.build.outputTimestamp>2023-12-13T00:00:00Z<"
Review Comment:
I think it's better (for both visibility and testing) to have
`project.build.outputTimestamp` in the `pom.xml`. Or at least, I can replace it
with a comment documenting that `project.build.outputTimestamp` is populating
by the `dev/release/test-helper.rb`. Thoughts ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]