Skip to content

Commit

Permalink
method for parsing svn log listing
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Mar 2, 2024
1 parent 84b3893 commit 69eac74
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/whimsy/asf/svn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,23 @@ def self.svn!(command, path, options = {})
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
Expand Down

0 comments on commit 69eac74

Please sign in to comment.