合并不触发冲突事件
使用 Sharpsvn 的合并方法合并 2 个修订版时,我没有触发冲突事件。我尝试在 SvnMergeArgs 和 SvnUpdateArgs 中使用冲突事件。我调用了 Sharpsvn 的 merge 方法,然后调用了 update 方法。合并只是用旧版本覆盖工作副本,更新不会触发事件。
我在这里错过了什么,冲突没有被解雇。以下是我的代码。
private static void MergingBranchedScript()
{
using (SvnClient client = new SvnClient())
{
client.Merge(@"path\abc.sql",
new Uri("file:///path/Trunk/Script/abc.sql"),
new SvnRevisionRange(4,7), new SvnMergeArgs());
SvnUpdateArgs args = new SvnUpdateArgs();
SvnUpdateResult result;
client.Update(@"path\Script", args, out result);
args.Conflict += new EventHandler<SvnConflictEventArgs>(args_Conflict);
}
}
public static void args_Conflict(object sender, SvnConflictEventArgs e)
{
//implementation
}
I am not getting the conflict event fired when merging 2 revisions using Merge method of sharpsvn. I tried using the the conflict event in SvnMergeArgs and SvnUpdateArgs. I called the merge method followed by update method of sharpsvn. The merge just overwrites the working copy with the older revision and update do not fire the event.
What am I missing out here that the conflict is not getting fired. The following is my code.
private static void MergingBranchedScript()
{
using (SvnClient client = new SvnClient())
{
client.Merge(@"path\abc.sql",
new Uri("file:///path/Trunk/Script/abc.sql"),
new SvnRevisionRange(4,7), new SvnMergeArgs());
SvnUpdateArgs args = new SvnUpdateArgs();
SvnUpdateResult result;
client.Update(@"path\Script", args, out result);
args.Conflict += new EventHandler<SvnConflictEventArgs>(args_Conflict);
}
}
public static void args_Conflict(object sender, SvnConflictEventArgs e)
{
//implementation
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您当前的代码仅在操作已完成时挂钩事件。如果你想在所有命令上挂钩冲突事件,你应该
在调用合并之前使用。
但您也可以将事件挂接到传递给 client.Merge() 的 SvnMergeArgs 上。
Your current code only hooks the event when the operations are already done. If you want to hook the conflict event on all commands you should use a
before calling merge.
But you can also hook the event on the SvnMergeArgs that you pass to client.Merge().