public SVNCommitInfo closeEdit() throws SVNException { if (!myIsRootOpen) { localDirectoryDiff(createDirInfo(null, "", false, myDepth)); } return null; }
public void addFile(String path, String copyFromPath, long copyFromRevision) throws SVNException { String name = SVNPathUtil.tail(path); myCurrentFile = createFileInfo(myCurrentDirectory, path, true); myCurrentDirectory.myComparedEntries.add(name); }
private File getTempDirectory() throws SVNException { if (myTempDirectory == null) { myTempDirectory = getDiffCallback().createTempDirectory(); } return myTempDirectory; }
private void reportAddedFile(SVNDirectoryInfo info, String path, SVNEntry entry) throws SVNException { if (entry.isCopied()) { if (myIsCompareToBase) { return; } reportModifiedFile(info, entry); return; } SVNAdminArea dir = retrieve(info.myPath); String name = SVNPathUtil.tail(path); Map wcProps = null; if (myIsCompareToBase) { wcProps = dir.getBaseProperties(name).asMap(); } else { wcProps = dir.getProperties(name).asMap(); } String mimeType = (String) wcProps.get(SVNProperty.MIME_TYPE); Map propDiff = computePropsDiff(new HashMap(), wcProps); File sourceFile; if (myIsCompareToBase) { sourceFile = dir.getBaseFile(name, false); } else { sourceFile = detranslateFile(dir, name); } getDiffCallback().fileAdded(path, null, sourceFile, 0, entry.getRevision(), null, mimeType, null, propDiff); }
private void reportAddedDir(SVNDirectoryInfo info) throws SVNException { SVNAdminArea dir = retrieve(info.myPath); Map wcProps; if (myIsCompareToBase) { wcProps = dir.getBaseProperties(dir.getThisDirName()).asMap(); } else { wcProps = dir.getProperties(dir.getThisDirName()).asMap(); } Map propDiff = computePropsDiff(new HashMap(), wcProps); if (!propDiff.isEmpty()) { getDiffCallback().propertiesChanged(info.myPath, null, propDiff); } for(Iterator entries = dir.entries(false); entries.hasNext();) { SVNEntry entry = (SVNEntry) entries.next(); if (dir.getThisDirName().equals(entry.getName())) { continue; } if (!myIsCompareToBase && entry.isScheduledForDeletion()) { continue; } if (entry.isFile()) { reportAddedFile(info, SVNPathUtil.append(info.myPath, entry.getName()), entry); } else if (entry.isDirectory() && myIsRecursive) { SVNDirectoryInfo childInfo = createDirInfo(info, SVNPathUtil.append(info.myPath, entry.getName()), false); reportAddedDir(childInfo); } } }
return; SVNAdminArea dir = retrieve(info.myPath); boolean anchor = !"".equals(myAdminInfo.getTargetName()) && dir == myAdminInfo.getAnchor(); if (!anchor && !info.myComparedEntries.contains("")) { SVNVersionedProperties baseProps = dir.getBaseProperties(dir.getThisDirName()); Map propDiff = baseProps.compareTo(dir.getProperties(dir.getThisDirName())).asMap(); getDiffCallback().propertiesChanged(info.myPath, baseProps.asMap(), propDiff); if (getDiffCallback().isDiffUnversioned()) { processedFiles = new HashSet(); reportModifiedFile(info, entry); } else if (entry.isDirectory()) { if (anchor || myIsRecursive) { SVNDirectoryInfo childInfo = createDirInfo(info, SVNPathUtil.append(info.myPath, entry.getName()), false); localDirectoryDiff(childInfo); if (getDiffCallback().isDiffUnversioned()) { diffUnversioned(dir.getRoot(), dir, anchor, processedFiles);
originalProps = new HashMap(); } else { SVNAdminArea dir = retrieve(myCurrentDirectory.myPath); if (dir != null && myIsCompareToBase) { originalProps = dir.getBaseProperties(dir.getThisDirName()).asMap(); reposProps.put(diffName, diff.get(diffName)); diff = computePropsDiff(originalProps, reposProps); reversePropChanges(originalProps, diff); getDiffCallback().propertiesChanged(myCurrentDirectory.myPath, originalProps, diff); myCurrentDirectory.myComparedEntries.add(""); localDirectoryDiff(myCurrentDirectory);
getDiffCallback().fileAdded(commitPath, null, reposFile, 0, myTargetRevision, null, reposMimeType, null, myCurrentFile.myPropertyDiff); } else { getDiffCallback().fileDeleted(commitPath, reposFile, null, reposMimeType, null, reposProperties); localFile = dir.getBaseFile(fileName, false); } else { localFile = detranslateFile(dir, fileName); } else { originalProps = dir.getProperties(fileName).asMap(); myCurrentFile.myPropertyDiff = computePropsDiff(originalProps, reposProperties); String originalMimeType = (String) originalProps.get(SVNProperty.MIME_TYPE); if (myCurrentFile.myPropertyDiff != null && !myCurrentFile.myPropertyDiff.isEmpty() && !myIsReverseDiff) { reversePropChanges(originalProps, myCurrentFile.myPropertyDiff); getDiffCallback().fileChanged(commitPath, myIsReverseDiff ? localFile : reposFile, myIsReverseDiff ? reposFile : localFile,
public void deleteEntry(String path, long revision) throws SVNException { File fullPath = new File(myAdminInfo.getAnchor().getRoot(), path); SVNAdminArea dir = myWCAccess.probeRetrieve(fullPath); SVNEntry entry = myWCAccess.getEntry(fullPath, false); if (entry == null) { return; } String name = SVNPathUtil.tail(path); myCurrentDirectory.myComparedEntries.add(name); if (!myIsCompareToBase && entry.isScheduledForDeletion()) { return; } if (entry.isFile()) { if (myIsReverseDiff) { File baseFile = dir.getBaseFile(name, false); SVNProperties baseProps = dir.getBaseProperties(name).asMap(); getDiffCallback().fileDeleted(path, baseFile, null, null, null, baseProps, null); } else { reportAddedFile(myCurrentDirectory, path, entry); } } else if (entry.isDirectory()) { SVNDirectoryInfo info = createDirInfo(myCurrentDirectory, path, false, SVNDepth.INFINITY); reportAddedDir(info); } }
private void doDiffWCWC(File path1, SVNRevision revision1, File path2, SVNRevision revision2, SVNDepth depth, boolean useAncestry, OutputStream result, Collection changeLists) throws SVNException { if (!path1.equals(path2) || !(revision1 == SVNRevision.BASE && revision2 == SVNRevision.WORKING)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Only diffs between a path's text-base and its working files are supported at this time (-rBASE:WORKING)"); SVNErrorManager.error(err, SVNLogType.WC); } SVNWCAccess wcAccess = createWCAccess(); try { int admDepth = getAdminDepth(depth); SVNAdminAreaInfo info = wcAccess.openAnchor(path1, false, admDepth); wcAccess.getVersionedEntry(path1, false); long rev = getRevisionNumber(revision1, null, path1); AbstractDiffCallback callback = new SVNDiffCallback(info.getAnchor(), getDiffGenerator(), rev, -1, result); SVNDiffEditor editor = new SVNDiffEditor(wcAccess, info, callback, useAncestry, false, false, depth, changeLists); try { editor.closeEdit(); } finally { editor.cleanup(); } } finally { wcAccess.close(); } }
long revNumber = getRevisionNumber(revision1, repository, null); AbstractDiffCallback callback = new SVNDiffCallback(info.getAnchor(), getDiffGenerator(), reverse ? -1 : revNumber, reverse ? revNumber : -1, result); SVNDiffEditor editor = new SVNDiffEditor(wcAccess, info, callback, useAncestry, reverse, revision2 == SVNRevision.BASE || revision2 == SVNRevision.COMMITTED, depth, changeLists); boolean serverSupportsDepth = repository.hasCapability(SVNCapability.DEPTH); SVNReporter reporter = new SVNReporter(info, info.getAnchor().getFile(info.getTargetName()), false, !serverSupportsDepth, depth, false, false, true, getDebugLog()); repository.diff(url1, revNumber, pegRevisionNumber, target, !useAncestry, depth, true, reporter, SVNCancellableEditor.newInstance(editor, this, getDebugLog())); } finally { editor.cleanup();
public void applyTextDelta(String path, String baseChecksum) throws SVNException { SVNEntry entry = myWCAccess.getEntry(myAdminInfo.getAnchor().getFile(path), false); if (entry != null && entry.isCopied()) { myCurrentFile.myIsAdded = false; } if (!myCurrentFile.myIsAdded) { SVNAdminArea dir = retrieve(myCurrentDirectory.myPath); String fileName = SVNPathUtil.tail(myCurrentFile.myPath); myCurrentFile.myBaseFile = dir.getBaseFile(fileName, false); } myCurrentFile.myFile = createTempFile(); myDeltaProcessor.applyTextDelta(myCurrentFile.myBaseFile, myCurrentFile.myFile, false); }
diffUnversioned(file, null, SVNPathUtil.append(parentRelativePath, file.getName()), false, null); } else if (fileType == SVNFileType.FILE || fileType == SVNFileType.SYMLINK) { String mimeType1 = null; String mimeType2 = SVNFileUtil.detectMimeType(file, null); String filePath = SVNPathUtil.append(parentRelativePath, file.getName()); getDiffCallback().fileAdded(filePath, null, file, 0, 0, mimeType1, mimeType2, null, null, null);
public void openDir(String path, long revision) throws SVNException { SVNDepth subDirDepth = myCurrentDirectory.myDepth; if (subDirDepth == SVNDepth.IMMEDIATES) { subDirDepth = SVNDepth.EMPTY; } myCurrentDirectory = createDirInfo(myCurrentDirectory, path, false, subDirDepth); }
private File detranslateFile(SVNAdminArea dir, String name) throws SVNException { SVNVersionedProperties properties = dir.getProperties(name); String keywords = properties.getPropertyValue(SVNProperty.KEYWORDS); String eolStyle = properties.getPropertyValue(SVNProperty.EOL_STYLE); boolean special = properties.getPropertyValue(SVNProperty.SPECIAL) != null; if (keywords == null && eolStyle == null && (!special || SVNFileUtil.isWindows)) { return dir.getFile(name); } byte[] eol = SVNTranslator.getEOL(eolStyle); File tmpFile = createTempFile(); Map keywordsMap = SVNTranslator.computeKeywords(keywords, null, null, null, null); SVNTranslator.translate(dir.getFile(name), tmpFile, eol, keywordsMap, special, false); return tmpFile; }
return; reportModifiedFile(info, entry); return; SVNAdminArea dir = retrieve(info.myPath); String name = SVNPathUtil.tail(path); SVNProperties wcProps = null; SVNProperties propDiff = computePropsDiff(new SVNProperties(), wcProps); sourceFile = dir.getBaseFile(name, false); } else { sourceFile = detranslateFile(dir, name); getDiffCallback().fileAdded(path, null, sourceFile, 0, entry.getRevision(), null, mimeType, null, propDiff, null);
private void reportAddedDir(SVNDirectoryInfo info) throws SVNException { SVNAdminArea dir = retrieve(info.myPath); SVNEntry thisDirEntry = dir.getEntry(dir.getThisDirName(), false); if (SVNWCAccess.matchesChangeList(myChangeLists, thisDirEntry)) { wcProps = dir.getProperties(dir.getThisDirName()).asMap(); SVNProperties propDiff = computePropsDiff(new SVNProperties(), wcProps); if (!propDiff.isEmpty()) { getDiffCallback().propertiesChanged(info.myPath, null, propDiff, null); reportAddedFile(info, SVNPathUtil.append(info.myPath, entry.getName()), entry); } else if (entry.isDirectory()) { if (info.myDepth.compareTo(SVNDepth.FILES) > 0 || depthBelowHere = SVNDepth.EMPTY; SVNDirectoryInfo childInfo = createDirInfo(info, SVNPathUtil.append(info.myPath, entry.getName()), false, depthBelowHere); reportAddedDir(childInfo);
return; SVNAdminArea dir = retrieve(info.myPath); boolean anchor = !"".equals(myAdminInfo.getTargetName()) && dir == myAdminInfo.getAnchor(); SVNEntry thisDirEntry = dir.getEntry(dir.getThisDirName(), false); SVNVersionedProperties baseProps = dir.getBaseProperties(dir.getThisDirName()); SVNProperties propDiff = baseProps.compareTo(dir.getProperties(dir.getThisDirName())).asMap(); getDiffCallback().propertiesChanged(info.myPath, baseProps.asMap(), propDiff, null); if (getDiffCallback().isDiffUnversioned()) { processedFiles = new SVNHashSet(); reportModifiedFile(info, entry); } else if (entry.isDirectory()) { if (anchor || info.myDepth.compareTo(SVNDepth.FILES) > 0 || depthBelowHere = SVNDepth.EMPTY; SVNDirectoryInfo childInfo = createDirInfo(info, SVNPathUtil.append(info.myPath, entry.getName()), false, depthBelowHere); localDirectoryDiff(childInfo); if (getDiffCallback().isDiffUnversioned()) { String relativePath = dir.getRelativePath(myAdminInfo.getAnchor()); diffUnversioned(dir.getRoot(), dir, relativePath, anchor, processedFiles);
originalProps = new SVNProperties(); } else { SVNAdminArea dir = retrieve(myCurrentDirectory.myPath); if (dir != null && myIsCompareToBase) { originalProps = dir.getBaseProperties(dir.getThisDirName()).asMap(); originalProps = dir.getProperties(dir.getThisDirName()).asMap(); SVNProperties baseProps = dir.getBaseProperties(dir.getThisDirName()).asMap(); SVNProperties reposProps = applyPropChanges(baseProps, myCurrentDirectory.myPropertyDiff); diff = computePropsDiff(originalProps, reposProps); reversePropChanges(originalProps, diff); getDiffCallback().propertiesChanged(myCurrentDirectory.myPath, originalProps, diff, null); myCurrentDirectory.myComparedEntries.add(""); localDirectoryDiff(myCurrentDirectory);
baseProperties = dir != null ? dir.getBaseProperties(fileName).asMap() : new SVNProperties(); SVNProperties reposProperties = applyPropChanges(baseProperties, myCurrentFile.myPropertyDiff); String reposMimeType = reposProperties.getStringValue(SVNProperty.MIME_TYPE); File reposFile = myCurrentFile.myFile; getDiffCallback().fileAdded(commitPath, null, reposFile, 0, myTargetRevision, null, reposMimeType, null, myCurrentFile.myPropertyDiff, null); } else { getDiffCallback().fileDeleted(commitPath, reposFile, null, reposMimeType, null, reposProperties, null); localFile = dir.getBaseFile(fileName, false); } else { localFile = detranslateFile(dir, fileName); } else { originalProps = dir.getProperties(fileName).asMap(); myCurrentFile.myPropertyDiff = computePropsDiff(originalProps, reposProperties); String originalMimeType = originalProps.getStringValue(SVNProperty.MIME_TYPE); if (myCurrentFile.myPropertyDiff != null && !myCurrentFile.myPropertyDiff.isEmpty() && !myIsReverseDiff) { reversePropChanges(originalProps, myCurrentFile.myPropertyDiff); getDiffCallback().fileChanged(commitPath, myIsReverseDiff ? localFile : reposFile, myIsReverseDiff ? reposFile : localFile,