This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 69eac74e method for parsing svn log listing
69eac74e is described below

commit 69eac74e64c180900f4aaf47e96894880aa350d7
Author: Sebb <s...@apache.org>
AuthorDate: Sat Mar 2 13:45:39 2024 +0000

    method for parsing svn log listing
---
 lib/whimsy/asf/svn.rb | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 51cb248c..fd80a817 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -435,6 +435,23 @@ module ASF
       return out, err
     end
 
+    # get list of commmits from initial to current, and parses the output
+    # Returns: [out, err], where:
+    #  out = array of entries, each of which is an array of [commitid, 
committer, datestamp]
+    #  err = error message (in which case out is nil)
+    def self.svn_commits(path, before, after, env=nil)
+      out, err = ASF::SVN.svn('log', path, {env: env, quiet: true, revision: 
"#{before}:#{after}"})
+      # extract lines starting with r1234, and split into fields
+      return out&.scan(%r{^r\d+ .*})&.map {|k| k.split(' | ')}, err
+    end
+
+    # as for self.svn_commits, but failure raises an error
+    def self.svn_commits!(path, before, after, env=nil)
+      out, err = self.svn_commits(path, before, after, env)
+      raise Exception.new("SVN command failed: #{err}") if out.nil?
+      return out, err
+    end
+
     # low level SVN command for use in Wunderbar context (_json, _text etc)
     # params:
     # command - info, list etc

Reply via email to