mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
fix<Histories,Dashboard>: fix crash when push/pull/fetch with no remotes added into this repository
This commit is contained in:
parent
0eae6f90af
commit
4d5e543527
2 changed files with 19 additions and 1 deletions
|
@ -271,16 +271,31 @@ namespace SourceGit.Views.Widgets {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenFetch(object sender, RoutedEventArgs e) {
|
private void OpenFetch(object sender, RoutedEventArgs e) {
|
||||||
|
if (repo.Remotes.Count == 0) {
|
||||||
|
Models.Exception.Raise("No remotes added to this repository!!!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new Popups.Fetch(repo, null).Show();
|
new Popups.Fetch(repo, null).Show();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenPull(object sender, RoutedEventArgs e) {
|
private void OpenPull(object sender, RoutedEventArgs e) {
|
||||||
|
if (repo.Remotes.Count == 0) {
|
||||||
|
Models.Exception.Raise("No remotes added to this repository!!!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new Popups.Pull(repo, null).Show();
|
new Popups.Pull(repo, null).Show();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenPush(object sender, RoutedEventArgs e) {
|
private void OpenPush(object sender, RoutedEventArgs e) {
|
||||||
|
if (repo.Remotes.Count == 0) {
|
||||||
|
Models.Exception.Raise("No remotes added to this repository!!!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new Popups.Push(repo, null).Show();
|
new Popups.Push(repo, null).Show();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
@ -450,6 +465,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
private void FillLocalBranchContextMenu(ContextMenu menu, Models.Branch branch) {
|
private void FillLocalBranchContextMenu(ContextMenu menu, Models.Branch branch) {
|
||||||
var push = new MenuItem();
|
var push = new MenuItem();
|
||||||
push.Header = App.Text("BranchCM.Push", branch.Name);
|
push.Header = App.Text("BranchCM.Push", branch.Name);
|
||||||
|
push.IsEnabled = repo.Remotes.Count > 0;
|
||||||
push.Click += (o, e) => {
|
push.Click += (o, e) => {
|
||||||
new Popups.Push(repo, branch).Show();
|
new Popups.Push(repo, branch).Show();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
@ -768,6 +784,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
var pushTag = new MenuItem();
|
var pushTag = new MenuItem();
|
||||||
pushTag.Header = App.Text("TagCM.Push", tag.Name);
|
pushTag.Header = App.Text("TagCM.Push", tag.Name);
|
||||||
|
pushTag.IsEnabled = repo.Remotes.Count > 0;
|
||||||
pushTag.Click += (o, ev) => {
|
pushTag.Click += (o, ev) => {
|
||||||
new Popups.PushTag(repo, tag.Name).Show();
|
new Popups.PushTag(repo, tag.Name).Show();
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
|
|
|
@ -406,7 +406,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
var push = new MenuItem();
|
var push = new MenuItem();
|
||||||
push.Header = App.Text("BranchCM.Push", current.Name);
|
push.Header = App.Text("BranchCM.Push", current.Name);
|
||||||
push.IsEnabled = dirty;
|
push.IsEnabled = repo.Remotes.Count > 0 && dirty;
|
||||||
push.Click += (o, e) => {
|
push.Click += (o, e) => {
|
||||||
new Popups.Push(repo, current).Show();
|
new Popups.Push(repo, current).Show();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
@ -579,6 +579,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
var push = new MenuItem();
|
var push = new MenuItem();
|
||||||
push.Header = App.Text("TagCM.Push", tag);
|
push.Header = App.Text("TagCM.Push", tag);
|
||||||
|
push.IsEnabled = repo.Remotes.Count > 0;
|
||||||
push.Click += (o, e) => {
|
push.Click += (o, e) => {
|
||||||
new Popups.PushTag(repo, tag).Show();
|
new Popups.PushTag(repo, tag).Show();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
|
Loading…
Reference in a new issue