Java Code Examples for org.tigris.subversion.svnclientadapter.ISVNInfo#getRevision()

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNInfo#getRevision() . 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: RevertModificationsAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static RevertModifications.RevisionInterval recountStartRevision(SvnClient client, SVNUrl repository, RevertModifications.RevisionInterval ret) throws SVNClientException {
    SVNRevision currStartRevision = ret.startRevision;
    SVNRevision currEndRevision = ret.endRevision;

    if(currStartRevision.equals(SVNRevision.HEAD)) {
        ISVNInfo info = client.getInfo(repository);
        currStartRevision = info.getRevision();
    }

    long currStartRevNum = Long.parseLong(currStartRevision.toString());
    long newStartRevNum = (currStartRevNum > 0) ? currStartRevNum - 1
                                                : currStartRevNum;

    return new RevertModifications.RevisionInterval(
                                     new SVNRevision.Number(newStartRevNum),
                                     currEndRevision);
}
 
Example 2
Source File: BlameTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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 3
Source File: StatusCacheManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * The cached statuses do not provide revision numbers anymore.
 * This method is the only place how to query for the revision of the resource explicitely.
 * @param resource
 * @return
 * @throws SVNException
 */
public SVNRevision getResourceRevision(ISVNLocalResource resource) throws SVNException
{    
	if (resource == null) return null;
    GetInfoCommand command = new GetInfoCommand(resource);
    command.run(null);
    final ISVNInfo info = command.getInfo();

	return (info != null) ? info.getRevision() : null;
}
 
Example 4
Source File: BlameTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void blame(Annotator annotator, String path) throws Exception {
    createAndCommitParentFolders(path);
    File file = createFile(path);
    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);        
    String author3 = info.getLastCommitAuthor();
    Date date3 = info.getLastChangedDate();
    Number rev3 = info.getRevision();
    
    ISVNAnnotations a1 = annotator.annotate(getNbClient(), file, null, null);
    
    // test 
    assertEquals(3, a1.numberOfLines());
    
    assertEquals("a", a1.getLine(0));
    assertEquals("b", a1.getLine(1));
    assertEquals("c", a1.getLine(2));
    
    assertEquals(author1, a1.getAuthor(0));
    assertEquals(author2, a1.getAuthor(1));
    assertEquals(author3, a1.getAuthor(2));

    assertDate(date1, a1.getChanged(0), isCommandLine());
    assertDate(date2, a1.getChanged(1), isCommandLine());
    assertDate(date3, a1.getChanged(2), isCommandLine());

    assertEquals(rev1.getNumber(), a1.getRevision(0));
    assertEquals(rev2.getNumber(), a1.getRevision(1));
    assertEquals(rev3.getNumber(), a1.getRevision(2));    
}
 
Example 5
Source File: BlameTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testBlameCopied() 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);
    String author3 = info.getLastCommitAuthor();
    Date date3 = info.getLastChangedDate();
    Number rev3 = info.getRevision();

    File copy = new File(getWC(), "copy");

    ISVNClientAdapter c = getNbClient();
    copy(file, copy);
    ISVNAnnotations a1 = c.annotate(copy, null, null);

    // test
    assertEquals(3, a1.numberOfLines());

    assertEquals("a", a1.getLine(0));
    assertEquals("b", a1.getLine(1));
    assertEquals("c", a1.getLine(2));

    assertEquals(author1, a1.getAuthor(0));
    assertEquals(author2, a1.getAuthor(1));
    assertEquals(author3, a1.getAuthor(2));

    assertDate(date1, a1.getChanged(0), isCommandLine());
    assertDate(date2, a1.getChanged(1), isCommandLine());
    assertDate(date3, a1.getChanged(2), isCommandLine());

    assertEquals(rev1.getNumber(), a1.getRevision(0));
    assertEquals(rev2.getNumber(), a1.getRevision(1));
    assertEquals(rev3.getNumber(), a1.getRevision(2));

}
 
Example 6
Source File: BlameTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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));

}