In the code below (which uses the SVNKit Java library) I define the function
get-dir-contents, which takes a Subversion repository URL and, via the proxy
ISVNDirEntryHandler, prints each entry to the screen in the call to
handleDirEntry. I would like it to collect and return the entries instead,
but I'm not sure how to do so without having handleDirEntry append them to a
list. Is there a more appropriate way to handle this in Clojure?
Thanks,
Justin
(import '(org.tmatesoft.svn.core SVNException ISVNDirEntryHandler))
(import '(org.tmatesoft.svn.core.internal.wc SVNPath))
(import '(org.tmatesoft.svn.core.wc SVNWCUtil SVNClientManager SVNRevision))
(import '(org.tmatesoft.svn.core.internal.io.dav DAVRepositoryFactory))
(def username "user")
(def password "password")
(def HEAD SVNRevision/HEAD)
(DAVRepositoryFactory/setup)
(def client-mgr
(SVNClientManager/newInstance
(SVNWCUtil/createDefaultOptions true)
(SVNWCUtil/createDefaultAuthenticationManager username password)))
(defn get-dir-contents [url-path]
(.doList (.getLogClient client-mgr) (.getURL (SVNPath. url-path)) HEAD
HEAD false
(proxy [ISVNDirEntryHandler] []
(handleDirEntry [dir-entry]
(println (.getName dir-entry))))))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---