public boolean isApplicable(SvnList operation, SvnWcGeneration wcGeneration) throws SVNException { if (wcGeneration == SvnWcGeneration.V16 && operation.getFirstTarget().isFile()) { return false; } return true; }
/** * Analyzes the targets and returns whether or not operation has at least one file in targets. * * @return <code>true</code> if operation has at least one file in targets, otherwise <code>false</code> */ public boolean hasFileTargets() { for (SvnTarget target : getTargets()) { if (target.isFile()) { return true; } } return false; }
private String getDisplayPath(SvnTarget path) { if (path.isFile()) { final String absolutePath = path.getFile().getAbsolutePath().replace(File.separatorChar, '/'); final String currentPath = new File("").getAbsolutePath().replace(File.separatorChar, '/'); String relativePath = getRelativePath(absolutePath, currentPath); if (relativePath != null) { return relativePath; } else { return absolutePath; } } return path.getPathOrUrlString(); }
@Override public boolean isApplicable(SvnDiff operation, SvnWcGeneration wcGeneration) throws SVNException { if (operation.getSource() != null) { if (operation.getSource().isFile() && wcGeneration != SvnWcGeneration.V17) { return false; } return true; } else { if (operation.getFirstSource().isFile() && wcGeneration != SvnWcGeneration.V17) { return false; } if (operation.getSecondSource().isFile() && wcGeneration != SvnWcGeneration.V17) { return false; } return true; } }
@Override public boolean isApplicable(SvnDiffSummarize operation, SvnWcGeneration wcGeneration) throws SVNException { if (operation.getSource() != null) { if (operation.getSource().isFile() && wcGeneration != SvnWcGeneration.V17) { return false; } return true; } else { if (operation.getFirstSource().isFile() && wcGeneration != SvnWcGeneration.V17) { return false; } if (operation.getSecondSource().isFile() && wcGeneration != SvnWcGeneration.V17) { return false; } return true; } }
@Override public boolean isApplicable(SvnDiff operation, SvnWcGeneration wcGeneration) throws SVNException { if (wcGeneration != SvnWcGeneration.V16) { return false; } if (operation.getSource() != null) { if (operation.getSource().isFile()) { return true; } } else { if (operation.getFirstSource().isFile()) { return true; } if (operation.getSecondSource().isFile()) { return true; } } return false; }
/** * Determines whether target is located in the local working copy and its peg revision is working copy specific. * @return <code>true</code> if the target and its peg revision refers to local working copy, otherwise <code>false</code> */ public boolean isLocal() { return isFile() && getResolvedPegRevision().isLocal(); }
public void setBaseTarget(SvnTarget baseTarget) { if (baseTarget.isFile()) { generator.setBasePath(baseTarget.getFile()); } }
/** * Determines whether target is remote or local, and returns corresponding <code>String</code> representation of the target's path * @return <code>String</code> representation of the target's path * @throws {@link IllegalStateException} if neither file not URL was specified as a target */ public String getPathOrUrlString() { if (isFile()) { return getFile().getPath(); } else if (isURL()) { return getURL().toString(); } throw new IllegalStateException("A target can be either an URL or a path"); }
/** * Determines whether target is remote or local, and returns corresponding <code>String</code> representation of the target's path * @return <code>String</code> representation of the target * @throws {@link IllegalStateException} if neither file not URL was specified as a target's path */ public String getPathOrUrlDecodedString() { if (isFile()) { return getFile().getPath(); } else if (isURL()) { return getURL().toString(); } throw new IllegalStateException("A target can be either an URL or a path"); }
private String getRelativeToRootPath(SvnTarget target, SvnTarget originalTarget) { String relativePath; if (repositoryRoot == null) { relativePath = null; } else { if (repositoryRoot.isFile() == target.isFile()) { String targetString = target.getPathOrUrlDecodedString(); String baseTargetString = repositoryRoot.getPathOrUrlDecodedString(); relativePath = getRelativePath(targetString, baseTargetString); } else { String targetString = target.getPathOrUrlDecodedString(); String baseTargetString = new File("").getAbsolutePath(); relativePath = getRelativePath(targetString, baseTargetString); } } return relativePath != null ? relativePath : target.getPathOrUrlString(); }
private boolean areAllSourcesLocal(SvnRemoteCopy operation) { // need all sources to be wc files at WORKING. // BASE revision meas repos_to_repos copy for(SvnCopySource source : operation.getSources()) { if (source.getSource().isFile() && (source.getRevision() == SVNRevision.WORKING || source.getRevision() == SVNRevision.UNDEFINED)) { continue; } return false; } return true; }
@Override protected File getOperationalWorkingCopy() { if (getSource() != null && getSource().isFile()) { return getSource().getFile(); } else if (getFirstSource() != null && getFirstSource().isFile()) { return getFirstSource().getFile(); } else if (getSecondSource() != null && getSecondSource().isFile()) { return getSecondSource().getFile(); } return null; }
@Override protected File getOperationalWorkingCopy() { if (getSource() != null && getSource().isFile()) { return getSource().getFile(); } else { if (getFirstSource() != null && getFirstSource().isFile()) { return getFirstSource().getFile(); } if (getSecondSource() != null && getSecondSource().isFile()) { return getSecondSource().getFile(); } } return null; }
@Override public boolean isApplicable(SvnLogMergeInfo operation, SvnWcGeneration wcGeneration) throws SVNException { if (operation.getSource().isFile()) { if (SvnOperationFactory.detectWcGeneration(operation.getSource().getFile(), true) != SvnWcGeneration.V16) { return false; } } if (operation.getFirstTarget().isFile()) { if (SvnOperationFactory.detectWcGeneration(operation.getFirstTarget().getFile(), true) != SvnWcGeneration.V16) { return false; } } return true; }
/** * Determines whether target is remote or local, and returns corresponding <code>String</code> * representation of the target's path and peg revision. * * @return <code>String</code> of the target's path and peg revision */ public String toString() { if (isFile()) { return getFile().getAbsolutePath() + '@' + getPegRevision(); } else if (isURL()) { return getURL().toString() + '@' + getPegRevision(); } return "INVALID TARGET"; } }
@Override protected SVNProperties run(SVNWCContext context) throws SVNException { for (SvnTarget target : getOperation().getTargets()) { if (target.isFile()) { run(context, target.getFile()); } } return getOperation().first(); }
private boolean areAllSourcesLocal(SvnCopy operation) { for(SvnCopySource source : operation.getSources()) { if (source.getSource().isFile()) { if (operation.isMove()) { continue; } if (isLocalRevision(source.getRevision()) && isLocalRevision(source.getSource().getResolvedPegRevision())) { continue; } } return false; } return true; }
private boolean areAllSourcesRemote(SvnCopy operation) { for(SvnCopySource source : operation.getSources()) { if (source.getSource().isFile()) { if (operation.isMove()) { return false; } if (isLocalRevision(source.getRevision()) && isLocalRevision(source.getSource().getResolvedPegRevision())) { return false; } } } return true; }
@Override public Void run() throws SVNException { for (SvnTarget target : getTargets()) { if (!target.isFile()) { continue; } final File wc = getFirstTarget().getFile(); final File wcDb = new File(wc, SVNFileUtil.getAdminDirectoryName() + "/wc.db"); if (SVNFileType.getType(wcDb) != SVNFileType.FILE) { continue; } final SVNSqlJetDb db = SVNSqlJetDb.open(wcDb, Mode.ReadWrite); db.beginTransaction(SqlJetTransactionMode.WRITE); try { SvnNgUpgradeSDb.setVersion(db, getVersion()); } finally { db.commit(); } } return null; }