public override bool Equals(object obj) { if (null == obj) { return(false); } if (this == obj) { return(true); } GitStash other = obj as GitStash; return(other != null && Equals(other)); }
private void Initialize() { IList<GitStash> stashedItems = Module.GetStashes(); currentWorkingDirStashItem = new GitStash { Name = currentWorkingDirChanges.Text, Message = currentWorkingDirChanges.Text }; stashedItems.Insert(0, currentWorkingDirStashItem); Stashes.Text = ""; StashMessage.Text = ""; Stashes.SelectedItem = null; Stashes.Items.Clear(); foreach (GitStash stashedItem in stashedItems) Stashes.Items.Add(stashedItem); if (Stashes.Items.Count > 1)// more than just the default ("Current working directory changes") Stashes.SelectedIndex = 1;// -> auto-select first non-default else if (Stashes.Items.Count > 0)// (no stashes) -> select default ("Current working directory changes") Stashes.SelectedIndex = 0; }
protected bool Equals(GitStash other) { return string.Equals(_stash, other._stash); }
public IList<GitStash> GetStashes() { var list = RunGitCmd("stash list").Split('\n'); var stashes = new List<GitStash>(); foreach (var stashString in list) { if (stashString.IndexOf(':') <= 0) continue; var stash = new GitStash { Name = stashString.Substring(0, stashString.IndexOf(':')).Trim() }; if (stashString.IndexOf(':') + 1 < stashString.Length) stash.Message = stashString.Substring(stashString.IndexOf(':') + 1).Trim(); stashes.Add(stash); } return stashes; }
public static List<GitStash> GetStashes() { string[] list = GitCommands.RunCmd(Settings.GitCommand, "stash list").Split('\n'); List<GitStash> stashes = new List<GitStash>(); foreach (string stashString in list) { if (stashString.IndexOf(':') > 0) { GitStash stash = new GitStash(); stash.Name = stashString.Substring(0, stashString.IndexOf(':')).Trim(); if (stashString.IndexOf(':') + 1 < stashString.Length) stash.Message = stashString.Substring(stashString.IndexOf(':') + 1).Trim(); stashes.Add(stash); } } return stashes; }
private void Initialize() { IList<GitStash> stashedItems = Settings.Module.GetStashes(); currentWorkingDirStashItem = new GitStash(); currentWorkingDirStashItem.Name = currentWorkingDirChanges.Text; currentWorkingDirStashItem.Message = currentWorkingDirChanges.Text; stashedItems.Insert(0, currentWorkingDirStashItem); Stashes.Text = ""; StashMessage.Text = ""; Stashes.SelectedItem = null; Stashes.Items.Clear(); foreach(GitStash stashedItem in stashedItems) Stashes.Items.Add(stashedItem); if (Stashes.Items.Count > 1) Stashes.SelectedIndex = 1; else if (Stashes.Items.Count > 0) Stashes.SelectedIndex = 0; }
protected bool Equals(GitStash other) { return(string.Equals(_stash, other._stash)); }