org.tigris.subversion.svnclientadapter.SVNRevision.Number Java Examples
The following examples show how to use
org.tigris.subversion.svnclientadapter.SVNRevision.Number.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SvnClientJavaHl.java From MergeProcessor with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void merge(Path path, URL url, long revision, boolean recursivly, boolean recordOnly) throws SvnClientException { try { final SVNRevisionRange[] revisionRange = new SVNRevisionRange[] { new SVNRevisionRange(new Number(revision - 1), new Number(revision)) }; client.merge(toSVNUrl(url), // SVN URL SVNRevision.HEAD, // pegRevision revisionRange, // revisions to merge (must be in the form N-1:M) path.toFile(), // target local path false, // force recursivly ? Depth.infinity : Depth.empty, // how deep to traverse into subdirectories false, // ignoreAncestry false, // dryRun recordOnly); // recordOnly } catch (MalformedURLException | SVNClientException e) { throw new SvnClientException(e); } }
Example #2
Source File: RemoteResourceStatus.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Constructor * @param realStatus * @param revision */ public RemoteResourceStatus(ISVNStatus realStatus, SVNRevision.Number revision) { super(realStatus, null, true); this.textStatus = realStatus.getRepositoryTextStatus().toInt(); this.propStatus = realStatus.getRepositoryPropStatus().toInt(); if (revision == null) { this.repositoryRevision = SVNRevision.SVN_INVALID_REVNUM; } else { this.repositoryRevision = revision.getNumber(); } if (SVNStatusKind.EXTERNAL.equals(realStatus.getTextStatus())) { this.textStatus = realStatus.getTextStatus().toInt(); } }
Example #3
Source File: StatusCommand.java From netbeans with Apache License 2.0 | 6 votes |
public Status(String path, SVNStatusKind wcStatus, SVNStatusKind wcPropsStatus, Number wcRev, boolean wcLocked, boolean wcCopied, boolean wcSwitched, Number commitRev, String author, Date changeDate, String lockOwner, String lockComment, Date lockCreated, SVNStatusKind repoStatus, SVNStatusKind repoPropsStatus, boolean treeConflict) { this.path = path; this.wcStatus = wcStatus; this.wcPropsStatus = wcPropsStatus; this.wcRev = wcRev; this.wcLocked = wcLocked; this.wcCopied = wcCopied; this.wcSwitched = wcSwitched; this.commitRev = commitRev; this.author = author; this.changeDate = changeDate; this.lockOwner = lockOwner; this.lockComment = lockComment; this.lockCreated = lockCreated; this.repoStatus = repoStatus; this.repoPropsStatus = repoPropsStatus; this.treeConflict = treeConflict; }
Example #4
Source File: BlameTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void blameNullAuthor(Annotator annotator) throws Exception { File file = createFile("file"); add(file); commit(file); // 1. line write(file, "a\n"); anoncommit(file); ISVNInfo info = getInfo(file); Number rev1 = info.getRevision(); ISVNAnnotations a1 = annotator.annotate(getNbClient(), file, null, null); // test assertEquals(1, a1.numberOfLines()); assertEquals("a", a1.getLine(0)); assertNull(a1.getAuthor(0)); // assertNull(a.getChanged(0)); is null only for svnClientAdapter assertEquals(rev1.getNumber(), a1.getRevision(0)); }
Example #5
Source File: FileStatusCache.java From netbeans with Apache License 2.0 | 6 votes |
public void patchRevision(File[] fileArray, Number revision) { for (File file : fileArray) { synchronized(this) { FileInformation status = getCachedStatus(file); ISVNStatus entry = status != null ? status.getEntry(file) : null; if(entry != null) { Number rev = entry.getRevision(); if(rev == null) continue; if(rev.getNumber() != revision.getNumber()) { FileInformation info = createFileInformation(file, new FakeRevisionStatus(entry, revision), REPOSITORY_STATUS_UNKNOWN); File dir = file.getParentFile(); Map<File, FileInformation> files = getScannedFiles(dir); Map<File, FileInformation> newFiles = new HashMap<File, FileInformation>(files); newFiles.put(file, info); turbo.writeEntry(dir, FILE_STATUS_MAP, newFiles.isEmpty() ? null : newFiles); } } } } }
Example #6
Source File: SvnClientJavaHl.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public List<SvnDiff> diff(final URL url, long fromRevision, long toRevision) throws SvnClientException { final List<SvnDiff> list = new ArrayList<>(); try { final SVNDiffSummary[] diffSummarize = client.diffSummarize(toSVNUrl(url), new Number(fromRevision), toSVNUrl(url), new Number(toRevision), Depth.infinity, true); for (final SVNDiffSummary svnDiffSummary : diffSummarize) { final SvnDiffAction action; if (svnDiffSummary.getDiffKind() == SVNDiffKind.ADDED) { action = SvnDiffAction.ADDED; } else if (svnDiffSummary.getDiffKind() == SVNDiffKind.DELETED) { action = SvnDiffAction.DELETED; } else if (svnDiffSummary.getDiffKind() == SVNDiffKind.MODIFIED) { action = SvnDiffAction.MODIFIED; } else if (svnDiffSummary.getDiffKind() == SVNDiffKind.NORMAL) { if (svnDiffSummary.propsChanged()) { action = SvnDiffAction.PROPERTY_CHANGED; } else { throw LogUtil .throwing(new SvnClientException("Unknown state of SVNDiffSummary " + svnDiffSummary)); } } else { throw LogUtil .throwing(new SvnClientException("Unknown SvnDiffAction " + svnDiffSummary.getDiffKind())); } list.add(new SvnDiff(action, new URL(convertURLToString(url) + '/' + svnDiffSummary.getPath()))); } } catch (MalformedURLException | SVNClientException e) { throw new SvnClientException(e); } return list; }
Example #7
Source File: RemoteResourceTransfer.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public Object fromByteArray(byte[] buffer) { try { ByteArrayInputStream in = new ByteArrayInputStream(buffer); DataInputStream readIn = new DataInputStream(in); boolean isFolder = readIn.readBoolean(); // first, we read the url of the remote resource SVNUrl urlResource = new SVNUrl(readIn.readUTF()); // then we read the url of the repository String location = readIn.readUTF(); // we read the revision SVNRevision revision = SVNRevision.getRevision(readIn.readUTF()); // we read the last changed revision SVNRevision.Number lastChangedRevision = ( Number) SVNRevision.getRevision(readIn.readUTF()); Date date = new Date(readIn.readLong()); String author = null; try { author = readIn.readUTF(); } catch (Exception e) { // Ignore null author } ISVNRepositoryLocation repositoryLocation = SVNProviderPlugin.getPlugin().getRepository(location); if (isFolder) { return new RemoteFolder(null, repositoryLocation,urlResource, revision, lastChangedRevision, date, author); } return new RemoteFile(null, repositoryLocation,urlResource, revision, lastChangedRevision, date, author); } catch(Exception ex) { return null; } }
Example #8
Source File: RemoteResourceStatus.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Update missing data from the supplied info * * @param info */ public void updateFromInfo(ISVNInfo info) { if (info == null) return; /** a temporary variable serving as immediate cache for various status values */ Object aValue = null; aValue = info.getNodeKind(); if (aValue != null) this.nodeKind = ((SVNNodeKind) aValue).toInt(); aValue = info.getLastChangedDate(); if (aValue == null) { this.lastChangedDate = -1; } else { this.lastChangedDate = ((Date) aValue).getTime(); } aValue = info.getLastChangedRevision(); if (aValue == null) { this.lastChangedRevision = SVNRevision.SVN_INVALID_REVNUM; } else { this.lastChangedRevision = ((SVNRevision.Number) aValue).getNumber(); } this.lastCommitAuthor = info.getLastCommitAuthor(); aValue = info.getUrl(); if (aValue == null) { this.url = null; } else { this.url = ((SVNUrl) aValue).toString(); } }
Example #9
Source File: RepositoryRevision.java From netbeans with Apache License 2.0 | 5 votes |
void rollback () { SvnProgressSupport support = new SvnProgressSupport() { @Override public void perform() { File file = getFile(); boolean wasDeleted = getChangedPath().getAction() == 'D'; SVNUrl repoUrl = getLogInfoHeader().getRepositoryRootUrl(); SVNUrl fileUrl = repoUrl.appendPath(getChangedPath().getPath()); SVNRevision.Number revision = getLogInfoHeader().getLog().getRevision(); SvnUtils.rollback(file, repoUrl, fileUrl, revision, wasDeleted, getLogger()); } }; support.start(Subversion.getInstance().getRequestProcessor(repositoryRootUrl), repositoryRootUrl, NbBundle.getMessage(RepositoryRevision.class, "MSG_Rollback_Progress")); //NOI18N }
Example #10
Source File: LogCommand.java From netbeans with Apache License 2.0 | 5 votes |
public LogMessage(String msg, Number rev, String author, Date date, ISVNLogMessageChangePath[] paths) { this.msg = msg; this.rev = rev; this.author = author; this.date = date; this.paths = paths; }
Example #11
Source File: LogCommand.java From netbeans with Apache License 2.0 | 5 votes |
private Number getRevision(String revisionValue) { Number rev = null; if (revisionValue != null && !revisionValue.trim().equals("")) { try { rev = new SVNRevision.Number(Long.parseLong(revisionValue)); } catch (NumberFormatException e) { // ignore new SVNRevision.Number(-1); } } return rev; }
Example #12
Source File: LogCommand.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void endElement(String uri, String localName, String name) throws SAXException { tag = null; if (ENTRY_ELEMENT_NAME.equals(name)) { if(values != null) { String author = (String) values.get(AUTHOR_ELEMENT_NAME); if(author == null) author = ""; Date date = null; String dateValue = (String) values.get(DATE_ELEMENT_NAME); if (dateValue == null) throw new SAXException("'date' tag expected under 'logentry'"); try { date = dateFormat.parse(dateValue); } catch (ParseException ex) { // ignore } String msg = (String) values.get(MSG_ELEMENT_NAME); if(msg == null) msg = ""; SVNRevision.Number rev = getRevision((String) values.get(REVISION_ATTRIBUTE)); List<Path> pathsList = getPathList(); ISVNLogMessageChangePath[] paths; if(pathsList.size() > 0) { paths = new SVNLogMessageChangePath[pathsList.size()]; for (int i = 0; i < pathsList.size(); i++) { Path path = pathsList.get(i); paths[i] = new SVNLogMessageChangePath(path.path, getRevision(path.copyRev), path.copyPath, path.action); } } else { paths = new SVNLogMessageChangePath[] {}; } logs.add(new LogMessage(msg, rev, author, date, paths)); values = null; } } }
Example #13
Source File: RepositoryRevision.java From netbeans with Apache License 2.0 | 5 votes |
public void initFakeRootEvent() { fakeRootEvents = new LinkedList<Event>(); for (final File selectionRoot : selectionRoots) { Event e = new Event(new ISVNLogMessageChangePath() { private String path; @Override public String getPath() { if(path == null) { try { path = SvnUtils.getRelativePath(selectionRoot); if (!path.startsWith("/")) { //NOI18B path = "/" + path; //NOI18B } } catch (SVNClientException ex) { Subversion.LOG.log(Level.INFO, selectionRoot.getAbsolutePath(), ex); path = "/"; //NOI18B } } return path; } @Override public Number getCopySrcRevision() { return null; } @Override public String getCopySrcPath() { return null; } @Override public char getAction() { return '?'; } }, true, null); e.setFile(selectionRoot); fakeRootEvents.add(e); } }
Example #14
Source File: ListCommand.java From netbeans with Apache License 2.0 | 5 votes |
public DirEntry(String path, Date lastChangedDate, Number lastChangedRevision, boolean hasProps, String lastCommitAuthor, SVNNodeKind kind, long size) { this.path = path; this.lastChangedDate = lastChangedDate; this.lastChangedRevision = lastChangedRevision; this.hasProps = hasProps; this.lastCommitAuthor = lastCommitAuthor; this.kind = kind; this.size = size; }
Example #15
Source File: InfoCommand.java From netbeans with Apache License 2.0 | 5 votes |
private SVNRevision.Number getNumber(String revision) { if (revision == null) { return null; } try { return new SVNRevision.Number(Long.parseLong(revision)); } catch (NumberFormatException e) { return new SVNRevision.Number(-1); } }
Example #16
Source File: ResourceStatus.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public Number getLastChangedRevision() { if (lastChangedRevision == SVNRevision.SVN_INVALID_REVNUM) { return null; } else { return new SVNRevision.Number(lastChangedRevision); } }
Example #17
Source File: LogTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
private void logLimit(Log log) throws Exception { File file = createFile("file"); add(file); write(file, "1"); commit(file, "msg1"); ISVNInfo info1 = getInfo(file); write(file, "2"); commit(file, "msg2"); ISVNInfo info2 = getInfo(file); write(file, "3"); commit(file, "msg3"); ISVNLogMessage[] logsNb = null; switch(log) { case file: logsNb = getNbClient().getLogMessages(file, new SVNRevision.Number(0), SVNRevision.HEAD, false, true, 2); break; case url: logsNb = getNbClient().getLogMessages(getFileUrl(file), null, new SVNRevision.Number(0), SVNRevision.HEAD, false, true, 2); break; default: fail("no idea!"); } // test assertEquals(2, logsNb.length); String testName = getName(); assertLogMessage(info1, logsNb[0], "msg1", new ISVNLogMessageChangePath[] { new ChangePath('A', "/" + testName + "/" + testName + "_wc/file", null, null) }); assertLogMessage(info2, logsNb[1], "msg2", new ISVNLogMessageChangePath[] { new ChangePath('M', "/" + testName + "/" + testName + "_wc/file", null, null) }); }
Example #18
Source File: StatusCommand.java From netbeans with Apache License 2.0 | 5 votes |
private Number getRevision(String revisionValue) { Number rev = null; if (revisionValue != null && !revisionValue.trim().equals("")) { try { rev = new SVNRevision.Number(Long.parseLong(revisionValue)); } catch (NumberFormatException e) { // ignore new SVNRevision.Number(-1); } } return rev; }
Example #19
Source File: LogTestHidden.java From netbeans with Apache License 2.0 | 4 votes |
public ChangePath(char action, String path, Number copySrcRevision, String copySrcPath) { this.action = action; this.path = path; this.copySrcRevision = copySrcRevision; this.copySrcPath = copySrcPath; }
Example #20
Source File: LogTestHidden.java From netbeans with Apache License 2.0 | 4 votes |
public Number getCopySrcRevision() { return copySrcRevision; }
Example #21
Source File: JhlInfo2.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Number getCopyRev() { return JhlConverter.convertRevisionNumber(info.getCopyFromRev()); }
Example #22
Source File: BlameTestHidden.java From netbeans with Apache License 2.0 | 4 votes |
private void blameStartRevEndRev(Annotator annotator) throws Exception { File file = createFile("file"); add(file); commit(file); // 1. line write(file, "a\n"); commit(file); ISVNInfo info = getInfo(file); String author1 = info.getLastCommitAuthor(); Date date1 = info.getLastChangedDate(); Number rev1 = info.getRevision(); // 2. line write(file, "a\nb\n"); commit(file); info = getInfo(file); String author2 = info.getLastCommitAuthor(); Date date2 = info.getLastChangedDate(); Number rev2 = info.getRevision(); // 3. line write(file, "a\nb\nc\n"); commit(file); info = getInfo(file); ISVNAnnotations a1 = annotator.annotate(getNbClient(), file, rev1, rev2); // test assertEquals(2, a1.numberOfLines()); assertEquals("a", a1.getLine(0)); assertEquals("b", a1.getLine(1)); assertEquals(author1, a1.getAuthor(0)); assertEquals(author2, a1.getAuthor(1)); assertDate(date1, a1.getChanged(0), isCommandLine()); assertDate(date2, a1.getChanged(1), isCommandLine()); assertEquals(rev1.getNumber(), a1.getRevision(0)); assertEquals(rev2.getNumber(), a1.getRevision(1)); }
Example #23
Source File: HistoryFolder.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Number getCopySrcRevision() { return copySrcRevision; }
Example #24
Source File: SVNInfoUnversioned.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Number getRevision() { return null; }
Example #25
Source File: SVNInfoUnversioned.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Number getLastChangedRevision() { return null; }
Example #26
Source File: SVNInfoUnversioned.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Number getCopyRev() { return null; }
Example #27
Source File: RemoteResourceStatus.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Number getRevision() { return getRepositoryRevision(); }
Example #28
Source File: LocalResourceStatus.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Number getRevision() { throw new UnsupportedOperationException("LocalResourceStatus does not provide (repository) revision"); }
Example #29
Source File: ResourceStatus.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * @param status * @param url - Only needed when status.getUrl is Null, such as * for an svn:externals folder */ public ResourceStatus(ISVNStatus status, String url, boolean useUrlHack) { super(); /** a temporary variable serving as immediate cache for various status values */ Object aValue = null; aValue = status.getUrlString(); if (aValue == null) { if (url == null) this.url = null; else this.url = url; } else { this.url = (String) aValue; } // This is a hack to get the URL for incoming additions if when URL is null due to a JavaHL bug. // See Issue #1312 for details. This should only be done for RemoteResourceStatus (useUrlHack == true), // not LocalResourceStatus. if (this.url == null && useUrlHack) { File file = status.getFile(); if (file != null) { List<String> segments = new ArrayList<String>(); segments.add(file.getName()); File parentFile = file.getParentFile(); while (parentFile != null) { if (parentFile.exists()) { IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(parentFile.getPath())); if (container != null) { ISVNLocalFolder localFolder = SVNWorkspaceRoot.getSVNFolderFor(container); SVNUrl parentUrl = localFolder.getUrl(); if (parentUrl != null) { StringBuffer sb = new StringBuffer(parentUrl.toString()); for (int i = segments.size() - 1; i >= 0; i--) { sb.append("/" + segments.get(i)); } this.url = sb.toString(); break; } } } segments.add(parentFile.getName()); parentFile = parentFile.getParentFile(); } } } aValue = status.getLastChangedRevision(); if (aValue == null) { this.lastChangedRevision = SVNRevision.SVN_INVALID_REVNUM; } else { this.lastChangedRevision = ((SVNRevision.Number) aValue).getNumber(); } aValue = status.getLastChangedDate(); if (aValue == null) { this.lastChangedDate = -1; } else { this.lastChangedDate = ((Date) aValue).getTime(); } this.lastCommitAuthor = status.getLastCommitAuthor(); this.textStatus = status.getTextStatus().toInt(); this.propStatus = status.getPropStatus().toInt(); this.treeConflicted = status.hasTreeConflict(); this.fileExternal = status.isFileExternal(); this.conflictDescriptor = status.getConflictDescriptor(); this.nodeKind = status.getNodeKind().toInt(); this.file = status.getFile(); }
Example #30
Source File: JhlInfo.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Number getRevision() { return JhlConverter.convertRevisionNumber(info.getRev()); }