// command line svn cleanup work space, deleting a file does not add, revert the modified file public static BOOL RevertDelUnversioned ( String SVNPath) { the try { var svnProcess = new new Process (); svnProcess.StartInfo.FileName = " svn " ; svnProcess.StartInfo.Arguments = " Revert --recursive " + SVNPath; svnProcess.Start (); svnProcess.WaitForExit (); var ecode1 = svnProcess.ExitCode; svnProcess.StartInfo.FileName = "svn"; svnProcess.StartInfo.Arguments = "cleanup --remove-unversioned " + svnPath; svnProcess.Start(); svnProcess.WaitForExit(); var ecode2 = svnProcess.ExitCode; svnProcess.StartInfo.FileName = "svn"; svnProcess.StartInfo.Arguments = "update " + svnPath; svnProcess.Start(); svnProcess.WaitForExit(); var ecode3 = svnProcess.ExitCode; return ecode1 == 0 && ecode2 == 0 && ecode3 == 0; } catch { return false; } }
sharpsvn way (not try)
/// <Summary> /// deleted file is not associated with SVN /// </ Summary> /// <param name = "workingCopyPath"> working path </ param> public static void RemoveUnversionedSvnFiles ( String workingCopyPath) { the using (Client SvnClient = new new SvnClient ()) { client.Authentication.UserNamePasswordHandlers + = ((SENDER, E) => { e.UserName = "ABC"; e.Password = "123"; }); client.Status(workingCopyPath, (o, e) => { if (e.LocalContentStatus == SvnStatus.NotVersioned) { try { File.Delete(e.FullPath); } catch { } } }); } }