J'ai un problème de commit avec sharpsvn. Maintenant j'ajoute tous les fichiers de ma copie de travail (si le fichier est ajouté jette une exception), et après je le commets. Ça marche mais ça fait des exceptions. Il y a un moyen d'obtenir l'état du dépôt avant de faire add() et d'ajouter seulement les nouveaux fichiers ou les fichiers qui ont été changés? Et si je supprime un fichier ou un dossier sur ma copie de travail, comment puis-je supprimer ces fichiers ou dossier sur le référentiel? code:Commit dans sharpSVN
String[] folders;
folders = Directory.GetDirectories(direccionLocal,"*.*", SearchOption.AllDirectories);
foreach (String folder in folders)
{
String[] files;
files = Directory.GetFiles(folder);
foreach (String file in files)
{
if (file.IndexOf("\\.svn") == -1)
{
Add(file, workingcopy);
}
}
}
Commit(workingcopy, "change");
Ajouter:
public bool Add(string path, string direccionlocal)
{
using (SvnClient client = new SvnClient())
{
SvnAddArgs args = new SvnAddArgs();
args.Depth = SvnDepth.Empty;
Console.Out.WriteLine(path);
args.AddParents = true;
try
{
return client.Add(path, args);
}
catch (Exception ex)
{
return false;
}
}
}
Commit:
public bool Commit(string path, string message)
{
using (SvnClient client = new SvnClient())
{
SvnCommitArgs args = new SvnCommitArgs();
args.LogMessage = message;
args.ThrowOnError = true;
args.ThrowOnCancel = true;
try
{
return client.Commit(path, args);
}
catch (Exception e)
{
if (e.InnerException != null)
{
throw new Exception(e.InnerException.Message, e);
}
throw e;
}
}
}