0

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
    }
  • Until Subversion 1.8, the conflict handler is not called for all kinds of conflicts. We found a few cases where it wasn't called for tree conflicts. As of 1.8 it should be called for all conflicts, but in some cases later than in 1.7 as we try to complete as much work as possible before calling the conflict handler. – Bert Huijben Dec 15 '13 at 23:53

1 Answers1

4

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().

Bert Huijben
  • 19,525
  • 4
  • 57
  • 73