public void OnConflict(object sender, SvnConflictEventArgs e) { if (_synchronizer != null && _synchronizer.InvokeRequired) { // If needed marshall the call to the UI thread e.Detach(); // Make this instance thread safe! _synchronizer.Invoke(new EventHandler <SvnConflictEventArgs>(OnConflict), new object[] { sender, e }); return; } AnkhConfig config = GetService <IAnkhConfigurationService>().Instance; if (config.InteractiveMergeOnConflict) { // Only call interactive merge if the user opted in on it if (_currentMergeConflictHandler == null) { _currentMergeConflictHandler = CreateMergeConflictHandler(); } _currentMergeConflictHandler.OnConflict(e); } }
private MergeConflictHandler CreateMergeConflictHandler() { MergeConflictHandler mergeConflictHandler = new MergeConflictHandler(Context); if (mergeOptionsPage != null) { MergeOptionsPage.ConflictResolutionOption binaryOption = mergeOptionsPage.BinaryConflictResolution; if (binaryOption == MergeOptionsPage.ConflictResolutionOption.PROMPT) { mergeConflictHandler.PromptOnBinaryConflict = true; } else { mergeConflictHandler.BinaryConflictResolutionChoice = ToSvnAccept(binaryOption); } MergeOptionsPage.ConflictResolutionOption textOption = mergeOptionsPage.TextConflictResolution; if (textOption == MergeOptionsPage.ConflictResolutionOption.PROMPT) { mergeConflictHandler.PromptOnTextConflict = true; } else { mergeConflictHandler.TextConflictResolutionChoice = ToSvnAccept(textOption); } } return(mergeConflictHandler); }
private MergeConflictHandler CreateMergeConflictHandler() { MergeConflictHandler mergeConflictHandler = new MergeConflictHandler(Context); mergeConflictHandler.PromptOnBinaryConflict = true; mergeConflictHandler.PromptOnTextConflict = true; return(mergeConflictHandler); }
public Handler(IAnkhServiceProvider context, ISynchronizeInvoke synchronizer, MergeConflictHandler conflictHandler) : base(context) { _synchronizer = synchronizer; _currentMergeConflictHandler = conflictHandler; }
private MergeConflictHandler CreateMergeConflictHandler() { MergeConflictHandler mergeConflictHandler = new MergeConflictHandler(Context); if (mergeOptionsPage != null) { MergeOptionsPage.ConflictResolutionOption binaryOption = mergeOptionsPage.BinaryConflictResolution; if (binaryOption == MergeOptionsPage.ConflictResolutionOption.PROMPT) { mergeConflictHandler.PromptOnBinaryConflict = true; } else { mergeConflictHandler.BinaryConflictResolutionChoice = ToSvnAccept(binaryOption); } MergeOptionsPage.ConflictResolutionOption textOption = mergeOptionsPage.TextConflictResolution; if (textOption == MergeOptionsPage.ConflictResolutionOption.PROMPT) { mergeConflictHandler.PromptOnTextConflict = true; } else { mergeConflictHandler.TextConflictResolutionChoice = ToSvnAccept(textOption); } } return mergeConflictHandler; }
public void PerformMerge() { MergeType mergeType = GetPage <MergeTypePage>().SelectedMergeType; ProgressRunnerArgs runnerArgs = new ProgressRunnerArgs(); runnerArgs.CreateLog = !PerformDryRun; // Perform merge using IProgressRunner Context.GetService <IProgressRunner>().RunModal(MergeStrings.MergingTitle, runnerArgs, delegate(object sender, ProgressWorkerArgs ee) { _mergeActions = new List <SvnNotifyEventArgs>(); _resolvedMergeConflicts = new Dictionary <string, List <SvnConflictType> >(); MergeConflictHandler mergeConflictHandler = CreateMergeConflictHandler(); Handler conflictHandler = new Handler(Context, ee.Synchronizer, mergeConflictHandler); try { if (!PerformDryRun) { // Attach the conflict handler ee.Client.Conflict += new EventHandler <SvnConflictEventArgs>(conflictHandler.OnConflict); } // Attach the cancel handler ee.Client.Cancel += new EventHandler <SvnCancelEventArgs>(this.OnCancel); // Attach the notify handler ee.Client.Notify += new EventHandler <SvnNotifyEventArgs>(this.OnNotify); if (mergeType == MergeType.TwoDifferentTrees) { MergeSourceTwoDifferentTreesPage page = ((MergeSourceTwoDifferentTreesPage)mergeSourceTwoDifferentTreesPage); SvnDiffMergeArgs dArgs = new SvnDiffMergeArgs(); Uri fromUri; Uri toUri; // Set the proper depth dArgs.Depth = ((MergeOptionsPage)mergeOptionsPage).Depth; // Set whether or not unversioned obstructions should be allowed dArgs.Force = ((MergeOptionsPage)mergeOptionsPage).AllowUnversionedObstructions; // Set whether or not to ignore ancestry dArgs.IgnoreAncestry = ((MergeOptionsPage)mergeOptionsPage).IgnoreAncestry; // Set whether or not this is a dry run dArgs.DryRun = PerformDryRun; // Create 'From' uri Uri.TryCreate(page.MergeSourceOne, UriKind.Absolute, out fromUri); // Create 'To' uri if necessary if (page.HasSecondMergeSourceUrl) { Uri.TryCreate(page.MergeSourceTwo, UriKind.Absolute, out toUri); } else { toUri = fromUri; } ee.Client.DiffMerge(MergeTarget.FullPath, new SvnUriTarget(fromUri, (page.MergeFromRevision > -1 ? new SvnRevision(page.MergeFromRevision - 1) : SvnRevision.Head)), new SvnUriTarget(toUri, (page.MergeToRevision > -1 ? new SvnRevision(page.MergeToRevision) : SvnRevision.Head)), dArgs); } else if (mergeType == MergeType.Reintegrate) { SvnReintegrationMergeArgs args = new SvnReintegrationMergeArgs(); // Set whether or not this is a dry run args.DryRun = PerformDryRun; ee.Client.ReintegrationMerge(MergeTarget.FullPath, MergeSource.Target, args); } else { SvnMergeArgs args = new SvnMergeArgs(); // Set the proper depth args.Depth = mergeOptionsPage.Depth; // Set whether or not unversioned obstructions should be allowed args.Force = mergeOptionsPage.AllowUnversionedObstructions; // Set whether or not to ignore ancestry args.IgnoreAncestry = mergeOptionsPage.IgnoreAncestry; // Set whether or not this merge should just record the merge information args.RecordOnly = (mergeType == MergeType.ManuallyRecord || mergeType == MergeType.ManuallyRemove); // Set whether or not this is a dry run args.DryRun = PerformDryRun; //no need to continue with the merge operation since there are no revisions to merge if (MergeRevisions != null && EnumTools.GetFirst(MergeRevisions) == null) { throw new Exception(MergeStrings.NoLogItems); } if (MergeRevisions == null) { // Merge all eligible ee.Client.Merge( MergeTarget.FullPath, MergeSource.Target, new SvnRevisionRange(SvnRevision.Zero, SvnRevision.Head), args); } else { // Cherrypicking ee.Client.Merge( MergeTarget.FullPath, MergeSource.Target, new List <SvnRevisionRange>(MergeRevisions), args); } } } finally { if (!PerformDryRun) { // Detach the conflict handler ee.Client.Conflict -= new EventHandler <SvnConflictEventArgs>(conflictHandler.OnConflict); } // Detach the notify handler ee.Client.Notify -= new EventHandler <SvnNotifyEventArgs>(OnNotify); // Detach the cancel handler ee.Client.Cancel -= new EventHandler <SvnCancelEventArgs>(this.OnCancel); if (mergeConflictHandler != null) { _resolvedMergeConflicts = mergeConflictHandler.ResolvedMergedConflicts; mergeConflictHandler = null; } } }); }
public void OnConflict(object sender, SvnConflictEventArgs e) { if (_synchronizer != null && _synchronizer.InvokeRequired) { // If needed marshall the call to the UI thread e.Detach(); // Make this instance thread safe! _synchronizer.Invoke(new EventHandler<SvnConflictEventArgs>(OnConflict), new object[] { sender, e }); return; } AnkhConfig config = GetService<IAnkhConfigurationService>().Instance; if (config.InteractiveMergeOnConflict) { // Only call interactive merge if the user opted in on it if (_currentMergeConflictHandler == null) _currentMergeConflictHandler = CreateMergeConflictHandler(); _currentMergeConflictHandler.OnConflict(e); } }
private MergeConflictHandler CreateMergeConflictHandler() { MergeConflictHandler mergeConflictHandler = new MergeConflictHandler(Context); mergeConflictHandler.PromptOnBinaryConflict = true; mergeConflictHandler.PromptOnTextConflict = true; return mergeConflictHandler; }