在Sharpsvn中提交的问题 [英] Problem with commit in sharpsvn
本文介绍了在Sharpsvn中提交的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将计算机中工作副本的更改提交到存储库. 该存储库位于URL中,我现在正在执行此操作:
I want to commit the changes of a working copy in my computer to the repository. The repository is in an URL and i´m doing this now:
using (SvnClient client = new SvnClient())
{
SvnCommitArgs ca = new SvnCommitArgs();
ca.ChangeLists.Add(workingcopydir + filename);
ca.LogMessage = "Change";
client.Add(workingcopydir + filename);
try
{
client.Commit(workingcopydir, ca);
//, ca, out resultado
}
catch (Exception exc)
{
MessageBox.Show(this, exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
但是它不起作用,完成后将添加文件但未提交.为什么? 谢谢!!! :)
But it doesn´t work, when it finish the file is added but not commited. Why? Thanks!!! :)
推荐答案
FWIW,我这样做是这样的:
FWIW, I do it like so:
public bool Add (string path)
{
using(SvnClient client = NewSvnClient()){
SvnAddArgs args = new SvnAddArgs();
args.Depth = SvnDepth.Empty;
args.AddParents = true;
return client.Add(path, args);
}
}
public bool Commit (string path, string message)
{
using(SvnClient client = NewSvnClient()){
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;
}
}
}
然后我这样称呼它:
repo.Add("some folder");
...
repo.Commit("base working copy");
这篇关于在Sharpsvn中提交的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文