Domanda

ancora un po ' n00b su SharpSVN, sto cercando di ottenere qualche semplice codice per aprire un repository SVN, e leggere (almeno) il percorso completo di tutti i file in una cartella specifica.

Diciamo che questa cartella è ronco\fonte

Io non sto cercando di checkout o di impegnarsi, basta leggere in una lista

Anche io sto cercando di leggere TUTTI i file, non solo quelle modificate.

È stato utile?

Soluzione

ok sembra che ho trovato un metodo..

        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);
                }
            }
        }

Altri suggerimenti

Scrisse in fretta nel blocco note;Mi dispiace.

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");
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top