use of org.tmatesoft.svn.core.wc.SVNClientManager in project oxTrust by GluuFederation.
the class SubversionService method commitShibboleth3ConfigurationFiles.
public boolean commitShibboleth3ConfigurationFiles(GluuOrganization organization, List<SubversionFile> newSubversionFiles, List<SubversionFile> removeSubversionFiles, String svnComment) {
// Retrieve properties and derive applianceSvnHome
String svnUrl = appConfiguration.getSvnConfigurationStoreRoot();
String inumFN = StringHelper.removePunctuation(appConfiguration.getApplianceInum());
String svnPassword = appConfiguration.getSvnConfigurationStorePassword();
String applianceSvnHomePath = String.format("%s/%s", baseSvnDir, inumFN);
if (StringHelper.isEmpty(svnUrl) || StringHelper.isEmpty(inumFN) || StringHelper.isEmpty(svnPassword)) {
// log.error("Failed to commit files to repository. Please check SVN related properties in gluuAppliance.properties file");
return false;
}
SVNClientManager clientManager = null;
try {
// Decrypt password
svnPassword = encryptionService.decrypt(svnPassword);
// Create an instance of SVNClientManager
log.debug("Creating an instance of SVNClientManager");
SVNURL repositoryURL = SVNURL.parseURIEncoded(svnUrl);
clientManager = SvnHelper.getSVNClientManager(inumFN, svnPassword);
// Check root path exists
boolean result = checkRootSvnPath(clientManager, repositoryURL);
if (!result) {
return result;
}
File applianceSvnHome = new File(applianceSvnHomePath);
removeFilesFromLocalRepository(applianceSvnHome, removeSubversionFiles);
// Copy files to temporary repository folder
copyFilesToLocalRepository(applianceSvnHome, newSubversionFiles);
// Add files
log.debug("Adding files if neccessary");
SvnHelper.addNewFiles(clientManager, applianceSvnHome);
// Commit updates to repository
log.debug("Commiting updates to repository");
String message = String.format("Automatic update of Shibboleth configuration files for organization %s", organization.getDisplayName());
message += "\n Changes List:\n" + svnComment;
SvnHelper.commit(clientManager, applianceSvnHome, false, message);
return true;
} catch (Exception ex) {
// log.error("Failed to commit files to repository", ex);
} finally {
if (clientManager != null) {
clientManager.dispose();
}
}
return false;
}
use of org.tmatesoft.svn.core.wc.SVNClientManager in project Gargoyle by callakrsos.
the class SVNList method listRemoved.
/**
* Not Yet Support.
* 아직 미구현
* @작성자 : KYJ
* @작성일 : 2017. 2. 16.
* @param relativePath
* @param startRevision
* @param isRecursive
* @return
* @throws SVNException
*/
@Deprecated
public List<SVNLogEntry> listRemoved(String relativePath, long startRevision, boolean isRecursive) throws SVNException {
SVNClientManager mgr = getSvnManager();
Collection<SVNLogEntry> allLogs = getJavaSVNManager().getAllLogs(relativePath, startRevision);
return Collections.emptyList();
}
use of org.tmatesoft.svn.core.wc.SVNClientManager in project Gargoyle by callakrsos.
the class SVNResource method getSvnUrlByFileSystem.
/**
* SVN 서버에 연결된 루트 디렉토리에 속하는 로컬 파일시스템의 파일에 해당하는 SVN서버 경로를 리턴한다.
*
* @작성자 : KYJ
* @작성일 : 2016. 8. 1.
* @return
* @throws Exception
*/
public SVNURL getSvnUrlByFileSystem(File file, SVNRevision revision) throws Exception {
SVNClientManager svnManager2 = getSvnManager();
SVNInfo doInfo = svnManager2.getWCClient().doInfo(file, revision);
return doInfo.getURL();
}
use of org.tmatesoft.svn.core.wc.SVNClientManager in project sonarqube by SonarSource.
the class SvnBlameCommand method blame.
@Override
public void blame(final BlameInput input, final BlameOutput output) {
FileSystem fs = input.fileSystem();
LOG.debug("Working directory: " + fs.baseDir().getAbsolutePath());
SVNClientManager clientManager = null;
try {
clientManager = newSvnClientManager(configuration);
for (InputFile inputFile : input.filesToBlame()) {
blame(clientManager, inputFile, output);
}
} finally {
if (clientManager != null) {
try {
clientManager.dispose();
} catch (Exception e) {
LOG.warn("Unable to dispose SVN ClientManager", e);
}
}
}
}
use of org.tmatesoft.svn.core.wc.SVNClientManager in project sonarqube by SonarSource.
the class SvnScmProvider method branchChangedLines.
@CheckForNull
@Override
public Map<Path, Set<Integer>> branchChangedLines(String targetBranchName, Path rootBaseDir, Set<Path> changedFiles) {
SVNClientManager clientManager = null;
try {
clientManager = newSvnClientManager(configuration);
// find reference revision number: the copy point
SVNLogClient svnLogClient = clientManager.getLogClient();
long[] revisionCounter = { 0 };
svnLogClient.doLog(new File[] { rootBaseDir.toFile() }, null, null, null, true, true, 0, svnLogEntry -> revisionCounter[0] = svnLogEntry.getRevision());
long startRev = revisionCounter[0];
SVNDiffClient svnDiffClient = clientManager.getDiffClient();
File path = rootBaseDir.toFile();
ChangedLinesComputer computer = newChangedLinesComputer(rootBaseDir, changedFiles);
svnDiffClient.doDiff(path, SVNRevision.create(startRev), path, SVNRevision.WORKING, SVNDepth.INFINITY, false, computer.receiver(), null);
return computer.changedLines();
} catch (Exception e) {
LOG.warn("Failed to get changed lines from Subversion", e);
} finally {
if (clientManager != null) {
try {
clientManager.dispose();
} catch (Exception e) {
LOG.warn("Unable to dispose SVN ClientManager", e);
}
}
}
return null;
}
Aggregations