private bool CanAddTag(TextBox textbox) { string tag = textbox?.Text; return(ValidateTag(tag) && TagPresets != null && !TagPresets.Any(x => x.Tag == tag) && !CustomTags.Any(x => x.Tag == tag)); }
private void Commit() { if (string.IsNullOrEmpty(CommitMessage)) { MainWindow.Instance.Dispatcher.Invoke(() => { MainWindow.ShowMessage("Not so fast...", "Please provide a commit message", MessageDialogStyle.Affirmative); }); return; } // Tag has been typed in but not added if (!string.IsNullOrEmpty(TagString) && CustomTags.All(x => x.Tag != TagString)) { MessageDialogResult result = MessageDialogResult.Negative; MainWindow.Instance.Dispatcher.Invoke(async() => { result = await MainWindow.ShowMessage("Missing Tag", "You seem to have a tag that has not been added. Do you want to continue without adding the tag?", MessageDialogStyle.AffirmativeAndNegative); }).Wait(); if (result == MessageDialogResult.Negative) { return; } } OperationStatusDialog.Start("Commit"); bool commitSuccessful = _areaVM.Area.Commit(CommitMessage, false, GetCommitTags()); if (commitSuccessful && PushOnCommit) { _areaVM.ExecuteClientCommand((c) => c.Push(), "push", true); } OperationStatusDialog.Finish(); CommitMessage = string.Empty; TagPresets.ForEach(x => x.IsChecked = false); MainWindow.Instance.Dispatcher.Invoke(() => CustomTags.Clear()); Refresh(); }
public void Merge(Directives other) { if (Ignore != null && other.Ignore != null) { Ignore.Merge(other.Ignore); } else if (other.Ignore != null) { Ignore = other.Ignore; } if (other.UseTortoiseMerge != null) { UseTortoiseMerge = other.UseTortoiseMerge; } if (Include != null && other.Include != null) { Include.Merge(other.Include); } else if (other.Include != null) { Include = other.Include; } if (other.DefaultCompression != null) { DefaultCompression = other.DefaultCompression; } if (other.ExternalDiff != null) { ExternalDiff = other.ExternalDiff; } if (other.ExternalMerge != null) { ExternalMerge = other.ExternalMerge; } if (other.ExternalMerge2Way != null) { ExternalMerge2Way = other.ExternalMerge2Way; } if (other.NonBlockingDiff != null) { NonBlockingDiff = other.NonBlockingDiff; } if (other.m_UserName != null) { m_UserName = other.m_UserName; } if (!string.IsNullOrEmpty(other.ObjectStorePath)) { ObjectStorePath = other.ObjectStorePath; } if (other.Externals != null) { if (Externals == null) { Externals = new Dictionary <string, Extern>(); } foreach (var x in other.Externals) { Externals[x.Key] = x.Value; } } foreach (var x in other.Tokens) { Newtonsoft.Json.Linq.JToken prior; if (Tokens.TryGetValue(x.Key, out prior)) { if (prior.Type == Newtonsoft.Json.Linq.JTokenType.Array && x.Value.Type == Newtonsoft.Json.Linq.JTokenType.Array) { Newtonsoft.Json.Linq.JArray array = prior as Newtonsoft.Json.Linq.JArray; Newtonsoft.Json.Linq.JArray merge = x.Value as Newtonsoft.Json.Linq.JArray; foreach (var y in merge) { array.Add(y); } continue; } } Tokens[x.Key] = x.Value; } if (other.Hooks != null) { if (Hooks != null) { foreach (var x in other.Hooks) { Hooks.Add(x); } } else { Hooks = other.Hooks; } } if (other.Sparse.Count > 0) { Sparse = Sparse.Concat(other.Sparse).ToList(); } if (other.Excludes.Count > 0) { Excludes = Excludes.Concat(other.Excludes).ToList(); } if (other.TagPresets != null) { if (TagPresets == null) { TagPresets = new List <TagPreset>(); } TagPresets.AddRange(other.TagPresets); TagPresets = TagPresets.Distinct().ToList(); } }
private List <string> GetCommitTags() { return(TagPresets.Where(x => x.IsChecked).Select(x => x.Tag) .Union(CustomTags.Select(x => x.Tag)).ToList()); }