private void UpdateBranches(RemoteActionResult <IReadOnlyList <IGitRef> > branchList) { Cursor = Cursors.Default; if (branchList.HostKeyFail) { string remoteUrl = _NO_TRANSLATE_From.Text; if (FormRemoteProcess.AskForCacheHostkey(this, Module, remoteUrl)) { LoadBranches(); } } else if (branchList.AuthenticationFail) { if (FormPuttyError.AskForKey(this, out _)) { LoadBranches(); } } else { string text = _NO_TRANSLATE_Branches.Text; List <string> names = _defaultBranchItems.Concat(branchList.Result.Select(o => o.LocalName)).ToList(); _NO_TRANSLATE_Branches.DataSource = names; if (names.Any(a => a == text)) { _NO_TRANSLATE_Branches.Text = text; } } }
private void UpdateBranches(RemoteActionResult <IList <GitRef> > branchList) { Cursor = Cursors.Default; if (branchList.HostKeyFail) { string remoteUrl = _NO_TRANSLATE_From.Text; if (FormRemoteProcess.AskForCacheHostkey(this, Module, remoteUrl)) { LoadBranches(); } } else if (branchList.AuthenticationFail) { string loadedKey; if (FormPuttyError.AskForKey(this, out loadedKey)) { LoadBranches(); } } else { string text = Branches.Text; Branches.DataSource = branchList.Result; if (branchList.Result.Any(a => a.LocalName == text)) { Branches.Text = text; } } }
private void ProcessHeads(string remote, IList <GitRef> localHeads, RemoteActionResult <IList <GitRef> > remoteHeads) { Cursor = Cursors.Default; if (remoteHeads.HostKeyFail) { string remoteUrl; remoteUrl = Module.GetPathSetting(string.Format(SettingKeyString.RemoteUrl, remote)); if (string.IsNullOrEmpty(remoteUrl)) { remoteUrl = remote; } if (FormRemoteProcess.AskForCacheHostkey(this, Module, remoteUrl)) { LoadMultiBranchViewData(remote, localHeads); } } else if (remoteHeads.AuthenticationFail) { string loadedKey; if (FormPuttyError.AskForKey(this, out loadedKey)) { LoadMultiBranchViewData(remote, localHeads); } } else { // Add all the local branches. foreach (var head in localHeads) { DataRow row = _branchTable.NewRow(); row["Force"] = false; row["Delete"] = false; row["Local"] = head.Name; string remoteName; if (head.Remote == remote) { remoteName = head.MergeWith ?? head.Name; } else { remoteName = head.Name; } row["Remote"] = remoteName; bool newAtRemote = remoteHeads.Result.Any(h => h.Name == remoteName); row["New"] = newAtRemote ? _no.Text : _yes.Text; row["Push"] = newAtRemote; _branchTable.Rows.Add(row); } // Offer to delete all the left over remote branches. foreach (var remoteHead in remoteHeads.Result) { GitRef head = remoteHead; if (localHeads.All(h => h.Name != head.Name)) { DataRow row = _branchTable.NewRow(); row["Local"] = null; row["Remote"] = remoteHead.Name; row["New"] = _no.Text; row["Push"] = false; row["Force"] = false; row["Delete"] = false; _branchTable.Rows.Add(row); } } } BranchGrid.Enabled = true; }
public RemoteActionResult<IList<IGitRef>> GetRemoteServerRefs(string remote, bool tags, bool branches) { var result = new RemoteActionResult<IList<IGitRef>>() { AuthenticationFail = false, HostKeyFail = false, Result = null }; remote = remote.ToPosixPath(); result.CmdResult = GetTreeFromRemoteRefs(remote, tags, branches); var tree = result.CmdResult.StdOutput; // If the authentication failed because of a missing key, ask the user to supply one. if (tree.Contains("FATAL ERROR") && tree.Contains("authentication")) { result.AuthenticationFail = true; } else if (tree.ToLower().Contains("the server's host key is not cached in the registry")) { result.HostKeyFail = true; } else if (result.CmdResult.ExitedSuccessfully) { result.Result = GetTreeRefs(tree); } return result; }
private void UpdateBranches(RemoteActionResult<IList<GitRef>> branchList) { Cursor = Cursors.Default; if (branchList.HostKeyFail) { string remoteUrl = _NO_TRANSLATE_From.Text; if (FormRemoteProcess.AskForCacheHostkey(this, Module, remoteUrl)) { LoadBranches(); } } else if (branchList.AuthenticationFail) { string loadedKey; if (FormPuttyError.AskForKey(this, out loadedKey)) { LoadBranches(); } } else { string text = _NO_TRANSLATE_Branches.Text; List<string> branchlist = _defaultBranchItems.Concat(branchList.Result.Select(o => o.LocalName)).ToList(); _NO_TRANSLATE_Branches.DataSource = branchlist; if (branchlist.Any(a => a == text)) { _NO_TRANSLATE_Branches.Text = text; } } }
private void ProcessHeads(string remote, IList<GitRef> localHeads, RemoteActionResult<IList<GitRef>> remoteHeads) { Cursor = Cursors.Default; if (remoteHeads.HostKeyFail) { string remoteUrl; remoteUrl = Module.GetPathSetting(string.Format(SettingKeyString.RemoteUrl, remote)); if (string.IsNullOrEmpty(remoteUrl)) remoteUrl = remote; if (FormRemoteProcess.AskForCacheHostkey(this, Module, remoteUrl)) { LoadMultiBranchViewData(remote, localHeads); } } else if (remoteHeads.AuthenticationFail) { string loadedKey; if (FormPuttyError.AskForKey(this, out loadedKey)) { LoadMultiBranchViewData(remote, localHeads); } } else { // Add all the local branches. foreach (var head in localHeads) { DataRow row = _branchTable.NewRow(); row["Force"] = false; row["Delete"] = false; row["Local"] = head.Name; string remoteName; if (head.Remote == remote) remoteName = head.MergeWith ?? head.Name; else remoteName = head.Name; row["Remote"] = remoteName; bool newAtRemote = remoteHeads.Result.Any(h => h.Name == remoteName); row["New"] = newAtRemote ? _no.Text : _yes.Text; row["Push"] = newAtRemote; _branchTable.Rows.Add(row); } // Offer to delete all the left over remote branches. foreach (var remoteHead in remoteHeads.Result) { GitRef head = remoteHead; if (localHeads.All(h => h.Name != head.Name)) { DataRow row = _branchTable.NewRow(); row["Local"] = null; row["Remote"] = remoteHead.Name; row["New"] = _no.Text; row["Push"] = false; row["Force"] = false; row["Delete"] = false; _branchTable.Rows.Add(row); } } } BranchGrid.Enabled = true; }
public RemoteActionResult<IList<GitRef>> GetRemoteRefs(string remote, bool tags, bool branches) { RemoteActionResult<IList<GitRef>> result = new RemoteActionResult<IList<GitRef>>() { AuthenticationFail = false, HostKeyFail = false, Result = null }; remote = remote.ToPosixPath(); var tree = GetTreeFromRemoteRefs(remote, tags, branches); // If the authentication failed because of a missing key, ask the user to supply one. if (tree.Contains("FATAL ERROR") && tree.Contains("authentication")) { result.AuthenticationFail = true; } else if (tree.Contains("the server's host key is not cached in the registry", StringComparison.OrdinalIgnoreCase)) { result.HostKeyFail = true; } else { result.Result = GetTreeRefs(tree); } return result; }