Browse Source

Fixed open working dir with spaces from VS and shell extensions and added reset file

pull/198/head
Henk Westhuis 17 years ago
parent
commit
af2b176173
  1. 52
      GitCommands/GitCommands/Git/GitCommands.cs
  2. 6
      GitCommands/GitCommands/GitCommands.csproj
  3. BIN
      GitPlugin/Connect.cs
  4. 2
      GitUI/AboutBox.Designer.cs
  5. 72
      GitUI/Commit.Designer.cs
  6. 30
      GitUI/Commit.cs
  7. 3
      GitUI/Commit.resx
  8. 2
      GitUI/FormPull.cs
  9. 1
      GitUI/FormPush.Designer.cs
  10. 5
      GitUI/FormPush.cs
  11. 2
      GitUI/MergePatch.cs
  12. 2
      SimpleExt/ReleaseMinDependency/mt.dep
  13. BIN
      SimpleExt/ReleaseMinDependency/vc90.idb
  14. 2
      SimpleExt/SimpleExt.h
  15. 3
      SimpleExt/SimpleShlExt.cpp

52
GitCommands/GitCommands/Git/GitCommands.cs

@ -392,20 +392,56 @@ namespace GitCommands
static public string ResetSoft(string commit)
{
return RunCmd(Settings.GitDir + "git.cmd", "reset --soft \"" + commit + "\"");
return ResetSoft(commit, "");
}
static public string ResetMixed(string commit)
{
return RunCmd(Settings.GitDir + "git.cmd", "reset --mixed \"" + commit + "\"");
return ResetMixed(commit, "");
}
static public string ResetHard(string commit)
{
if (string.IsNullOrEmpty(commit))
return RunCmd(Settings.GitDir + "git.cmd", "reset --hard");
else
return RunCmd(Settings.GitDir + "git.cmd", "reset --hard \"" + commit + "\"");
return ResetHard(commit, "");
}
static public string ResetSoft(string commit, string file)
{
string args = "reset --soft";
if (!string.IsNullOrEmpty(commit))
args += " \"" + commit + "\"";
if (!string.IsNullOrEmpty(file))
args += " -- \"" + file + "\"";
return RunCmd(Settings.GitDir + "git.cmd", args);
}
static public string ResetMixed(string commit, string file)
{
string args = "reset --mixed";
if (!string.IsNullOrEmpty(commit))
args += " \"" + commit + "\"";
if (!string.IsNullOrEmpty(file))
args += " -- \"" + file + "\"";
return RunCmd(Settings.GitDir + "git.cmd", args);
}
static public string ResetHard(string commit, string file)
{
string args = "reset --hard";
if (!string.IsNullOrEmpty(commit))
args += " \"" + commit + "\"";
if (!string.IsNullOrEmpty(file))
args += " -- \"" + file + "\"";
return RunCmd(Settings.GitDir + "git.cmd", args);
}
static public string ResetSoftCmd(string commit)
@ -423,6 +459,10 @@ namespace GitCommands
return "reset --hard \"" + commit + "\"";
}
static public string ResetFile(string file)
{
return RunCmd(Settings.GitDir + "git.cmd", "checkout-index --index --force -- \"" + file + "\"");
}
public string FormatPatch(string from, string to, string output)

6
GitCommands/GitCommands/GitCommands.csproj

@ -38,12 +38,6 @@
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>

BIN
GitPlugin/Connect.cs

2
GitUI/AboutBox.Designer.cs

@ -116,7 +116,7 @@
this.labelVersion.Name = "labelVersion";
this.labelVersion.Size = new System.Drawing.Size(271, 17);
this.labelVersion.TabIndex = 0;
this.labelVersion.Text = "Version 1.09";
this.labelVersion.Text = "Version 1.10";
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.labelVersion.Click += new System.EventHandler(this.labelVersion_Click);
//

72
GitUI/Commit.Designer.cs

@ -36,16 +36,15 @@
this.label2 = new System.Windows.Forms.Label();
this.Loading = new System.Windows.Forms.PictureBox();
this.Unstaged = new System.Windows.Forms.DataGridView();
this.nameDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ChangeString = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.gitItemStatusBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.splitContainer5 = new System.Windows.Forms.SplitContainer();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.UnstageFiles = new System.Windows.Forms.Button();
this.UnstagedFileContext = new System.Windows.Forms.ContextMenuStrip(this.components);
this.ResetChanges = new System.Windows.Forms.ToolStripMenuItem();
this.AddFiles = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.Staged = new System.Windows.Forms.DataGridView();
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ChangeString2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Ok = new System.Windows.Forms.Button();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
@ -61,6 +60,9 @@
this.label1 = new System.Windows.Forms.Label();
this.Message = new System.Windows.Forms.RichTextBox();
this.OutPut = new System.Windows.Forms.RichTextBox();
this.nameDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.gitItemStatusBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
@ -72,10 +74,10 @@
this.splitContainer4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Loading)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Unstaged)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gitItemStatusBindingSource)).BeginInit();
this.splitContainer5.Panel1.SuspendLayout();
this.splitContainer5.Panel2.SuspendLayout();
this.splitContainer5.SuspendLayout();
this.UnstagedFileContext.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Staged)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
@ -89,6 +91,7 @@
this.splitContainer8.Panel1.SuspendLayout();
this.splitContainer8.Panel2.SuspendLayout();
this.splitContainer8.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gitItemStatusBindingSource)).BeginInit();
this.SuspendLayout();
//
// splitContainer1
@ -179,6 +182,7 @@
this.Unstaged.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.nameDataGridViewTextBoxColumn1,
this.ChangeString});
this.Unstaged.ContextMenuStrip = this.UnstagedFileContext;
this.Unstaged.DataSource = this.gitItemStatusBindingSource;
this.Unstaged.Dock = System.Windows.Forms.DockStyle.Fill;
this.Unstaged.Location = new System.Drawing.Point(0, 0);
@ -188,17 +192,10 @@
this.Unstaged.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.Unstaged.Size = new System.Drawing.Size(389, 277);
this.Unstaged.TabIndex = 0;
this.Unstaged.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.Unstaged_CellMouseDown);
this.Unstaged.SelectionChanged += new System.EventHandler(this.Untracked_SelectionChanged);
this.Unstaged.Click += new System.EventHandler(this.Unstaged_Click);
//
// nameDataGridViewTextBoxColumn1
//
this.nameDataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.nameDataGridViewTextBoxColumn1.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn1.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn1.Name = "nameDataGridViewTextBoxColumn1";
this.nameDataGridViewTextBoxColumn1.ReadOnly = true;
//
// ChangeString
//
this.ChangeString.DataPropertyName = "ChangeString";
@ -206,10 +203,6 @@
this.ChangeString.Name = "ChangeString";
this.ChangeString.ReadOnly = true;
//
// gitItemStatusBindingSource
//
this.gitItemStatusBindingSource.DataSource = typeof(GitCommands.GitItemStatus);
//
// splitContainer5
//
this.splitContainer5.Dock = System.Windows.Forms.DockStyle.Fill;
@ -253,6 +246,20 @@
this.UnstageFiles.UseVisualStyleBackColor = true;
this.UnstageFiles.Click += new System.EventHandler(this.UnstageFiles_Click);
//
// UnstagedFileContext
//
this.UnstagedFileContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ResetChanges});
this.UnstagedFileContext.Name = "UnstagedFileContext";
this.UnstagedFileContext.Size = new System.Drawing.Size(153, 48);
//
// ResetChanges
//
this.ResetChanges.Name = "ResetChanges";
this.ResetChanges.Size = new System.Drawing.Size(152, 22);
this.ResetChanges.Text = "Reset changes";
this.ResetChanges.Click += new System.EventHandler(this.ResetSoft_Click);
//
// AddFiles
//
this.AddFiles.Image = global::GitUI.Properties.Resources._4;
@ -297,14 +304,6 @@
this.Staged.SelectionChanged += new System.EventHandler(this.Tracked_SelectionChanged);
this.Staged.Click += new System.EventHandler(this.Staged_Click);
//
// nameDataGridViewTextBoxColumn
//
this.nameDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
//
// ChangeString2
//
this.ChangeString2.DataPropertyName = "ChangeString";
@ -487,6 +486,26 @@
this.OutPut.TabIndex = 0;
this.OutPut.Text = "";
//
// nameDataGridViewTextBoxColumn1
//
this.nameDataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.nameDataGridViewTextBoxColumn1.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn1.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn1.Name = "nameDataGridViewTextBoxColumn1";
this.nameDataGridViewTextBoxColumn1.ReadOnly = true;
//
// gitItemStatusBindingSource
//
this.gitItemStatusBindingSource.DataSource = typeof(GitCommands.GitItemStatus);
//
// nameDataGridViewTextBoxColumn
//
this.nameDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
//
// FormCommit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -509,11 +528,11 @@
this.splitContainer4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Loading)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.Unstaged)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gitItemStatusBindingSource)).EndInit();
this.splitContainer5.Panel1.ResumeLayout(false);
this.splitContainer5.Panel1.PerformLayout();
this.splitContainer5.Panel2.ResumeLayout(false);
this.splitContainer5.ResumeLayout(false);
this.UnstagedFileContext.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Staged)).EndInit();
this.splitContainer3.Panel1.ResumeLayout(false);
this.splitContainer3.Panel2.ResumeLayout(false);
@ -528,6 +547,7 @@
this.splitContainer8.Panel1.PerformLayout();
this.splitContainer8.Panel2.ResumeLayout(false);
this.splitContainer8.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gitItemStatusBindingSource)).EndInit();
this.ResumeLayout(false);
}
@ -567,5 +587,7 @@
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn ChangeString2;
private System.Windows.Forms.ContextMenuStrip UnstagedFileContext;
private System.Windows.Forms.ToolStripMenuItem ResetChanges;
}
}

30
GitUI/Commit.cs

@ -26,6 +26,7 @@ namespace GitUI
private void FormCommit_Load(object sender, EventArgs e)
{
Initialize();
this.Text = "Commit (" + GitCommands.Settings.WorkingDir + ")";
}
GitCommands.GitCommands gitGetUnstagedCommand = new GitCommands.GitCommands();
@ -247,5 +248,34 @@ namespace GitUI
DoCommit(true);
}
}
private void ResetSoft_Click(object sender, EventArgs e)
{
if (Unstaged.Rows.Count > LastRow && LastRow >= 0 && MessageBox.Show("Are you sure you want to reset the changes of this?", "Reset", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
GitItemStatus item = (GitItemStatus)Unstaged.Rows[LastRow].DataBoundItem;
string output = GitCommands.GitCommands.ResetFile(item.Name);
if (!string.IsNullOrEmpty(output))
MessageBox.Show(output, "Reset changes");
Initialize();
}
}
int LastRow;
private void Unstaged_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
System.Drawing.Point pt = Unstaged.PointToClient(Cursor.Position);
DataGridView.HitTestInfo hti = Unstaged.HitTest(pt.X, pt.Y);
LastRow = hti.RowIndex;
Unstaged.ClearSelection();
if (LastRow >= 0 && Unstaged.Rows.Count > LastRow)
Unstaged.Rows[LastRow].Selected = true;
}
}
}
}

3
GitUI/Commit.resx

@ -120,6 +120,9 @@
<metadata name="ChangeString.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="UnstagedFileContext.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>220, 17</value>
</metadata>
<metadata name="gitItemStatusBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>

2
GitUI/FormPull.cs

@ -94,7 +94,7 @@ namespace GitUI
private void FormPull_Load(object sender, EventArgs e)
{
this.Text = "Pull (" + GitCommands.Settings.WorkingDir + ")";
}
private void PullSource_DrawItem(object sender, DrawItemEventArgs e)

1
GitUI/FormPush.Designer.cs

@ -142,6 +142,7 @@
this.Name = "FormPush";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Push";
this.Load += new System.EventHandler(this.FormPush_Load);
this.ResumeLayout(false);
this.PerformLayout();

5
GitUI/FormPush.cs

@ -72,5 +72,10 @@ namespace GitUI
{
new FormPull().ShowDialog();
}
private void FormPush_Load(object sender, EventArgs e)
{
this.Text = "Push (" + GitCommands.Settings.WorkingDir + ")";
}
}
}

2
GitUI/MergePatch.cs

@ -129,7 +129,7 @@ namespace GitUI
private void MergePatch_Load(object sender, EventArgs e)
{
this.Text = "Apply patch (" + GitCommands.Settings.WorkingDir + ")";
}
private void MergePatch_FormClosing(object sender, FormClosingEventArgs e)

2
SimpleExt/ReleaseMinDependency/mt.dep

@ -1 +1 @@
Manifest resource last updated at 20:03:09,47 on wo 07-01-2009
Manifest resource last updated at 17:50:09,66 on do 08-01-2009

BIN
SimpleExt/ReleaseMinDependency/vc90.idb

2
SimpleExt/SimpleExt.h

@ -4,7 +4,7 @@
/* File created by MIDL compiler version 7.00.0500 */
/* at Wed Jan 07 20:03:04 2009
/* at Thu Jan 08 17:50:02 2009
*/
/* Compiler settings for .\SimpleExt.idl:
Oicf, W1, Zp8, env=Win32 (32b run)

3
SimpleExt/SimpleShlExt.cpp

@ -164,8 +164,9 @@ void CSimpleShlExt::RunGitEx(const char * command)
CString args;
args += command;
args += " ";
args += " \"";
args += m_szFile;
args += "\"";
CString dir = GetRegistryValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\GitExtensions", "InstallDir");

Loading…
Cancel
Save