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


##########
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:
   >     1. We need `project.build.outputTimestamp` in the `pom.xml` as it's 
used by maven plugins to ensure the build is reproducible.
   
   Yes. I think so too.
   
   >     2. `project.build.outputTimestamp` value has to be fixed (not changing 
at each build). The value doesn't matter if it's always the same. That's the 
purpose of the setting the value (it's what I did in all other Apache projects 
where I'm working on).
   
   Yes. I think so too.
    
   >     3. We can't use `1970-01-01` else maven-assembly-plugin complains, 
that's why I used the first allowed value in the range which is 
`1980-01-01T00:00:02Z`. So I used the same in the `test-helper.rb` to be in 
sync.
   
   Yes and no. We don't need to use special timestamps such as `1970-...` and 
`1980-...` in `pom.xml`. `test-helper.rb` normalizes all timestamps such as  
`2023-12-13T00:00:00Z` in `pom.xml`. So we don't need to synchronize timestamps 
in `pom.xml` and `test-helper.rb`. So we can use  `2023-12-13T00:00:00Z` in 
`pom.xml` like you did.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to