private boolean propsMatch(SVNProperties srcProps, SVNProperties dstProps) { if (srcProps == null && dstProps == null) { return true; } else if (srcProps != null || dstProps != null) { return false; } else { SVNProperties diff = dstProps.compareTo(srcProps); return diff != null && diff.size() > 0 ? false : true; } }
public void dirPropsChanged(SvnDiffCallbackResult result, File path, boolean isAdded, SVNProperties propChanges, SVNProperties originalProperties) throws SVNException { SVNProperties regularPropChanges = new SVNProperties(); SvnNgPropertiesManager.categorizeProperties(propChanges, regularPropChanges, null, null); if (regularPropChanges.size() > 0) { this.propChanges.add(path); } }
public void fileChanged(SvnDiffCallbackResult result, File path, File leftFile, File rightFile, long rev1, long rev2, String mimeType1, String mimeType2, SVNProperties propChanges, SVNProperties originalProperties) throws SVNException { boolean textChange = rightFile != null; SVNProperties regularPropChanges = new SVNProperties(); SvnNgPropertiesManager.categorizeProperties(propChanges, regularPropChanges, null, null); boolean propChange = regularPropChanges.size() > 0; if (textChange || propChange) { sendSummary(path, textChange ? SVNStatusType.STATUS_MODIFIED : SVNStatusType.STATUS_NORMAL, propChange, SVNNodeKind.FILE); } }
public void fileAdded(SvnDiffCallbackResult result, File path, File leftFile, File rightFile, long rev1, long rev2, String mimeType1, String mimeType2, File copyFromPath, long copyFromRevision, SVNProperties propChanges, SVNProperties originalProperties) throws SVNException { SVNProperties regularPropChanges = new SVNProperties(); SvnNgPropertiesManager.categorizeProperties(propChanges, regularPropChanges, null, null); sendSummary(path, SVNStatusType.STATUS_ADDED, regularPropChanges.size() > 0, SVNNodeKind.FILE); }
private boolean areFilesSame(File olderAbsPath, SVNProperties originalProps, File mineAbsPath) throws SVNException { SVNProperties workingProps = context.getActualProps(mineAbsPath); boolean same = arePropertiesSame(originalProps, workingProps); if (same) { return !context.compareAndVerify(mineAbsPath, olderAbsPath, workingProps != null && workingProps.size() > 0, false, false); } return same; }
private SVNProperties collectProperties(FSRevisionNode revNode) throws SVNException { SVNProperties properties = new SVNProperties(); SVNProperties versionedProps = revNode.getProperties(myFSFS); if (versionedProps != null && versionedProps.size() > 0) { properties.putAll(versionedProps); } SVNProperties metaprops = null; try { metaprops = myFSFS.compoundMetaProperties(revNode.getCreatedRevision()); } catch (SVNException svne) { // } if (metaprops != null && metaprops.size() > 0) { properties.putAll(metaprops); } return properties; }
private SVNProperties collectProperties(FSRevisionNode revNode) throws SVNException { SVNProperties properties = new SVNProperties(); SVNProperties versionedProps = revNode.getProperties(myFSFS); if (versionedProps != null && versionedProps.size() > 0) { properties.putAll(versionedProps); } SVNProperties metaprops = null; try { metaprops = myFSFS.compoundMetaProperties(revNode.getCreatedRevision()); } catch (SVNException svne) { // } if (metaprops != null && metaprops.size() > 0) { properties.putAll(metaprops); } return properties; }
private SVNProperties collectProperties(FSRevisionNode revNode) throws SVNException { SVNProperties properties = new SVNProperties(); SVNProperties versionedProps = revNode.getProperties(myFSFS); if (versionedProps != null && versionedProps.size() > 0) { properties.putAll(versionedProps); } SVNProperties metaprops = null; try { metaprops = myFSFS.compoundMetaProperties(revNode.getCreatedRevision()); } catch (SVNException svne) { // } if (metaprops != null && metaprops.size() > 0) { properties.putAll(metaprops); } return properties; }
private void patchResourceProperties(String path, SVNProperties properties) throws SVNException { if (properties != null && properties.size() > 0) { final StringBuffer request = DAVProppatchHandler.generatePropertyRequest(null, properties); try { myConnection.doProppatch(null, path, request, null, null); } catch (SVNException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "applying log message to {0}", path); SVNErrorManager.error(err, SVNLogType.NETWORK); } } }
public void dirAdded(SvnDiffCallbackResult result, File relPath, SvnDiffSource copyFromSource, SvnDiffSource rightSource, SVNProperties copyFromProps, SVNProperties rightProps, Object dirBaton) throws SVNException { SVNProperties pristineProps = copyFromProps; if (rightProps != null && rightProps.size() > 0) { if (pristineProps == null) { pristineProps = new SVNProperties(); } SVNProperties propChanges = pristineProps.compareTo(rightProps); callback.dirPropsChanged(result, getAbsPath(relPath), true, propChanges, pristineProps); } callback.dirClosed(result, getAbsPath(relPath), true); }
public static void upgradeApplyDavCache(SVNWCDbRoot root, File dirRelPath, Map<String, SVNProperties> cacheValues) throws SVNException { SVNSqlJetStatement selectRoot = root.getSDb().getStatement(SVNWCDbStatements.SELECT_WCROOT_NULL); long wcId = 0; try { if (selectRoot.next()) wcId = selectRoot.getColumnLong(WCROOT__Fields.id); } finally { selectRoot.reset(); } /* Iterate over all the wcprops, writing each one to the wc_db. */ for (Iterator<String> names = cacheValues.keySet().iterator(); names.hasNext();) { String name = (String) names.next(); SVNProperties props = (SVNProperties) cacheValues.get(name); if (props.size() > 0) { File localRelPath = SVNFileUtil.createFilePath(dirRelPath, name); SVNSqlJetStatement stmt = root.getSDb().getStatement(SVNWCDbStatements.UPDATE_BASE_NODE_DAV_CACHE); stmt.bindf("is", wcId, localRelPath); stmt.bindProperties(3, props); try { stmt.exec(); } finally { stmt.reset(); } } } }
protected ISVNEditor getCommitEditorInternal(Map locks, boolean keepLocks, SVNProperties revProps, ISVNWorkspaceMediator mediator) throws SVNException { try { openConnection(); String logMessage = revProps.getStringValue(SVNRevisionProperty.LOG); if (revProps.size() > 1 && !myConnection.isCommitRevprops()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_IMPLEMENTED, "Server doesn't support setting arbitrary revision properties during commit"); SVNErrorManager.error(err, SVNLogType.NETWORK); } write("(w(s(*l)w(*l)))", new Object[]{"commit", logMessage, locks, Boolean.valueOf(keepLocks), revProps}); authenticate(); read("", null, false); return new SVNCommitEditor(this, myConnection, new SVNCommitEditor.ISVNCommitCallback() { public void run(SVNException error) { if (error != null) { closeSession(); } closeConnection(); } }); } catch (SVNException e) { closeConnection(); closeSession(); throw e; } }
/** * @param revision * @param revisionProperties * @return editor to replicate the revision * @throws SVNException */ public ISVNEditor handleStartRevision(long revision, SVNProperties revisionProperties) throws SVNException { myTargetRepository.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, SVNPropertyValue.create(SVNProperty.toString(revision))); SVNProperties filtered = new SVNProperties(); filterProperties(revisionProperties, filtered, true); if (!filtered.containsName(SVNRevisionProperty.LOG)) { filtered.put(SVNRevisionProperty.LOG, ""); } SVNProperties normalizedProps = SVNAdminClient.normalizeRevisionProperties(filtered); myNormalizedRevPropsCount += normalizedProps.size(); if (mySyncEditor == null) { mySyncEditor = new SVNSynchronizeEditor(myTargetRepository, myLogEntryHandler, revision - 1, filtered); } else { mySyncEditor.reset(revision - 1, filtered); } ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(mySyncEditor, myCanceller, myDebugLog); return cancellableEditor; }
private UpdateWorkingProps updateWorkingProps(SVNSkel conflictSkel, File localAbsPath, WorkingNodeVersion oldNodeVersion, WorkingNodeVersion newNodeVersion) throws SVNException { UpdateWorkingProps updateWorkingProps = new UpdateWorkingProps(); if (oldNodeVersion.props == null) { oldNodeVersion.props = new SVNProperties(); } if (newNodeVersion.props == null) { newNodeVersion.props = new SVNProperties(); } updateWorkingProps.actualProps = db.readProperties(localAbsPath); updateWorkingProps.propChanges = SvnDiffEditor.computePropDiff(oldNodeVersion.props, newNodeVersion.props); SVNWCContext context = new SVNWCContext(db, eventHandler); SVNWCContext.MergePropertiesInfo mergePropertiesInfo = new SVNWCContext.MergePropertiesInfo(); mergePropertiesInfo.conflictSkel = conflictSkel; mergePropertiesInfo = context.mergeProperties3(mergePropertiesInfo, localAbsPath, oldNodeVersion.props, oldNodeVersion.props, updateWorkingProps.actualProps, updateWorkingProps.propChanges); updateWorkingProps.conflictSkel = mergePropertiesInfo.conflictSkel; SVNProperties newActualProperties = mergePropertiesInfo.newActualProperties; updateWorkingProps.propState = mergePropertiesInfo.mergeOutcome; SVNProperties newPropChanges = SvnDiffEditor.computePropDiff(newNodeVersion.props, newActualProperties); if (newPropChanges.size() > 0) { newActualProperties = null; } db.opSetProps(localAbsPath, newActualProperties, null, SVNWCContext.hasMagicProperty(updateWorkingProps.propChanges), null); return updateWorkingProps; }
/** * @param revision * @param revisionProperties * @return editor to replicate the revision * @throws SVNException */ public ISVNEditor handleStartRevision(long revision, SVNProperties revisionProperties) throws SVNException { myTargetRepository.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, SVNPropertyValue.create(SVNProperty.toString(revision))); SVNProperties filtered = new SVNProperties(); filterProperties(revisionProperties, filtered, true); if (!filtered.containsName(SVNRevisionProperty.LOG)) { filtered.put(SVNRevisionProperty.LOG, ""); } SVNProperties normalizedProps = SVNAdminClient.normalizeRevisionProperties(filtered); myNormalizedRevPropsCount += normalizedProps.size(); if (mySyncEditor == null) { mySyncEditor = new SVNSynchronizeEditor(myTargetRepository, myLogEntryHandler, revision - 1, filtered); } else { mySyncEditor.reset(revision - 1, filtered); } ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(mySyncEditor, myCanceller, myDebugLog); return cancellableEditor; }
public void opAddFile(File localAbsPath, SVNProperties props, SVNSkel workItems) throws SVNException { File dirAbsPath = SVNFileUtil.getParentFile(localAbsPath); String name = SVNFileUtil.getFileName(localAbsPath); DirParsedInfo parseDir = parseDir(dirAbsPath, Mode.ReadWrite, false, true); SVNWCDbDir pdh = parseDir.wcDbDir; File localRelpath = SVNFileUtil.createFilePath(parseDir.localRelPath, name); verifyDirUsable(pdh); InsertWorking ibw = new InsertWorking(); ibw.status = SVNWCDbStatus.Normal; ibw.kind = SVNWCDbKind.File; ibw.opDepth = SVNWCUtils.relpathDepth(localRelpath); ibw.localRelpath = localRelpath; ibw.wcRoot = pdh.getWCRoot(); if (props != null && props.size() > 0) { ibw.updateActualProps = true; ibw.newActualProps = props; } ibw.workItems = workItems; pdh.getWCRoot().getSDb().runTransaction(ibw); pdh.flushEntries(localAbsPath); }
/** * @param revision * @param revisionProperties * @return editor to replicate the revision * @throws SVNException */ public ISVNEditor handleStartRevision(long revision, SVNProperties revisionProperties) throws SVNException { myTargetRepository.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, SVNPropertyValue.create(SVNProperty.toString(revision))); SVNProperties filtered = new SVNProperties(); filterProperties(revisionProperties, filtered, true); if (!filtered.containsName(SVNRevisionProperty.LOG)) { filtered.put(SVNRevisionProperty.LOG, ""); } SVNProperties normalizedProps = SVNAdminClient.normalizeRevisionProperties(filtered); myNormalizedRevPropsCount += normalizedProps.size(); if (mySyncEditor == null) { mySyncEditor = new SVNSynchronizeEditor(myTargetRepository, myLogEntryHandler, revision - 1, filtered); } else { mySyncEditor.reset(revision - 1, filtered); } ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(mySyncEditor, myCanceller, myDebugLog); return cancellableEditor; }
public void opAddDirectory(File localAbsPath, SVNProperties props, SVNSkel workItems) throws SVNException { File dirAbsPath = SVNFileUtil.getParentFile(localAbsPath); String name = SVNFileUtil.getFileName(localAbsPath); DirParsedInfo parseDir = parseDir(dirAbsPath, Mode.ReadWrite); SVNWCDbDir pdh = parseDir.wcDbDir; File localRelpath = SVNFileUtil.createFilePath(parseDir.localRelPath, name); verifyDirUsable(pdh); InsertWorking ibw = new InsertWorking(); ibw.status = SVNWCDbStatus.Normal; ibw.kind = SVNWCDbKind.Dir; ibw.opDepth = SVNWCUtils.relpathDepth(localRelpath); ibw.localRelpath = localRelpath; ibw.wcRoot = pdh.getWCRoot(); if (props != null && props.size() > 0) { ibw.updateActualProps = true; ibw.newActualProps = props; } ibw.workItems = workItems; pdh.getWCRoot().getSDb().runTransaction(ibw); pdh.flushEntries(localAbsPath); }
public void opAddSymlink(File localAbsPath, File target, SVNProperties props, SVNSkel workItems) throws SVNException { assert isAbsolute(localAbsPath); assert target != null; File dirAbsPath = SVNFileUtil.getParentFile(localAbsPath); String name = SVNFileUtil.getFileName(localAbsPath); DirParsedInfo parsed = parseDir(localAbsPath, Mode.ReadOnly); SVNWCDbDir pdh = parsed.wcDbDir; verifyDirUsable(pdh); File localRelPath = SVNFileUtil.createFilePath(parsed.localRelPath, name); InsertWorking iw = new InsertWorking(); iw.status = SVNWCDbStatus.Normal; iw.kind = SVNWCDbKind.Symlink; iw.opDepth = SVNWCUtils.relpathDepth(localRelPath); if (props != null && props.size() > 0) { iw.updateActualProps = true; iw.newActualProps = props; } iw.target = target; iw.workItems = workItems; pdh.getWCRoot().getSDb().runTransaction(iw); pdh.flushEntries(localAbsPath); }
if (affectedRows == 1 || properties.size() == 0) return;