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 2a08f711 Also support timestamp listing
2a08f711 is described below
commit 2a08f71167ad85eb36f4bd7d1148eebb4a0b6923
Author: Sebb <[email protected]>
AuthorDate: Sat Aug 31 17:24:30 2024 +0100
Also support timestamp listing
---
lib/whimsy/asf/svn.rb | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 368511ba..01c60387 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -296,10 +296,26 @@ module ASF
# retrieve array of names, [err] for a path in svn
# directories are suffixed with '/'
- def self.listnames(path, user=nil, password=nil)
+ # If the timestamp is requested, the name is followed by the timestamp in
text and in seconds since epoch
+ def self.listnames(path, user=nil, password=nil, timestamp=false)
+ list = err = nil
+ if timestamp
+ list, err = self.svn(['list', '--xml'], path, {user: user, password:
password})
+ if list
+ files = []
+ require 'nokogiri'
+ xml_doc = Nokogiri::XML(list)
+ xml_doc.css('entry').each do |entry|
+ date = entry.css('date').text
+ files << [entry.css('name').text, date,
Time.parse(date).strftime('%s').to_i]
+ end
+ return files
+ end
+ else
list, err = self.svn('list', path, {user: user, password: password})
return list.split(%r{\R}) if list
- [list, err]
+ end
+ [list, err]
end
# These keys are common to svn_ and svn