kou commented on code in PR #39215:
URL: https://github.com/apache/arrow/pull/39215#discussion_r1444776173


##########
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:
   We don't need to use the special timestamp in `pom.xml`. (Timestamps in 
`pom.xml` are updated automatically in our release process, right? 
https://github.com/apache/arrow/pull/39215#issuecomment-1863620913 )
   We normalize timestamps in `pom.xml` for testing by this code.



-- 
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]

Reply via email to