#include "StdAfx.h"\r
#include "DropMoveCommand.h"\r
\r
-#include "ProgressDlg.h"\r
+#include "SysProgressDlg.h"\r
#include "MessageBox.h"\r
-#include "SVN.h"\r
+#include "Git.h"\r
#include "RenameDlg.h"\r
#include "ShellUpdater.h"\r
+#include "commonresource.h"\r
\r
bool DropMoveCommand::Execute()\r
{\r
CString droppath = parser.GetVal(_T("droptarget"));\r
- if (CTSVNPath(droppath).IsAdminDir())\r
+ CString ProjectTop;\r
+ if (CTGitPath(droppath).HasAdminDir(&ProjectTop))\r
return FALSE;\r
- SVN svn;\r
+ \r
+ if (ProjectTop != g_Git.m_CurrentDir )\r
+ {\r
+ CMessageBox::Show(NULL,_T("Target and source must be the same git repository"),_T("TortoiseGit"),MB_OK);\r
+ return FALSE;\r
+ }\r
+\r
+ droppath.Right(droppath.GetLength()-ProjectTop.GetLength()-1);\r
+\r
unsigned long count = 0;\r
pathList.RemoveAdminPaths();\r
CString sNewName;\r
+\r
if ((parser.HasKey(_T("rename")))&&(pathList.GetCount()==1))\r
{\r
// ask for a new name of the source item\r
sNewName = renDlg.m_name;\r
} while(sNewName.IsEmpty() || PathFileExists(droppath+_T("\\")+sNewName));\r
}\r
- CProgressDlg progress;\r
+ CSysProgressDlg progress;\r
if (progress.IsValid())\r
{\r
progress.SetTitle(IDS_PROC_MOVING);\r
}\r
for(int nPath = 0; nPath < pathList.GetCount(); nPath++)\r
{\r
- CTSVNPath destPath;\r
+ CTGitPath destPath;\r
if (sNewName.IsEmpty())\r
- destPath = CTSVNPath(droppath+_T("\\")+pathList[nPath].GetFileOrDirectoryName());\r
+ destPath = CTGitPath(droppath+_T("\\")+pathList[nPath].GetFileOrDirectoryName());\r
else\r
- destPath = CTSVNPath(droppath+_T("\\")+sNewName);\r
+ destPath = CTGitPath(droppath+_T("\\")+sNewName);\r
if (destPath.Exists())\r
{\r
CString name = pathList[nPath].GetFileOrDirectoryName();\r
}\r
destPath.SetFromWin(droppath+_T("\\")+dlg.m_name);\r
} \r
- if (!svn.Move(CTSVNPathList(pathList[nPath]), destPath, FALSE))\r
+ CString cmd,out;\r
+ \r
+ cmd.Format(_T("git.exe mv \"%s\" \"%s\""),pathList[nPath].GetGitPathString(),destPath.GetGitPathString());\r
+ if(g_Git.Run(cmd,&out,CP_OEMCP))\r
{\r
- if (svn.Err && (svn.Err->apr_err == SVN_ERR_UNVERSIONED_RESOURCE ||\r
- svn.Err->apr_err == SVN_ERR_CLIENT_MODIFIED))\r
+ if (CMessageBox::Show(hwndExplorer, out, _T("TortoiseGit"), MB_YESNO)==IDYES)\r
{\r
- // file/folder seems to have local modifications. Ask the user if\r
- // a force is requested.\r
- CString temp = svn.GetLastErrorMessage();\r
- CString sQuestion(MAKEINTRESOURCE(IDS_PROC_FORCEMOVE));\r
- temp += _T("\n") + sQuestion;\r
- if (CMessageBox::Show(hwndExplorer, temp, _T("TortoiseSVN"), MB_YESNO)==IDYES)\r
- {\r
+#if 0\r
if (!svn.Move(CTSVNPathList(pathList[nPath]), destPath, TRUE))\r
{\r
CMessageBox::Show(hwndExplorer, svn.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR);\r
return FALSE; //get out of here\r
}\r
CShellUpdater::Instance().AddPathForUpdate(destPath);\r
- }\r
+#endif\r
}\r
else\r
{\r
- TRACE(_T("%s\n"), (LPCTSTR)svn.GetLastErrorMessage());\r
- CMessageBox::Show(hwndExplorer, svn.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR);\r
+ //TRACE(_T("%s\n"), (LPCTSTR)svn.GetLastErrorMessage());\r
+ CMessageBox::Show(hwndExplorer, _T("Cancel"), _T("TortoiseGit"), MB_ICONERROR);\r
return FALSE; //get out of here\r
}\r
} \r