#include "AddCommand.h"\r
#include "IgnoreCommand.h"\r
#include "FormatPatchCommand.h"\r
+#include "ImportPatchCommand.h"\r
+\r
\r
#if 0\r
\r
cmdHelp,\r
cmdIgnore,\r
cmdImport,\r
+ cmdImportPatch,\r
cmdLock,\r
cmdLog,\r
cmdMerge,\r
{ cmdHelp, _T("help") },\r
{ cmdIgnore, _T("ignore") },\r
{ cmdImport, _T("import") },\r
+ { cmdImportPatch, _T("importpatch") },\r
{ cmdLock, _T("lock") },\r
{ cmdLog, _T("log") },\r
{ cmdMerge, _T("merge") },\r
return new IgnoreCommand;\r
case cmdFormatPatch:\r
return new FormatPatchCommand;\r
+ case cmdImportPatch:\r
+ return new ImportPatchCommand;\r
\r
#if 0\r
\r
--- /dev/null
+// TortoiseSVN - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2007-2008 - TortoiseSVN\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 "ImportPatchCommand.h"\r
+\r
+#include "MessageBox.h"\r
+#include "ImportPatchDlg.h"\r
+#include "InputLogDlg.h"\r
+#include "Git.h"\r
+#include "DirFileEnum.h"\r
+#include "ShellUpdater.h"\r
+\r
+bool ImportPatchCommand::Execute()\r
+{\r
+ CImportPatchDlg dlg;\r
+// dlg.m_bIsTag=TRUE;\r
+ CString cmd;\r
+ if(dlg.DoModal()==IDOK)\r
+ {\r
+ for(int i=0;i<dlg.m_PathList.GetCount();i++)\r
+ { \r
+ cmd.Format(_T("git.exe am \"%s\""),dlg.m_PathList[i].GetGitPathString());\r
+ CString output;\r
+ if(g_Git.Run(cmd,&output))\r
+ {\r
+ CMessageBox::Show(NULL,output,_T("TortoiseGit"),MB_OK);\r
+ return FALSE;\r
+ }\r
+ }\r
+ return TRUE;\r
+ }\r
+ return FALSE;\r
+}\r
--- /dev/null
+// TortoiseSVN - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2007 - TortoiseSVN\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
+/**\r
+ * \ingroup TortoiseProc\r
+ * Renames files and folders.\r
+ */\r
+class ImportPatchCommand : public Command\r
+{\r
+public:\r
+ /**\r
+ * Executes the command.\r
+ */\r
+ virtual bool Execute();\r
+};\r
+\r
+\r
--- /dev/null
+// ImportPatchDlg.cpp : implementation file\r
+//\r
+\r
+#include "stdafx.h"\r
+#include "TortoiseProc.h"\r
+#include "ImportPatchDlg.h"\r
+\r
+\r
+// CImportPatchDlg dialog\r
+\r
+IMPLEMENT_DYNAMIC(CImportPatchDlg, CResizableStandAloneDialog)\r
+\r
+CImportPatchDlg::CImportPatchDlg(CWnd* pParent /*=NULL*/)\r
+ : CResizableStandAloneDialog(CImportPatchDlg::IDD, pParent)\r
+{\r
+\r
+}\r
+\r
+CImportPatchDlg::~CImportPatchDlg()\r
+{\r
+\r
+}\r
+\r
+void CImportPatchDlg::DoDataExchange(CDataExchange* pDX)\r
+{\r
+ CDialog::DoDataExchange(pDX);\r
+ DDX_Control(pDX, IDC_LIST_PATCH,m_cList);\r
+}\r
+\r
+BOOL CImportPatchDlg::OnInitDialog()\r
+{\r
+ CResizableStandAloneDialog::OnInitDialog();\r
+\r
+ AddAnchor(IDC_LIST_PATCH, TOP_LEFT, BOTTOM_RIGHT);\r
+ AddAnchor(IDC_BUTTON_ADD, TOP_RIGHT);\r
+ AddAnchor(IDC_BUTTON_UP, TOP_RIGHT);\r
+ AddAnchor(IDC_BUTTON_DOWN, TOP_RIGHT);\r
+ AddAnchor(IDC_BUTTON_REMOVE, TOP_RIGHT);\r
+\r
+ AddAnchor(IDOK,BOTTOM_RIGHT);\r
+ AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
+\r
+\r
+ return TRUE;\r
+}\r
+\r
+BEGIN_MESSAGE_MAP(CImportPatchDlg, CResizableStandAloneDialog)\r
+ ON_LBN_SELCHANGE(IDC_LIST_PATCH, &CImportPatchDlg::OnLbnSelchangeListPatch)\r
+ ON_BN_CLICKED(IDC_BUTTON_ADD, &CImportPatchDlg::OnBnClickedButtonAdd)\r
+ ON_BN_CLICKED(IDC_BUTTON_UP, &CImportPatchDlg::OnBnClickedButtonUp)\r
+ ON_BN_CLICKED(IDC_BUTTON_DOWN, &CImportPatchDlg::OnBnClickedButtonDown)\r
+ ON_BN_CLICKED(IDC_BUTTON_REMOVE, &CImportPatchDlg::OnBnClickedButtonRemove)\r
+ ON_BN_CLICKED(IDOK, &CImportPatchDlg::OnBnClickedOk)\r
+END_MESSAGE_MAP()\r
+\r
+\r
+// CImportPatchDlg message handlers\r
+\r
+void CImportPatchDlg::OnLbnSelchangeListPatch()\r
+{\r
+ // TODO: Add your control notification handler code here\r
+ if(m_cList.GetSelectedCount() == 0)\r
+ {\r
+ this->GetDlgItem(IDC_BUTTON_UP)->EnableWindow(FALSE);\r
+ this->GetDlgItem(IDC_BUTTON_DOWN)->EnableWindow(FALSE);\r
+ this->GetDlgItem(IDC_BUTTON_REMOVE)->EnableWindow(FALSE);\r
+ }else\r
+ {\r
+ this->GetDlgItem(IDC_BUTTON_UP)->EnableWindow(TRUE);\r
+ this->GetDlgItem(IDC_BUTTON_DOWN)->EnableWindow(TRUE);\r
+ this->GetDlgItem(IDC_BUTTON_REMOVE)->EnableWindow(TRUE);\r
+\r
+ }\r
+\r
+}\r
+\r
+void CImportPatchDlg::OnBnClickedButtonAdd()\r
+{\r
+ \r
+ CFileDialog dlg(TRUE,NULL,\r
+ NULL,\r
+ OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT,\r
+ _T("Patch Files(*.patch)|*.patch|Diff Files(*.diff)|*.diff|All Files(*.*)|*.*||"));\r
+ if(dlg.DoModal()==IDOK)\r
+ {\r
+ POSITION pos;\r
+ pos=dlg.GetStartPosition();\r
+ while(pos)\r
+ {\r
+ m_cList.InsertItem(0,dlg.GetNextPathName(pos));\r
+ }\r
+ }\r
+\r
+ // TODO: Add your control notification handler code here\r
+}\r
+\r
+void CImportPatchDlg::OnBnClickedButtonUp()\r
+{\r
+ // TODO: Add your control notification handler code here\r
+ POSITION pos;\r
+ pos=m_cList.GetFirstSelectedItemPosition();\r
+ while(pos)\r
+ {\r
+ int index=m_cList.GetNextSelectedItem(pos);\r
+ if(index>1)\r
+ {\r
+ CString old=m_cList.GetItemText(index,0);\r
+ m_cList.DeleteItem(index);\r
+\r
+ m_cList.InsertItem(index-1,old);\r
+ }\r
+ }\r
+\r
+}\r
+\r
+void CImportPatchDlg::OnBnClickedButtonDown()\r
+{\r
+ // TODO: Add your control notification handler code here\r
+ POSITION pos;\r
+ pos=m_cList.GetFirstSelectedItemPosition();\r
+ while(pos)\r
+ {\r
+ int index=m_cList.GetNextSelectedItem(pos);\r
+ \r
+ CString old=m_cList.GetItemText(index,0);\r
+ m_cList.DeleteItem(index);\r
+\r
+ m_cList.InsertItem(index+1,old);\r
+ \r
+ }\r
+}\r
+\r
+void CImportPatchDlg::OnBnClickedButtonRemove()\r
+{\r
+ // TODO: Add your control notification handler code here\r
+ POSITION pos;\r
+ pos=m_cList.GetFirstSelectedItemPosition();\r
+ while(pos)\r
+ {\r
+ int index=m_cList.GetNextSelectedItem(pos);\r
+ m_cList.DeleteItem(index);\r
+ pos=m_cList.GetFirstSelectedItemPosition();\r
+ }\r
+}\r
+\r
+void CImportPatchDlg::OnBnClickedOk()\r
+{\r
+ // TODO: Add your control notification handler code here\r
+ int i;\r
+ for(int i=0;i<m_cList.GetItemCount();i++)\r
+ {\r
+ CTGitPath path;\r
+ path.SetFromWin(m_cList.GetItemText(i,0));\r
+ m_PathList.AddPath(path);\r
+ }\r
+ OnOK();\r
+}\r
--- /dev/null
+#pragma once\r
+\r
+#include "StandAloneDlg.h"\r
+// CImportPatchDlg dialog\r
+#include "TGitPath.h"\r
+\r
+class CImportPatchDlg : public CResizableStandAloneDialog\r
+{\r
+ DECLARE_DYNAMIC(CImportPatchDlg)\r
+\r
+public:\r
+ CImportPatchDlg(CWnd* pParent = NULL); // standard constructor\r
+ virtual ~CImportPatchDlg();\r
+\r
+// Dialog Data\r
+ enum { IDD = IDD_APPLY_PATCH_LIST };\r
+\r
+protected:\r
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support\r
+ virtual BOOL OnInitDialog();\r
+\r
+ CListCtrl m_cList;\r
+ DECLARE_MESSAGE_MAP()\r
+public:\r
+ afx_msg void OnLbnSelchangeListPatch();\r
+ afx_msg void OnBnClickedButtonAdd();\r
+ afx_msg void OnBnClickedButtonUp();\r
+ afx_msg void OnBnClickedButtonDown();\r
+ afx_msg void OnBnClickedButtonRemove();\r
+ afx_msg void OnBnClickedOk();\r
+\r
+ CTGitPathList m_PathList;\r
+};\r
RelativePath=".\Commands\FormatPatchCommand.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath=".\Commands\ImportPatchCommand.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\Commands\ImportPatchCommand.h"\r
+ >\r
+ </File>\r
</Filter>\r
</Filter>\r
<Filter\r
>\r
</File>\r
<File\r
+ RelativePath=".\ImportPatchDlg.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\ImportPatchDlg.h"\r
+ >\r
+ </File>\r
+ <File\r
RelativePath=".\MergeDlg.cpp"\r
>\r
</File>\r
<DebugSettings\r
Command="$(TargetPath)"\r
WorkingDirectory="D:\Profiles\b20596\tortoisegit"\r
- CommandArguments="/command:formatpatch /path:"D:\\Profiles\\b20596\\buildtest\\TortoiseGit""\r
+ CommandArguments="/command:importpatch /path:"D:\\Profiles\\b20596\\buildtest\\TortoiseGit""\r
Attach="false"\r
DebuggerType="3"\r
Remote="1"\r