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

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNInfo#getLastCommitAuthor() . 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: SVNRepositoryLocation.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public ISVNRemoteFile getRemoteFile(SVNUrl url) throws SVNException{
	ISVNClientAdapter svnClient = getSVNClient();
	ISVNInfo info = null;
	try {
		if (this.getRepositoryRoot().equals(url))
		    return new RemoteFile(this, url, SVNRevision.HEAD);
		else
		    info = svnClient.getInfo(url, SVNRevision.HEAD, SVNRevision.HEAD);
	} catch (SVNClientException e) {
		throw new SVNException(
			"Can't get latest remote resource for "
				+ url);
	}

	if (info == null)
		return null; // no remote file
	else {
		return new RemoteFile(null, // we don't know its parent
		this,
			url,
			SVNRevision.HEAD,
			info.getLastChangedRevision(),
			info.getLastChangedDate(),
			info.getLastCommitAuthor());
	}		
}
 
Example 2
Source File: RemoteResourceStatus.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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 3
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 4
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 5
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));

}
 
Example 6
Source File: GetRemoteResourceCommand.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void run(IProgressMonitor monitor) throws SVNException {
       monitor = Policy.monitorFor(monitor);
       monitor.beginTask(Policy.bind("GetRemoteResourceCommand.getLogEntries"), 100); //$NON-NLS-1$
       
       remoteResource = null;
       ISVNClientAdapter svnClient = repository.getSVNClient();
       ISVNInfo info;
       try {
           info = svnClient.getInfo(url, revision, revision);
       } catch (SVNClientException e) {
           throw new SVNException("Can't get remote resource "+url+" at revision "+revision,e);   
       }
       finally {
       	repository.returnSVNClient(svnClient);
       }
       
       if (info == null) {
           remoteResource = null; // no remote file
       }
       else
       {
           if (info.getNodeKind() == SVNNodeKind.FILE)
               remoteResource = new RemoteFile(
                   null,  // we don't know its parent
                   repository,
                   url,
                   revision,
                   info.getLastChangedRevision(),
                   info.getLastChangedDate(),
                   info.getLastCommitAuthor()
               );
            else
               remoteResource = new RemoteFolder(
                   null,  // we don't know its parent
                   repository,
                   url,
                   revision,
                   info.getLastChangedRevision(),
                   info.getLastChangedDate(),
                   info.getLastCommitAuthor()
               );                
       }
       monitor.done();
}