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); } }
private SVNPath getParentPath(SVNPath target) { return new SVNPath(SVNPathUtil.removeTail(target.getTarget()), target.getPegRevision()); }
private SVNPath getParentPath(SVNPath target) { return new SVNPath(SVNPathUtil.removeTail(target.getTarget()), target.getPegRevision()); }
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(); }
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(); }
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 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 void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (targets.size() < 2) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS); SVNErrorManager.error(err, SVNLogType.CLIENT); } if (targets.size() > 2) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNPath toURL = new SVNPath((String) targets.get(0)); if (!toURL.isURL()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR, "Path ''{0}'' is not a URL", toURL.getTarget()); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNPath fromURL = new SVNPath((String) targets.get(1)); if (!fromURL.isURL()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR, "Path ''{0}'' is not a URL", fromURL.getTarget()); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNAdminClient client = getEnvironment().getClientManager().getAdminClient(); client.setEventHandler(this); client.doInitialize(fromURL.getURL(), toURL.getURL()); }
public void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (targets.size() < 2) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS); SVNErrorManager.error(err, SVNLogType.CLIENT); } if (targets.size() > 2) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNPath toURL = new SVNPath((String) targets.get(0)); if (!toURL.isURL()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR, "Path ''{0}'' is not a URL", toURL.getTarget()); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNPath fromURL = new SVNPath((String) targets.get(1)); if (!fromURL.isURL()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR, "Path ''{0}'' is not a URL", fromURL.getTarget()); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNAdminClient client = getEnvironment().getClientManager().getAdminClient(); client.setEventHandler(this); client.doInitialize(fromURL.getURL(), toURL.getURL()); }
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()); } } } }
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()); } } } }
public void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (targets.size() < 1) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS); SVNErrorManager.error(err, SVNLogType.CLIENT); } if (targets.size() > 1) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNPath toURL = new SVNPath((String) targets.get(0)); if (!toURL.isURL()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR, "Path ''{0}'' is not a URL", toURL.getTarget()); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNAdminClient client = getEnvironment().getClientManager().getAdminClient(); client.setEventHandler(this); client.setReplayHandler(new ISVNLogEntryHandler() { public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { getEnvironment().getOut().println("Committed revision " + logEntry.getRevision() + "."); } }); client.doSynchronize(toURL.getURL()); }
public void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (targets.size() < 1) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS); SVNErrorManager.error(err, SVNLogType.CLIENT); } if (targets.size() > 1) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNPath toURL = new SVNPath((String) targets.get(0)); if (!toURL.isURL()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR, "Path ''{0}'' is not a URL", toURL.getTarget()); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNAdminClient client = getEnvironment().getClientManager().getAdminClient(); client.setEventHandler(this); client.setReplayHandler(new ISVNLogEntryHandler() { public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { getEnvironment().getOut().println("Committed revision " + logEntry.getRevision() + "."); } }); client.doSynchronize(toURL.getURL()); }
public void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (targets.size() < 1) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS); SVNErrorManager.error(err, SVNLogType.CLIENT); } if (targets.size() > 1) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNPath toURL = new SVNPath((String) targets.get(0)); if (!toURL.isURL()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR, "Path ''{0}'' is not a URL", toURL.getTarget()); SVNErrorManager.error(err, SVNLogType.CLIENT); } SVNAdminClient client = getEnvironment().getClientManager().getAdminClient(); SVNSyncInfo info = client.doInfo(toURL.getURL()); getSVNSyncEnvironment().getOut().println("Source URL: " + info.getSrcURL()); if (info.getSourceRepositoryUUID() != null) { getSVNSyncEnvironment().getOut().println("Source Repository UUID: " + info.getSourceRepositoryUUID()); } if (SVNRevision.isValidRevisionNumber(info.getLastMergedRevision())) { getSVNSyncEnvironment().getOut().println("Last Merged Revision: " + info.getLastMergedRevision()); } }
public void run() throws SVNException { List targets = getSVNEnvironment().combineTargets(getSVNEnvironment().getTargets(), true); if (targets.isEmpty()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS), SVNLogType.CLIENT); } SVNWCClient client = getSVNEnvironment().getClientManager().getWCClient(); if (!getSVNEnvironment().isQuiet()) { client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); } SVNDepth depth = getSVNEnvironment().getDepth(); if (depth == SVNDepth.UNKNOWN) { depth = SVNDepth.EMPTY; } for (Iterator ts = targets.iterator(); ts.hasNext();) { String targetName = (String) ts.next(); SVNPath target = new SVNPath(targetName); if (target.isFile()) { try { client.doResolve(target.getFile(), depth, SVNConflictChoice.MERGED); } catch (SVNException e) { SVNErrorMessage err = e.getErrorMessage(); getSVNEnvironment().handleWarning(err, new SVNErrorCode[] {err.getErrorCode()}, getSVNEnvironment().isQuiet()); } } } }
public void run() throws SVNException { List targets = getSVNEnvironment().combineTargets(getSVNEnvironment().getTargets(), true); if (targets.isEmpty()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS), SVNLogType.CLIENT); } SVNWCClient client = getSVNEnvironment().getClientManager().getWCClient(); if (!getSVNEnvironment().isQuiet()) { client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); } SVNDepth depth = getSVNEnvironment().getDepth(); if (depth == SVNDepth.UNKNOWN) { depth = SVNDepth.EMPTY; } for (Iterator ts = targets.iterator(); ts.hasNext();) { String targetName = (String) ts.next(); SVNPath target = new SVNPath(targetName); if (target.isFile()) { try { client.doResolve(target.getFile(), depth, SVNConflictChoice.MERGED); } catch (SVNException e) { SVNErrorMessage err = e.getErrorMessage(); getSVNEnvironment().handleWarning(err, new SVNErrorCode[] {err.getErrorCode()}, getSVNEnvironment().isQuiet()); } } } }
SVNPath target = new SVNPath((String) targets.get(0)); if (!target.isFile()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
SVNPath target = new SVNPath((String) targets.get(0)); if (!target.isFile()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
private SVNURL checkRootURLOfTarget(SVNURL rootURL, String target) throws SVNException { SVNPath svnPath = new SVNPath(target, true); SVNWCClient client = getClientManager().getWCClient(); File path = svnPath.isFile() ? svnPath.getFile() : null; SVNURL url = svnPath.isURL() ? svnPath.getURL() : null; SVNURL tmpRootURL = null; try { tmpRootURL = client.getReposRoot(path, url, svnPath.getPegRevision()); } catch (SVNException svne) { SVNErrorMessage err = svne.getErrorMessage(); if (err.getErrorCode() == SVNErrorCode.ENTRY_NOT_FOUND || err.getErrorCode() == SVNErrorCode.WC_NOT_DIRECTORY) { return rootURL; } throw svne; } if (rootURL != null) { if (!rootURL.equals(tmpRootURL)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "All non-relative targets must have the same root URL"); SVNErrorManager.error(err, SVNLogType.CLIENT); } return rootURL; } return tmpRootURL; }
private SVNURL checkRootURLOfTarget(SVNURL rootURL, String target) throws SVNException { SVNPath svnPath = new SVNPath(target, true); SVNWCClient client = getClientManager().getWCClient(); File path = svnPath.isFile() ? svnPath.getFile() : null; SVNURL url = svnPath.isURL() ? svnPath.getURL() : null; SVNURL tmpRootURL = null; try { tmpRootURL = client.getReposRoot(path, url, svnPath.getPegRevision()); } catch (SVNException svne) { SVNErrorMessage err = svne.getErrorMessage(); if (err.getErrorCode() == SVNErrorCode.ENTRY_NOT_FOUND || err.getErrorCode() == SVNErrorCode.WC_NOT_DIRECTORY) { return rootURL; } throw svne; } if (rootURL != null) { if (!rootURL.equals(tmpRootURL)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "All non-relative targets must have the same root URL"); SVNErrorManager.error(err, SVNLogType.CLIENT); } return rootURL; } return tmpRootURL; }