List getCommitDiff()

in src/main/groovy/com/epam/esp/vcs/svn/SvnHelper.groovy [42:67]


    List<Commit> getCommitDiff(project, srcBranch, destBranch) {
        OS os = OS.getOs()
        List<String> params = ['svn', 'log', config.url, '--xml', "-r${revisionFrom}:${revisionTo}".toString(), '--username', config.user, '--password', config.password].asList()
        List<String> processOut = new ArrayList<String>()
        def result = os.execCommandLine(params, processOut, config.getPath(project), 600)   //.join()
        def commitList = new ArrayList<Commit>()

        if (result == 0) {
            if (logger.isInfoEnabled()) {
                logger.info("Processing result. ${processOut.size()} lines to process.")
            }
            def rootNode = new XmlParser().parseText(processOut.join(" "))
            rootNode.logentry.each { element ->
                def commit = new Commit()
                commit.date = element.date.text()
                commit.hash = element.attribute("revision")
                commit.author = element.author.text()
                commit.comment = element.msg.text()
                commitList.add(commit)
            }

        } else {
            throw new SvnException('Unable to execute svn command')
        }
        return commitList
    }