diff --git a/GitCommands/Git/GitCommandHelpers.cs b/GitCommands/Git/GitCommandHelpers.cs index 17382be8213..fe51752a997 100644 --- a/GitCommands/Git/GitCommandHelpers.cs +++ b/GitCommands/Git/GitCommandHelpers.cs @@ -427,24 +427,43 @@ public static ArgumentString StopBisectCmd() return new GitArgumentBuilder("bisect") { "reset" }; } - public static ArgumentString RebaseCmd(string branch, bool interactive, bool preserveMerges, bool autosquash, bool autoStash, string from = null, string onto = null) + public static ArgumentString RebaseCmd( + string branch, bool interactive, bool preserveMerges, bool autosquash, bool autoStash, bool ignoreDate, bool committerDateIsAuthorDate, string from = null, string onto = null) { if (from == null ^ onto == null) { throw new ArgumentException($"For arguments \"{nameof(from)}\" and \"{nameof(onto)}\", either both must have values, or neither may."); } - return new GitArgumentBuilder("rebase") + var builder = new GitArgumentBuilder("rebase"); + if (ignoreDate) { - { interactive, "-i" }, - { interactive && autosquash, "--autosquash" }, - { interactive && !autosquash, "--no-autosquash" }, - { preserveMerges, GitVersion.Current.SupportRebaseMerges ? "--rebase-merges" : "--preserve-merges" }, - { autoStash, "--autostash" }, - from.QuoteNE(), - branch.Quote(), - { onto != null, $"--onto {onto}" } - }; + builder.Add("--ignore-date"); + } + else if (committerDateIsAuthorDate) + { + builder.Add("--committer-date-is-author-date"); + } + else + { + if (interactive) + { + builder.Add("-i"); + builder.Add(autosquash ? "--autosquash" : "--no-autosquash"); + } + + if (preserveMerges) + { + builder.Add(GitVersion.Current.SupportRebaseMerges ? "--rebase-merges" : "--preserve-merges"); + } + } + + builder.Add(autoStash, "--autostash"); + builder.Add(from.QuoteNE()); + builder.Add(branch.Quote()); + builder.Add(onto != null, $"--onto {onto}"); + + return builder; } public static ArgumentString AbortRebaseCmd() diff --git a/GitUI/CommandsDialogs/FormRebase.Designer.cs b/GitUI/CommandsDialogs/FormRebase.Designer.cs index f5bad9a0375..0ecf782acc0 100644 --- a/GitUI/CommandsDialogs/FormRebase.Designer.cs +++ b/GitUI/CommandsDialogs/FormRebase.Designer.cs @@ -28,6 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.label1 = new System.Windows.Forms.Label(); this.lblCurrent = new System.Windows.Forms.Label(); this.Branches = new System.Windows.Forms.ComboBox(); @@ -45,6 +46,7 @@ private void InitializeComponent() this.chkPreserveMerges = new System.Windows.Forms.CheckBox(); this.chkAutosquash = new System.Windows.Forms.CheckBox(); this.chkStash = new System.Windows.Forms.CheckBox(); + this.chkIgnoreDate = new System.Windows.Forms.CheckBox(); this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel(); this.chkSpecificRange = new System.Windows.Forms.CheckBox(); this.lblRangeFrom = new System.Windows.Forms.Label(); @@ -65,10 +67,12 @@ private void InitializeComponent() this.Ok = new System.Windows.Forms.Button(); this.panel2 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); + this.Commit = new System.Windows.Forms.Button(); this.panel4 = new System.Windows.Forms.Panel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.rebasePanel = new System.Windows.Forms.FlowLayoutPanel(); - this.Commit = new System.Windows.Forms.Button(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.chkCommitterDateIsAuthorDate = new System.Windows.Forms.CheckBox(); this.flowLayoutPanel2.SuspendLayout(); this.OptionsPanel.SuspendLayout(); this.flowLayoutPanel4.SuspendLayout(); @@ -86,7 +90,7 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(3, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(305, 19); + this.label1.Size = new System.Drawing.Size(236, 13); this.label1.TabIndex = 0; this.label1.Text = "Rebase current branch on top of another branch"; // @@ -96,7 +100,7 @@ private void InitializeComponent() this.lblCurrent.AutoSize = true; this.lblCurrent.Location = new System.Drawing.Point(3, 5); this.lblCurrent.Name = "lblCurrent"; - this.lblCurrent.Size = new System.Drawing.Size(105, 19); + this.lblCurrent.Size = new System.Drawing.Size(80, 13); this.lblCurrent.TabIndex = 2; this.lblCurrent.Text = "Current branch:"; // @@ -106,18 +110,18 @@ private void InitializeComponent() this.Branches.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.Branches.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.Branches.FormattingEnabled = true; - this.Branches.Location = new System.Drawing.Point(81, 3); + this.Branches.Location = new System.Drawing.Point(68, 3); this.Branches.Name = "Branches"; - this.Branches.Size = new System.Drawing.Size(218, 27); + this.Branches.Size = new System.Drawing.Size(218, 21); this.Branches.TabIndex = 6; // // label2 // this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 4); + this.label2.Location = new System.Drawing.Point(3, 7); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(72, 19); + this.label2.Size = new System.Drawing.Size(59, 13); this.label2.TabIndex = 5; this.label2.Text = "Rebase on"; // @@ -177,11 +181,11 @@ private void InitializeComponent() this.flowLayoutPanel2.Controls.Add(this.lblCurrent); this.flowLayoutPanel2.Controls.Add(this.Currentbranch); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 19); + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 13); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(0, 5, 0, 5); - this.flowLayoutPanel2.Size = new System.Drawing.Size(509, 29); + this.flowLayoutPanel2.Size = new System.Drawing.Size(684, 23); this.flowLayoutPanel2.TabIndex = 31; this.flowLayoutPanel2.WrapContents = false; // @@ -189,9 +193,9 @@ private void InitializeComponent() // this.Currentbranch.Anchor = System.Windows.Forms.AnchorStyles.Left; this.Currentbranch.AutoSize = true; - this.Currentbranch.Location = new System.Drawing.Point(114, 5); + this.Currentbranch.Location = new System.Drawing.Point(89, 5); this.Currentbranch.Name = "Currentbranch"; - this.Currentbranch.Size = new System.Drawing.Size(0, 19); + this.Currentbranch.Size = new System.Drawing.Size(0, 13); this.Currentbranch.TabIndex = 3; // // OptionsPanel @@ -201,12 +205,12 @@ private void InitializeComponent() this.OptionsPanel.Controls.Add(this.flowLayoutPanel4, 0, 0); this.OptionsPanel.Controls.Add(this.flowLayoutPanel5, 0, 1); this.OptionsPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.OptionsPanel.Location = new System.Drawing.Point(3, 84); + this.OptionsPanel.Location = new System.Drawing.Point(3, 72); this.OptionsPanel.Name = "OptionsPanel"; this.OptionsPanel.RowCount = 2; this.OptionsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.OptionsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.OptionsPanel.Size = new System.Drawing.Size(503, 72); + this.OptionsPanel.Size = new System.Drawing.Size(678, 72); this.OptionsPanel.TabIndex = 30; this.OptionsPanel.Visible = false; // @@ -216,10 +220,12 @@ private void InitializeComponent() this.flowLayoutPanel4.Controls.Add(this.chkPreserveMerges); this.flowLayoutPanel4.Controls.Add(this.chkAutosquash); this.flowLayoutPanel4.Controls.Add(this.chkStash); + this.flowLayoutPanel4.Controls.Add(this.chkIgnoreDate); + this.flowLayoutPanel4.Controls.Add(this.chkCommitterDateIsAuthorDate); this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel4.Location = new System.Drawing.Point(3, 3); this.flowLayoutPanel4.Name = "flowLayoutPanel4"; - this.flowLayoutPanel4.Size = new System.Drawing.Size(497, 25); + this.flowLayoutPanel4.Size = new System.Drawing.Size(672, 25); this.flowLayoutPanel4.TabIndex = 0; this.flowLayoutPanel4.WrapContents = false; // @@ -229,7 +235,7 @@ private void InitializeComponent() this.chkInteractive.AutoSize = true; this.chkInteractive.Location = new System.Drawing.Point(3, 3); this.chkInteractive.Name = "chkInteractive"; - this.chkInteractive.Size = new System.Drawing.Size(139, 23); + this.chkInteractive.Size = new System.Drawing.Size(116, 17); this.chkInteractive.TabIndex = 7; this.chkInteractive.Text = "Interactive Rebase"; this.chkInteractive.UseVisualStyleBackColor = true; @@ -239,9 +245,9 @@ private void InitializeComponent() // this.chkPreserveMerges.Anchor = System.Windows.Forms.AnchorStyles.Left; this.chkPreserveMerges.AutoSize = true; - this.chkPreserveMerges.Location = new System.Drawing.Point(148, 3); + this.chkPreserveMerges.Location = new System.Drawing.Point(125, 3); this.chkPreserveMerges.Name = "chkPreserveMerges"; - this.chkPreserveMerges.Size = new System.Drawing.Size(130, 23); + this.chkPreserveMerges.Size = new System.Drawing.Size(106, 17); this.chkPreserveMerges.TabIndex = 7; this.chkPreserveMerges.Text = "Preserve Merges"; this.chkPreserveMerges.UseVisualStyleBackColor = true; @@ -252,9 +258,9 @@ private void InitializeComponent() this.chkAutosquash.Anchor = System.Windows.Forms.AnchorStyles.Left; this.chkAutosquash.AutoSize = true; this.chkAutosquash.Enabled = false; - this.chkAutosquash.Location = new System.Drawing.Point(284, 3); + this.chkAutosquash.Location = new System.Drawing.Point(237, 3); this.chkAutosquash.Name = "chkAutosquash"; - this.chkAutosquash.Size = new System.Drawing.Size(101, 23); + this.chkAutosquash.Size = new System.Drawing.Size(82, 17); this.chkAutosquash.TabIndex = 7; this.chkAutosquash.Text = "Autosquash"; this.chkAutosquash.UseVisualStyleBackColor = true; @@ -264,13 +270,26 @@ private void InitializeComponent() this.chkStash.Anchor = System.Windows.Forms.AnchorStyles.Left; this.chkStash.AutoSize = true; this.chkStash.Enabled = false; - this.chkStash.Location = new System.Drawing.Point(343, 3); + this.chkStash.Location = new System.Drawing.Point(325, 3); this.chkStash.Name = "chkStash"; - this.chkStash.Size = new System.Drawing.Size(54, 19); + this.chkStash.Size = new System.Drawing.Size(76, 17); this.chkStash.TabIndex = 8; this.chkStash.Text = "Auto stash"; this.chkStash.UseVisualStyleBackColor = true; // + // chkIgnoreDate + // + this.chkIgnoreDate.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.chkIgnoreDate.AutoSize = true; + this.chkIgnoreDate.Location = new System.Drawing.Point(407, 3); + this.chkIgnoreDate.Name = "chkIgnoreDate"; + this.chkIgnoreDate.Size = new System.Drawing.Size(82, 17); + this.chkIgnoreDate.TabIndex = 9; + this.chkIgnoreDate.Text = "Ignore Date"; + this.toolTip1.SetToolTip(this.chkIgnoreDate, "Changes the author dates of the commits in this branch\r\ninto the commit dates."); + this.chkIgnoreDate.UseVisualStyleBackColor = true; + this.chkIgnoreDate.Click += new System.EventHandler(this.DateClick); + // // flowLayoutPanel5 // this.flowLayoutPanel5.AutoSize = true; @@ -283,7 +302,7 @@ private void InitializeComponent() this.flowLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel5.Location = new System.Drawing.Point(3, 34); this.flowLayoutPanel5.Name = "flowLayoutPanel5"; - this.flowLayoutPanel5.Size = new System.Drawing.Size(497, 35); + this.flowLayoutPanel5.Size = new System.Drawing.Size(672, 35); this.flowLayoutPanel5.TabIndex = 1; this.flowLayoutPanel5.WrapContents = false; // @@ -291,9 +310,9 @@ private void InitializeComponent() // this.chkSpecificRange.Anchor = System.Windows.Forms.AnchorStyles.Left; this.chkSpecificRange.AutoSize = true; - this.chkSpecificRange.Location = new System.Drawing.Point(3, 4); + this.chkSpecificRange.Location = new System.Drawing.Point(3, 6); this.chkSpecificRange.Name = "chkSpecificRange"; - this.chkSpecificRange.Size = new System.Drawing.Size(111, 23); + this.chkSpecificRange.Size = new System.Drawing.Size(94, 17); this.chkSpecificRange.TabIndex = 12; this.chkSpecificRange.Text = "Specific range"; this.chkSpecificRange.UseVisualStyleBackColor = true; @@ -303,9 +322,9 @@ private void InitializeComponent() // this.lblRangeFrom.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblRangeFrom.AutoSize = true; - this.lblRangeFrom.Location = new System.Drawing.Point(120, 6); + this.lblRangeFrom.Location = new System.Drawing.Point(103, 8); this.lblRangeFrom.Name = "lblRangeFrom"; - this.lblRangeFrom.Size = new System.Drawing.Size(75, 19); + this.lblRangeFrom.Size = new System.Drawing.Size(59, 13); this.lblRangeFrom.TabIndex = 9; this.lblRangeFrom.Text = "From (exc.)"; // @@ -313,9 +332,9 @@ private void InitializeComponent() // this.txtFrom.Anchor = System.Windows.Forms.AnchorStyles.Left; this.txtFrom.Enabled = false; - this.txtFrom.Location = new System.Drawing.Point(201, 3); + this.txtFrom.Location = new System.Drawing.Point(168, 5); this.txtFrom.Name = "txtFrom"; - this.txtFrom.Size = new System.Drawing.Size(80, 26); + this.txtFrom.Size = new System.Drawing.Size(80, 20); this.txtFrom.TabIndex = 8; // // btnChooseFromRevision @@ -323,7 +342,7 @@ private void InitializeComponent() this.btnChooseFromRevision.Anchor = System.Windows.Forms.AnchorStyles.Left; this.btnChooseFromRevision.Enabled = false; this.btnChooseFromRevision.Image = global::GitUI.Properties.Images.SelectRevision; - this.btnChooseFromRevision.Location = new System.Drawing.Point(287, 4); + this.btnChooseFromRevision.Location = new System.Drawing.Point(254, 3); this.btnChooseFromRevision.Name = "btnChooseFromRevision"; this.btnChooseFromRevision.Size = new System.Drawing.Size(25, 24); this.btnChooseFromRevision.TabIndex = 30; @@ -334,9 +353,9 @@ private void InitializeComponent() // this.lblRangeTo.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblRangeTo.AutoSize = true; - this.lblRangeTo.Location = new System.Drawing.Point(318, 6); + this.lblRangeTo.Location = new System.Drawing.Point(285, 8); this.lblRangeTo.Name = "lblRangeTo"; - this.lblRangeTo.Size = new System.Drawing.Size(24, 19); + this.lblRangeTo.Size = new System.Drawing.Size(20, 13); this.lblRangeTo.TabIndex = 11; this.lblRangeTo.Text = "To"; // @@ -347,18 +366,18 @@ private void InitializeComponent() this.cboTo.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.cboTo.Enabled = false; this.cboTo.FormattingEnabled = true; - this.cboTo.Location = new System.Drawing.Point(348, 5); + this.cboTo.Location = new System.Drawing.Point(311, 4); this.cboTo.Name = "cboTo"; - this.cboTo.Size = new System.Drawing.Size(184, 27); + this.cboTo.Size = new System.Drawing.Size(184, 21); this.cboTo.TabIndex = 29; // // ShowOptions // this.ShowOptions.Anchor = System.Windows.Forms.AnchorStyles.Left; this.ShowOptions.AutoSize = true; - this.ShowOptions.Location = new System.Drawing.Point(305, 4); + this.ShowOptions.Location = new System.Drawing.Point(292, 7); this.ShowOptions.Name = "ShowOptions"; - this.ShowOptions.Size = new System.Drawing.Size(92, 19); + this.ShowOptions.Size = new System.Drawing.Size(71, 13); this.ShowOptions.TabIndex = 27; this.ShowOptions.TabStop = true; this.ShowOptions.Text = "Show options"; @@ -367,19 +386,19 @@ private void InitializeComponent() // patchGrid1 // this.patchGrid1.Dock = System.Windows.Forms.DockStyle.Fill; - this.patchGrid1.Location = new System.Drawing.Point(3, 190); + this.patchGrid1.Location = new System.Drawing.Point(3, 172); this.patchGrid1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.patchGrid1.Name = "patchGrid1"; - this.patchGrid1.Size = new System.Drawing.Size(503, 274); + this.patchGrid1.Size = new System.Drawing.Size(678, 292); this.patchGrid1.TabIndex = 16; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(3, 159); + this.label3.Location = new System.Drawing.Point(3, 147); this.label3.Name = "label3"; this.label3.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0); - this.label3.Size = new System.Drawing.Size(139, 29); + this.label3.Size = new System.Drawing.Size(101, 23); this.label3.TabIndex = 0; this.label3.Text = "Commits to re-apply:"; // @@ -429,7 +448,7 @@ private void InitializeComponent() this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 472F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(984, 472); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1159, 472); this.tableLayoutPanel1.TabIndex = 19; // // helpImageDisplayUserControl1 @@ -445,7 +464,7 @@ private void InitializeComponent() this.helpImageDisplayUserControl1.IsOnHoverShowImage2 = false; this.helpImageDisplayUserControl1.IsOnHoverShowImage2NoticeText = "Hover to see scenario when fast forward is possible."; this.helpImageDisplayUserControl1.Location = new System.Drawing.Point(3, 3); - this.helpImageDisplayUserControl1.MinimumSize = new System.Drawing.Size(289, 422); + this.helpImageDisplayUserControl1.MinimumSize = new System.Drawing.Size(289, 418); this.helpImageDisplayUserControl1.Name = "helpImageDisplayUserControl1"; this.helpImageDisplayUserControl1.Size = new System.Drawing.Size(289, 466); this.helpImageDisplayUserControl1.TabIndex = 20; @@ -468,7 +487,7 @@ private void InitializeComponent() this.flowLayoutPanel1.Controls.Add(this.SolveMergeconflicts); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel1.Location = new System.Drawing.Point(813, 3); + this.flowLayoutPanel1.Location = new System.Drawing.Point(988, 3); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(168, 466); this.flowLayoutPanel1.TabIndex = 1; @@ -505,6 +524,16 @@ private void InitializeComponent() this.panel3.Size = new System.Drawing.Size(10, 15); this.panel3.TabIndex = 21; // + // Commit + // + this.Commit.Location = new System.Drawing.Point(3, 198); + this.Commit.Name = "Commit"; + this.Commit.Size = new System.Drawing.Size(162, 25); + this.Commit.TabIndex = 23; + this.Commit.Text = "Commit..."; + this.Commit.UseVisualStyleBackColor = true; + this.Commit.Click += new System.EventHandler(this.CommitButtonClick); + // // panel4 // this.panel4.Location = new System.Drawing.Point(3, 229); @@ -532,7 +561,7 @@ private void InitializeComponent() this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(509, 466); + this.tableLayoutPanel3.Size = new System.Drawing.Size(684, 466); this.tableLayoutPanel3.TabIndex = 32; // // rebasePanel @@ -542,20 +571,24 @@ private void InitializeComponent() this.rebasePanel.Controls.Add(this.Branches); this.rebasePanel.Controls.Add(this.ShowOptions); this.rebasePanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.rebasePanel.Location = new System.Drawing.Point(3, 51); + this.rebasePanel.Location = new System.Drawing.Point(3, 39); this.rebasePanel.Name = "rebasePanel"; - this.rebasePanel.Size = new System.Drawing.Size(503, 27); + this.rebasePanel.Size = new System.Drawing.Size(678, 27); this.rebasePanel.TabIndex = 32; // - // Commit + // chkCommitterDateIsAuthorDate // - this.Commit.Location = new System.Drawing.Point(3, 198); - this.Commit.Name = "Commit"; - this.Commit.Size = new System.Drawing.Size(162, 25); - this.Commit.TabIndex = 23; - this.Commit.Text = "Commit..."; - this.Commit.UseVisualStyleBackColor = true; - this.Commit.Click += new System.EventHandler(this.CommitButtonClick); + this.chkCommitterDateIsAuthorDate.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.chkCommitterDateIsAuthorDate.AutoSize = true; + this.chkCommitterDateIsAuthorDate.Location = new System.Drawing.Point(495, 3); + this.chkCommitterDateIsAuthorDate.Name = "chkCommitterDateIsAuthorDate"; + this.chkCommitterDateIsAuthorDate.Size = new System.Drawing.Size(169, 17); + this.chkCommitterDateIsAuthorDate.TabIndex = 10; + this.chkCommitterDateIsAuthorDate.Text = "Committer Date Is Author Date"; + this.toolTip1.SetToolTip(this.chkCommitterDateIsAuthorDate, "Changes the committer dates of the commits in this branch\r\ninto the author dates." + + "\r\n"); + this.chkCommitterDateIsAuthorDate.UseVisualStyleBackColor = true; + this.chkCommitterDateIsAuthorDate.Click += new System.EventHandler(this.DateClick); // // FormRebase // @@ -563,9 +596,9 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.ClientSize = new System.Drawing.Size(984, 472); + this.ClientSize = new System.Drawing.Size(1159, 472); this.Controls.Add(this.tableLayoutPanel1); - this.MinimumSize = new System.Drawing.Size(1000, 510); + this.MinimumSize = new System.Drawing.Size(1175, 510); this.Name = "FormRebase"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Rebase"; @@ -634,5 +667,8 @@ private void InitializeComponent() private Help.HelpImageDisplayUserControl helpImageDisplayUserControl1; private System.Windows.Forms.CheckBox chkStash; private System.Windows.Forms.Button Commit; + private System.Windows.Forms.CheckBox chkIgnoreDate; + private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.CheckBox chkCommitterDateIsAuthorDate; } } \ No newline at end of file diff --git a/GitUI/CommandsDialogs/FormRebase.cs b/GitUI/CommandsDialogs/FormRebase.cs index 049ecfca5ec..c51c5e8acbe 100644 --- a/GitUI/CommandsDialogs/FormRebase.cs +++ b/GitUI/CommandsDialogs/FormRebase.cs @@ -182,6 +182,15 @@ private void InteractiveRebaseClick(object sender, EventArgs e) chkAutosquash.Enabled = chkInteractive.Checked; } + private void DateClick(object sender, EventArgs e) + { + chkCommitterDateIsAuthorDate.Enabled = !chkIgnoreDate.Checked; + chkIgnoreDate.Enabled = !chkCommitterDateIsAuthorDate.Checked; + chkInteractive.Enabled = !chkIgnoreDate.Checked && !chkCommitterDateIsAuthorDate.Checked; + chkPreserveMerges.Enabled = !chkIgnoreDate.Checked && !chkCommitterDateIsAuthorDate.Checked; + chkAutosquash.Enabled = chkInteractive.Checked && !chkIgnoreDate.Checked && !chkCommitterDateIsAuthorDate.Checked; + } + private void AddFilesClick(object sender, EventArgs e) { UICommands.StartAddFilesDialog(this); @@ -259,13 +268,13 @@ private void OkClick(object sender, EventArgs e) { rebaseCmd = GitCommandHelpers.RebaseCmd( cboTo.Text, chkInteractive.Checked, chkPreserveMerges.Checked, - chkAutosquash.Checked, chkStash.Checked, txtFrom.Text, Branches.Text); + chkAutosquash.Checked, chkStash.Checked, chkIgnoreDate.Checked, chkCommitterDateIsAuthorDate.Checked, txtFrom.Text, Branches.Text); } else { rebaseCmd = GitCommandHelpers.RebaseCmd( Branches.Text, chkInteractive.Checked, - chkPreserveMerges.Checked, chkAutosquash.Checked, chkStash.Checked); + chkPreserveMerges.Checked, chkAutosquash.Checked, chkStash.Checked, chkIgnoreDate.Checked, chkCommitterDateIsAuthorDate.Checked); } var dialogResult = FormProcess.ReadDialog(this, rebaseCmd); diff --git a/GitUI/CommandsDialogs/FormRebase.resx b/GitUI/CommandsDialogs/FormRebase.resx index d58980a38d7..9d9bc4df986 100644 --- a/GitUI/CommandsDialogs/FormRebase.resx +++ b/GitUI/CommandsDialogs/FormRebase.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/GitUI/Translation/English.xlf b/GitUI/Translation/English.xlf index 66105fe7cdd..02e8cda3ac5 100644 --- a/GitUI/Translation/English.xlf +++ b/GitUI/Translation/English.xlf @@ -5647,6 +5647,14 @@ Nothing to rebase. Autosquash + + Committer Date Is Author Date + + + + Ignore Date + + Interactive Rebase diff --git a/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs b/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs index 904f2fd87b0..2b4cee47018 100644 --- a/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs +++ b/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs @@ -2592,8 +2592,8 @@ private void LaunchRebase(string command) } string rebaseCmd = GitCommandHelpers.RebaseCmd( - LatestSelectedRevision.FirstParentId?.ToString(), - interactive: true, preserveMerges: false, autosquash: false, autoStash: true); + LatestSelectedRevision.FirstParentId?.ToString(), interactive: true, preserveMerges: false, + autosquash: false, autoStash: true, ignoreDate: false, committerDateIsAuthorDate: false); using (var formProcess = new FormProcess(null, rebaseCmd, Module.WorkingDir, null, true)) { diff --git a/UnitTests/GitCommands.Tests/Git/GitCommandHelpersTest.cs b/UnitTests/GitCommands.Tests/Git/GitCommandHelpersTest.cs index 37b84c0f4a9..7d5dfcac643 100644 --- a/UnitTests/GitCommands.Tests/Git/GitCommandHelpersTest.cs +++ b/UnitTests/GitCommands.Tests/Git/GitCommandHelpersTest.cs @@ -599,37 +599,58 @@ public void RebaseCmd() { Assert.AreEqual( "-c rebase.autoSquash=false rebase \"branch\"", - GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: false).Arguments); + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: false, ignoreDate: false, committerDateIsAuthorDate: false).Arguments); Assert.AreEqual( "-c rebase.autoSquash=false rebase -i --no-autosquash \"branch\"", - GitCommandHelpers.RebaseCmd("branch", interactive: true, preserveMerges: false, autosquash: false, autoStash: false).Arguments); + GitCommandHelpers.RebaseCmd("branch", interactive: true, preserveMerges: false, autosquash: false, autoStash: false, ignoreDate: false, committerDateIsAuthorDate: false).Arguments); Assert.AreEqual( GitVersion.Current.SupportRebaseMerges ? "-c rebase.autoSquash=false rebase --rebase-merges \"branch\"" : "-c rebase.autoSquash=false rebase --preserve-merges \"branch\"", - GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: true, autosquash: false, autoStash: false).Arguments); + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: true, autosquash: false, autoStash: false, ignoreDate: false, committerDateIsAuthorDate: false).Arguments); Assert.AreEqual( "-c rebase.autoSquash=false rebase \"branch\"", - GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: true, autoStash: false).Arguments); + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: true, autoStash: false, ignoreDate: false, committerDateIsAuthorDate: false).Arguments); Assert.AreEqual( "-c rebase.autoSquash=false rebase --autostash \"branch\"", - GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: true).Arguments); + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: true, ignoreDate: false, committerDateIsAuthorDate: false).Arguments); Assert.AreEqual( "-c rebase.autoSquash=false rebase -i --autosquash \"branch\"", - GitCommandHelpers.RebaseCmd("branch", interactive: true, preserveMerges: false, autosquash: true, autoStash: false).Arguments); + GitCommandHelpers.RebaseCmd("branch", interactive: true, preserveMerges: false, autosquash: true, autoStash: false, ignoreDate: false, committerDateIsAuthorDate: false).Arguments); + Assert.AreEqual( + "-c rebase.autoSquash=false rebase --ignore-date \"branch\"", + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: false, ignoreDate: true, committerDateIsAuthorDate: false).Arguments); + Assert.AreEqual( + "-c rebase.autoSquash=false rebase --committer-date-is-author-date \"branch\"", + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: false, ignoreDate: false, committerDateIsAuthorDate: true).Arguments); + Assert.AreEqual( + "-c rebase.autoSquash=false rebase --ignore-date --autostash \"branch\"", + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: true, ignoreDate: true, committerDateIsAuthorDate: false).Arguments); + Assert.AreEqual( + "-c rebase.autoSquash=false rebase --committer-date-is-author-date --autostash \"branch\"", + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: true, ignoreDate: false, committerDateIsAuthorDate: true).Arguments); + Assert.AreEqual( + "-c rebase.autoSquash=false rebase --ignore-date --autostash \"branch\"", + GitCommandHelpers.RebaseCmd("branch", interactive: true, preserveMerges: true, autosquash: true, autoStash: true, ignoreDate: true, committerDateIsAuthorDate: false).Arguments); + Assert.AreEqual( + "-c rebase.autoSquash=false rebase --committer-date-is-author-date --autostash \"branch\"", + GitCommandHelpers.RebaseCmd("branch", interactive: true, preserveMerges: true, autosquash: true, autoStash: true, ignoreDate: false, committerDateIsAuthorDate: true).Arguments); Assert.AreEqual( GitVersion.Current.SupportRebaseMerges ? "-c rebase.autoSquash=false rebase -i --autosquash --rebase-merges --autostash \"branch\"" : "-c rebase.autoSquash=false rebase -i --autosquash --preserve-merges --autostash \"branch\"", - GitCommandHelpers.RebaseCmd("branch", interactive: true, preserveMerges: true, autosquash: true, autoStash: true).Arguments); + GitCommandHelpers.RebaseCmd("branch", interactive: true, preserveMerges: true, autosquash: true, autoStash: true, ignoreDate: false, committerDateIsAuthorDate: false).Arguments); // TODO quote 'onto'? Assert.AreEqual( "-c rebase.autoSquash=false rebase \"from\" \"branch\" --onto onto", - GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: false, "from", "onto").Arguments); + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: false, ignoreDate: false, committerDateIsAuthorDate: false, "from", "onto").Arguments); + Assert.AreEqual( + "-c rebase.autoSquash=false rebase --ignore-date \"from\" \"branch\" --onto onto", + GitCommandHelpers.RebaseCmd("branch", interactive: false, preserveMerges: false, autosquash: false, autoStash: false, ignoreDate: true, committerDateIsAuthorDate: false, "from", "onto").Arguments); Assert.Throws( - () => GitCommandHelpers.RebaseCmd("branch", false, false, false, false, from: null, onto: "onto")); + () => GitCommandHelpers.RebaseCmd("branch", false, false, false, false, false, false, from: null, onto: "onto")); Assert.Throws( - () => GitCommandHelpers.RebaseCmd("branch", false, false, false, false, from: "from", onto: null)); + () => GitCommandHelpers.RebaseCmd("branch", false, false, false, false, false, false, from: "from", onto: null)); } [TestCase(CleanMode.OnlyNonIgnored, true, false, null, "clean --dry-run")]