Search code examples
eclipsesvnsubclipse

Subclipse SVN first commit ignore certain directories


Decided to take the jump from CVS to SVN.

I setup a new repository in subclipse for my project. When I go to 'Finish' the setup it wants to do an initial commit and presents me with a flat list of files to select the files for version controlling.

The problem is I have thousands of generated binary files I dont want to commit.

So I click on cancel because it would take me all day to go through and unselect all the unwanted files. Annoyingly when I click on a parent category for the files I want to ignore it is not recursive!

So I click cancel then go to the eclipse directory structure for the project and manually set svn:ignore on all directories I want to ignore. Then I try and do a commit again and all the files are once again presented - ignore seems to have done nothing.

Can anybody point out what I might be doing wrong?


Solution

  • For the first commit, I recommend writing a small script to delete (of course you'll have a backup) all the files that are not meant to be committed.

    Afterwards, if you find you accidentally committed a file, you can

    svn delete file
    

    Upon the first checkout, copy back (or better yet, regenerate) all the binary files. This will trigger svn to notice that your local repository is out-of-sync with the remote repository.

    cd <Root of local repository>
    svn status 
    

    You will see lots of "to be added" items. Go to the parent directory and add in svn:ignore properties for each of the generated items.

    cd build
    svn propedit svn:ignore .
    

    which will open an editor (if it doesn't, you need to set the environmental variable SVN_EDITOR to a suitable editor). Then you can add in entries that svn will know are not tracked.

    (in the ignore property editor)
    
    target
    build
    image*
    *.o
    
    (and so on)
    

    Save the file, and it will be staged for the next commit. Subsequent runs of svn status will no longer show these files as "needing to be added", but they will show the directory as "needing to be committed (it's a revision on the directory)"