zoukankan      html  css  js  c++  java
  • SharpSvn操作 -- 获取Commit节点列表

     1         /// <summary>
     2         /// 获取工作目录的所有节点,包括子目录
     3         /// </summary>
     4         /// <param name="workingCopyDir"></param>
     5         /// <returns></returns>
     6         public List<LocalNode> FetchWorkingCopy(string workingCopyDir)
     7         {
     8             var nodes = new List<LocalNode>();
     9             var workingRoot = SvnClient.GetWorkingCopyRoot(workingCopyDir);
    10             if (workingRoot == null)
    11             {
    12                 FetchNotVersionedDir(workingCopyDir, nodes);
    13             }
    14             else
    15             {
    16                 FetchWorkingCopyDir(workingCopyDir, nodes);
    17             }
    18             PrintLocalNodes(nodes);
    19             return nodes;
    20         }
    View Code
     1         private void FetchWorkingCopyDir(string path, List<LocalNode> nodes)
     2         {
     3             var statusArgs = new SvnStatusArgs
     4             {
     5                 Depth = SvnDepth.Children,
     6                 RetrieveAllEntries = true,
     7                 ThrowOnError = false
     8             };
     9             Collection<SvnStatusEventArgs> list;
    10             if (!SvnClient.GetStatus(path, statusArgs, out list))
    11                 return;
    12             for (var i = 1; i < list.Count; i++)
    13             {
    14                 var argse = list[i];
    15                 if (argse.Versioned)
    16                 {
    17                     nodes.Add(new LocalNode { FullPath = argse.FullPath, NodeKind = argse.NodeKind, NodeStatus = argse.LocalNodeStatus });
    18                     if (argse.NodeKind == SvnNodeKind.Directory)
    19                         FetchWorkingCopyDir(argse.FullPath, nodes);
    20                 }
    21                 else
    22                 {
    23                     var nodeKind = File.Exists(argse.FullPath) ? SvnNodeKind.File : SvnNodeKind.Directory;
    24                     nodes.Add(new LocalNode { FullPath = argse.FullPath, NodeKind = nodeKind, NodeStatus = argse.LocalNodeStatus });
    25                     if (nodeKind == SvnNodeKind.Directory)
    26                         FetchNotVersionedDir(argse.FullPath, nodes);
    27                 }
    28             }
    29         }
    30 
    31         private void FetchNotVersionedDir(string path, List<LocalNode> nodes)
    32         {
    33             var files = Directory.GetFiles(path);
    34             nodes.AddRange(files.Select(file => new LocalNode { FullPath = file, NodeKind = SvnNodeKind.File, NodeStatus = SvnStatus.NotVersioned }));
    35             var dirs = Directory.GetDirectories(path);
    36             foreach (var dir in dirs)
    37             {
    38                 nodes.Add(new LocalNode { FullPath = dir, NodeKind = SvnNodeKind.Directory, NodeStatus = SvnStatus.NotVersioned });
    39                 FetchNotVersionedDir(dir, nodes);
    40             }
    41         }
    View Code
    1     public class LocalNode
    2     {
    3         public string FullPath { get; set; }
    4         public SvnNodeKind NodeKind { get; set; }
    5         public SvnStatus NodeStatus { get; set; }
    6     }
  • 相关阅读:
    微信开发教程 Yank.WeiXin.Robot
    HtmlAgilityPack教程
    PHP获取文件的绝对路径
    关于mysql联合索引
    IE无法获得cookie,ie不支持cookie的解决办法,火狐支持
    最详细的cookie和浏览隐私之间的关系
    JavaScipt选取文档元素的方法
    javascript正则表达式
    JS实现操作成功定时回到主页效果
    js实现表格信息的删除和添加
  • 原文地址:https://www.cnblogs.com/maozhh/p/6733504.html
Copyright © 2011-2022 走看看