Java Code Examples for org.tigris.subversion.svnclientadapter.ISVNClientAdapter#update()

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNClientAdapter#update() . 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: AbstractSvnTestCase.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void commit(ISVNClientAdapter client, File folder, String msg) throws SVNClientException {
    add(client, folder);
    try {
        client.commit(new File[]{ folder }, msg, true);
    } catch (SVNClientException e) {
        if(e.getMessage().toLowerCase().indexOf("out of date") > -1) {
            try {
                client.update(folder, SVNRevision.HEAD, true);
                client.commit(new File[]{ folder }, msg, true);
            } catch (SVNClientException e1) {
                fail("failed to commit file " + getFilePathDescr(folder) + ": " + e1.getMessage());
            }
        } else {
            fail("failed to commit file " + getFilePathDescr(folder) + ": " + e.getMessage());
        }            
    }    
    //assertStatus(SVNStatusKind.NORMAL, folder);
}
 
Example 2
Source File: UpdateTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void testUpdateFile(String folder1Name,
                            String folder2Name,
                            String fileName) throws Exception {
    File wc1 = createFolder(folder1Name);
    File file1 = createFile(wc1, fileName);
    write(file1, 1);
    importFile(wc1);
    assertStatus(SVNStatusKind.NORMAL, wc1);
    assertStatus(SVNStatusKind.NORMAL, file1);
                    
    File wc2 = createFolder(folder2Name);
    File file2 = new File(wc2, fileName);
    
    SVNUrl url = getTestUrl().appendPath(wc1.getName());
    ISVNClientAdapter c = getNbClient();         
    c.checkout(url, wc2, SVNRevision.HEAD, true);
    assertStatus(SVNStatusKind.NORMAL, file2);
    assertContents(file2, 1);
    
    SVNRevision revisionBefore = (SVNRevision.Number) getRevision(getRepoUrl());
    
    write(file2, 2);
    assertStatus(SVNStatusKind.MODIFIED, file2);
    commit(file2);
    assertStatus(SVNStatusKind.NORMAL, file2);
                    
    clearNotifiedFiles();     
    long r = c.update(file1, SVNRevision.HEAD, false);
    
    SVNRevision revisionAfter = (SVNRevision.Number) getRevision(getRepoUrl());
    
    assertNotSame(revisionBefore, revisionAfter);
    assertEquals(((SVNRevision.Number)revisionAfter).getNumber(), r);
    assertStatus(SVNStatusKind.NORMAL, file1);
    assertContents(file1, 2);     
    assertNotifiedFiles(new File[] {file1});
}
 
Example 3
Source File: UpdateTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void testUpdateFilePrevRevision(String folder1Name,
                                        String folder2Name,
                                        String fileName) throws Exception {
    File wc1 = createFolder(folder1Name);
    File file1 = createFile(wc1, fileName);
    write(file1, 1);
    importFile(wc1);
                    
    assertStatus(SVNStatusKind.NORMAL, wc1);
    assertStatus(SVNStatusKind.NORMAL, file1);
                                    
    File wc2 = createFolder(folder2Name);
    File file2 = new File(wc2, fileName);
    
    SVNUrl url = getTestUrl().appendPath(wc1.getName());
    ISVNClientAdapter c = getNbClient();         
    c.checkout(url, wc2, SVNRevision.HEAD, true);
    assertStatus(SVNStatusKind.NORMAL, file2);
    assertContents(file2, 1);
            
    SVNRevision prevRev = (SVNRevision.Number) getRevision(getRepoUrl());
    
    write(file2, 2);
    assertStatus(SVNStatusKind.MODIFIED, file2);
    commit(file2);
    assertStatus(SVNStatusKind.NORMAL, file2);

    clearNotifiedFiles();             
    long r = c.update(file1, prevRev, false);
    
    SVNRevision revisionAfter = (SVNRevision.Number) getRevision(getRepoUrl());
            
    assertNotSame(r, ((SVNRevision.Number)revisionAfter).getNumber());
    assertEquals(((SVNRevision.Number)prevRev).getNumber(), r);
    assertStatus(SVNStatusKind.NORMAL, file1);
    assertContents(file1, 1);        
    assertNotifiedFiles(new File[] { /*file1*/ }); // XXX no output from cli!
}
 
Example 4
Source File: UpdateTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testUpdateFolderRecusivelly() throws Exception {                                                                        
    File wc1 = createFolder("wc1");
    File fileA1 = createFile(wc1, "fileA");
    File fileB1 = createFile(wc1, "fileB");
    File folder1 = createFolder(wc1, "folder");
    File fileC1 = createFile(folder1, "fileC");
    
    write(fileA1, 1);
    write(fileB1, 1);
    write(fileC1, 1);
    importFile(wc1);
    assertStatus(SVNStatusKind.NORMAL, wc1);
    assertStatus(SVNStatusKind.NORMAL, fileA1);
    assertStatus(SVNStatusKind.NORMAL, fileB1);
    assertStatus(SVNStatusKind.NORMAL, fileC1);
                    
    File wc2 = createFolder("wc2");      
    File fileA2 = new File(wc2, "fileA");
    File fileB2 = new File(wc2, "fileB");
    File fileC2 = new File(new File(wc2, folder1.getName()), "fileC");
    
    SVNUrl url = getTestUrl().appendPath(wc1.getName());
    ISVNClientAdapter c = getNbClient();         
    c.checkout(url, wc2, SVNRevision.HEAD, true);
    assertStatus(SVNStatusKind.NORMAL, fileA2);
    assertStatus(SVNStatusKind.NORMAL, fileB2);
    assertStatus(SVNStatusKind.NORMAL, fileC2);
    assertContents(fileA2, 1);
    assertContents(fileB2, 1);
    assertContents(fileC2, 1);
    
    SVNRevision revisionBefore = (SVNRevision.Number) getRevision(getRepoUrl());
    
    write(fileA2, 2);
    write(fileB2, 2);
    write(fileC2, 2);
    assertStatus(SVNStatusKind.MODIFIED, fileA2);
    assertStatus(SVNStatusKind.MODIFIED, fileB2);
    assertStatus(SVNStatusKind.MODIFIED, fileC2);
    commit(wc2);
    assertStatus(SVNStatusKind.NORMAL, fileA2);
    assertStatus(SVNStatusKind.NORMAL, fileB2);
    assertStatus(SVNStatusKind.NORMAL, fileC2);
    
    clearNotifiedFiles();             
    long r = c.update(wc1, SVNRevision.HEAD, true);        
    SVNRevision revisionAfter = (SVNRevision.Number) getRevision(getRepoUrl());
    
    assertNotSame(revisionBefore, revisionAfter);
    assertEquals(((SVNRevision.Number)revisionAfter).getNumber(), r);
    assertStatus(SVNStatusKind.NORMAL, fileA1);
    assertStatus(SVNStatusKind.NORMAL, fileB1);
    assertStatus(SVNStatusKind.NORMAL, fileC1);
    assertContents(fileA1, 2);        
    assertContents(fileB1, 2);        
    assertContents(fileC1, 2);        
    assertNotifiedFiles(new File[] {fileA1, fileB1, fileC1});
}
 
Example 5
Source File: UpdateTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testUpdateFolderNonRecusivelly() throws Exception {                                                                        
    // XXX setproperty on folder
    
    File wc1 = createFolder("wc1");
    File fileA1 = createFile(wc1, "fileA");
    File fileB1 = createFile(wc1, "fileB");
    File folder1 = createFolder(wc1, "folder");
    File fileC1 = createFile(folder1, "fileC");
    
    write(fileA1, 1);
    write(fileB1, 1);
    write(fileC1, 1);
    importFile(wc1);
    assertStatus(SVNStatusKind.NORMAL, wc1);
    assertStatus(SVNStatusKind.NORMAL, fileA1);
    assertStatus(SVNStatusKind.NORMAL, fileB1);
    assertStatus(SVNStatusKind.NORMAL, fileC1);
                    
    File wc2 = createFolder("wc2");      
    File fileA2 = new File(wc2, "fileA");
    File fileB2 = new File(wc2, "fileB");
    File fileC2 = new File(new File(wc2, folder1.getName()), "fileC");
    
    SVNUrl url = getTestUrl().appendPath(wc1.getName());
    ISVNClientAdapter c = getNbClient();         
    c.checkout(url, wc2, SVNRevision.HEAD, true);
    assertStatus(SVNStatusKind.NORMAL, fileA2);
    assertStatus(SVNStatusKind.NORMAL, fileB2);
    assertStatus(SVNStatusKind.NORMAL, fileC2);
    assertContents(fileA2, 1);
    assertContents(fileB2, 1);
    assertContents(fileC2, 1);
    
    SVNRevision revisionBefore = (SVNRevision.Number) getRevision(getRepoUrl());
    
    write(fileA2, 2);
    write(fileB2, 2);
    write(fileC2, 2);
    assertStatus(SVNStatusKind.MODIFIED, fileA2);
    assertStatus(SVNStatusKind.MODIFIED, fileB2);
    assertStatus(SVNStatusKind.MODIFIED, fileC2);
    commit(wc2);
    assertStatus(SVNStatusKind.NORMAL, fileA2);
    assertStatus(SVNStatusKind.NORMAL, fileB2);
    assertStatus(SVNStatusKind.NORMAL, fileC2);
    
    clearNotifiedFiles();             
    long r = c.update(wc1, SVNRevision.HEAD, false);        
    SVNRevision revisionAfter = (SVNRevision.Number) getRevision(getRepoUrl());

    assertNotSame(revisionBefore, revisionAfter);
    assertEquals(((SVNRevision.Number)revisionAfter).getNumber(), r);
    assertStatus(SVNStatusKind.NORMAL, fileA1);
    assertStatus(SVNStatusKind.NORMAL, fileB1);
    assertStatus(SVNStatusKind.NORMAL, fileC1);
    assertContents(fileA1, 2);        
    assertContents(fileB1, 2);        
    assertContents(fileC1, 1);        
    assertNotifiedFiles(new File[] {fileA1, fileB1});
}
 
Example 6
Source File: ResolvedTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void testResolved(String folder1Name,
                          String folder2Name,
                          String fileName) throws Exception {
                    
    File wc1 = createFolder(folder1Name);
    File file1 = createFile(wc1, fileName);
    write(file1, 1);
    importFile(wc1);
    assertStatus(SVNStatusKind.NORMAL, wc1);
    assertStatus(SVNStatusKind.NORMAL, file1);
                    
    File wc2 = createFolder(folder2Name);
    File file2 = new File(wc2, fileName);
    
    SVNUrl url = getTestUrl().appendPath(wc1.getName());
    ISVNClientAdapter c = getNbClient();         
    c.checkout(url, wc2, SVNRevision.HEAD, true);        
    assertStatus(SVNStatusKind.NORMAL, file2);
    assertContents(file2, 1);
    
    write(file2, 2);        
    assertStatus(SVNStatusKind.MODIFIED, file2);
    commit(file2);
    assertStatus(SVNStatusKind.NORMAL, file2);
                    
    write(file1, 3);
    
    c.update(file1, SVNRevision.HEAD, false);
    
    assertStatus(SVNStatusKind.CONFLICTED, file1);
    
    write(file1, 2);
    clearNotifiedFiles();
    c.resolved(file1);
    
    assertStatus(SVNStatusKind.NORMAL, file1);
    
    if (isSvnkit()) {
        // svnkit does not notify about resolved files
        assertNotifiedFiles();
    } else {
        assertNotifiedFiles(file1);
    }
}