protected File getLocalRepository(int index) throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (targets.isEmpty()) { targets.add(""); } if (targets.isEmpty() || index > targets.size() - 1 ) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR, "Repository argument required"), SVNLogType.CLIENT); } SVNPath target = new SVNPath((String) targets.get(index)); if (target.isURL()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR, "'" + target.getTarget() + "' is an URL when it should be a path"), SVNLogType.CLIENT); } return target.getFile(); }
private SVNPath getParentPath(SVNPath target) { return new SVNPath(SVNPathUtil.removeTail(target.getTarget()), target.getPegRevision()); }
public void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (targets.isEmpty()) { targets.add(""); } SVNPath target = new SVNPath((String) targets.get(0)); if (target.isURL()) { target = new SVNPath(""); targets.add(0, ""); } String trailURL = (String) (targets.size() > 1 ? targets.get(1) : null); if (target.isFile()) { String id = SVNClientManager.newInstance().getWCClient().doGetWorkingCopyID(target.getFile(), trailURL, getSVNVersionEnvironment().isCommitted()); if (id != null) { getEnvironment().getOut().print(id); if (!getSVNVersionEnvironment().isNoNewLine()) { getEnvironment().getOut().println(); } } } }
public SVNPath(String target, boolean hasPegRevision) throws SVNException { myTarget = target; myHasPegRevision = hasPegRevision; if (myHasPegRevision) { parsePegRevision(true); } else { parsePegRevision(false); } myTarget = SVNPathUtil.canonicalizePath(myTarget); assertControlChars(isURL() ? SVNEncodingUtil.uriDecode(myTarget) : myTarget); }
public void run() throws SVNException { List targets = getSVNEnvironment().combineTargets(getSVNEnvironment().getTargets(), true); if (targets.isEmpty()) { targets.add(""); } SvnOperationFactory factory = new SvnOperationFactory(); if (!getSVNEnvironment().isQuiet()) { factory.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); } SvnUpgrade upgrade = factory.createUpgrade(); for (Iterator ts = targets.iterator(); ts.hasNext();) { String targetName = (String) ts.next(); SVNPath target = new SVNPath(targetName); if (target.isFile()) { getSVNEnvironment().checkCancelled(); upgrade.setSingleTarget(SvnTarget.fromFile(target.getFile())); try { upgrade.run(); } catch (SVNException e) { getSVNEnvironment().handleWarning(e.getErrorMessage(), new SVNErrorCode[] {SVNErrorCode.WC_NOT_DIRECTORY}, getSVNEnvironment().isQuiet()); } } } }
SVNPath target = new SVNPath((String) targets.get(i)); if (target.isFile()) { if ("".equals(target.getTarget())) { if (isScheduledForAddition(target.getFile())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_INVALID_OP_ON_CWD, "Cannot revert addition of current directory; please try again from the parent directory"); pathsList.add(target.getFile());
private void doDiff(SVNDiffClient client, SVNLogEntry logEntry, SVNPath target, SVNDepth depth) throws SVNException { if (target.isFile()) { client.doDiff(target.getFile(), target.getPegRevision(), SVNRevision.create(logEntry.getRevision() - 1), SVNRevision.create(logEntry.getRevision()), depth, true, getSVNEnvironment().getOut(), getSVNEnvironment().getChangelistsCollection()); } else { client.doDiff(target.getURL(), target.getPegRevision(), SVNRevision.create(logEntry.getRevision() - 1), SVNRevision.create(logEntry.getRevision()), depth, true, getSVNEnvironment().getOut()); } }
wcClient.doSetRevisionProperty(url, getSVNEnvironment().getStartRevision(), propertyName, null, getSVNEnvironment().isForce(), this); } else { File targetFile = new SVNPath(target).getFile(); wcClient.doSetRevisionProperty(targetFile, getSVNEnvironment().getStartRevision(), propertyName, null, getSVNEnvironment().isForce(), this); for (Iterator ts = targets.iterator(); ts.hasNext();) { String targetName = (String) ts.next(); SVNPath target = new SVNPath(targetName); if (target.isFile()) { boolean success = true; try { if (target.isFile()){ client.doSetProperty(target.getFile(), propertyName, null, getSVNEnvironment().isForce(), depth, this, changeLists); } else { client.setCommitHandler(getSVNEnvironment()); client.doSetProperty(target.getURL(), propertyName, null, SVNRevision.HEAD, getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().isForce(), this);
for (Iterator ts = targets.iterator(); ts.hasNext();) { String targetName = (String) ts.next(); SVNPath target = new SVNPath(targetName); if (target.isURL()) { continue; client.doAdd(new File[]{target.getFile()}, getSVNEnvironment().isForce(), false, getSVNEnvironment().isParents(), depth, false, getSVNEnvironment().isNoIgnore(), getSVNEnvironment().isParents(), !getSVNEnvironment().isNoAutoProps());
public boolean isVersioned(String target) throws SVNException { SVNPath commandTarget = new SVNPath(target); if (SVNBasicClient.isWC17Supported()) { SVNWCContext context = null; try { context = new SVNWCContext(getOptions(), null); File file = commandTarget.getFile(); if (file != null) { SVNNodeKind kind = context.readKind(file.getAbsoluteFile(), false); try { wcAccess = SVNWCAccess.newInstance(null); wcAccess.probeOpen(commandTarget.getFile(), false, 0); SVNEntry entry = wcAccess.getVersionedEntry(commandTarget.getFile(), false); return entry != null; } catch (SVNException e) {
public boolean isFile() { return !isURL(); }
protected void copy(SVNCopySource copySource, File dst, boolean save) throws SVNException { if (copySource == null || dst == null) { return; } SVNEntry entry = myWCAccess.getEntry(dst, false); if (entry != null) { doVirtualCopy(entry, copySource, save); } else { getCopyDriver().setupCopy(new SVNCopySource[]{copySource}, new SVNPath(dst.getAbsolutePath()), false, true, null, null, null, null, null); } }
public File getFile() { if (myFile != null) { return myFile; } if (isFile()) { return new File(myTarget).getAbsoluteFile(); } return null; }
public void run() throws SVNException { List targets = getSVNEnvironment().combineTargets(getSVNEnvironment().getTargets(), true); if (targets.isEmpty()) { targets.add(""); } SvnOperationFactory factory = new SvnOperationFactory(); if (!getSVNEnvironment().isQuiet()) { factory.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); } SvnUpgrade upgrade = factory.createUpgrade(); for (Iterator ts = targets.iterator(); ts.hasNext();) { String targetName = (String) ts.next(); SVNPath target = new SVNPath(targetName); if (target.isFile()) { getSVNEnvironment().checkCancelled(); upgrade.setSingleTarget(SvnTarget.fromFile(target.getFile())); try { upgrade.run(); } catch (SVNException e) { getSVNEnvironment().handleWarning(e.getErrorMessage(), new SVNErrorCode[] {SVNErrorCode.WC_NOT_DIRECTORY}, getSVNEnvironment().isQuiet()); } } } }
SVNPath target = new SVNPath((String) targets.get(i)); if (target.isFile()) { if ("".equals(target.getTarget())) { if (isScheduledForAddition(target.getFile())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_INVALID_OP_ON_CWD, "Cannot revert addition of current directory; please try again from the parent directory"); pathsList.add(target.getFile());
private void doDiff(SVNDiffClient client, SVNLogEntry logEntry, SVNPath target, SVNDepth depth) throws SVNException { if (target.isFile()) { client.doDiff(target.getFile(), target.getPegRevision(), SVNRevision.create(logEntry.getRevision() - 1), SVNRevision.create(logEntry.getRevision()), depth, true, getSVNEnvironment().getOut(), getSVNEnvironment().getChangelistsCollection()); } else { client.doDiff(target.getURL(), target.getPegRevision(), SVNRevision.create(logEntry.getRevision() - 1), SVNRevision.create(logEntry.getRevision()), depth, true, getSVNEnvironment().getOut()); } }
wcClient.doSetRevisionProperty(url, getSVNEnvironment().getStartRevision(), propertyName, null, getSVNEnvironment().isForce(), this); } else { File targetFile = new SVNPath(target).getFile(); wcClient.doSetRevisionProperty(targetFile, getSVNEnvironment().getStartRevision(), propertyName, null, getSVNEnvironment().isForce(), this); for (Iterator ts = targets.iterator(); ts.hasNext();) { String targetName = (String) ts.next(); SVNPath target = new SVNPath(targetName); if (target.isFile()) { boolean success = true; try { if (target.isFile()){ client.doSetProperty(target.getFile(), propertyName, null, getSVNEnvironment().isForce(), depth, this, changeLists); } else { client.setCommitHandler(getSVNEnvironment()); client.doSetProperty(target.getURL(), propertyName, null, SVNRevision.HEAD, getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().isForce(), this);
public SVNPath(String target, boolean keepPegRevision, boolean parsePegRevision) throws SVNException { myTarget = target; if (parsePegRevision) { parsePegRevision(keepPegRevision); } myTarget = SVNPathUtil.canonicalizePath(myTarget); assertControlChars(isURL() ? SVNEncodingUtil.uriDecode(myTarget) : myTarget); }
for (Iterator ts = targets.iterator(); ts.hasNext();) { String targetName = (String) ts.next(); SVNPath target = new SVNPath(targetName); if (target.isURL()) { continue; client.doAdd(new File[]{target.getFile()}, getSVNEnvironment().isForce(), false, getSVNEnvironment().isParents(), depth, false, getSVNEnvironment().isNoIgnore(), getSVNEnvironment().isParents(), !getSVNEnvironment().isNoAutoProps());