0

How can I get the number of files in a repository ? I've tried this C# code to get the tree of a repository :

private TreeNode GetRepoTreeNodes(string currentrepourl, string currentnodepath, ref SvnClient sc)
        {
            List<TreeNode> tnkids = new List<TreeNode>();

            //using (SvnClient sc = new SvnClient())
            //{
                Collection<SvnLis​tEventArgs> repocontents = null;
                if (sc.GetList(new Uri(currentrepourl), out repocontents))
                {
                    foreach (SvnListEventArgs kiditem in repocontents)
                    {
                        if (!string.IsNullOrEmp​ty(kiditem.Path))
                        {
                            TreeNode tn = GetRepoTreeNodes(currentrepourl + @"/" + kiditem.Path, kiditem.Path, ref sc);
                            // TreeNode tn = new TreeNode(kiditem.Path, tnkids.ToArray());
                            tnkids.Add(tn);
                        }
                    }
                }
            //}

            TreeNode thenode = new TreeNode(currentnodepath, tnkids.ToArray());
            return thenode;
        }

The problem is, when it reaches the end of the loap, it still treats the file as a directory and it throws an exception. I couldnt find a solution. If you have an other way to satisfy this purpose please help with with it. Thank you

user2311028
  • 1,531
  • 3
  • 13
  • 11

1 Answers1

0

Check out these two answers-- they should give you a good idea on how to use GetList() to accomplish what you're attempting:

Community
  • 1
  • 1