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); } }
/// <summary> /// 遇到文件冲突 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SC_Conflict(object sender, SvnConflictEventArgs e) { ShowInfo("文件冲突" + e.ConflictReason.ToString()); }
/// <summary> /// Handles the conflict based on the preferences. /// </summary> public void OnConflict(SvnConflictEventArgs args) { if (args.ConflictReason == SvnConflictReason.Edited) { SvnAccept choice = SvnAccept.Postpone; if (args.ConflictType == SvnConflictType.Property) { if (PromptOnPropertyConflict) { HandleConflictWithDialog(args); return; } else { choice = PropertyConflictResolutionChoice; } } else if (args.IsBinary) { if (PromptOnBinaryConflict) { HandleConflictWithDialog(args); return; } else { choice = BinaryConflictResolutionChoice; } } else { if (PromptOnTextConflict) { if (UseExternalMergeTool()) { HandleConflictWithExternalMergeTool(args); } else { HandleConflictWithDialog(args); } return; } else { choice = TextConflictResolutionChoice; } } args.Choice = choice; } else { args.Choice = SvnAccept.Postpone; } AddToCurrentResolutions(args); }
static unsafe IntPtr _svn_wc_conflict_resolver_func( void **resultPtr, IntPtr descriptionPtr, IntPtr baton, IntPtr resultPoolPtr, IntPtr scratchPoolPtr) { var client = AprBaton <SvnClient> .Get(baton); var conflictResult = svn_wc.svn_wc_create_conflict_result( svn_wc_conflict_choice_t.svn_wc_conflict_choose_postpone, null, apr_pool_t.__CreateInstance(resultPoolPtr)); *resultPtr = conflictResult.__Instance.ToPointer(); var resultPool = new AprPool(resultPoolPtr, false); // Connect to parent pool var scratchPool = new AprPool(scratchPoolPtr, false); // Connect to parent pool var description = svn_wc_conflict_description2_t.__CreateInstance(descriptionPtr); var ea = new SvnConflictEventArgs(description, scratchPool); try { client.HandleClientConflict(ea); if (ea.Cancel) { return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CANCELLED, null, "Operation canceled from OnConflict").__Instance); } conflictResult.choice = (svn_wc_conflict_choice_t)ea.Choice; if (ea.Choice == SvnAccept.Merged) { if (ea.MergedValue != null) { conflictResult.merged_value = resultPool.AllocSvnString(ea.MergedValue); } if (ea.MergedFile != null) { conflictResult.merged_file = resultPool.AllocAbsoluteDirent(ea.MergedFile); } } return(IntPtr.Zero); } catch (Exception e) { return(SvnException.CreateExceptionSvnError("Conflict resolver", e).__Instance); } finally { ea.Detach(false); scratchPool.Dispose(); resultPool.Dispose(); } }
private void SvnReintegrationMergeArgsOnConflict(object sender, SvnConflictEventArgs e) { if (!AutoMerge) { Logger.LogError($"Найден конфликт, с типом {e.Conflict.NodeKind}: " , $"\nАдрес бранчи\t{e.Conflict.RightSource.Target}\nАдрес релиза\t{e.Conflict.LeftSource.Target}"); return; } AutoResolveConflict(e); }
private void AutoResolveConflict(SvnConflictEventArgs e) { switch (e.ConflictAction) { case SvnConflictAction.Add when e.ConflictType == SvnConflictType.Tree && e.NodeKind == SvnNodeKind.Directory && e.ConflictReason == SvnConflictReason.Obstructed && Directory.Exists(e.Conflict.FullPath): Logger.LogError("Попытка добавить папку, которая уже существует:" , $"\nАдрес бранчи\t{e.Conflict.RightSource.Target}\nАдрес релиза\t{e.Conflict.LeftSource.Target}"); Logger.LogError("Производим автоматическое слияние:", "оставляем существующую."); e.Choice = SvnAccept.Working; return; case SvnConflictAction.Delete when e.ConflictReason == SvnConflictReason.Missing && e.NodeKind == SvnNodeKind.Directory && !Directory.Exists(e.Conflict.FullPath): Logger.LogError("Попытка удалить папку, которая уже удалена:" , $"\nАдрес бранчи\t{e.Conflict.RightSource.Target}\nАдрес релиза\t{e.Conflict.LeftSource.Target}"); Logger.LogError("Производим автоматическое слияние:", "принимаем удаление."); e.Choice = SvnAccept.Working; return; case SvnConflictAction.Add when e.ConflictType == SvnConflictType.Tree && e.NodeKind == SvnNodeKind.File && e.ConflictReason == SvnConflictReason.Obstructed && File.Exists(e.Conflict.FullPath): Logger.LogError("Попытка добавить файл который уже существует:" , $"\nАдрес бранчи\t{e.Conflict.RightSource.Target}\nАдрес релиза\t{e.Conflict.LeftSource.Target}"); Logger.LogError("Не возможно произвести автоматическое слияние:", "требуется провести слияние в ручном режиме."); e.Choice = SvnAccept.Postpone; CommitIfNoError = false; return; case SvnConflictAction.Delete when e.ConflictReason == SvnConflictReason.Missing && e.NodeKind == SvnNodeKind.None && !Directory.Exists(e.Conflict.FullPath): Logger.LogError("Попытка удалить ветку, которая уже удалена:" , $"\nАдрес бранчи\t{e.Conflict.RightSource.Target}\nАдрес релиза\t{e.Conflict.LeftSource.Target}"); Logger.LogError("Производим автоматическое слияние:", "принимаем удаление."); e.Choice = SvnAccept.Working; return; default: e.Choice = SvnAccept.Postpone; Logger.LogError("Не возможно произвести автоматическое слияние:", "не найдено подходящее правило."); break; } CommitIfNoError = false; }
private void HandleConflictWithDialog(SvnConflictEventArgs e) { using (MergeConflictHandlerDialog dlg = new MergeConflictHandlerDialog(e)) { if (dlg.ShowDialog(Context) == DialogResult.OK) { e.Choice = dlg.ConflictResolution; bool applyToAll = dlg.ApplyToAll; // modify the preferences based on the conflicted file type if (applyToAll) { PropertyConflictResolutionChoice = e.Choice; PromptOnPropertyConflict = false; BinaryConflictResolutionChoice = e.Choice; PromptOnBinaryConflict = false; TextConflictResolutionChoice = e.Choice; PromptOnTextConflict = false; } else { bool applyToType = dlg.ApplyToType; if (applyToType) { if (e.ConflictType == SvnConflictType.Property) { PropertyConflictResolutionChoice = e.Choice; PromptOnPropertyConflict = false; } else if (e.IsBinary) { BinaryConflictResolutionChoice = e.Choice; PromptOnBinaryConflict = false; } else { TextConflictResolutionChoice = e.Choice; PromptOnTextConflict = false; } } } // TODO handle merged file option } else { // Aborts the current operation. e.Cancel = true; } } AddToCurrentResolutions(e); }
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; } _currentMergeConflictHandler.OnConflict(e); }
private void AddToCurrentResolutions(SvnConflictEventArgs args) { if (args != null && args.Choice != SvnAccept.Postpone) { List<SvnConflictType> conflictTypes = null; if (_resolvedMergeConflicts.ContainsKey(args.Path)) { conflictTypes = _resolvedMergeConflicts[args.Path]; } else { conflictTypes = new List<SvnConflictType>(); _resolvedMergeConflicts.Add(args.Path.Replace('/', '\\'), conflictTypes); } conflictTypes.Add(args.ConflictType); } }
private void HandleConflictWithExternalMergeTool(SvnConflictEventArgs e) { IAnkhDiffHandler handler = GetService<IAnkhDiffHandler>(); if (handler == null) { HandleConflictWithDialog(e); } else { AnkhMergeArgs ama = new AnkhMergeArgs(); // Ensure paths are in valid format or the DiffToolMonitor constructor // throws argument exception validatig the file path to be monitored. ama.BaseFile = SvnTools.GetNormalizedFullPath(e.BaseFile); ama.TheirsFile = SvnTools.GetNormalizedFullPath(e.TheirFile); ama.MineFile = SvnTools.GetNormalizedFullPath(e.MyFile); ama.MergedFile = SvnTools.GetNormalizedFullPath(e.MergedFile); ama.Mode = DiffMode.PreferExternal; ama.BaseTitle = "Base"; ama.TheirsTitle = "Theirs"; ama.MineTitle = "Mine"; ama.MergedTitle = new System.IO.FileInfo(e.Path).Name; bool merged = handler.RunMerge(ama); if (merged) { IUIService ui = Context.GetService<IUIService>(); string message = "Did you resolve all of the conflicts in the file?\n\nAnswering yes marks this file as resolved, no will keep it as conflicted."; string caption = "Resolve Conflict"; DialogResult result = ui.ShowMessage(message, caption, MessageBoxButtons.YesNoCancel); e.Cancel = result == DialogResult.Cancel; if(!e.Cancel) merged = result == DialogResult.Yes; } if (!merged) { //Restore original merged file. HandleConflictWithDialog(e); } else { e.Choice = SvnAccept.Merged; } } }
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); } }
public MergeConflictHandlerDialog(SvnConflictEventArgs args) { InitializeComponent(); this.input = args; this.postponeRadioButton.Checked = true; this.Text = args.Path.Replace('/', '\\'); if (this.input != null) { isBinary = this.input.IsBinary; if (this.input.ConflictType == SvnConflictType.Property) { applyToTypedCheckBox.Text = "All &Property conflicts"; } else if (isBinary) { applyToTypedCheckBox.Text = "All &Binary conflicts"; } else { applyToTypedCheckBox.Text = "All &Text conflicts"; } ShowDifferences(this.input.MyFile, this.input.TheirFile); } }
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; } _currentMergeConflictHandler.OnConflict(e); }
static void UpdateArgs_Conflict(object sender, SvnConflictEventArgs e) { e.Choice = SvnAccept.TheirsFull; }
private void SvnUpdateArgsOnConflict(object sender, SvnConflictEventArgs e) { AutoResolveConflict(e); }
private void Client_Conflict(object sender, SvnConflictEventArgs e) { //conflict as raised- need to solve it mConflictsPaths.Add(e.MergedFile); }
void ConflictHandler(object sender, SvnConflictEventArgs e) { e.Choice = SvnAccept.MineFull; System.Diagnostics.Debug.WriteLine(e); }