Subversion – check state of local work copy

Using “SlikSvn” (and most other svn clients), you can relatively easily check the state of your locally checked out copy on a Windows pc.

  • Are some objects not yet committed
  • Are some objects not yet added to Subversion

Add this to a .CMD file in Windows. In the output it will list objects that needs to be handled – most likely:

  • Commit Add/Change to Subversion
  • Release lock
CheckSVNState.CMD
——————————-
@ECHO OFF
SET DT=%DATE: =0%
SET TT=%TIME: =0%

SET OUTFILE=EDI_Local_Svn_%DT:~-4%%DT:~3,2%%DT:~0,2%.txt
C:\bin\SlikSvn\bin\svn status S:\SVNLocal | FIND /V “? ” > c:\temp\%OUTFILE%
——————————-

You can also check for objects that should have been added to Subversion, but have been missed:

CheckSVNMissingAdd.CMD
——————————-
@ECHO OFF

REM
REM Find all files in a given local working-copy that are NOT under version-control
REM

C:\bin\SlikSvn\bin\svn status S:\SVNLocal | find “? ” | find /v “\bin” | find /v “\obj” | find /v “.vs” | find /v “btproj.user” | find /v “csproj.user” | find /v “\UpgradeLog” | find /v “.btp.cs” | find /v “.xsd.cs” | find /v “.btm.cs” | more
——————————-

The files excluded by the various FIND commands needs to be adapted to the type of files you work with. The command above was create for Biztalk development.

Inspired by SO

Leave a Reply

Your email address will not be published. Required fields are marked *