2013-04-23 105 views
0

我試圖檢查svn是否已更新,並且我不希望使用SharpSVN。 我正在嘗試使用Process類。檢查SVN是否已更新C#

在批處理,這就是我通常會做:svn st -u <svn path> | find "*"

這裏是我的代碼:

private void checkSVN() 
{ 
     Process newProcess= new Process(); 
     newProcess.StartInfo.FileName = "svn"; 
     newProcess.StartInfo.WorkingDirectory = ""; 
     newProcess.StartInfo.Arguments = "st -u C:\\SVN | find " + @"""*"""; 
     newProcess.StartInfo.UseShellExecute = false; 
     newProcess.StartInfo.RedirectStandardOutput = true; 
     newProcess.OutputDataReceived += new DataReceivedEventHandler(parseStandartOutput); 

     newProcess.Start(); 
     newProcess.BeginOutputReadLine(); 
} 
private static void parseStandartOutput(object sendingProcess, DataReceivedEventArgs outLine) 
{ 
    if (!String.IsNullOrEmpty(outLine.Data)) 
     m_svnOutput += outLine.Data + " "; 
} 

的問題是,find "*"不工作 - newProcess.StartInfo.Arguments設置爲"st -u C:\\SVN | find \"*\*"",當然,這是行不通的。

任何想法?

+1

爲什麼你不希望使用SharpSVN?因爲它看起來像最好的選擇http://stackoverflow.com/questions/2074891/how-to-access-file-information-in-a-pre-commit-hook-using-sharpsvn/2075198#2075198其他庫:http ://stackoverflow.com/questions/211765/svn-libraries-for-net – 2013-04-23 14:36:27

回答

0

你試過只是

 newProcess.StartInfo.Arguments = "st -u C:\\SVN | find \"*\""; 
+0

是的,我有...同樣的事情...應該有結果的變量'm_svnOutput'是空的,這就是爲什麼我知道它doesn沒有工作。至於'newProcess.StartInfo.Arguments' - 我仍然會得到'「st -u C:\\ SVN | find \」* \ *「」'there ... – Idanis 2013-04-23 14:40:59