I am developing a java based eclipse plugin that monitors file activity. I need to find out if a given file is checked into the SVN by the user.
edit
There are two files. Local file and repository. I have to keep track of the local file and make sure the user commits it to the repository every time he saves it locally.
You could make svn do the work for you by running
svn status /path/to/my/filefrom the shell on the path to the file. If it isn’t checked in then you will get? /path/to/my/fileback (it begins with a question mark). If it is checked in and unmodified you will get no response from svn status, otherwise the line will begin with the character describing the file’s status (eg. A, M, D).Bear in mind if the file is not within an svn repository svn status will throw a warning
svn: warning: '/path/to/my/file' is not a working copy.[edit] Having seen your clarification, you need to check for all the status flags (added, modified, deleted etc.) and remind your user to commit where appropriate.
svn help statuscontains the (exhaustive) full list.If you run svn status from within the project without providing a path it gives you the status of all the files in the repository. If it is unmodified this will yield nothing, otherwise any changes will be printed to stdout. You probably want to do this, rather than running through each file to check its status.