Pergunta

ainda um pouco de um n00b em SharpSVN, eu estou olhando para obter um código simples para abrir um repositório SVN, e ler (pelo menos) o caminho completo de todos os arquivos em uma pasta específica.

Vamos dizer que esta pasta é \ tronco \ source

Eu não estou olhando para check-out ou cometer, basta ler em uma lista

Eu também estou olhando para ler todos os arquivos, não apenas aqueles alterados.

Foi útil?

Solução

ok parece que eu encontrei um método ..

        bool gotList;
        List<string> files = new List<string>();

        using (SvnClient client = new SvnClient())
        {
            Collection<SvnListEventArgs> list;

            gotList = client.GetList(projectPath, out list);

            if (gotList)
            {
                foreach (SvnListEventArgs item in list)
                {
                    files.Add(item.Path);
                }
            }
        }

Outras dicas

escreveu isso em uma pressa no bloco de notas; Desculpe.

SvnClient client = new SvnClient();
client.Authentication.DefaultCredentials = new NetworkCredential("svnuser", "svnpass");
SvnUriTarget folderTarget = new SvnUriTarget("https://mysvnserver.com/mysvnpath");
List<String> filesFound = getFolderFiles(client, folderTarget);

// GetFolderFiles
//   Function that, given a SvnClient and Target to a folder, returns a list of files
private List<String> getFolderFiles(SvnClient client, SvnTarget folderTarget)
{
    List<String> filesFound = new List<String>();
    List<SvnListEventArgs> listResults;

    if (client.GetList(folderTarget, out listResults))
    {
        foreach (SvnListEventArgs item in listResults)
            if (item.Entry.NodeKind == SvnNodeKind.File)
                filesFound.Add(item.Path);

        return filesFound;
    }
    else
       throw new Exception("Failed to retrieve files via SharpSvn");
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top