use of org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions in project intellij-community by JetBrains.
the class SvnBusyOnAddTest method getStatus.
@Nullable
private String getStatus(final File ioFile) throws SVNException {
try {
SVNStatusClient readClient = new SVNStatusClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
final SVNStatus status = readClient.doStatus(ioFile, false);
return status == null ? null : status.getNodeStatus().toString();
} catch (SVNException e) {
if (SVNErrorCode.WC_NOT_WORKING_COPY.equals(e.getErrorMessage().getErrorCode())) {
return null;
}
throw e;
}
}
use of org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions in project intellij-community by JetBrains.
the class SvnBusyOnAddTest method testStatusDoesNotLockForWrite.
public void testStatusDoesNotLockForWrite() throws Exception {
final File ioFile = new File(myWorkingCopyRoot, filename);
ioFile.getParentFile().mkdirs();
/*SVNWCClient client11 = new SVNWCClient((ISVNRepositoryPool)null, new DefaultSVNOptions());
client11.doAdd(ioFile.getParentFile(), true, false, true, true);*/
ioFile.createNewFile();
try {
final SVNStatusClient readClient = new SVNStatusClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
final Semaphore semaphore = new Semaphore();
final Semaphore semaphoreMain = new Semaphore();
final Semaphore semaphoreWokeUp = new Semaphore();
final AtomicReference<Boolean> wasUp = new AtomicReference<>(false);
final ISVNStatusHandler handler = status -> {
semaphore.waitFor();
wasUp.set(true);
};
semaphore.down();
semaphoreMain.down();
semaphoreWokeUp.down();
final SVNException[] exception = new SVNException[1];
Thread thread = new Thread(() -> {
try {
semaphoreMain.up();
readClient.doStatus(myWorkingCopyRoot, true, false, true, false, handler);
semaphoreWokeUp.up();
} catch (SVNException e) {
exception[0] = e;
}
}, "svn test");
thread.start();
semaphoreMain.waitFor();
TimeoutUtil.sleep(5);
SVNWCClient client = new SVNWCClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
client.doAdd(ioFile.getParentFile(), true, false, true, true);
semaphore.up();
semaphoreWokeUp.waitFor();
Assert.assertEquals(true, wasUp.get().booleanValue());
if (exception[0] != null) {
throw exception[0];
}
thread.join();
} finally {
ioFile.delete();
}
}
use of org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions in project Gargoyle by callakrsos.
the class AbstractSVN method init.
/**
* 접속정보 초기화
*
* @작성자 : KYJ
* @작성일 : 2016. 5. 2.
* @param properties
*/
public void init(Properties properties) {
validate();
try {
svnURL = SVNURL.parseURIEncoded(getUrl());
repository = SVNRepositoryFactory.create(svnURL);
if ((getUserId() == null && getUserPassword() == null) || (getUserId().isEmpty() && getUserPassword().isEmpty())) {
authManager = SVNWCUtil.createDefaultAuthenticationManager(SVNWCUtil.getDefaultConfigurationDirectory());
} else {
authManager = SVNWCUtil.createDefaultAuthenticationManager(getUserId(), getUserPassword().toCharArray());
}
repository.setAuthenticationManager(authManager);
DefaultSVNOptions options = new DefaultSVNOptions();
svnManager = SVNClientManager.newInstance(options, authManager);
// svnManager.dispose();
// repository.closeSession();
} catch (SVNException e) {
LOGGER.error(ValueUtil.toString(e));
// throw new RuntimeException(e);
}
}
use of org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions in project Corgi by kevinYin.
the class CreateDeploymentController method ensureSvnRevision.
private void ensureSvnRevision(DeploymentOrder order, ProjectModule module) {
String tagName = order.getTagName().trim();
String svnAddr = module.getRepoUrl() + (tagName.startsWith("/") ? tagName : "/" + tagName);
try {
SVNURL url = SVNURL.parseURIEncoded(svnAddr);
DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true);
SVNClientManager clientManager = SVNClientManager.newInstance(options, module.getSvnAccount(), module.getSvnPassword());
SVNWCClient svnwcClient = clientManager.getWCClient();
SVNInfo info = svnwcClient.doInfo(url, null, null);
order.setVersionNo(info.getCommittedRevision().getNumber() + "");
} catch (Exception e) {
logger.error("读取版本号出错", e);
}
if (StringUtils.isEmpty(order.getVersionNo())) {
throw new IllegalArgumentException("读取SVN版本号出错: " + order.getTagName());
}
}
use of org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions in project intellij-community by JetBrains.
the class Idea87218Test method main.
public static void main(String[] args) {
try {
SVNStatusClient client = new SVNStatusClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
File src = new File(ourWcPath, "file1.txt");
SVNStatus status = client.doStatus(src, false);
assert status != null && SVNStatusType.STATUS_NORMAL.equals(status.getNodeStatus());
File dir = new File(ourWcPath, "unversioned");
SVNStatus dirStatus = client.doStatus(dir, false);
assert dirStatus != null && SVNStatusType.STATUS_UNVERSIONED.equals(dirStatus.getNodeStatus());
File dst = new File(dir, "file1.txt");
/*
final SVNCopyClient copyClient = new SVNCopyClient((ISVNRepositoryPool)null, new DefaultSVNOptions());
final SVNCopySource svnCopySource = new SVNCopySource(SVNRevision.UNDEFINED, SVNRevision.WORKING, src);
copyClient.doCopy(new SVNCopySource[]{svnCopySource}, dst, true, false, true);
*/
SVNMoveClient moveClient = new SVNMoveClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
moveClient.doMove(src, dst);
} catch (SVNException e) {
e.printStackTrace();
}
}
Aggregations