Refine search
private boolean areFileContentsEqual(String path1, long rev1, String path2, long rev2, SVNProperties props2) throws SVNException { SVNProperties props1 = new SVNProperties(); props2 = props2 == null ? new SVNProperties() : props2; SVNRepository repos = getSourceRepository(); repos.getFile(path1, rev1, props1, null); repos.getFile(path2, rev2, props2, null); String crc1 = props1.getStringValue(SVNProperty.CHECKSUM); String crc2 = props2.getStringValue(SVNProperty.CHECKSUM); return crc1 != null && crc1.equals(crc2); }
public void receive(SvnTarget target, SVNProperties object) throws SVNException { if (propName != null && object.containsName(propName)) { data[0] = new SVNPropertyData(propName, object.getSVNPropertyValue(propName), getOptions()); } } });
protected static SVNProperties omitMergeInfoChanges(SVNProperties props) { SVNProperties result = new SVNProperties(); for (String name : props.nameSet()) { if (SVNProperty.MERGE_INFO.equals(name)) { continue; } SVNPropertyValue pv = props.getSVNPropertyValue(name); result.put(name, pv); } return result; }
public void changeDirProperty(String name, SVNPropertyValue value) throws SVNException { if (myCurrentDirectory.myPropertyDiff == null) { myCurrentDirectory.myPropertyDiff = new SVNProperties(); } myCurrentDirectory.myPropertyDiff.put(name, value); }
private static boolean hasNullValues(SVNProperties props) { if (props.isEmpty()) { return false; } return props.containsValue(null); }
private void doList(SVNRepository repos, long rev, final ISVNDirEntryHandler handler, boolean fetchLocks, SVNDepth depth, int entryFields) throws SVNException { SVNURL url = repos.getLocation(); SVNURL reposRoot = repos.getRepositoryRoot(false); SVNDirEntry entry = null; SVNException error = null; try { entry = repos.info("", rev); } catch (SVNException svne) { if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_IMPLEMENTED) { error = svne; } else { if (!url.equals(reposRoot)) { String name = SVNPathUtil.tail(repos.getLocation().getPath()); repos.setLocation(repos.getLocation().removePathTail(), false); SVNProperties props = new SVNProperties(); String author = revProps.getStringValue(SVNRevisionProperty.AUTHOR); String dateStr = revProps.getStringValue(SVNRevisionProperty.DATE); Date datestamp = null; if (dateStr != null) { datestamp = SVNDate.parseDateString(dateStr); entry = new SVNDirEntry(url, reposRoot, "", kind, 0, !props.isEmpty(), rev, datestamp, author); entry.setRelativePath(""); if (!(e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_IMPLEMENTED)) { throw e;
SVNProperties baseMap = oldBaseProps.asMap(); if (modifiedProps == null) { modifiedProps = new SVNProperties(); for(Iterator names = baseMap.nameSet().iterator(); names.hasNext();) { String name = (String) names.next(); if (!modifiedProps.containsName(name)) { modifiedProps.put(name, SVNPropertyValue.create(null)); if (modifiedProps != null && !modifiedProps.isEmpty()) { if (modifiedProps.containsName(SVNProperty.EXTERNALS)) { String oldExternal = adminArea.getProperties(adminArea.getThisDirName()).getStringPropertyValue(SVNProperty.EXTERNALS); String newExternal = modifiedProps.getStringValue(SVNProperty.EXTERNALS); String path = myCurrentDirectory.getPath(); if (oldExternal == null && newExternal != null) { modifiedProps, null, null, true, false, log); } catch (SVNException svne) { SVNErrorMessage err = svne.getErrorMessage().wrap("Couldn't do property merge"); SVNErrorManager.error(err, svne, SVNLogType.WC); event.setURL(myCurrentDirectory.URL != null ? SVNURL.parseURIEncoded(myCurrentDirectory.URL) : null); myWCAccess.handleEvent(event);
long revNumber = getRevisionNumber(revision, repos, null); checkCancelled(); SVNNodeKind nodeKind = repos.checkPath("", revNumber); checkCancelled(); if (nodeKind == SVNNodeKind.DIR) { repos.getFile("", revNumber, properties, new SVNCancellableOutputStream(dst, this)); } else { if (properties == null) { properties = new SVNProperties(); repos.getFile("", revNumber, properties, null); checkCancelled(); String mimeType = properties.getStringValue(SVNProperty.MIME_TYPE); String charset = SVNTranslator.getCharset(properties.getStringValue(SVNProperty.CHARSET), mimeType, repos.getLocation().toString(), getOptions()); String keywords = properties.getStringValue(SVNProperty.KEYWORDS); String eol = properties.getStringValue(SVNProperty.EOL_STYLE); if (charset != null || keywords != null || eol != null) { String cmtRev = properties.getStringValue(SVNProperty.COMMITTED_REVISION); String cmtDate = properties.getStringValue(SVNProperty.COMMITTED_DATE); String author = properties.getStringValue(SVNProperty.LAST_AUTHOR); Map keywordsMap = SVNTranslator.computeKeywords(keywords, expandKeywords ? repos.getLocation().toString() : null, repos.getRepositoryRoot(true).toString(), author, cmtDate, cmtRev, getOptions()); OutputStream translatingStream = SVNTranslator.getTranslatingOutputStream(dst, charset, SVNTranslator.getEOL(eol, getOptions()), false, keywordsMap, expandKeywords); repos.getFile("", revNumber, null, new SVNCancellableOutputStream(translatingStream, getEventDispatcher()));
public void getInheritedProperties(String path, long revision, String propertyName, ISVNInheritedPropertiesHandler handler) throws SVNException { if (isInvalidRevision(revision)) { revision = getLatestRevision(); if (hasCapability(SVNCapability.INHERITED_PROPS)) { getInheritedPropertiesImpl(path, revision, propertyName, handler); return; rootRelativePath = "/"; setLocation(getLocation().removePathTail(), false); final SVNProperties properties = new SVNProperties(); try { getDir("", revision, properties, 0, (ISVNDirEntryHandler) null); final SVNProperties filtered = new SVNProperties(); if (propertyName != null && properties.containsName(propertyName)) { filtered.put(propertyName, properties.getSVNPropertyValue(propertyName)); } else if (propertyName == null) { for(String propName : properties.nameSet()) { if (SVNProperty.isRegularProperty(propName)) { filtered.put(propName, properties.getSVNPropertyValue(propName)); if (handler != null && !filtered.isEmpty()) { handler.handleInheritedProperites(rootRelativePath, filtered);
checkIfRepositoryIsAtRoot(toRepos, toURL); lock(toRepos); long latestRevision = toRepos.getLatestRevision(); if (latestRevision != 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, SVNPropertyValue fromURLProp = toRepos.getRevisionPropertyValue(0, SVNRevisionProperty.FROM_URL); if (fromURLProp != null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, toRepos.setRevisionPropertyValue(0, SVNRevisionProperty.FROM_URL, SVNPropertyValue.create(fromURL.toString())); String uuid = fromRepos.getRepositoryUUID(true); toRepos.setRevisionPropertyValue(0, SVNRevisionProperty.FROM_UUID, SVNPropertyValue.create(uuid)); SVNPropertyValue.create("0")); SVNProperties normalizedProps = copyRevisionProperties(fromRepos, toRepos, 0, false); handleNormalizedProperties(normalizedProps.size(), 0); } catch (SVNException svne) { error = svne;
private void doGetRemoteProperty(SVNURL url, String path, SVNRepository repos, String propName, SVNRevision rev, SVNDepth depth, ISVNPropertyHandler handler) throws SVNException { checkCancelled(); long revNumber = getRevisionNumber(rev, repos, null); SVNNodeKind kind = repos.checkPath(path, revNumber); SVNProperties props = new SVNProperties(); if (kind == SVNNodeKind.DIR) { Collection children = repos.getDir(path, revNumber, props, SVNDirEntry.DIRENT_KIND, SVNDepth.FILES.compareTo(depth) <= 0 ? new ArrayList() : null); if (propName != null) { SVNPropertyValue value = props.getSVNPropertyValue(propName); if (value != null) { handler.handleProperty(url, new SVNPropertyData(propName, value, getOptions())); for (Iterator names = props.nameSet().iterator(); names.hasNext();) { String name = (String) names.next(); if (name.startsWith(SVNProperty.SVN_ENTRY_PREFIX) || name.startsWith(SVNProperty.SVN_WC_PREFIX)) { continue; SVNPropertyValue value = props.getSVNPropertyValue(name); handler.handleProperty(url, new SVNPropertyData(name, value, getOptions())); repos.getFile(path, revNumber, props, null); if (propName != null) { SVNPropertyValue value = props.getSVNPropertyValue(propName); if (value != null) { handler.handleProperty(url, new SVNPropertyData(propName, value, getOptions())); for (Iterator names = props.nameSet().iterator(); names.hasNext();) { String name = (String) names.next(); if (name.startsWith(SVNProperty.SVN_ENTRY_PREFIX) || name.startsWith(SVNProperty.SVN_WC_PREFIX)) { continue;
SVNURL url = SVNURL.parseURIEncoded(srcURL); SVNUpdateClient updateClient = new SVNUpdateClient(getRepositoryPool(), getOptions()); updateClient.setEventHandler(getEventDispatcher()); url = SVNURL.parseURIEncoded(pair.mySource); SVNURL url = SVNURL.parseURIEncoded(srcURL); File tmpFile = SVNAdminUtil.createTmpFile(dir); String path = getPathRelativeToRoot(null, url, null, null, topSrcRepos); SVNProperties props = new SVNProperties(); OutputStream os = null; long revision = -1; try { os = SVNFileUtil.openFileForWriting(tmpFile); revision = topSrcRepos.getFile(path, srcRevNum, props, new SVNCancellableOutputStream(os, this)); } finally { SVNFileUtil.closeFile(os);
SVNProperties properties; try { properties = externals == null ? null : new SVNProperties(); entries = repository.getDir(path, rev, properties, entryFields, entries); } catch (SVNAuthenticationException e) { return; } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_AUTHORIZED) { return; SVNPropertyValue svnExternalsVaule = properties == null ? null : properties.getSVNPropertyValue(SVNProperty.EXTERNALS); if (svnExternalsVaule != null) { SVNURL location = repository.getLocation(); externals.put(location.appendPath(path, false), svnExternalsVaule);
public static void remotePropertyGet(SVNURL url, SVNNodeKind kind, String path, SVNRepository repos, long revNumber, SVNDepth depth, ISvnObjectReceiver<SVNProperties> receiver) throws SVNException { SVNURL fullURL = url.appendPath(path, false); SVNProperties props = new SVNProperties(); final Collection<SVNDirEntry> dirEntries = new LinkedList<SVNDirEntry>(); if (kind == SVNNodeKind.DIR) { repos.getDir(path, revNumber, props, SVNDirEntry.DIRENT_KIND, handler); } else if (kind == SVNNodeKind.FILE) { repos.getFile(path, revNumber, props, null); } else { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.NODE_UNKNOWN_KIND, "Unknown node kind for ''{0}''", fullURL); for (String name : new HashSet<String>(props.nameSet())) { if (!SVNProperty.isRegularProperty(name)) { props.remove(name); if (!props.isEmpty()) { receiver.receive(SvnTarget.fromURL(fullURL), props);
public SVNProperties getRevisionProperties(long revision, SVNProperties properties) throws SVNException { properties = properties == null ? new SVNProperties() : properties; try { openConnection(); String path = getLocation().getPath(); path = SVNEncodingUtil.uriEncode(path); DAVConnection connection = getConnection(); DAVProperties source = DAVUtil.getBaselineProperties(connection, this, path, revision, null); properties = DAVUtil.filterProperties(source, properties); if (revision >= 0) { String commitMessage = properties.getStringValue(SVNRevisionProperty.LOG); getOptions().saveCommitMessage(DAVRepository.this, revision, commitMessage); } } finally { closeConnection(); } return properties; }
public Void invoke(File ws, VirtualChannel channel) throws IOException, InterruptedException { File workingCopy = new File(ws, location.getLocalDir()).getCanonicalFile(); try { SVNURL svnUrl = SVNURL.parseURIEncoded(tagUrl); SVNCopyClient copyClient; try { copyClient = SubversionSCM.createClientManager(authProvider).getCopyClient(); } catch (NoSuchMethodError e) { //todo remove when backward compatibility not needed //fallback for older versions of org.jenkins-ci.plugins:subversion buildListener.getLogger().println( "[RELEASE] You are using an old subversion jenkins plugin, please consider upgrading."); copyClient = SubversionSCM.createSvnClientManager(authProvider).getCopyClient(); } buildListener.getLogger().println("[RELEASE] Creating subversion tag: " + tagUrl); SVNCopySource source = new SVNCopySource(SVNRevision.WORKING, SVNRevision.WORKING, workingCopy); SVNCommitInfo commitInfo = copyClient.doCopy(new SVNCopySource[]{source}, svnUrl, false, true, true, commitMessage, new SVNProperties()); SVNErrorMessage errorMessage = commitInfo.getErrorMessage(); if (errorMessage != null) { throw new IOException("Failed to create tag: " + errorMessage.getFullMessage()); } return null; } catch (SVNException e) { debuggingLogger.log(Level.FINE, "Failed to create tag", e); throw new IOException("Subversion tag creation failed: " + e.getMessage()); } } }
private String[] createActivity() throws SVNException { String activity = myConnection.doMakeActivity(myCommitMediator); String path = SVNEncodingUtil.uriEncode(myLocation.getPath()); String vcc = DAVUtil.getPropertyValue(myConnection, path, null, DAVElement.VERSION_CONTROLLED_CONFIGURATION); break; } catch (SVNException svne) { if (svne.getErrorMessage().getErrorCode() != SVNErrorCode.APMOD_BAD_BASELINE || i == 4) { throw svne; final SVNPropertyValue authorRevisionProperty = myRevProps.remove(SVNRevisionProperty.AUTHOR); patchResourceProperties(location, myRevProps); if (authorRevisionProperty != null) { myRevProps = new SVNProperties(); myRevProps.put(SVNRevisionProperty.AUTHOR, authorRevisionProperty); } else { myRevProps = null;
private String createActivity() throws SVNException { String activity = myConnection.doMakeActivity(myCommitMediator); String path = SVNEncodingUtil.uriEncode(myLocation.getPath()); String vcc = DAVUtil.getPropertyValue(myConnection, path, null, DAVElement.VERSION_CONTROLLED_CONFIGURATION); break; } catch (SVNException svne) { if (svne.getErrorMessage().getErrorCode() != SVNErrorCode.APMOD_BAD_BASELINE || i == 4) { throw svne; SVNErrorManager.error(err, SVNLogType.NETWORK); if (myRevProps != null && myRevProps.size() > 0) { StringBuffer request = DAVProppatchHandler.generatePropertyRequest(null, myRevProps);
public boolean fileIsBinary() throws SVNException { if (isBinary == null) { SVNProperties props = new SVNProperties(); repos.getFile("", baseRev, props, null); setBinary(props); } return isBinary.booleanValue(); }