public static FSTransactionInfo beginTransaction(long baseRevision, int flags, FSFS owner) throws SVNException { FSTransactionInfo txn = createTxn(baseRevision, owner); String commitTime = SVNTimeUtil.formatDate(new Date(System.currentTimeMillis())); owner.setTransactionProperty(txn.getTxnId(), SVNRevisionProperty.DATE, commitTime); if ((flags & SVN_FS_TXN_CHECK_OUT_OF_DATENESS) != 0) { owner.setTransactionProperty(txn.getTxnId(), SVNProperty.TXN_CHECK_OUT_OF_DATENESS, SVNProperty.toString(true)); } if ((flags & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { owner.setTransactionProperty(txn.getTxnId(), SVNProperty.TXN_CHECK_LOCKS, SVNProperty.toString(true)); } return txn; }
public static void markTree(SVNAdminArea dir, String schedule, boolean copied, boolean keepLocal, int flags) throws SVNException { for (Iterator entries = dir.entries(false); entries.hasNext();) { SVNEntry entry = (SVNEntry) entries.next(); markEntry(dir, entry, schedule, copied, keepLocal, flags); } Map attributes = new SVNHashMap(); SVNEntry dirEntry = dir.getEntry(dir.getThisDirName(), false); if (!(dirEntry.isScheduledForAddition() && SVNProperty.SCHEDULE_DELETE.equals(schedule))) { if ((flags & SCHEDULE) != 0) { attributes.put(SVNProperty.SCHEDULE, schedule); } if ((flags & COPIED) != 0) { attributes.put(SVNProperty.COPIED, copied ? Boolean.TRUE.toString() : null); } } if ((flags & KEEP_LOCAL) != 0 && keepLocal) { attributes.put(SVNProperty.KEEP_LOCAL, SVNProperty.toString(true)); } if (attributes.size() > 0) { dir.modifyEntry(dir.getThisDirName(), attributes, true, false); attributes.clear(); } dir.saveEntries(false); }
public static void markTree(SVNAdminArea dir, String schedule, boolean copied, boolean keepLocal, int flags) throws SVNException { for (Iterator entries = dir.entries(false); entries.hasNext();) { SVNEntry entry = (SVNEntry) entries.next(); markEntry(dir, entry, schedule, copied, keepLocal, flags); } Map attributes = new SVNHashMap(); SVNEntry dirEntry = dir.getEntry(dir.getThisDirName(), false); if (!(dirEntry.isScheduledForAddition() && SVNProperty.SCHEDULE_DELETE.equals(schedule))) { if ((flags & SCHEDULE) != 0) { attributes.put(SVNProperty.SCHEDULE, schedule); } if ((flags & COPIED) != 0) { attributes.put(SVNProperty.COPIED, copied ? Boolean.TRUE.toString() : null); } } if ((flags & KEEP_LOCAL) != 0 && keepLocal) { attributes.put(SVNProperty.KEEP_LOCAL, SVNProperty.toString(true)); } if (attributes.size() > 0) { dir.modifyEntry(dir.getThisDirName(), attributes, true, false); attributes.clear(); } dir.saveEntries(false); }
public static void markTree(SVNAdminArea dir, String schedule, boolean copied, boolean keepLocal, int flags) throws SVNException { for (Iterator entries = dir.entries(false); entries.hasNext();) { SVNEntry entry = (SVNEntry) entries.next(); markEntry(dir, entry, schedule, copied, keepLocal, flags); } Map attributes = new SVNHashMap(); SVNEntry dirEntry = dir.getEntry(dir.getThisDirName(), false); if (!(dirEntry.isScheduledForAddition() && SVNProperty.SCHEDULE_DELETE.equals(schedule))) { if ((flags & SCHEDULE) != 0) { attributes.put(SVNProperty.SCHEDULE, schedule); } if ((flags & COPIED) != 0) { attributes.put(SVNProperty.COPIED, copied ? Boolean.TRUE.toString() : null); } } if ((flags & KEEP_LOCAL) != 0 && keepLocal) { attributes.put(SVNProperty.KEEP_LOCAL, SVNProperty.toString(true)); } if (attributes.size() > 0) { dir.modifyEntry(dir.getThisDirName(), attributes, true, false); attributes.clear(); } dir.saveEntries(false); }
entryAttrs.put(SVNProperty.KEEP_LOCAL, SVNProperty.toString(keepLocal));
entryAttrs.put(SVNProperty.KEEP_LOCAL, SVNProperty.toString(keepLocal));
public void writeChangeEntry(OutputStream changesFile, FSPathChange pathChange) throws SVNException, IOException { FSPathChangeKind changeKind = pathChange.getChangeKind(); if (!(changeKind == FSPathChangeKind.FS_PATH_CHANGE_ADD || changeKind == FSPathChangeKind.FS_PATH_CHANGE_DELETE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_MODIFY || changeKind == FSPathChangeKind.FS_PATH_CHANGE_REPLACE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_RESET)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change type"); SVNErrorManager.error(err); } String changeString = changeKind.toString(); String idString = null; if (pathChange.getRevNodeId() != null) { idString = pathChange.getRevNodeId().toString(); } else { idString = FSPathChangeKind.ACTION_RESET; } String output = idString + " " + changeString + " " + SVNProperty.toString(pathChange.isTextModified()) + " " + SVNProperty.toString(pathChange.arePropertiesModified()) + " " + pathChange.getPath() + "\n"; changesFile.write(output.getBytes("UTF-8")); String copyfromPath = pathChange.getCopyPath(); long copyfromRevision = pathChange.getCopyRevision(); if (copyfromPath != null && copyfromRevision != FSRepository.SVN_INVALID_REVNUM) { String copyfromLine = copyfromRevision + " " + copyfromPath; changesFile.write(copyfromLine.getBytes("UTF-8")); } changesFile.write("\n".getBytes("UTF-8")); }
public void writeChangeEntry(OutputStream changesFile, FSPathChange pathChange, boolean includeNodeKind) throws SVNException, IOException { FSPathChangeKind changeKind = pathChange.getChangeKind(); if (!(changeKind == FSPathChangeKind.FS_PATH_CHANGE_ADD || changeKind == FSPathChangeKind.FS_PATH_CHANGE_DELETE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_MODIFY || changeKind == FSPathChangeKind.FS_PATH_CHANGE_REPLACE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_RESET)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change type"); SVNErrorManager.error(err, SVNLogType.FSFS); } String changeString = changeKind.toString(); if (includeNodeKind) { changeString += "-" + pathChange.getKind().toString(); } String idString = null; if (pathChange.getRevNodeId() != null) { idString = pathChange.getRevNodeId().toString(); } else { idString = FSPathChangeKind.ACTION_RESET; } String output = idString + " " + changeString + " " + SVNProperty.toString(pathChange.isTextModified()) + " " + SVNProperty.toString(pathChange.arePropertiesModified()) + " " + pathChange.getPath() + "\n"; changesFile.write(output.getBytes("UTF-8")); String copyfromPath = pathChange.getCopyPath(); long copyfromRevision = pathChange.getCopyRevision(); if (copyfromPath != null && copyfromRevision != SVNRepository.INVALID_REVISION) { String copyfromLine = copyfromRevision + " " + copyfromPath; changesFile.write(copyfromLine.getBytes("UTF-8")); } changesFile.write("\n".getBytes("UTF-8")); }
public void writeChangeEntry(OutputStream changesFile, FSPathChange pathChange, boolean includeNodeKind) throws SVNException, IOException { FSPathChangeKind changeKind = pathChange.getChangeKind(); if (!(changeKind == FSPathChangeKind.FS_PATH_CHANGE_ADD || changeKind == FSPathChangeKind.FS_PATH_CHANGE_DELETE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_MODIFY || changeKind == FSPathChangeKind.FS_PATH_CHANGE_REPLACE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_RESET)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change type"); SVNErrorManager.error(err, SVNLogType.FSFS); } String changeString = changeKind.toString(); if (includeNodeKind) { changeString += "-" + pathChange.getKind().toString(); } String idString = null; if (pathChange.getRevNodeId() != null) { idString = pathChange.getRevNodeId().toString(); } else { idString = FSPathChangeKind.ACTION_RESET; } final boolean includeMergeInfoModifications = getOwner().getDBFormat() >= FSFS.MIN_MERGEINFO_IN_CHANGED_FORMAT; String mergeInfoString = includeMergeInfoModifications ? SVNProperty.toString(pathChange.getMergeInfoModified() == Boolean.TRUE) + " " : ""; String output = idString + " " + changeString + " " + SVNProperty.toString(pathChange.isTextModified()) + " " + SVNProperty.toString(pathChange.arePropertiesModified()) + " " + mergeInfoString + pathChange.getPath() + "\n"; changesFile.write(output.getBytes("UTF-8")); String copyfromPath = pathChange.getCopyPath(); long copyfromRevision = pathChange.getCopyRevision(); if (copyfromPath != null && copyfromRevision != SVNRepository.INVALID_REVISION) { String copyfromLine = copyfromRevision + " " + copyfromPath; changesFile.write(copyfromLine.getBytes("UTF-8")); } changesFile.write("\n".getBytes("UTF-8")); }
public void writeChangeEntry(OutputStream changesFile, FSPathChange pathChange, boolean includeNodeKind) throws SVNException, IOException { FSPathChangeKind changeKind = pathChange.getChangeKind(); if (!(changeKind == FSPathChangeKind.FS_PATH_CHANGE_ADD || changeKind == FSPathChangeKind.FS_PATH_CHANGE_DELETE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_MODIFY || changeKind == FSPathChangeKind.FS_PATH_CHANGE_REPLACE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_RESET)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change type"); SVNErrorManager.error(err, SVNLogType.FSFS); } String changeString = changeKind.toString(); if (includeNodeKind) { changeString += "-" + pathChange.getKind().toString(); } String idString = null; if (pathChange.getRevNodeId() != null) { idString = pathChange.getRevNodeId().toString(); } else { idString = FSPathChangeKind.ACTION_RESET; } String output = idString + " " + changeString + " " + SVNProperty.toString(pathChange.isTextModified()) + " " + SVNProperty.toString(pathChange.arePropertiesModified()) + " " + pathChange.getPath() + "\n"; changesFile.write(output.getBytes("UTF-8")); String copyfromPath = pathChange.getCopyPath(); long copyfromRevision = pathChange.getCopyRevision(); if (copyfromPath != null && copyfromRevision != SVNRepository.INVALID_REVISION) { String copyfromLine = copyfromRevision + " " + copyfromPath; changesFile.write(copyfromLine.getBytes("UTF-8")); } changesFile.write("\n".getBytes("UTF-8")); }
attributes.put(SVNProperty.KEEP_LOCAL, SVNProperty.toString(true));
attributes.put(SVNProperty.KEEP_LOCAL, SVNProperty.toString(true));
attributes.put(SVNProperty.KEEP_LOCAL, SVNProperty.toString(true));
/** * @param revision * @param revisionProperties * @param editor * @throws SVNException */ public void handleEndRevision(long revision, SVNProperties revisionProperties, ISVNEditor editor) throws SVNException { editor.closeEdit(); if (mySyncEditor.getCommitInfo().getNewRevision() != revision) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Commit created rev {0} but should have created {1}", new Object[] { String.valueOf(mySyncEditor.getCommitInfo().getNewRevision()), String.valueOf(revision) }); SVNErrorManager.error(err, SVNLogType.FSFS); } SVNProperties existingProperties = myTargetRepository.getRevisionProperties(revision, null); SVNProperties filtered = new SVNProperties(); filterProperties(revisionProperties, filtered, false); SVNProperties normalizedProps = SVNAdminClient.normalizeRevisionProperties(filtered); myNormalizedRevPropsCount += normalizedProps.size(); int filteredCount = SVNAdminHelper.writeRevisionProperties(myTargetRepository, revision, filtered); SVNAdminHelper.removePropertiesNotInSource(myTargetRepository, revision, revisionProperties, existingProperties); myTargetRepository.setRevisionPropertyValue(0, SVNRevisionProperty.LAST_MERGED_REVISION, SVNPropertyValue.create(SVNProperty.toString(revision))); myTargetRepository.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, null); myAdminClient.handlePropertesCopied(filteredCount > 0, revision); }
/** * @param revision * @param revisionProperties * @param editor * @throws SVNException */ public void handleEndRevision(long revision, SVNProperties revisionProperties, ISVNEditor editor) throws SVNException { editor.closeEdit(); if (mySyncEditor.getCommitInfo().getNewRevision() != revision) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Commit created rev {0} but should have created {1}", new Object[] { String.valueOf(mySyncEditor.getCommitInfo().getNewRevision()), String.valueOf(revision) }); SVNErrorManager.error(err, SVNLogType.FSFS); } SVNProperties existingProperties = myTargetRepository.getRevisionProperties(revision, null); SVNProperties filtered = new SVNProperties(); filterProperties(revisionProperties, filtered, false); SVNProperties normalizedProps = SVNAdminClient.normalizeRevisionProperties(filtered); myNormalizedRevPropsCount += normalizedProps.size(); int filteredCount = SVNAdminHelper.writeRevisionProperties(myTargetRepository, revision, filtered); SVNAdminHelper.removePropertiesNotInSource(myTargetRepository, revision, revisionProperties, existingProperties); myTargetRepository.setRevisionPropertyValue(0, SVNRevisionProperty.LAST_MERGED_REVISION, SVNPropertyValue.create(SVNProperty.toString(revision))); myTargetRepository.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, null); myAdminClient.handlePropertesCopied(filteredCount > 0, revision); }
/** * @param revision * @param revisionProperties * @param editor * @throws SVNException */ public void handleEndRevision(long revision, SVNProperties revisionProperties, ISVNEditor editor) throws SVNException { editor.closeEdit(); if (mySyncEditor.getCommitInfo().getNewRevision() != revision) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Commit created rev {0} but should have created {1}", new Object[] { String.valueOf(mySyncEditor.getCommitInfo().getNewRevision()), String.valueOf(revision) }); SVNErrorManager.error(err, SVNLogType.FSFS); } SVNProperties existingProperties = myTargetRepository.getRevisionProperties(revision, null); SVNProperties filtered = new SVNProperties(); filterProperties(revisionProperties, filtered, false); SVNProperties normalizedProps = SVNAdminClient.normalizeRevisionProperties(filtered); myNormalizedRevPropsCount += normalizedProps.size(); int filteredCount = SVNAdminHelper.writeRevisionProperties(myTargetRepository, revision, filtered); SVNAdminHelper.removePropertiesNotInSource(myTargetRepository, revision, revisionProperties, existingProperties); myTargetRepository.setRevisionPropertyValue(0, SVNRevisionProperty.LAST_MERGED_REVISION, SVNPropertyValue.create(SVNProperty.toString(revision))); myTargetRepository.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, null); myAdminClient.handlePropertesCopied(filteredCount > 0, revision); }
/** * @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; }
/** * @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; }
/** * @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; }