Skip to content

Commit

Permalink
Optionally return age of file
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Sep 12, 2024
1 parent d5e549d commit 9ce4f94
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/whimsy/asf/documents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,17 @@ def self.refreshnames(storedates, env)
end

# Find the file name (or directory) that matches a person
# return [svnpath, name] if found
# return [svnpath, name, timestamp, epoch (int)] if found
# return nil if not found
def self.findpath(userid, env)
def self.findpath(userid, env, getDates=false)
reqdir = ASF::SVN.svnpath!(STEM)
list, err = ASF::SVN.listnames(reqdir, env.user, env.password)
if list
names = list.select{|x| x.start_with?("#{userid}.") or x == "#{userid}/"} # if there is a sig, then files are in a subdir
list, err = ASF::SVN.listnames(reqdir, env.user, env.password, getDates)
if list # This is a list of [names] or triples [name, ISO timestamp, epoch (int)]
names = list.select{|x,_y| x.start_with?("#{userid}.") or x == "#{userid}/"} # if there is a sig, then files are in a subdir
if names.size == 1
name = names.first
path = ASF::SVN.svnpath!(STEM, name)
return [path, name]
return [path, name].flatten # this works equally well with or without dates
end
return nil
else
Expand Down

0 comments on commit 9ce4f94

Please sign in to comment.