OSDN Git Service

Add Merge, new branch, new tag Dialog
authorFrank Li <lznuaa@gmail.com>
Wed, 24 Dec 2008 06:14:47 +0000 (14:14 +0800)
committerFrank Li <lznuaa@gmail.com>
Wed, 24 Dec 2008 06:14:47 +0000 (14:14 +0800)
19 files changed:
src/Git/Git.cpp
src/Git/Git.h
src/Resources/TortoiseProcENG.rc
src/TortoiseProc/CherryPick.h [new file with mode: 0644]
src/TortoiseProc/Commands/BranchCommand.cpp [new file with mode: 0644]
src/TortoiseProc/Commands/BranchCommand.h [new file with mode: 0644]
src/TortoiseProc/Commands/Command.cpp
src/TortoiseProc/Commands/MergeCommand.cpp
src/TortoiseProc/Commands/TagCommand.cpp [new file with mode: 0644]
src/TortoiseProc/Commands/TagCommand.h [new file with mode: 0644]
src/TortoiseProc/CreateBranchTagDlg.cpp
src/TortoiseProc/CreateBranchTagDlg.h
src/TortoiseProc/MergeDlg.cpp [new file with mode: 0644]
src/TortoiseProc/MergeDlg.h [new file with mode: 0644]
src/TortoiseProc/TortoiseProc.vcproj
src/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user
src/TortoiseProc/resource.h
src/Utils/MiscUI/HistoryCombo.cpp
src/Utils/MiscUI/HistoryCombo.h

index 369b42b..094158f 100644 (file)
@@ -245,11 +245,38 @@ git_revnum_t CGit::GetHash(CString &friendname)
        return out;\r
 }\r
 \r
-int CGit::GetBranchList(CStringList &list,int *current)\r
+int CGit::GetTagList(CStringList &list)\r
+{\r
+       int ret;\r
+       CString cmd,output;\r
+       cmd=_T("git.exe tag -l");\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);\r
+               }\r
+       }\r
+       return ret;\r
+}\r
+\r
+int CGit::GetBranchList(CStringList &list,int *current,BRANCH_TYPE type)\r
 {\r
        int ret;\r
        CString cmd,output;\r
        cmd=_T("git.exe branch");\r
+\r
+       if(type==(BRANCH_LOCAL|BRANCH_REMOTE))\r
+               cmd+=_T(" -a");\r
+       else if(type==BRANCH_REMOTE)\r
+               cmd+=_T(" -r");\r
+\r
        int i=0;\r
        ret=g_Git.Run(cmd,&output);\r
        if(!ret)\r
index 1595a83..f07687d 100644 (file)
@@ -30,9 +30,16 @@ public:
        }\r
        CString m_CurrentDir;\r
 \r
+       typedef enum\r
+       {\r
+               BRANCH_LOCAL=0x1,\r
+               BRANCH_REMOTE=0x2,\r
+               BRANCH_ALL=BRANCH_LOCAL|BRANCH_REMOTE,\r
+       }BRANCH_TYPE;\r
 \r
        int GetRemoteList(CStringList &list);\r
-       int GetBranchList(CStringList &list, int *Current);\r
+       int GetBranchList(CStringList &list, int *Current,BRANCH_TYPE type=BRANCH_LOCAL);\r
+       int GetTagList(CStringList &list);\r
        \r
        int GetLog(CString& logOut);\r
        git_revnum_t GetHash(CString &friendname);\r
index 20305be..eb37ff4 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
diff --git a/src/TortoiseProc/CherryPick.h b/src/TortoiseProc/CherryPick.h
new file mode 100644 (file)
index 0000000..16764ea
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+\r
+#include "StandAloneDlg.h"\r
+#include "HistoryCombo.h"\r
+\r
+// CCherryPick dialog\r
+\r
+class CCherryPick : public CResizableStandAloneDialog\r
+{\r
+       DECLARE_DYNAMIC(CCherryPick)\r
+\r
+public:\r
+       CCherryPick(CWnd* pParent = NULL);   // standard constructor\r
+       virtual ~CCherryPick();\r
+\r
+// Dialog Data\r
+       enum { IDD = IDD_CHERRY_PICK };\r
+\r
+       CString m_PickVersion;\r
+\r
+protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
+       virtual BOOL OnInitDialog();\r
+       CHistoryCombo m_Version;\r
+\r
+       DECLARE_MESSAGE_MAP()\r
+};\r
diff --git a/src/TortoiseProc/Commands/BranchCommand.cpp b/src/TortoiseProc/Commands/BranchCommand.cpp
new file mode 100644 (file)
index 0000000..9c8bd58
--- /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 "BranchCommand.h"\r
+\r
+#include "MessageBox.h"\r
+//#include "SVNProgressDlg.h"\r
+//#include "ProgressDlg.h"\r
+#include "InputLogDlg.h"\r
+#include "Git.h"\r
+#include "DirFileEnum.h"\r
+#include "ShellUpdater.h"\r
+#include "CreateBranchTagDlg.h"\r
+\r
+bool BranchCommand::Execute()\r
+{\r
+       CCreateBranchTagDlg dlg;\r
+       dlg.m_bIsTag=FALSE;\r
+       \r
+       if(dlg.DoModal()==IDOK)\r
+       {\r
+               CString cmd;\r
+               CString force;\r
+               CString track;\r
+               if(dlg.m_bTrack)\r
+                       track=_T("--track");\r
+\r
+               if(dlg.m_bForce)\r
+                       force=_T("-f");\r
+\r
+               cmd.Format(_T("git.exe branch %s %s %s %s"),\r
+                       track,\r
+                       force,\r
+                       dlg.m_BranchTagName,\r
+                       dlg.m_Base\r
+                       );\r
+               CString out;\r
+               if(g_Git.Run(cmd,&out))\r
+               {\r
+                       CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK);\r
+               }\r
+               return TRUE;\r
+               \r
+       }\r
+       return FALSE;\r
+}\r
diff --git a/src/TortoiseProc/Commands/BranchCommand.h b/src/TortoiseProc/Commands/BranchCommand.h
new file mode 100644 (file)
index 0000000..d1f35d8
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 BranchCommand : public Command\r
+{\r
+public:\r
+       /**\r
+        * Executes the command.\r
+        */\r
+       virtual bool                    Execute();\r
+};\r
+\r
+\r
index b53e972..a1736fd 100644 (file)
@@ -36,6 +36,9 @@
 #include "PullCommand.h"\r
 #include "FetchCommand.h"\r
 #include "PushCommand.h"\r
+#include "BranchCommand.h"\r
+#include "TagCommand.h"\r
+#include "MergeCommand.h"\r
 \r
 #if 0\r
 #include "AddCommand.h"\r
@@ -61,7 +64,7 @@
 #include "ImportCommand.h"\r
 #include "LockCommand.h"\r
 \r
-#include "MergeCommand.h"\r
+\r
 #include "MergeAllCommand.h"\r
 #include "PasteCopyCommand.h"\r
 #include "PasteMoveCommand.h"\r
@@ -91,6 +94,7 @@ typedef enum
        cmdAbout,\r
        cmdAdd,\r
        cmdBlame,\r
+       cmdBranch,\r
        cmdCat,\r
        cmdCheckout,\r
        cmdCleanup,\r
@@ -135,6 +139,7 @@ typedef enum
        cmdSettings,\r
        cmdShowCompare,\r
        cmdSwitch,\r
+       cmdTag,\r
        cmdUnIgnore,\r
        cmdUnlock,\r
        cmdUpdate,\r
@@ -152,6 +157,7 @@ static const struct CommandInfo
        {       cmdAbout,                       _T("about")                             },\r
        {       cmdAdd,                         _T("add")                               },\r
        {       cmdBlame,                       _T("blame")                             },\r
+       {       cmdBranch,                      _T("branch")                    },\r
        {       cmdCat,                         _T("cat")                               },\r
        {       cmdCheckout,            _T("checkout")                  },\r
        {       cmdCleanup,                     _T("cleanup")                   },\r
@@ -196,6 +202,7 @@ static const struct CommandInfo
        {       cmdSettings,            _T("settings")                  },\r
        {       cmdShowCompare,         _T("showcompare")               },\r
        {       cmdSwitch,                      _T("switch")                    },\r
+       {       cmdTag,                         _T("tag")                               },\r
        {       cmdUnIgnore,            _T("unignore")                  },\r
        {       cmdUnlock,                      _T("unlock")                    },\r
        {       cmdUpdate,                      _T("update")                    },\r
@@ -254,6 +261,12 @@ Command * CommandServer::GetCommand(const CString& sCmd)
                return new FetchCommand;\r
        case cmdPush:\r
                return new PushCommand;\r
+       case cmdBranch:\r
+               return new BranchCommand;\r
+       case cmdTag:\r
+               return new TagCommand;\r
+       case cmdMerge:\r
+               return new MergeCommand;\r
 #if 0\r
        case cmdAdd:\r
                return new AddCommand;\r
index 8fdbd38..38bf467 100644 (file)
 //\r
 #include "StdAfx.h"\r
 #include "MergeCommand.h"\r
-\r
-#include "MergeWizard.h"\r
-#include "MergeWizardStart.h"\r
-#include "SVNProgressDlg.h"\r
+#include "git.h"\r
+#include "MergeDlg.h"\r
 #include "MessageBox.h"\r
 \r
 bool MergeCommand::Execute()\r
 {\r
-       DWORD nMergeWizardMode =\r
-               (DWORD)CRegDWORD(_T("Software\\TortoiseSVN\\MergeWizardMode"), 0);\r
-\r
-       if (parser.HasVal(_T("fromurl")))\r
-       {\r
-               // fromurl means merging a revision range\r
-               nMergeWizardMode = 2;\r
-       }\r
-       if (parser.HasVal(_T("fromurl2")))\r
+       CMergeDlg dlg;\r
+       if(dlg.DoModal()==IDOK)\r
        {\r
-               // fromurl2 means merging a tree\r
-               nMergeWizardMode = 1;\r
-       }\r
+               CString cmd;\r
+               CString noff;\r
+               CString squash;\r
 \r
-       CMergeWizard wizard(IDS_PROGRS_CMDINFO, NULL, nMergeWizardMode);\r
-       wizard.wcPath = cmdLinePath;\r
+               if(dlg.m_bNoFF)\r
+                       noff=_T("--no-ff");\r
 \r
-       if (parser.HasVal(_T("fromurl")))\r
-       {\r
-               wizard.URL1 = parser.GetVal(_T("fromurl"));\r
-               wizard.url = parser.GetVal(_T("fromurl"));\r
-               wizard.revRangeArray.FromListString(parser.GetVal(_T("revrange")));\r
-       }\r
-       if (parser.HasVal(_T("fromurl2")))\r
-       {\r
-               wizard.URL2 = parser.GetVal(_T("tourl"));\r
-               wizard.startRev = SVNRev(parser.GetVal(_T("fromrev")));\r
-               wizard.endRev = SVNRev(parser.GetVal(_T("torev")));\r
-       }\r
-       if (wizard.DoModal() == ID_WIZFINISH)\r
-       {\r
-               CSVNProgressDlg progDlg;\r
-               progDlg.SetCommand(CSVNProgressDlg::SVNProgress_Merge);\r
-               int options = wizard.m_bIgnoreAncestry ? ProgOptIgnoreAncestry : 0;\r
-               options |= wizard.m_bRecordOnly ? ProgOptRecordOnly : 0;\r
-               progDlg.SetOptions(options);\r
-               progDlg.SetPathList(CTSVNPathList(wizard.wcPath));\r
-               progDlg.SetUrl(wizard.URL1);\r
-               progDlg.SetSecondUrl(wizard.URL2);\r
-               switch (wizard.nRevRangeMerge)\r
-               {\r
-               case MERGEWIZARD_REVRANGE:\r
-                       {\r
-                               if (wizard.revRangeArray.GetCount())\r
-                               {\r
-                                       wizard.revRangeArray.AdjustForMerge(!!wizard.bReverseMerge);\r
-                                       progDlg.SetRevisionRanges(wizard.revRangeArray);\r
-                               }\r
-                               else\r
-                               {\r
-                                       SVNRevRangeArray tempRevArray;\r
-                                       tempRevArray.AddRevRange(1, SVNRev::REV_HEAD);\r
-                                       progDlg.SetRevisionRanges(tempRevArray);\r
-                               }\r
-                       }\r
-                       break;\r
-               case MERGEWIZARD_TREE:\r
-                       {\r
-                               progDlg.SetRevision(wizard.startRev);\r
-                               progDlg.SetRevisionEnd(wizard.endRev);\r
-                               if (wizard.URL1.Compare(wizard.URL2) == 0)\r
-                               {\r
-                                       SVNRevRangeArray tempRevArray;\r
-                                       tempRevArray.AdjustForMerge(!!wizard.bReverseMerge);\r
-                                       tempRevArray.AddRevRange(wizard.startRev, wizard.endRev);\r
-                                       progDlg.SetRevisionRanges(tempRevArray);\r
-                               }\r
-                       }\r
-                       break;\r
-               case MERGEWIZARD_REINTEGRATE:\r
-                       {\r
-                               progDlg.SetCommand(CSVNProgressDlg::SVNProgress_MergeReintegrate);\r
-                       }\r
-                       break;\r
-               }\r
-               progDlg.SetDepth(wizard.m_depth);\r
-               progDlg.SetDiffOptions(SVN::GetOptionsString(wizard.m_bIgnoreEOL, wizard.m_IgnoreSpaces));\r
-               progDlg.DoModal();\r
-               return !progDlg.DidErrorsOccur();\r
+               if(dlg.m_bSquash)\r
+                       squash=_T("--squash");\r
+\r
+               cmd.Format(_T("git.exe merge %s %s %s"),\r
+                       noff,\r
+                       squash,\r
+                       dlg.m_Base);\r
+\r
+               CString output;\r
+               g_Git.Run(cmd,&output);\r
+\r
+               CMessageBox::Show(NULL,output,_T("TortoiseGit"),MB_OK);\r
        }\r
        return false;\r
 }
\ No newline at end of file
diff --git a/src/TortoiseProc/Commands/TagCommand.cpp b/src/TortoiseProc/Commands/TagCommand.cpp
new file mode 100644 (file)
index 0000000..c577b38
--- /dev/null
@@ -0,0 +1,60 @@
+// 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 "TagCommand.h"\r
+\r
+#include "MessageBox.h"\r
+#include "CreateBranchTagDlg.h"\r
+#include "InputLogDlg.h"\r
+#include "Git.h"\r
+#include "DirFileEnum.h"\r
+#include "ShellUpdater.h"\r
+\r
+bool TagCommand::Execute()\r
+{\r
+       CCreateBranchTagDlg dlg;\r
+       dlg.m_bIsTag=TRUE;\r
+       \r
+       if(dlg.DoModal()==IDOK)\r
+       {\r
+               CString cmd;\r
+               CString force;\r
+               CString track;\r
+               if(dlg.m_bTrack)\r
+                       track=_T("--track");\r
+\r
+               if(dlg.m_bForce)\r
+                       force=_T("-f");\r
+\r
+               cmd.Format(_T("git.exe tag %s %s %s %s"),\r
+                       track,\r
+                       force,\r
+                       dlg.m_BranchTagName,\r
+                       dlg.m_Base\r
+                       );\r
+               CString out;\r
+               if(g_Git.Run(cmd,&out))\r
+               {\r
+                       CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK);\r
+               }\r
+               return TRUE;\r
+               \r
+       }\r
+       return FALSE;\r
+}\r
diff --git a/src/TortoiseProc/Commands/TagCommand.h b/src/TortoiseProc/Commands/TagCommand.h
new file mode 100644 (file)
index 0000000..8c34a30
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 TagCommand : public Command\r
+{\r
+public:\r
+       /**\r
+        * Executes the command.\r
+        */\r
+       virtual bool                    Execute();\r
+};\r
+\r
+\r
index 082a52b..565456c 100644 (file)
@@ -4,7 +4,8 @@
 #include "stdafx.h"\r
 #include "TortoiseProc.h"\r
 #include "CreateBranchTagDlg.h"\r
-\r
+#include "Git.h"\r
+#include "Messagebox.h"\r
 \r
 // CCreateBranchTagDlg dialog\r
 \r
@@ -13,7 +14,7 @@ IMPLEMENT_DYNAMIC(CCreateBranchTagDlg, CResizableStandAloneDialog)
 CCreateBranchTagDlg::CCreateBranchTagDlg(CWnd* pParent /*=NULL*/)\r
        : CResizableStandAloneDialog(CCreateBranchTagDlg::IDD, pParent)\r
 {\r
-\r
+       m_bIsTag=0;\r
 }\r
 \r
 CCreateBranchTagDlg::~CCreateBranchTagDlg()\r
@@ -35,6 +36,12 @@ void CCreateBranchTagDlg::DoDataExchange(CDataExchange* pDX)
 \r
 \r
 BEGIN_MESSAGE_MAP(CCreateBranchTagDlg, CResizableStandAloneDialog)\r
+       ON_BN_CLICKED(IDC_RADIO_HEAD, &CCreateBranchTagDlg::OnBnClickedRadio)\r
+       ON_BN_CLICKED(IDC_RADIO_BRANCH, &CCreateBranchTagDlg::OnBnClickedRadio)\r
+       ON_BN_CLICKED(IDC_RADIO_TAGS, &CCreateBranchTagDlg::OnBnClickedRadio)\r
+       ON_BN_CLICKED(IDC_RADIO_VERSION, &CCreateBranchTagDlg::OnBnClickedRadio)\r
+       ON_BN_CLICKED(IDOK, &CCreateBranchTagDlg::OnBnClickedOk)\r
+       ON_CBN_SELCHANGE(IDC_COMBOBOXEX_BRANCH, &CCreateBranchTagDlg::OnCbnSelchangeComboboxexBranch)\r
 END_MESSAGE_MAP()\r
 \r
 BOOL CCreateBranchTagDlg::OnInitDialog()\r
@@ -52,8 +59,103 @@ BOOL CCreateBranchTagDlg::OnInitDialog()
        AddAnchor(IDOK,BOTTOM_RIGHT);\r
        AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
 \r
+\r
+       CheckRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION,IDC_RADIO_HEAD);\r
+\r
+       CStringList list;\r
+       g_Git.GetTagList(list);\r
+       m_Tags.AddString(list);\r
+\r
+       list.RemoveAll();\r
+       int current;\r
+       g_Git.GetBranchList(list,&current,CGit::BRANCH_ALL);\r
+       m_Branch.AddString(list);\r
+       m_Branch.SetCurSel(current);\r
+\r
+       m_Version.LoadHistory(_T("Software\\TortoiseGit\\History\\VersionHash"), _T("hash"));\r
+       m_Version.SetCurSel(0);\r
+\r
+       OnBnClickedRadio();\r
+       this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
+\r
+       if(this->m_bIsTag)\r
+       {\r
+               this->SetWindowTextW(_T("Create Tag"));\r
+               this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowTextW(_T("Tag"));\r
+       }\r
+       else\r
+       {\r
+               this->SetWindowTextW(_T("Create Branch"));\r
+               this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowTextW(_T("Branch"));\r
+       }\r
+       \r
        return TRUE;\r
 \r
 \r
 }\r
 // CCreateBranchTagDlg message handlers\r
+\r
+void CCreateBranchTagDlg::OnBnClickedRadio()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       this->m_Branch.EnableWindow(FALSE);\r
+       this->m_Tags.EnableWindow(FALSE);\r
+       this->m_Version.EnableWindow(FALSE);\r
+       int radio=GetCheckedRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION);\r
+       switch (radio)\r
+       {\r
+       case IDC_RADIO_HEAD:\r
+               break;\r
+       case IDC_RADIO_BRANCH:\r
+               this->m_Branch.EnableWindow(TRUE);\r
+               break;\r
+       case IDC_RADIO_TAGS:\r
+               this->m_Tags.EnableWindow(TRUE);\r
+               break;\r
+       case IDC_RADIO_VERSION:\r
+               this->m_Version.EnableWindow(TRUE);\r
+               break;\r
+       }\r
+}\r
+\r
+void CCreateBranchTagDlg::OnBnClickedOk()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       this->UpdateData(TRUE);\r
+       if(this->m_BranchTagName.Trim().IsEmpty())\r
+       {\r
+               CMessageBox::Show(NULL,_T("Branch\Tag name can't empty"),_T("TortiseGit"),MB_OK);\r
+               return;\r
+       }\r
+       int radio=GetCheckedRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION);\r
+       switch (radio)\r
+       {\r
+       case IDC_RADIO_HEAD:\r
+               this->m_Base=_T("HEAD");\r
+               break;\r
+       case IDC_RADIO_BRANCH:\r
+               this->m_Base=m_Branch.GetString();\r
+               break;\r
+       case IDC_RADIO_TAGS:\r
+               this->m_Base=m_Tags.GetString();\r
+               break;\r
+       case IDC_RADIO_VERSION:\r
+               this->m_Base=m_Version.GetString();\r
+               break;\r
+       }\r
+       this->m_Version.SaveHistory();\r
+       OnOK();\r
+}\r
+\r
+void CCreateBranchTagDlg::OnCbnSelchangeComboboxexBranch()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       \r
+       if(this->m_Branch.GetString().Left(6)==_T("origin"))\r
+               this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(TRUE);\r
+       else\r
+               this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
+\r
+       if(this->m_bIsTag)\r
+               this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
+}\r
index 206dba2..737d508 100644 (file)
@@ -31,4 +31,8 @@ protected:
        CHistoryCombo m_Version;\r
        \r
        DECLARE_MESSAGE_MAP()\r
+public:\r
+       afx_msg void OnBnClickedRadio();\r
+       afx_msg void OnBnClickedOk();\r
+       afx_msg void OnCbnSelchangeComboboxexBranch();\r
 };\r
diff --git a/src/TortoiseProc/MergeDlg.cpp b/src/TortoiseProc/MergeDlg.cpp
new file mode 100644 (file)
index 0000000..0d9d646
--- /dev/null
@@ -0,0 +1,130 @@
+// MergeDlg.cpp : implementation file\r
+//\r
+\r
+#include "stdafx.h"\r
+#include "TortoiseProc.h"\r
+#include "MergeDlg.h"\r
+\r
+#include "Git.h"\r
+#include "Messagebox.h"\r
+// CMergeDlg dialog\r
+\r
+IMPLEMENT_DYNAMIC(CMergeDlg, CResizableStandAloneDialog)\r
+\r
+CMergeDlg::CMergeDlg(CWnd* pParent /*=NULL*/)\r
+       : CResizableStandAloneDialog(CMergeDlg::IDD, pParent)\r
+{\r
+\r
+}\r
+\r
+CMergeDlg::~CMergeDlg()\r
+{\r
+}\r
+\r
+void CMergeDlg::DoDataExchange(CDataExchange* pDX)\r
+{\r
+       CDialog::DoDataExchange(pDX);\r
+       DDX_Control(pDX, IDC_COMBOBOXEX_BRANCH, this->m_Branch);\r
+       DDX_Control(pDX, IDC_COMBOBOXEX_TAGS, this->m_Tags);\r
+       DDX_Control(pDX, IDC_COMBOBOXEX_VERSION, this->m_Version);\r
+\r
+       DDX_Check(pDX,IDC_CHECK_NOFF,this->m_bNoFF);\r
+       DDX_Check(pDX,IDC_CHECK_SQUASH,this->m_bSquash);\r
+}\r
+\r
+\r
+BEGIN_MESSAGE_MAP(CMergeDlg, CResizableStandAloneDialog)\r
+       ON_BN_CLICKED(IDC_RADIO_BRANCH, &CMergeDlg::OnBnClickedRadio)\r
+       ON_BN_CLICKED(IDC_RADIO_TAGS, &CMergeDlg::OnBnClickedRadio)\r
+       ON_BN_CLICKED(IDC_RADIO_VERSION, &CMergeDlg::OnBnClickedRadio)\r
+       ON_BN_CLICKED(IDOK, &CMergeDlg::OnBnClickedOk)\r
+END_MESSAGE_MAP()\r
+\r
+\r
+BOOL CMergeDlg::OnInitDialog()\r
+{\r
+       CResizableStandAloneDialog::OnInitDialog();\r
+\r
+       AddAnchor(IDC_COMBOBOXEX_BRANCH, TOP_LEFT, TOP_RIGHT);\r
+       AddAnchor(IDC_COMBOBOXEX_TAGS, TOP_LEFT, TOP_RIGHT);\r
+       AddAnchor(IDC_COMBOBOXEX_VERSION, TOP_LEFT, TOP_RIGHT);\r
+\r
+       AddAnchor(IDC_GROUP_BASEON, TOP_LEFT, TOP_RIGHT);\r
+       AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);\r
+\r
+       AddAnchor(IDC_BUTTON_SHOW, TOP_RIGHT);\r
+       \r
+       AddAnchor(IDOK,BOTTOM_RIGHT);\r
+       AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
+\r
+\r
+       CheckRadioButton(IDC_RADIO_BRANCH,IDC_RADIO_VERSION,IDC_RADIO_BRANCH);\r
+\r
+       CStringList list;\r
+       g_Git.GetTagList(list);\r
+       m_Tags.AddString(list);\r
+\r
+       list.RemoveAll();\r
+       int current;\r
+       g_Git.GetBranchList(list,&current,CGit::BRANCH_ALL);\r
+       m_Branch.AddString(list);\r
+       //m_Branch.SetCurSel(current);\r
+\r
+       m_Version.LoadHistory(_T("Software\\TortoiseGit\\History\\VersionHash"), _T("hash"));\r
+       m_Version.SetCurSel(0);\r
+\r
+       OnBnClickedRadio();\r
+                       \r
+       return TRUE;\r
+}\r
+\r
+// CMergeDlg message handlers\r
+\r
+void CMergeDlg::OnBnClickedRadio()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       this->m_Branch.EnableWindow(FALSE);\r
+       this->m_Tags.EnableWindow(FALSE);\r
+       this->m_Version.EnableWindow(FALSE);\r
+       int radio=GetCheckedRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION);\r
+       switch (radio)\r
+       {\r
+       case IDC_RADIO_BRANCH:\r
+               this->m_Branch.EnableWindow(TRUE);\r
+               break;\r
+       case IDC_RADIO_TAGS:\r
+               this->m_Tags.EnableWindow(TRUE);\r
+               break;\r
+       case IDC_RADIO_VERSION:\r
+               this->m_Version.EnableWindow(TRUE);\r
+               break;\r
+       }\r
+}\r
+\r
+void CMergeDlg::OnBnClickedOk()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       this->UpdateData(TRUE);\r
+       \r
+       int radio=GetCheckedRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION);\r
+       switch (radio)\r
+       {\r
+       case IDC_RADIO_BRANCH:\r
+               this->m_Base=m_Branch.GetString();\r
+               break;\r
+       case IDC_RADIO_TAGS:\r
+               this->m_Base=m_Tags.GetString();\r
+               break;\r
+       case IDC_RADIO_VERSION:\r
+               this->m_Base=m_Version.GetString();\r
+               break;\r
+       }\r
+\r
+       if(m_Base.Trim().IsEmpty())\r
+       {\r
+               CMessageBox::Show(NULL,_T("You must choose source"),_T("TortiseGit"),MB_OK);\r
+               return;\r
+       }\r
+       this->m_Version.SaveHistory();\r
+       OnOK();\r
+}\r
diff --git a/src/TortoiseProc/MergeDlg.h b/src/TortoiseProc/MergeDlg.h
new file mode 100644 (file)
index 0000000..6485234
--- /dev/null
@@ -0,0 +1,37 @@
+#pragma once\r
+\r
+#include "StandAloneDlg.h"\r
+#include "HistoryCombo.h"\r
+\r
+// CMergeDlg dialog\r
+\r
+class CMergeDlg : public CResizableStandAloneDialog\r
+{\r
+       DECLARE_DYNAMIC(CMergeDlg)\r
+\r
+public:\r
+       CMergeDlg(CWnd* pParent = NULL);   // standard constructor\r
+       virtual ~CMergeDlg();\r
+\r
+// Dialog Data\r
+       enum { IDD = IDD_MERGE };\r
+\r
+       BOOL m_bSquash;\r
+       BOOL m_bNoFF;\r
+\r
+       CString m_Base;\r
+\r
+\r
+protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
+       virtual BOOL OnInitDialog();\r
+\r
+       CHistoryCombo m_Branch;\r
+       CHistoryCombo m_Tags;\r
+       CHistoryCombo m_Version;\r
+\r
+       DECLARE_MESSAGE_MAP()\r
+public:\r
+       afx_msg void OnBnClickedRadio();\r
+       afx_msg void OnBnClickedOk();\r
+};\r
index da79e05..bebef84 100644 (file)
                                </File>\r
                        </Filter>\r
                        <Filter\r
-                               Name="branch"\r
+                               Name="branch\tag"\r
                                >\r
+                               <File\r
+                                       RelativePath=".\Commands\BranchCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\BranchCommand.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\TagCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\TagCommand.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
+                       <Filter\r
+                               Name="merge"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\Commands\MergeCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\MergeCommand.h"\r
+                                       >\r
+                               </File>\r
                        </Filter>\r
                </Filter>\r
                <Filter\r
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath=".\MergeDlg.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\MergeDlg.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\ProgressDlg.cpp"\r
                                >\r
                        </File>\r
index 86af789..fe10b38 100644 (file)
@@ -11,7 +11,7 @@
                        <DebugSettings\r
                                Command="$(TargetPath)"\r
                                WorkingDirectory="D:\Profiles\b20596\tortoisegit"\r
-                               CommandArguments="/command:push /path:&quot;D:\\Profiles\\b20596\\buildtest\\TortoiseGit&quot;"\r
+                               CommandArguments="/command:merge /path:&quot;D:\\Profiles\\b20596\\buildtest\\TortoiseGit&quot;"\r
                                Attach="false"\r
                                DebuggerType="3"\r
                                Remote="1"\r
index 1ce7af5..089cd60 100644 (file)
Binary files a/src/TortoiseProc/resource.h and b/src/TortoiseProc/resource.h differ
index 98a108d..d669707 100644 (file)
@@ -315,7 +315,15 @@ void CHistoryCombo::SetMaxHistoryItems(int nMaxItems)
        for (int n = m_nMaxHistoryItems; n < nNumItems; n++)\r
                DeleteString(m_nMaxHistoryItems);\r
 }\r
-\r
+void CHistoryCombo::AddString(CStringList &list)\r
+{\r
+       POSITION pos;\r
+       pos=list.GetHeadPosition();\r
+       while(pos)\r
+       {\r
+               AddString(list.GetNext(pos));\r
+       }\r
+}\r
 CString CHistoryCombo::GetString() const\r
 {\r
        CString str;\r
index 03ce601..c5ee1b0 100644 (file)
@@ -111,6 +111,8 @@ public:
         */\r
        CString GetString() const;\r
 \r
+       void AddString(CStringList &list);\r
+\r
 protected:\r
        /**\r
         * Will be called whenever the return key is pressed while the\r