2017-02-06 4 views
0

私はSharpsvnクライアントクラスを使用して、svnディレクトリのファイルにプロパティを設定しています。私は、新しいタイムスタンプでプロパティを継続的にリセットしたいのです。そうすることで、新しいログメッセージを含む新しいリビジョンがリポジトリ履歴で更新されます。私がしたくないことは、ファイルを変更してディレクトリに戻すことです。今、私はディレクトリ上のファイルに接続する方法を理解しようとしています。ここで私は、現在持っているコードは次のとおりです。sharpsvn clinetクラスを使用してsvnディレクトリのファイルにプロパティを設定するにはどうすればよいですか?

System.Uri uri = new System.Uri("url link"); 

using (SvnClient client = new SvnClient()) 
{ 
    try 
    { 
    // Get new timestamp 
    DateTime dt = DateTime.Now; 
    string time = String.Format("{0:G}", dt); 

    // Set property to file in the svn directory 
    client.RemoteSetProperty(uri, "svn:time", time); 
    } 
    catch (Svnexception ex) 
    { 
    MessageBox.show(ex.Message + "Check out error!"); 
    } 
} 

私もclient.SetPropertyメソッドを使用してみましたが、私は、ローカルの作業コピーの両方に、まっすぐURLにそれをしようとしたとき、それは動作しませんでした。助けが素晴らしいだろう!

答えて

0

コードの一部を変更して、必要に応じて動作させます。どうぞご覧ください:

   System.Uri uri = new System.Uri("url link"); 

       using (SvnClient client = new SvnClient()) 
       { 
        try 
        { 
         // Get new timestamp 
         DateTime date = DateTime.Now; 
         string time = String.Format("{0:G}", date); 

         // To Get the Latest Revision on the Required SVN Folder 
         SvnInfoEventArgs info; 
         client.GetInfo(uri, out info); 

         // Prepare a PropertyArgs object with latest revision and a commit message; 
         SvnSetPropertyArgs args = new SvnSetPropertyArgs() { BaseRevision = info.Revision, LogMessage = "Sample msg for SVN commit" }; 

         // Set property to file in the svn directory 
         client.RemoteSetProperty(uri, "svn:time", time, args); 
        } 
        catch (Exception ex) 
        { 
         MessageBox.Show(ex.Message + "Check out error!"); 
        } 
       } 

希望します。

関連する問題