SVN: Checkout/export only the directory structure

后端 未结 12 1283
花落未央
花落未央 2020-12-08 19:14

Is there a way to perform a SVN checkout (or export), which would fetch only the directory structure; that is to say, no files?

12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 19:51

    My DotNet (LINQ) way to do this:

    First, run the svn list command. And push the output to an .xml file.

    "svn.exe" list "https://myserver.com:8443/svn/DotNet/src/v40Base/v40/" --recursive --username %USERNAME% --xml >>myfile.xml
    

    And then run some LINQ code against the .xml file.

        private static void FindSVNDirectories()
        {
    
            string fileName = @"C:\temp\myfile.xml";
    
            XDocument xDoc = XDocument.Load(fileName);
    
            //XNamespace ns = XNamespace.Get("http://schemas.microsoft.com/developer/msbuild/2003");
            string ns = string.Empty;
    
            //List of directories
            var list1 = from list in xDoc.Descendants(ns + "list")
                        from item in list.Elements(ns + "entry")
                        where item.Attribute("kind").Value=="dir"
                        select new
                           {
                               mykind = item.Attribute("kind").Value,
                               myname = (item.Element(ns + "name").Value)
                           };
    
            StringBuilder sb = new StringBuilder();
            foreach (var v in list1)
            {
                sb.Append(v.ToString() + System.Environment.NewLine );
            }
    
            Console.WriteLine(sb.ToString());
    
    
        }
    

提交回复
热议问题