Chris Lee commented on Bug JENKINS-13844

Found the issue; the status objects returned by SVNKit have different values when used against a SVN 1.7 working copy.

Using the original snippet of code, status objects are returned for the correct files, but their status is STATUS_NONE, and hence the subsequent logic for removing files of specific statuses is not triggered:

/home/jenkins/workspace/UTIL_TRUNK/.gradle    none 
/home/jenkins/workspace/UTIL_TRUNK/foo        none 
/home/jenkins/workspace/UTIL_TRUNK/build      none

Modifying the code to combine the node & contents status yields the correct results:

/home/jenkins/workspace/UTIL_TRUNK/.gradle                   ignored
Deleting /home/jenkins/workspace/UTIL_TRUNK/.gradle
/home/jenkins/workspace/UTIL_TRUNK/foo                       unversioned
Deleting /home/jenkins/workspace/UTIL_TRUNK/foo
/home/jenkins/workspace/UTIL_TRUNK/build                     ignored

The relevant change is:

// for SVN 1.7 working copies, status.getContentsStatus() is STATUS_NONE; need to use the combined status to get the correct status (UNVERSIONED, IGNORED, etc.) 
     SVNStatusType s = status.getCombinedNodeAndContentsStatus(); 
     //SVNStatusType s = status.getContentsStatus();

The complete test harness is:

import java.io.File;

import java.util.*;
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.ISVNStatusHandler;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNStatus;
import org.tmatesoft.svn.core.wc.SVNStatusType;
import org.tmatesoft.svn.core.wc.*;
import org.tmatesoft.svn.core.internal.wc.*;

public class Test
{
    public static void main( String[] args ) throws SVNException
    {
        SVNClientManager clientManager = SVNClientManager.newInstance();

        Collection<String> changeLists = Collections.emptyList();
        //clientManager.getStatusClient().doStatus( new File( args[ 0 ] ).getAbsoluteFile(), SVNRevision.WORKING, SVNDepth.INFINITY, false, false, true, false, new ISVNStatusHandler()
        clientManager.getStatusClient().doStatus( new File( args[ 0 ] ), null, SVNDepth.INFINITY, false, false, true, false, new ISVNStatusHandler()
        {
            @Override
            public void handleStatus( SVNStatus status ) throws SVNException
            {
                // for SVN 1.7 working copies, status.getContentsStatus() is STATUS_NONE; need to use the combined status to get the correct status (UNVERSIONED, IGNORED, etc.)
                SVNStatusType s = status.getCombinedNodeAndContentsStatus();
                //SVNStatusType s = status.getContentsStatus();

                System.out.printf( "%-60s %s\n", status.getFile(), s );
                if( s == SVNStatusType.STATUS_UNVERSIONED || s == SVNStatusType.STATUS_IGNORED || s == SVNStatusType.STATUS_MODIFIED )
                {
                    System.out.println( "Deleting " + status.getFile() );
                }
            }
        }, null );
    }
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to