/** * Get repository URL for SVN. */ private static String getSVNUrl(File wc) throws Exception { final SvnOperationFactory of = new SvnOperationFactory(); final SvnGetInfo infoOp = of.createGetInfo(); infoOp.setSingleTarget(SvnTarget.fromFile(wc)); infoOp.setDepth(SVNDepth.EMPTY); infoOp.setRevision(SVNRevision.WORKING); final SvnInfo info = infoOp.run(); SVNURL svn = info.getUrl(); return svn.toString(); }
@Override public void initDefaults() { super.initDefaults(); setFetchActualOnly(true); setFetchExcluded(true); }
@Override protected void ensureArgumentsAreValid() throws SVNException { if (getFirstTarget().getPegRevision() == null || getFirstTarget().getPegRevision() == SVNRevision.UNDEFINED) { if (getRevision() == null || !getRevision().isValid()) { setRevision(hasRemoteTargets() ? SVNRevision.HEAD : SVNRevision.WORKING); } } else { // TODO: should we add setRevision(getFirstTarget().getPegRevision()); ? currently everything is working without this line } if (getDepth() == null || getDepth() == SVNDepth.UNKNOWN) { setDepth(SVNDepth.EMPTY); } super.ensureArgumentsAreValid(); }
/** * Get version of "omegat/project_save.tmx" in SVN. */ private static String getSVNTmxVersion(File wc) throws Exception { final SvnOperationFactory of = new SvnOperationFactory(); final SvnGetInfo infoOp = of.createGetInfo(); infoOp.setSingleTarget(SvnTarget.fromFile(new File(wc, "omegat/project_save.tmx"))); infoOp.setDepth(SVNDepth.EMPTY); SvnInfo info = infoOp.run(); long r = info.getRevision(); return Long.toString(r); }
public void info(String pathOrUrl, Revision revision, Revision pegRevision, Depth depth, boolean fetchExcluded, boolean fetchActualOnly, boolean includeExternals, Collection<String> changelists, InfoCallback callback) throws ClientException { beforeOperation(); try { getEventHandler().setPathPrefix(getPathPrefix(pathOrUrl)); SvnGetInfo info = svnOperationFactory.createGetInfo(); info.setSingleTarget(getTarget(pathOrUrl, pegRevision)); info.setRevision(getSVNRevision(revision)); info.setDepth(getSVNDepth(depth)); info.setFetchExcluded(fetchExcluded); info.setFetchActualOnly(fetchActualOnly); info.setIncludeExternals(includeExternals); info.setApplicalbeChangelists(changelists); info.setReceiver(getInfoReceiver(callback)); info.run(); } catch (SVNException e) { throw getClientException(e); } finally { afterOperation(); } }
private void doExternalsInfo(Map<File, File> externals, SVNDepth depth) throws SVNException { for (Map.Entry<File, File> entry : externals.entrySet()) { final File localAbsPath = entry.getKey(); final File definingAbsPath = entry.getValue(); final Structure<StructureFields.ExternalNodeInfo> externalNodeInfoStructure = SvnWcDbExternals.readExternal(getWcContext(), localAbsPath, definingAbsPath, StructureFields.ExternalNodeInfo.kind, StructureFields.ExternalNodeInfo.revision); if (externalNodeInfoStructure != null) { ISVNWCDb.SVNWCDbKind externalKind = externalNodeInfoStructure.get(StructureFields.ExternalNodeInfo.kind); long optRev = externalNodeInfoStructure.lng(StructureFields.ExternalNodeInfo.revision); if (externalKind != SVNWCDbKind.Dir) { continue; } final SVNNodeKind kind = SVNFileType.getNodeKind(SVNFileType.getType(localAbsPath)); if (kind != SVNNodeKind.DIR) { continue; } handleEvent(SVNEventFactory.createSVNEvent(localAbsPath, SVNNodeKind.UNKNOWN, null, SVNRepository.INVALID_REVISION, SVNStatusType.UNKNOWN, SVNStatusType.UNKNOWN, SVNStatusType.LOCK_UNKNOWN, SVNEventAction.INFO_EXTERNAL, SVNEventAction.INFO_EXTERNAL, null, null)); final SvnOperationFactory operationFactory = getOperation().getOperationFactory(); final SvnGetInfo getInfo = operationFactory.createGetInfo(); getInfo.setSingleTarget(SvnTarget.fromFile(localAbsPath)); getInfo.setFetchExcluded(getOperation().isFetchExcluded()); getInfo.setFetchActualOnly(getOperation().isFetchActualOnly()); getInfo.setIncludeExternals(getOperation().isIncludeExternals()); getInfo.run(); } } }
public SVNURL getURLFromTarget(String target) throws SVNException { if (SVNCommandUtil.isURL(target)) { return SVNURL.parseURIEncoded(target); } try { SvnGetInfo info = new SvnOperationFactory().createGetInfo(); info.setSingleTarget(SvnTarget.fromFile(new File(target))); info.setDepth(SVNDepth.EMPTY); SvnInfo i = info.run(); return i != null ? i.getUrl() : null; } catch (SVNException e) { // } return null; }
final SVNInfo[] info = new SVNInfo[1]; SvnGetInfo getInfo = getOperationsFactory().createGetInfo(); getInfo.setSingleTarget(SvnTarget.fromURL(url, pegRevision)); getInfo.setRevision(revision); getInfo.setDepth(SVNDepth.EMPTY); getInfo.setReceiver(new ISvnObjectReceiver<SvnInfo>() { public void receive(SvnTarget target, SvnInfo object) throws SVNException { if (info[0] == null) { getInfo.run(); return info[0];
public SVNURL getURLFromTarget(String target) throws SVNException { if (SVNCommandUtil.isURL(target)) { return SVNURL.parseURIEncoded(target); } try { SvnGetInfo info = new SvnOperationFactory().createGetInfo(); info.setSingleTarget(SvnTarget.fromFile(new File(target))); info.setDepth(SVNDepth.EMPTY); SvnInfo i = info.run(); return i != null ? i.getUrl() : null; } catch (SVNException e) { // } return null; }
final SVNInfo[] info = new SVNInfo[1]; SvnGetInfo getInfo = getOperationsFactory().createGetInfo(); getInfo.setSingleTarget(SvnTarget.fromFile(path)); getInfo.setRevision(revision); getInfo.setDepth(SVNDepth.EMPTY); getInfo.setReceiver(new ISvnObjectReceiver<SvnInfo>() { public void receive(SvnTarget target, SvnInfo object) throws SVNException { if (info[0] == null) { getInfo.run(); return info[0];
SvnGetInfo info = getOperationsFactory().createGetInfo(); if (path != null) { info.setSingleTarget(SvnTarget.fromFile(path, pegRevision)); } else { info.setSingleTarget(SvnTarget.fromURL(url, pegRevision)); info.setDepth(SVNDepth.EMPTY); SvnInfo i = info.run(); return i != null ? i.getRepositoryRootUrl() : null;
getInfo.setSingleTarget(SvnTarget.fromFile(path, pegRevision)); getInfo.setRevision(revision); getInfo.setDepth(depth); getInfo.setApplicalbeChangelists(changeLists); getInfo.setReceiver(new ISvnObjectReceiver<SvnInfo>() { public void receive(SvnTarget target, SvnInfo object) throws SVNException { handler.handleInfo(SvnCodec.info(object)); getInfo.run();
getInfo.setSingleTarget(SvnTarget.fromURL(url, pegRevision)); getInfo.setRevision(revision); getInfo.setDepth(depth); getInfo.setReceiver(new ISvnObjectReceiver<SvnInfo>() { public void receive(SvnTarget target, SvnInfo object) throws SVNException { handler.handleInfo(SvnCodec.info(object)); getInfo.run();
public void getChangelists(String rootPath, Collection<String> changelists, Depth depth, final ChangelistCallback callback) throws ClientException { beforeOperation(); try { getEventHandler().setPathPrefix(getPathPrefix(rootPath)); SvnGetInfo getInfo = svnOperationFactory.createGetInfo(); getInfo.setSingleTarget(getTarget(rootPath)); getInfo.setApplicalbeChangelists(changelists); getInfo.setDepth(getSVNDepth(depth)); if (callback != null) { getInfo.setReceiver(new ISvnObjectReceiver<SvnInfo>() { public void receive(SvnTarget target, SvnInfo svnInfo) throws SVNException { SvnWorkingCopyInfo wcInfo = svnInfo.getWcInfo(); if (wcInfo != null) { String path = getFilePath(wcInfo.getPath()); String changelist = wcInfo.getChangelist(); callback.doChangelist(path, changelist); } } }); } getInfo.run(); } catch (SVNException e) { throw getClientException(e); } finally { afterOperation(); } }