OSDN Git Service

Add missed stash file. Support save and applied
authorFrank Li <lznuaa@gmail.com>
Thu, 12 Mar 2009 15:19:57 +0000 (23:19 +0800)
committerFrank Li <lznuaa@gmail.com>
Thu, 12 Mar 2009 15:19:57 +0000 (23:19 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/Commands/StashCommand.cpp [new file with mode: 0644]
src/TortoiseProc/Commands/StashCommand.h [new file with mode: 0644]

diff --git a/src/TortoiseProc/Commands/StashCommand.cpp b/src/TortoiseProc/Commands/StashCommand.cpp
new file mode 100644 (file)
index 0000000..fb97f54
--- /dev/null
@@ -0,0 +1,71 @@
+// TortoiseGit - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2008-2009 - TortoiseGit\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+#include "StdAfx.h"\r
+#include "StashCommand.h"\r
+\r
+#include "MessageBox.h"\r
+#include "RenameDlg.h"\r
+#include "InputLogDlg.h"\r
+#include "Git.h"\r
+#include "DirFileEnum.h"\r
+#include "ShellUpdater.h"\r
+#include "ChangedDlg.h"\r
+\r
+bool StashSaveCommand::Execute()\r
+{\r
+       bool bRet = false;\r
+\r
+       CString cmd,out;\r
+       cmd=_T("git.exe stash");\r
+       \r
+       if(g_Git.Run(cmd,&out,CP_ACP))\r
+       {\r
+               CMessageBox::Show(NULL,CString(_T("<ct=0x0000FF>Stash Fail!!!</ct>\n"))+out,_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+       }else\r
+       {\r
+               CMessageBox::Show(NULL,CString(_T("<ct=0xff0000>Stash Success</ct>\n"))+out,_T("TortoiseGit"),MB_OK|MB_ICONINFORMATION);\r
+               bRet = true;\r
+       }\r
+       return bRet;\r
+}\r
+\r
+bool StashApplyCommand::Execute()\r
+{\r
+       bool bRet = false;\r
+\r
+       CString cmd,out;\r
+       cmd=_T("git.exe stash apply");\r
+       \r
+       if(g_Git.Run(cmd,&out,CP_ACP))\r
+       {\r
+               CMessageBox::Show(NULL,CString(_T("<ct=0x0000FF>Stash Apply Fail!!!</ct>\n"))+out,_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+\r
+       }else\r
+       {\r
+               if(CMessageBox::Show(NULL,CString(_T("<ct=0xff0000>Stash Apply Success</ct>\nDo you want to show change?"))\r
+                       ,_T("TortoiseGit"),MB_YESNO|MB_ICONINFORMATION) == IDYES)\r
+               {\r
+                       CChangedDlg dlg;\r
+                       dlg.m_pathList = pathList;\r
+                       dlg.DoModal();                  \r
+               }\r
+               bRet = true;\r
+       }\r
+       return bRet;\r
+}\r
diff --git a/src/TortoiseProc/Commands/StashCommand.h b/src/TortoiseProc/Commands/StashCommand.h
new file mode 100644 (file)
index 0000000..02dec58
--- /dev/null
@@ -0,0 +1,40 @@
+// TortoiseGit - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2009 - TortoiseGit\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+#pragma once\r
+#include "Command.h"\r
+\r
+class StashSaveCommand : public Command\r
+{\r
+public:\r
+       /**\r
+        * Executes the command.\r
+        */\r
+       virtual bool                    Execute();\r
+};\r
+\r
+class StashApplyCommand : public Command\r
+{\r
+public:\r
+       /**\r
+        * Executes the command.\r
+        */\r
+       virtual bool                    Execute();\r
+};\r
+\r
+\r