I use for my smal project Java SVNKit (for tagging):
at the moment and its work:
public void copy(String branchName, String dstTag, boolean isMove, String msg) throws SVNException, IOException {
String finalURL = getSvnUrl() + "tags/" + dstTag;
URL url = new URL(finalURL);
String loginPassword = getUsername() + ":" + getPassword();
String encoded = EncodingUtil.getAsciiString(Base64.encodeBase64(EncodingUtil.getAsciiBytes(loginPassword)));
URLConnection conn = url.openConnection();
conn.setRequestProperty("Authorization", "Basic " + encoded);
HttpURLConnection urlConnect = null;
try {
urlConnect = (HttpURLConnection)conn;
if (urlConnect.getResponseCode() != HttpURLConnection.HTTP_OK) {
ourClientManager.getCopyClient().doCopy(SVNURL.parseURIDecoded(getSvnUrl() + branchName),
SVNRevision.HEAD, SVNURL.parseURIDecoded(finalURL), isMove, msg);
LOGGER.info("svn-tagging " + dstTag);
} else
LOGGER.info(dstTag + " Tag exists.");
} finally {
if (urlConnect != null) {
urlConnect.disconnect();
}
}
}
I want to check if tag exists or not and I want to do/use with SVNRepository
and SVNClientManager
and not HttpURLConnection.HTTP_OK
, does anyone have any idea?