Merge not firing conflict event
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 voi开发者_C百科d args_Conflict(object sender, SvnConflictEventArgs e)
{
//implementation
}
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
client.Conflict += new EventHandler<SvnConflictEventArgs>(args_Conflict);
before calling merge.
But you can also hook the event on the SvnMergeArgs that you pass to client.Merge().
精彩评论