我想将计算机中工作副本的更改提交到存储库。 存储库位于URL中,我现在正在执行此操作:
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);
}
}
但它不起作用,当它完成文件时添加但未提交。为什么? 谢谢!!! :)
答案 0 :(得分:4)
FWIW,我是这样做的:
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");
答案 1 :(得分:1)
ChangeList参数用作过滤器。只有标记为在特定更改列表中的文件才会被操作。
对于提交,您只需提供多个目标。