Search code examples
svnsvnkit

How to list all unversioned files with the SVN CLI and/or SVNKit?


I'm trying to list every un-versioned file in my SVN working copy regardless of their directory depth. Let me start with a scenario on the command line - my ultimate goal is to do this with SVNKit.

If I run the following commands in my home directory,

svnadmin create svnrepo
svn mkdir file:///home/foobar/svnrepo/myproj -m "New proj"
svn co file:///home/foobar/svnrepo/myproj
cd myproj
mkdir -p trunk/path/to/new/folder
touch trunk/path/to/new/folder/file.txt
svn status

I see the following output,

?       trunk

What I want to see is file.txt in the list. I know if I add trunk, then all the files will show up, but I can't do this in my scenario.

In SVNKit I'm calling getStatusClient().doStatus( new File(myWorkingCopy), SVNRevision.HEAD, SVNDepth.Infinity, false, true, false, false, handler, null). My handler implements ISVNStatusHandler and ISVNEventHandler and the handleStatus() method only sees that trunk is unversioned. Probably as expected.

Does anyone know if it is possible (or how) to get a list of every un-versioned file by querying the status at the root of my working copy with SVNKit?

Thanks


Solution

  • I'm pretty sure this is not possible by pure SVNKit functionality (*). Instead, when you encounter an unversioned directory you need to do the unversioned-recursion yourself.

    (*) Have a look at SVNStatusEditor17.getDirStatus: in the for(String name : allChildren) loop, in case of versioned directories (nodeInfo != null) there is a recursion. However, in case of sendUnversioned there is none.