Question

encore un peu d'un n00b sur SharpSVN, je suis à la recherche d'obtenir un code simple à ouvrir un dépôt SVN, et lire (au moins) le chemin complet de tous les fichiers dans un dossier spécifique.

Disons que ce dossier est \ trunk \ source

Je ne cherche pas à la caisse ou de commettre, de lire dans une liste

Je cherche aussi à lire tous les fichiers, pas seulement ceux modifiés.

Était-ce utile?

La solution

ok on dirait que j'ai trouvé une méthode ..

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

Autres conseils

A écrit ce pressé dans le bloc-notes; Désolé.

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");
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top