class SVN

Attributes

client[RW]

Public Class Methods

new(user,password) click to toggle source
# File lib/svnkit.rb, line 37
def initialize user,password
        SVNRepositoryFactoryImpl.setup
        authormanager = BasicAuthenticationManager.new  user,password
        options = SVNWCUtil.createDefaultOptions(true)
        @client = SVNClientManager.newInstance(options,authormanager)
end

Public Instance Methods

checkout(svnurl,des) click to toggle source
# File lib/svnkit.rb, line 43
def checkout  svnurl,des
        url = SVNURL.parseURIEncoded svnurl
        #respository = @client.createRepository url,true
        #revision =  respository.getLatestRevision
        #depth = SVNDepth.getInfinityOrEmptyDepth true
        desFile = JavaFile.new des
        updateclient = @client.getUpdateClient
        updateclient.setIgnoreExternals false
        updateclient.doCheckout(url, desFile, SVNRevision::HEAD, SVNRevision::HEAD, SVNDepth::INFINITY,true)
end
copy(svnurls,desturl,message='copy operation by svnkit') click to toggle source
# File lib/svnkit.rb, line 54
def copy svnurls,desturl,message='copy operation by svnkit'
        copyclient = @client.getCopyClient
        copyclient.setIgnoreExternals false
            des=SVNURL.parseURIEncoded desturl
            copysources=[]
            svnurls.each do |svnurl|
                url =SVNURL.parseURIEncoded svnurl
                copysources << SVNCopySource.new(SVNRevision::HEAD, SVNRevision::HEAD, url)
            end
            copyclient.doCopy(copysources.to_java("org.tmatesoft.svn.core.wc.SVNCopySource"), des, false, true, false, message, nil)
end
delete(svnurl,message='delete operation by svnkit') click to toggle source
# File lib/svnkit.rb, line 73
def delete svnurl,message='delete operation by svnkit'
        commitclient = @client.getCommitClient
        commitclient.setIgnoreExternals false
        url =SVNURL.parseURIEncoded svnurl
        deleteurls = []
        deleteurls << url
        commitclient.doDelete(deleteurls.to_java("org.tmatesoft.svn.core.SVNURL"), message)
end
export(svnurl,despath,message='download(without svn manager)operation by svnkit') click to toggle source
# File lib/svnkit.rb, line 91
def export svnurl,despath,message='download(without svn manager)operation by svnkit'
        updateclient = @client.getUpdateClient
        updateclient.setIgnoreExternals false
        url =SVNURL.parseURIEncoded svnurl
        des = File.new despath
        updateclient.doExport(url,des, SVNRevision::HEAD, SVNRevision::HEAD, message,true,SVNDepth::INFINITY)
end
log(svnurl,startRevision=nil,endRevision=nil) click to toggle source
# File lib/svnkit.rb, line 117
def log svnurl,startRevision=nil,endRevision=nil
        repository = @client.createRepository(SVNURL.parseURIEncoded(svnurl),false)
        endRevision = repository.getLatestRevision unless endRevision
        startRevision = 0 unless startRevision
        logEntries = repository.log([].to_java("java.lang.String"), nil,startRevision, endRevision, true, true)
        logs=[]
        logEntries.iterator.each do |entry|
                p entry.java_class
                log={}
                log['revision'] = entry.getRevision
                log['author'] = entry.getAuthor
                log['date'] = entry.getDate.format
                log['message'] = entry.getMessage
                log['changepaths'] = []
                entry.getChangedPaths.keySet.iterator.each do |changepath|
                        entryPath = entry.getChangedPaths.get changepath
                        p entryPath.getType.chr
                        p entryPath.getPath.to_s
                        log['changepaths']<<{entryPath.getPath.to_s=>entryPath.getType.chr}
                end
                logs<<log
        end
        logs
end
mkdir(svnurl,message='mkdir operation by svnkit') click to toggle source
# File lib/svnkit.rb, line 82
def mkdir svnurl,message='mkdir operation by svnkit'
        commitclient = @client.getCommitClient
        commitclient.setIgnoreExternals false
        url = SVNURL.parseURIEncoded svnurl
        mkurls = []
        mkurls << url
        commitclient.doMkDir(mkurls.to_java("org.tmatesoft.svn.core.SVNURL"),message)
end
svninfo(svnurl) click to toggle source
# File lib/svnkit.rb, line 111
def svninfo svnurl
        wcclient
        url =SVNURL.parseURIEncoded svnurl
        info = @svnwcclient.doInfo(url, SVNRevision::HEAD, SVNRevision::HEAD)
end
update(targetpath) click to toggle source
# File lib/svnkit.rb, line 99
def update targetpath
        updateclient = @client.getUpdateClient
        updateclient.setIgnoreExternals false
        target = JavaFile.new targetpath
        updateclient.doUpdate(target, SVNRevision::HEAD,SVNDepth::INFINITY,true, true)
end
upload(svnurl,targetfile,message='import operation by svnkit') click to toggle source
# File lib/svnkit.rb, line 66
def upload svnurl,targetfile,message='import operation by svnkit'
        commitclient = @client.getCommitClient
        commitclient.setIgnoreExternals false
        url = SVNURL.parseURIEncoded svnurl
        target = JavaFile.new targetfile
        commitclient.doImport(target,url,message, nil, true, false,SVNDepth::INFINITY)
end
wcclient() click to toggle source
# File lib/svnkit.rb, line 106
def wcclient
        @svnwcclient = @client.getWCClient unless @svnwcclient
        @svnwcclient.setIgnoreExternals false
end