OSDN Git Service

Add Pull Push Fetch Clone Dialog
authorFrank Li <lznuaa@gmail.com>
Mon, 22 Dec 2008 14:56:10 +0000 (22:56 +0800)
committerFrank Li <lznuaa@gmail.com>
Mon, 22 Dec 2008 14:56:10 +0000 (22:56 +0800)
20 files changed:
src/Git/Git.cpp
src/Git/Git.h
src/Git/GitAdminDir.cpp
src/Git/TGitPath.cpp
src/Resources/TortoiseProcENG.rc
src/TortoiseGit.sln
src/TortoiseProc/Commands/Command.cpp
src/TortoiseProc/Commands/FetchCommand.cpp [new file with mode: 0644]
src/TortoiseProc/Commands/FetchCommand.h [new file with mode: 0644]
src/TortoiseProc/Commands/PullCommand.cpp [new file with mode: 0644]
src/TortoiseProc/Commands/PullCommand.h [new file with mode: 0644]
src/TortoiseProc/Commands/PushCommand.cpp [new file with mode: 0644]
src/TortoiseProc/Commands/PushCommand.h [new file with mode: 0644]
src/TortoiseProc/PullFetchDlg.cpp [new file with mode: 0644]
src/TortoiseProc/PullFetchDlg.h [new file with mode: 0644]
src/TortoiseProc/PushDlg.cpp [new file with mode: 0644]
src/TortoiseProc/PushDlg.h [new file with mode: 0644]
src/TortoiseProc/TortoiseProc.vcproj
src/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user
src/TortoiseProc/resource.h

index fd69d74..369b42b 100644 (file)
@@ -243,4 +243,55 @@ git_revnum_t CGit::GetHash(CString &friendname)
        if(pos>0)\r
                return out.Left(pos);\r
        return out;\r
+}\r
+\r
+int CGit::GetBranchList(CStringList &list,int *current)\r
+{\r
+       int ret;\r
+       CString cmd,output;\r
+       cmd=_T("git.exe branch");\r
+       int i=0;\r
+       ret=g_Git.Run(cmd,&output);\r
+       if(!ret)\r
+       {               \r
+               int pos=0;\r
+               CString one;\r
+               while( pos>=0 )\r
+               {\r
+                       i++;\r
+                       one=output.Tokenize(_T("\n"),pos);\r
+                       list.AddTail(one.Right(one.GetLength()-2));\r
+                       if(one[0] == _T('*'))\r
+                               if(current)\r
+                                       *current=i;\r
+               }\r
+       }\r
+       return ret;\r
+}\r
+\r
+int CGit::GetRemoteList(CStringList &list)\r
+{\r
+       int ret;\r
+       CString cmd,output;\r
+       cmd=_T("git.exe config  --get-regexp remote.*.url");\r
+       ret=g_Git.Run(cmd,&output);\r
+       if(!ret)\r
+       {\r
+               int pos=0;\r
+               CString one;\r
+               while( pos>=0 )\r
+               {\r
+                       one=output.Tokenize(_T("\n"),pos);\r
+                       int start=one.Find(_T("."),0);\r
+                       if(start>0)\r
+                       {\r
+                               CString url;\r
+                               url=one.Right(one.GetLength()-start-1);\r
+                               one=url;\r
+                               one=one.Left(one.Find(_T("."),0));\r
+                               list.AddTail(one);\r
+                       }\r
+               }\r
+       }\r
+       return ret;\r
 }
\ No newline at end of file
index ba93ccb..1595a83 100644 (file)
@@ -29,6 +29,10 @@ public:
                return m_GitDir.HasAdminDir(path,&m_CurrentDir);\r
        }\r
        CString m_CurrentDir;\r
+\r
+\r
+       int GetRemoteList(CStringList &list);\r
+       int GetBranchList(CStringList &list, int *Current);\r
        \r
        int GetLog(CString& logOut);\r
        git_revnum_t GetHash(CString &friendname);\r
index d050f77..1f6ddcc 100644 (file)
@@ -88,6 +88,7 @@ bool GitAdminDir::HasAdminDir(const CString& path) const
 \r
 bool GitAdminDir::HasAdminDir(const CString& path,CString *ProjectTopDir) const\r
 {\r
+       bool b=PathIsDirectory(path);\r
        return HasAdminDir(path, !!PathIsDirectory(path),ProjectTopDir);\r
 }\r
 \r
index 0515bb7..319e17e 100644 (file)
@@ -830,6 +830,7 @@ int CTGitPathList::FillUnRev(int action,CTGitPathList *list)
        for(int i=0;i<count;i++)\r
        {       \r
                CString cmd;\r
+               pos=0;\r
                \r
                CString ignored;\r
                if(action & CTGitPath::LOGACTIONS_IGNORE)\r
index 330aecc..187b5e9 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
index 08192a3..dcacb33 100644 (file)
@@ -37,6 +37,9 @@ EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wrap", "Wrap\Wrap.vcproj", "{F5ACFF87-241F-4F93-BD5B-444B47A20ED7}"\r
 EndProject\r
 Global\r
+       GlobalSection(TestCaseManagementSettings) = postSolution\r
+               CategoryFile = TortoiseGit.vsmdi\r
+       EndGlobalSection\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
                debug_static|Mixed Platforms = debug_static|Mixed Platforms\r
                debug_static|Win32 = debug_static|Win32\r
index cdd9d7d..b53e972 100644 (file)
@@ -33,6 +33,9 @@
 \r
 #include "RevertCommand.h"\r
 #include "RemoveCommand.h"\r
+#include "PullCommand.h"\r
+#include "FetchCommand.h"\r
+#include "PushCommand.h"\r
 \r
 #if 0\r
 #include "AddCommand.h"\r
@@ -103,6 +106,7 @@ typedef enum
        cmdDropCopyAdd,\r
        cmdDropExport,\r
        cmdDropMove,\r
+       cmdFetch,\r
        cmdExport,\r
        cmdHelp,\r
        cmdIgnore,\r
@@ -115,6 +119,8 @@ typedef enum
        cmdPasteMove,\r
        cmdPrevDiff,\r
        cmdProperties,\r
+       cmdPull,\r
+       cmdPush,\r
        cmdRTFM,\r
        cmdRebuildIconCache,\r
        cmdRelocate,\r
@@ -161,6 +167,7 @@ static const struct CommandInfo
        {       cmdDropCopyAdd,         _T("dropcopyadd")               },\r
        {       cmdDropExport,          _T("dropexport")                },\r
        {       cmdDropMove,            _T("dropmove")                  },\r
+       {       cmdFetch,                       _T("fetch")                             },\r
        {       cmdExport,                      _T("export")                    },\r
        {       cmdHelp,                        _T("help")                              },\r
        {       cmdIgnore,                      _T("ignore")                    },\r
@@ -173,6 +180,8 @@ static const struct CommandInfo
        {       cmdPasteMove,           _T("pastemove")                 },\r
        {       cmdPrevDiff,            _T("prevdiff")                  },\r
        {       cmdProperties,          _T("properties")                },\r
+       {       cmdPull,                        _T("pull")                              },\r
+       {       cmdPush,                        _T("push")                              },\r
        {       cmdRTFM,                        _T("rtfm")                              },\r
        {       cmdRebuildIconCache,_T("rebuildiconcache")      },\r
        {       cmdRelocate,            _T("relocate")                  },\r
@@ -239,6 +248,12 @@ Command * CommandServer::GetCommand(const CString& sCmd)
                return new RemoveCommand;\r
        case cmdRevert:\r
                return new RevertCommand;\r
+       case cmdPull:\r
+               return new PullCommand;\r
+       case cmdFetch:\r
+               return new FetchCommand;\r
+       case cmdPush:\r
+               return new PushCommand;\r
 #if 0\r
        case cmdAdd:\r
                return new AddCommand;\r
diff --git a/src/TortoiseProc/Commands/FetchCommand.cpp b/src/TortoiseProc/Commands/FetchCommand.cpp
new file mode 100644 (file)
index 0000000..130716a
--- /dev/null
@@ -0,0 +1,62 @@
+// 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 "PullCommand.h"\r
+\r
+//#include "SVNProgressDlg.h"\r
+#include "StringUtils.h"\r
+#include "Hooks.h"\r
+#include "MessageBox.h"\r
+#include "PullFetchDlg.h"\r
+#include "ProgressDlg.h"\r
+\r
+bool PullCommand::Execute()\r
+{\r
+       CPullFetchDlg dlg;\r
+       if(dlg.DoModal()==IDOK)\r
+       {\r
+               CString url;\r
+               url=dlg.m_RemoteURL;\r
+               CString cmd;\r
+               cmd.Format(_T("git.exe pull \"%s\""),url);\r
+               CProgressDlg progress;\r
+               progress.m_GitCmd=cmd;\r
+               if(progress.DoModal()==IDOK)\r
+                       return TRUE;\r
+       }\r
+#if 0\r
+       CCloneDlg dlg;\r
+       dlg.m_Directory=this->orgCmdLinePath.GetWinPathString();\r
+       if(dlg.DoModal()==IDOK)\r
+       {\r
+               CString dir=dlg.m_Directory;\r
+               CString url=dlg.m_URL;\r
+               CString cmd;\r
+               cmd.Format(_T("git.exe clone %s %s"),\r
+                                               url,\r
+                                               dir);\r
+               CProgressDlg progress;\r
+               progress.m_GitCmd=cmd;\r
+               if(progress.DoModal()==IDOK)\r
+                       return TRUE;\r
+               \r
+       }\r
+#endif\r
+       return FALSE;\r
+}\r
diff --git a/src/TortoiseProc/Commands/FetchCommand.h b/src/TortoiseProc/Commands/FetchCommand.h
new file mode 100644 (file)
index 0000000..10f35ba
--- /dev/null
@@ -0,0 +1,38 @@
+// 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
+#pragma once\r
+#include "Command.h"\r
+\r
+#include "MessageBox.h"\r
+\r
+#include "git.h"\r
+/**\r
+ * \ingroup TortoiseProc\r
+ * Creates a repository\r
+ */\r
+class FetchCommand : public Command\r
+{\r
+public:\r
+       /**\r
+        * Executes the command.\r
+        */\r
+       virtual bool                    Execute();\r
+};\r
+\r
+\r
diff --git a/src/TortoiseProc/Commands/PullCommand.cpp b/src/TortoiseProc/Commands/PullCommand.cpp
new file mode 100644 (file)
index 0000000..c41e2ec
--- /dev/null
@@ -0,0 +1,62 @@
+// 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 "FetchCommand.h"\r
+\r
+//#include "SVNProgressDlg.h"\r
+#include "StringUtils.h"\r
+#include "Hooks.h"\r
+#include "MessageBox.h"\r
+#include "PullFetchDlg.h"\r
+#include "ProgressDlg.h"\r
+\r
+bool FetchCommand::Execute()\r
+{\r
+       CPullFetchDlg dlg;\r
+       if(dlg.DoModal()==IDOK)\r
+       {\r
+               CString url;\r
+               url=dlg.m_RemoteURL;\r
+               CString cmd;\r
+               cmd.Format(_T("git.exe fetch \"%s\""),url);\r
+               CProgressDlg progress;\r
+               progress.m_GitCmd=cmd;\r
+               if(progress.DoModal()==IDOK)\r
+                       return TRUE;\r
+       }\r
+#if 0\r
+       CCloneDlg dlg;\r
+       dlg.m_Directory=this->orgCmdLinePath.GetWinPathString();\r
+       if(dlg.DoModal()==IDOK)\r
+       {\r
+               CString dir=dlg.m_Directory;\r
+               CString url=dlg.m_URL;\r
+               CString cmd;\r
+               cmd.Format(_T("git.exe clone %s %s"),\r
+                                               url,\r
+                                               dir);\r
+               CProgressDlg progress;\r
+               progress.m_GitCmd=cmd;\r
+               if(progress.DoModal()==IDOK)\r
+                       return TRUE;\r
+               \r
+       }\r
+#endif\r
+       return FALSE;\r
+}\r
diff --git a/src/TortoiseProc/Commands/PullCommand.h b/src/TortoiseProc/Commands/PullCommand.h
new file mode 100644 (file)
index 0000000..b91f35e
--- /dev/null
@@ -0,0 +1,38 @@
+// 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
+#pragma once\r
+#include "Command.h"\r
+\r
+#include "MessageBox.h"\r
+\r
+#include "git.h"\r
+/**\r
+ * \ingroup TortoiseProc\r
+ * Creates a repository\r
+ */\r
+class PullCommand : public Command\r
+{\r
+public:\r
+       /**\r
+        * Executes the command.\r
+        */\r
+       virtual bool                    Execute();\r
+};\r
+\r
+\r
diff --git a/src/TortoiseProc/Commands/PushCommand.cpp b/src/TortoiseProc/Commands/PushCommand.cpp
new file mode 100644 (file)
index 0000000..9dbf656
--- /dev/null
@@ -0,0 +1,63 @@
+// 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 "PushCommand.h"\r
+\r
+//#include "SVNProgressDlg.h"\r
+#include "StringUtils.h"\r
+#include "Hooks.h"\r
+#include "MessageBox.h"\r
+\r
+#include "PushDlg.h"\r
+#include "ProgressDlg.h"\r
+\r
+bool PushCommand::Execute()\r
+{\r
+       CPushDlg dlg;\r
+//     dlg.m_Directory=this->orgCmdLinePath.GetWinPathString();\r
+       if(dlg.DoModal()==IDOK)\r
+       {\r
+//             CString dir=dlg.m_Directory;\r
+//             CString url=dlg.m_URL;\r
+               CString cmd;\r
+               CString force;\r
+               CString tags;\r
+               CString thin;\r
+\r
+               if(dlg.m_bPack)\r
+                       thin=_T("--thin");\r
+               if(dlg.m_bTags)\r
+                       tags=_T("--tags");\r
+               if(dlg.m_bForce)\r
+                       force=_T("--force");\r
+               \r
+               cmd.Format(_T("git.exe push %s %s %s \"%s\" %s:%s"),\r
+                               thin,tags,force,\r
+                               dlg.m_URL,\r
+                               dlg.m_BranchSourceName,\r
+                               dlg.m_BranchRemoteName);\r
+\r
+               CProgressDlg progress;\r
+               progress.m_GitCmd=cmd;\r
+               if(progress.DoModal()==IDOK)\r
+                       return TRUE;\r
+               \r
+       }\r
+       return FALSE;\r
+}\r
diff --git a/src/TortoiseProc/Commands/PushCommand.h b/src/TortoiseProc/Commands/PushCommand.h
new file mode 100644 (file)
index 0000000..99767bd
--- /dev/null
@@ -0,0 +1,38 @@
+// 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
+#pragma once\r
+#include "Command.h"\r
+\r
+#include "MessageBox.h"\r
+\r
+#include "git.h"\r
+/**\r
+ * \ingroup TortoiseProc\r
+ * Creates a repository\r
+ */\r
+class PushCommand : public Command\r
+{\r
+public:\r
+       /**\r
+        * Executes the command.\r
+        */\r
+       virtual bool                    Execute();\r
+};\r
+\r
+\r
diff --git a/src/TortoiseProc/PullFetchDlg.cpp b/src/TortoiseProc/PullFetchDlg.cpp
new file mode 100644 (file)
index 0000000..72949dc
--- /dev/null
@@ -0,0 +1,92 @@
+// PullFetchDlg.cpp : implementation file\r
+//\r
+\r
+#include "stdafx.h"\r
+#include "TortoiseProc.h"\r
+#include "PullFetchDlg.h"\r
+#include "Git.h"\r
+\r
+// CPullFetchDlg dialog\r
+\r
+IMPLEMENT_DYNAMIC(CPullFetchDlg, CResizableStandAloneDialog)\r
+\r
+CPullFetchDlg::CPullFetchDlg(CWnd* pParent /*=NULL*/)\r
+       : CResizableStandAloneDialog(CPullFetchDlg::IDD, pParent)\r
+{\r
+\r
+}\r
+\r
+CPullFetchDlg::~CPullFetchDlg()\r
+{\r
+}\r
+\r
+void CPullFetchDlg::DoDataExchange(CDataExchange* pDX)\r
+{\r
+       CDialog::DoDataExchange(pDX);\r
+       DDX_Control(pDX, IDC_REMOTE_COMBO, this->m_Remote);\r
+       DDX_Control(pDX, IDC_OTHER, this->m_Other);\r
+\r
+}\r
+\r
+\r
+BEGIN_MESSAGE_MAP(CPullFetchDlg,CResizableStandAloneDialog )\r
+       ON_BN_CLICKED(IDC_REMOTE_RD, &CPullFetchDlg::OnBnClickedRd)\r
+       ON_BN_CLICKED(IDC_OTHER_RD, &CPullFetchDlg::OnBnClickedRd)\r
+       ON_BN_CLICKED(IDOK, &CPullFetchDlg::OnBnClickedOk)\r
+END_MESSAGE_MAP()\r
+\r
+BOOL CPullFetchDlg::OnInitDialog()\r
+{\r
+       CResizableStandAloneDialog::OnInitDialog();\r
+       AddAnchor(IDC_REMOTE_COMBO, TOP_LEFT, TOP_RIGHT);\r
+       AddAnchor(IDC_OTHER, TOP_LEFT,TOP_RIGHT);\r
+\r
+       AddAnchor(IDOK,BOTTOM_RIGHT);\r
+       AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
+\r
+       CheckRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD,IDC_REMOTE_RD);\r
+       m_Remote.EnableWindow(TRUE);\r
+       m_Other.EnableWindow(FALSE);\r
+\r
+       m_Other.SetURLHistory(TRUE);\r
+       m_Other.LoadHistory(_T("Software\\TortoiseGit\\History\\PullURLS"), _T("url"));\r
+       m_Other.SetCurSel(0);\r
+\r
+       \r
+\r
+       return TRUE;\r
+}\r
+// CPullFetchDlg message handlers\r
+\r
+void CPullFetchDlg::OnBnClickedRd()\r
+{\r
+\r
+       // TODO: Add your control notification handler code here\r
+       if( GetCheckedRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD) == IDC_REMOTE_RD)\r
+       {\r
+               m_Remote.EnableWindow(TRUE);\r
+               m_Other.EnableWindow(FALSE);;\r
+       }\r
+       if( GetCheckedRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD) == IDC_OTHER_RD)\r
+       {\r
+               m_Remote.EnableWindow(FALSE);\r
+               m_Other.EnableWindow(TRUE);;\r
+       }\r
+       \r
+\r
+}\r
+\r
+void CPullFetchDlg::OnBnClickedOk()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       if( GetCheckedRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD) == IDC_REMOTE_RD)\r
+       {\r
+               m_RemoteURL=m_Remote.GetString();\r
+               \r
+       }\r
+       if( GetCheckedRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD) == IDC_OTHER_RD)\r
+       {\r
+               m_Other.GetWindowTextW(m_RemoteURL);\r
+       }\r
+       this->OnOK();\r
+}\r
diff --git a/src/TortoiseProc/PullFetchDlg.h b/src/TortoiseProc/PullFetchDlg.h
new file mode 100644 (file)
index 0000000..358e660
--- /dev/null
@@ -0,0 +1,30 @@
+#pragma once\r
+\r
+#include "StandAloneDlg.h"\r
+#include "HistoryCombo.h"\r
+// CPullFetchDlg dialog\r
+\r
+class CPullFetchDlg : public CResizableStandAloneDialog\r
+{\r
+       DECLARE_DYNAMIC(CPullFetchDlg)\r
+\r
+public:\r
+       CPullFetchDlg(CWnd* pParent = NULL);   // standard constructor\r
+       virtual ~CPullFetchDlg();\r
+\r
+// Dialog Data\r
+       enum { IDD = IDD_PULLFETCH };\r
+\r
+protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
+       CHistoryCombo   m_Remote;\r
+       CHistoryCombo   m_Other;\r
+       virtual BOOL OnInitDialog();\r
+\r
+       \r
+       DECLARE_MESSAGE_MAP()\r
+public:\r
+       afx_msg void OnBnClickedRd();\r
+       afx_msg void OnBnClickedOk();\r
+       CString m_RemoteURL;\r
+};\r
diff --git a/src/TortoiseProc/PushDlg.cpp b/src/TortoiseProc/PushDlg.cpp
new file mode 100644 (file)
index 0000000..6330e55
--- /dev/null
@@ -0,0 +1,146 @@
+// PushDlg.cpp : implementation file\r
+//\r
+\r
+#include "stdafx.h"\r
+#include "TortoiseProc.h"\r
+#include "PushDlg.h"\r
+\r
+#include "Git.h"\r
+// CPushDlg dialog\r
+\r
+IMPLEMENT_DYNAMIC(CPushDlg, CResizableStandAloneDialog)\r
+\r
+CPushDlg::CPushDlg(CWnd* pParent /*=NULL*/)\r
+       : CResizableStandAloneDialog(CPushDlg::IDD, pParent)\r
+{\r
+\r
+}\r
+\r
+CPushDlg::~CPushDlg()\r
+{\r
+}\r
+\r
+void CPushDlg::DoDataExchange(CDataExchange* pDX)\r
+{\r
+       CResizableStandAloneDialog::DoDataExchange(pDX);\r
+       DDX_Control(pDX, IDC_BRANCH_REMOTE, this->m_BranchRemote);\r
+       DDX_Control(pDX, IDC_BRANCH_SOURCE, this->m_BranchSource);\r
+       DDX_Control(pDX, IDC_REMOTE, this->m_Remote);\r
+       DDX_Control(pDX, IDC_URL, this->m_RemoteURL);\r
+       DDX_Check(pDX,IDC_FORCE,this->m_bForce);\r
+       DDX_Check(pDX,IDC_PACK,this->m_bPack);\r
+       DDX_Check(pDX,IDC_TAGS,this->m_bTags);\r
+\r
+}\r
+\r
+\r
+BEGIN_MESSAGE_MAP(CPushDlg, CResizableStandAloneDialog)\r
+       ON_BN_CLICKED(IDC_RD_REMOTE, &CPushDlg::OnBnClickedRd)\r
+       ON_BN_CLICKED(IDC_RD_URL, &CPushDlg::OnBnClickedRd)\r
+       ON_CBN_SELCHANGE(IDC_BRANCH_SOURCE, &CPushDlg::OnCbnSelchangeBranchSource)\r
+       ON_BN_CLICKED(IDOK, &CPushDlg::OnBnClickedOk)\r
+END_MESSAGE_MAP()\r
+\r
+BOOL CPushDlg::OnInitDialog()\r
+{\r
+       CResizableStandAloneDialog::OnInitDialog();\r
+       AddAnchor(IDC_BRANCH_REMOTE, TOP_RIGHT);\r
+       AddAnchor(IDC_BRANCH_SOURCE, TOP_LEFT);\r
+\r
+       AddAnchor(IDC_REMOTE, TOP_LEFT, TOP_RIGHT);\r
+       AddAnchor(IDC_URL, TOP_LEFT,TOP_RIGHT);\r
+\r
+       AddAnchor(IDC_URL_GROUP, TOP_LEFT,TOP_RIGHT);\r
+       AddAnchor(IDC_OPTION_GROUP, TOP_LEFT,TOP_RIGHT);\r
+       AddAnchor(IDC_BRANCH_GROUP, TOP_LEFT,TOP_RIGHT);\r
+\r
+       AddAnchor(IDC_STATIC_REMOTE, TOP_RIGHT);\r
+\r
+       AddAnchor(IDOK,BOTTOM_RIGHT);\r
+       AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
+\r
+       m_RemoteURL.SetURLHistory(TRUE);\r
+       m_RemoteURL.LoadHistory(_T("Software\\TortoiseGit\\History\\PushURLS"), _T("url"));\r
+       m_RemoteURL.SetCurSel(0);\r
+\r
+\r
+       m_RemoteURL.EnableWindow(FALSE);\r
+       CheckRadioButton(IDC_RD_REMOTE,IDC_RD_URL,IDC_RD_REMOTE);\r
+\r
+       CStringList list;\r
+\r
+       if(!g_Git.GetRemoteList(list))\r
+       {       \r
+               POSITION pos;\r
+               pos=list.GetHeadPosition();\r
+               while(pos)\r
+               {\r
+                       m_Remote.AddString(list.GetNext(pos));\r
+               }\r
+       }\r
+\r
+       int current=0;\r
+       if(!g_Git.GetBranchList(list,&current))\r
+       {\r
+               POSITION pos;\r
+               pos=list.GetHeadPosition();\r
+               while(pos)\r
+               {\r
+                       m_BranchSource.AddString(list.GetNext(pos));\r
+               }\r
+       }\r
+       m_BranchSource.SetCurSel(current);\r
+       \r
+       m_BranchRemote.LoadHistory(_T("Software\\TortoiseGit\\History\\RemoteBranch"), _T("branch"));\r
+       m_BranchRemote.SetCurSel(0);\r
+\r
+       //m_BranchRemote.SetWindowTextW(m_BranchSource.GetString());\r
+       return TRUE;\r
+}\r
+\r
+// CPushDlg message handlers\r
+\r
+void CPushDlg::OnBnClickedRd()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       // TODO: Add your control notification handler code here\r
+       if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_REMOTE)\r
+       {\r
+               m_Remote.EnableWindow(TRUE);\r
+               m_RemoteURL.EnableWindow(FALSE);;\r
+       }\r
+       if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_URL)\r
+       {\r
+               m_Remote.EnableWindow(FALSE);\r
+               m_RemoteURL.EnableWindow(TRUE);\r
+       }\r
+}\r
+\r
+\r
+void CPushDlg::OnCbnSelchangeBranchSource()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       m_BranchRemote.SetWindowTextW(m_BranchSource.GetString());\r
+}\r
+\r
+void CPushDlg::OnBnClickedOk()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       CResizableStandAloneDialog::UpdateData(TRUE);\r
+\r
+       if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_REMOTE)\r
+       {\r
+               m_URL=m_Remote.GetString();\r
+       }\r
+       if( GetCheckedRadioButton(IDC_RD_REMOTE,IDC_RD_URL) == IDC_RD_URL)\r
+       {\r
+               m_URL=m_RemoteURL.GetString();\r
+       }\r
+\r
+       this->m_BranchRemoteName=m_BranchRemote.GetString();\r
+       this->m_BranchSourceName=m_BranchSource.GetString();\r
+\r
+       this->m_RemoteURL.SaveHistory();\r
+       this->m_BranchRemote.SaveHistory();\r
+       CResizableStandAloneDialog::OnOK();\r
+}\r
diff --git a/src/TortoiseProc/PushDlg.h b/src/TortoiseProc/PushDlg.h
new file mode 100644 (file)
index 0000000..3b2bb44
--- /dev/null
@@ -0,0 +1,40 @@
+#pragma once\r
+\r
+#include "StandAloneDlg.h"\r
+#include "HistoryCombo.h"\r
+// CPushDlg dialog\r
+\r
+class CPushDlg : public CResizableStandAloneDialog\r
+{\r
+       DECLARE_DYNAMIC(CPushDlg)\r
+\r
+public:\r
+       CPushDlg(CWnd* pParent = NULL);   // standard constructor\r
+       virtual ~CPushDlg();\r
+       \r
+       CHistoryCombo   m_BranchRemote;\r
+       CHistoryCombo   m_BranchSource;\r
+       CHistoryCombo   m_Remote;\r
+       CHistoryCombo   m_RemoteURL;\r
+\r
+       CString m_URL;\r
+       CString m_BranchSourceName;\r
+       CString m_BranchRemoteName;\r
+\r
+       BOOL                    m_bTags;\r
+       BOOL                    m_bForce;\r
+       BOOL                    m_bPack;\r
+\r
+       virtual BOOL OnInitDialog();\r
+// Dialog Data\r
+       enum { IDD = IDD_PUSH };\r
+\r
+protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
+\r
+       DECLARE_MESSAGE_MAP()\r
+public:\r
+       afx_msg void OnBnClickedRd();\r
+       afx_msg void OnCbnSelchangeBranchSource();\r
+       afx_msg void OnBnClickedOk();\r
+};\r
index 1fe6850..101a718 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\explorer.ico"\r
+                               RelativePath="..\Resources\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\explorer.ico"\r
+                               RelativePath=".\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\newfolder.ico"\r
+                               RelativePath="..\Resources\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\newfolder.ico"\r
+                               RelativePath=".\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\open.ico"\r
+                               RelativePath="..\Resources\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\open.ico"\r
+                               RelativePath=".\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\save.ico"\r
+                               RelativePath="..\Resources\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\save.ico"\r
+                               RelativePath=".\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\saveas.ico"\r
+                               RelativePath="..\Resources\saveas.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\saveas.ico"\r
+                               RelativePath=".\saveas.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\up.ico"\r
+                               RelativePath="..\Resources\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\up.ico"\r
+                               RelativePath=".\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                        >\r
                                </File>\r
                        </Filter>\r
+                       <Filter\r
+                               Name="PullFetch"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\Commands\FetchCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\FetchCommand.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\PullCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\PullCommand.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+                       <Filter\r
+                               Name="push"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\Commands\PushCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\PushCommand.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
                </Filter>\r
                <Filter\r
                        Name="Utility Dialogs"\r
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath=".\PullFetchDlg.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\PullFetchDlg.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\PushDlg.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\PushDlg.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\RenameDlg.cpp"\r
                                >\r
                        </File>\r
index d6e8408..99ba314 100644 (file)
@@ -11,7 +11,7 @@
                        <DebugSettings\r
                                Command="$(TargetPath)"\r
                                WorkingDirectory="D:\Profiles\b20596\tortoisegit"\r
-                               CommandArguments="/command:clone /path:&quot;D:\profile\b20596\qgit4&quot;"\r
+                               CommandArguments="/command:push /path:&quot;D:\\Profiles\\b20596\\qgit4&quot;"\r
                                Attach="false"\r
                                DebuggerType="3"\r
                                Remote="1"\r
index 3588b4d..a7a1ef4 100644 (file)
Binary files a/src/TortoiseProc/resource.h and b/src/TortoiseProc/resource.h differ