Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push from empty FormCommit #9008

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion GitUI/CommandsDialogs/FormCommit.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion GitUI/CommandsDialogs/FormCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
using GitUI.Properties;
using GitUI.Script;
using GitUI.SpellChecker;
using GitUI.Theming;
using GitUI.UserControls;
using GitUIPluginInterfaces;
using Microsoft;
Expand All @@ -52,6 +51,8 @@ public sealed partial class FormCommit : GitModuleForm

private readonly TranslationString _amendCommitCaption = new("Amend commit");

private readonly TranslationString _commitAndPush = new("Commit && &push");

private readonly TranslationString _deleteFailed = new("Delete file failed");

private readonly TranslationString _deleteSelectedFiles =
Expand Down Expand Up @@ -213,6 +214,8 @@ public FormCommit(GitUICommands commands, CommitKind commitKind = CommitKind.Nor

InitializeComponent();

CommitAndPush.Text = _commitAndPush.Text;

splitRight.Panel2MinSize = DpiUtil.Scale(100);

_commitMessageManager = new CommitMessageManager(Module.WorkingDirGitDir, Module.CommitEncoding, commitMessage);
Expand Down Expand Up @@ -1028,6 +1031,7 @@ private void LoadUnstagedOutput(IReadOnlyList<GitItemStatus> allChangedFiles)
LoadingStaged.Visible = false;
Commit.Enabled = true;
CommitAndPush.Enabled = true;
CommitAndPush.Text = doChangesExist ? _commitAndPush.Text : TranslatedStrings.ButtonPush;
Amend.Enabled = true;
Reset.Enabled = doChangesExist;

Expand Down Expand Up @@ -2703,6 +2707,12 @@ private void editFileToolStripMenuItem_Click(object sender, EventArgs e)

private void CommitAndPush_Click(object sender, EventArgs e)
{
if (CommitAndPush.Text == TranslatedStrings.ButtonPush)
{
UICommands.StartPushDialog(this, pushOnShow: true);
return;
}

CheckForStagedAndCommit(Amend.Checked, push: true);
}

Expand Down
1 change: 0 additions & 1 deletion GitUI/CommandsDialogs/FormPush.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions GitUI/CommandsDialogs/FormPush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public FormPush(GitUICommands commands)
{
InitializeComponent();

Push.Text = TranslatedStrings.ButtonPush;

NewColumn.Width = DpiUtil.Scale(97);
PushColumn.Width = DpiUtil.Scale(36);
ForceColumn.Width = DpiUtil.Scale(101);
Expand Down
6 changes: 4 additions & 2 deletions GitUI/TranslatedStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal sealed class TranslatedStrings : Translate
private readonly TranslationString _buttonCloseApp = new("Close application");
private readonly TranslationString _buttonCreateBranch = new("Create branch");
private readonly TranslationString _buttonIgnore = new("Ignore");
private readonly TranslationString _buttonPush = new("&Push");
private readonly TranslationString _buttonReportBug = new("Report bug!");

private readonly TranslationString _captionFailedExecute = new("Failed to execute");
Expand Down Expand Up @@ -109,13 +110,13 @@ public TranslatedStrings()
Translator.Translate(this, AppSettings.CurrentTranslation);
}

private static Lazy<TranslatedStrings> _instance = new Lazy<TranslatedStrings>();
private static Lazy<TranslatedStrings> _instance = new();

public static void Reinitialize()
{
if (_instance.IsValueCreated)
{
_instance = new Lazy<TranslatedStrings>();
_instance = new();
}
}

Expand All @@ -131,6 +132,7 @@ public static void Reinitialize()
public static string ButtonCloseApp => _instance.Value._buttonCloseApp.Text;
public static string ButtonCreateBranch => _instance.Value._buttonCreateBranch.Text;
public static string ButtonIgnore => _instance.Value._buttonIgnore.Text;
public static string ButtonPush => _instance.Value._buttonPush.Text;
public static string ButtonReportBug => _instance.Value._buttonReportBug.Text;

public static string CaptionFailedExecute => _instance.Value._captionFailedExecute.Text;
Expand Down
16 changes: 8 additions & 8 deletions GitUI/Translation/English.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -3213,10 +3213,6 @@ gitex.cmd / gitex (located in the same folder as GitExtensions.exe):</source>
<source>&amp;Commit</source>
<target />
</trans-unit>
<trans-unit id="CommitAndPush.Text">
<source>Commit &amp;&amp; &amp;push</source>
<target />
</trans-unit>
<trans-unit id="Ok.Text">
<source>Commit</source>
<target />
Expand Down Expand Up @@ -3263,6 +3259,10 @@ Use this feature when a file is big and never change.
Git will never check if the file has changed that will improve status check performance.</source>
<target />
</trans-unit>
<trans-unit id="_commitAndPush.Text">
<source>Commit &amp;&amp; &amp;push</source>
<target />
</trans-unit>
<trans-unit id="_commitAuthorInfo.Text">
<source>Author</source>
<target />
Expand Down Expand Up @@ -5425,10 +5425,6 @@ This will initialize and update all submodules recursive.</source>
<source>Pull</source>
<target />
</trans-unit>
<trans-unit id="Push.Text">
<source>&amp;Push</source>
<target />
</trans-unit>
<trans-unit id="PushColumn.HeaderText">
<source>Push</source>
<target />
Expand Down Expand Up @@ -9573,6 +9569,10 @@ Select this commit to populate the full message.</source>
<source>Ignore</source>
<target />
</trans-unit>
<trans-unit id="_buttonPush.Text">
<source>&amp;Push</source>
<target />
</trans-unit>
<trans-unit id="_buttonReportBug.Text">
<source>Report bug!</source>
<target />
Expand Down
9 changes: 4 additions & 5 deletions ResourceManager/TranslatedStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public sealed class TranslatedStrings : Translate

private readonly TranslationString _installGitInstructions = new("Install git...");
private readonly TranslationString _findGitExecutable = new("Find git...");
private readonly TranslationString _gitExecutableNotFoundText =
new TranslationString("The Git executable could not be located on your system.");
private readonly TranslationString _gitExecutableNotFoundText = new("The Git executable could not be located on your system.");
private readonly TranslationString _authorDateText = new("{0:Author date|Author dates}");
private readonly TranslationString _committerText = new("Committer");
private readonly TranslationString _commitDateText = new("{0:Commit date|Commit dates}");
Expand All @@ -46,21 +45,21 @@ public sealed class TranslatedStrings : Translate
private readonly TranslationString _generalGitConfigExceptionMessage = new("Failed to read \"{0}\" due to the following error:{1}{1}{2}{1}{1}Due to the nature of this problem, the behavior of the application cannot be guaranteed and it must be closed.{1}{1}Please correct this issue and re-open Git Extensions.");
private readonly TranslationString _generalGitConfigExceptionCaption = new("Repository Configuration Error");

private readonly TranslationString _disableMenuItem = new TranslationString("Disable this dropdown");
private readonly TranslationString _disableMenuItem = new("Disable this dropdown");

// public only because of FormTranslate
public TranslatedStrings()
{
Translator.Translate(this, AppSettings.CurrentTranslation);
}

private static Lazy<TranslatedStrings> _instance = new Lazy<TranslatedStrings>();
private static Lazy<TranslatedStrings> _instance = new();

public static void Reinitialize()
{
if (_instance.IsValueCreated)
{
_instance = new Lazy<TranslatedStrings>();
_instance = new();
}
}

Expand Down