2012-03-20 4 views
0
私はSharpSvnで遊んだ

を持つファイルの作成日を取得し、リポジトリ
でフォルダを分析する必要があると私はいくつかのファイルがそこに作成されたときに知っておく必要があり、
ない最終更新日が、それがあったとき作成済み、SharpSvn

どうすればいいですか?

私は次のように開始:

Collection<SvnLogEventArgs> logitems; 
    var c = client.GetLog(new Uri(server_path), out logitems); 


    foreach (var i in logitems) 
    { 
     var properties = i.CustomProperties; 
     foreach (var p in properties) 
     { 
      Console.WriteLine(p.ToString()); 
      Console.WriteLine(p.Key); 
      Console.WriteLine(p.StringValue); 
     } 
    } 

しかし、私はそこに任意の作成日が表示されません。
誰かがそれを入手する場所を知っていますか?

答えて

0

私はそれを行うことはできません。ここで私はこの問題をどのように解決したのですか: SvnChangeAction.Addであれば時間があります。前のものより

public static List<SvnFile> GetSvnFiles(this SvnClient client, string uri_path) 
{ 
    // get logitems 
    Collection<SvnLogEventArgs> logitems; 
    client.GetLog(new Uri(uri_path), out logitems); 

    var result = new List<SvnFile>(); 

    // get craation date for each 
    foreach (var logitem in logitems.OrderBy(logitem => logitem.Time)) 
    { 
     foreach (var changed_path in logitem.ChangedPaths) 
     { 
      string filename = Path.GetFileName(changed_path.Path); 
      if (changed_path.Action == SvnChangeAction.Add) 
      { 
       result.Add(new SvnFile() { Name = filename, Created = logitem.Time }); 
      } 
     } 
    } 

    return result; 
} 
0

わずかに異なるコード:

private static DateTime findCreationDate(SvnClient client, SvnListEventArgs item) 
    { 
     Collection<SvnLogEventArgs> logList = new Collection<SvnLogEventArgs>(); 
     if (item.BasePath != "/" + item.Name) 
     { 
      client.GetLog(new Uri(item.RepositoryRoot + item.BasePath + "/" + item.Name), out logList); 
      foreach (var logItem in logList) 
      { 
       foreach (var changed_path in logItem.ChangedPaths) 
       { 

        string filename = Path.GetFileName(changed_path.Path); 
        if (filename == item.Name && changed_path.Action == SvnChangeAction.Add) 
        { 
         return logItem.Time;        
        } 
       } 
      } 
     } 
     return new DateTime(); 
    } 
ここにコードがある(SvnFileはないSharpSvnから自分のクラスは、あります)
関連する問題