From: Frank Li Date: Thu, 25 Dec 2008 09:11:03 +0000 (+0800) Subject: Add Patch Import Command (git am) X-Git-Url: http://git.sourceforge.jp/view?p=tortoisegit%2FTortoiseGitJp.git;a=commitdiff_plain;h=e1130385d0bec0c6fa5f5b7b99b32b6f70bf2a62 Add Patch Import Command (git am) --- diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 0ba5376..6b9d03b 100644 Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ diff --git a/src/TortoiseProc/Commands/Command.cpp b/src/TortoiseProc/Commands/Command.cpp index 162c62e..a9e6f34 100644 --- a/src/TortoiseProc/Commands/Command.cpp +++ b/src/TortoiseProc/Commands/Command.cpp @@ -44,6 +44,8 @@ #include "AddCommand.h" #include "IgnoreCommand.h" #include "FormatPatchCommand.h" +#include "ImportPatchCommand.h" + #if 0 @@ -121,6 +123,7 @@ typedef enum cmdHelp, cmdIgnore, cmdImport, + cmdImportPatch, cmdLock, cmdLog, cmdMerge, @@ -185,6 +188,7 @@ static const struct CommandInfo { cmdHelp, _T("help") }, { cmdIgnore, _T("ignore") }, { cmdImport, _T("import") }, + { cmdImportPatch, _T("importpatch") }, { cmdLock, _T("lock") }, { cmdLog, _T("log") }, { cmdMerge, _T("merge") }, @@ -284,6 +288,8 @@ Command * CommandServer::GetCommand(const CString& sCmd) return new IgnoreCommand; case cmdFormatPatch: return new FormatPatchCommand; + case cmdImportPatch: + return new ImportPatchCommand; #if 0 diff --git a/src/TortoiseProc/Commands/ImportPatchCommand.cpp b/src/TortoiseProc/Commands/ImportPatchCommand.cpp new file mode 100644 index 0000000..67b6570 --- /dev/null +++ b/src/TortoiseProc/Commands/ImportPatchCommand.cpp @@ -0,0 +1,49 @@ +// TortoiseSVN - a Windows shell extension for easy version control + +// Copyright (C) 2007-2008 - TortoiseSVN + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +#include "StdAfx.h" +#include "ImportPatchCommand.h" + +#include "MessageBox.h" +#include "ImportPatchDlg.h" +#include "InputLogDlg.h" +#include "Git.h" +#include "DirFileEnum.h" +#include "ShellUpdater.h" + +bool ImportPatchCommand::Execute() +{ + CImportPatchDlg dlg; +// dlg.m_bIsTag=TRUE; + CString cmd; + if(dlg.DoModal()==IDOK) + { + for(int i=0;iGetDlgItem(IDC_BUTTON_UP)->EnableWindow(FALSE); + this->GetDlgItem(IDC_BUTTON_DOWN)->EnableWindow(FALSE); + this->GetDlgItem(IDC_BUTTON_REMOVE)->EnableWindow(FALSE); + }else + { + this->GetDlgItem(IDC_BUTTON_UP)->EnableWindow(TRUE); + this->GetDlgItem(IDC_BUTTON_DOWN)->EnableWindow(TRUE); + this->GetDlgItem(IDC_BUTTON_REMOVE)->EnableWindow(TRUE); + + } + +} + +void CImportPatchDlg::OnBnClickedButtonAdd() +{ + + CFileDialog dlg(TRUE,NULL, + NULL, + OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT, + _T("Patch Files(*.patch)|*.patch|Diff Files(*.diff)|*.diff|All Files(*.*)|*.*||")); + if(dlg.DoModal()==IDOK) + { + POSITION pos; + pos=dlg.GetStartPosition(); + while(pos) + { + m_cList.InsertItem(0,dlg.GetNextPathName(pos)); + } + } + + // TODO: Add your control notification handler code here +} + +void CImportPatchDlg::OnBnClickedButtonUp() +{ + // TODO: Add your control notification handler code here + POSITION pos; + pos=m_cList.GetFirstSelectedItemPosition(); + while(pos) + { + int index=m_cList.GetNextSelectedItem(pos); + if(index>1) + { + CString old=m_cList.GetItemText(index,0); + m_cList.DeleteItem(index); + + m_cList.InsertItem(index-1,old); + } + } + +} + +void CImportPatchDlg::OnBnClickedButtonDown() +{ + // TODO: Add your control notification handler code here + POSITION pos; + pos=m_cList.GetFirstSelectedItemPosition(); + while(pos) + { + int index=m_cList.GetNextSelectedItem(pos); + + CString old=m_cList.GetItemText(index,0); + m_cList.DeleteItem(index); + + m_cList.InsertItem(index+1,old); + + } +} + +void CImportPatchDlg::OnBnClickedButtonRemove() +{ + // TODO: Add your control notification handler code here + POSITION pos; + pos=m_cList.GetFirstSelectedItemPosition(); + while(pos) + { + int index=m_cList.GetNextSelectedItem(pos); + m_cList.DeleteItem(index); + pos=m_cList.GetFirstSelectedItemPosition(); + } +} + +void CImportPatchDlg::OnBnClickedOk() +{ + // TODO: Add your control notification handler code here + int i; + for(int i=0;i + + + + + + + + diff --git a/src/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user b/src/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user index c0d2327..054e486 100644 --- a/src/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user +++ b/src/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user @@ -11,7 +11,7 @@