OSDN Git Service

Merge branch 'master' of git://github.com/Jopie64/tortoisegit
authorFrank Li <lznuaa@gmail.com>
Thu, 18 Jun 2009 14:12:59 +0000 (22:12 +0800)
committerFrank Li <lznuaa@gmail.com>
Thu, 18 Jun 2009 14:12:59 +0000 (22:12 +0800)
src/Git/Git.cpp
src/Resources/TortoiseProcENG.rc
src/TortoiseProc/BrowseRefsDlg.cpp
src/TortoiseProc/FormatPatchDlg.cpp
src/TortoiseProc/FormatPatchDlg.h
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/resource.h

index 17c0a58..3000113 100644 (file)
@@ -657,10 +657,16 @@ int CGit::GetBranchList(STRING_VECTOR &list,int *current,BRANCH_TYPE type)
                while( pos>=0 )\r
                {\r
                        one=output.Tokenize(_T("\n"),pos);\r
-                       list.push_back(one.Right(one.GetLength()-2));\r
+                       one.Trim(L" \r\n\t");\r
+                       if(one.Find(L" -> ") >= 0 || one.IsEmpty())\r
+                               continue; // skip something like: refs/origin/HEAD -> refs/origin/master\r
                        if(one[0] == _T('*'))\r
+                       {\r
                                if(current)\r
                                        *current=i;\r
+                               one = one.Mid(2);\r
+                       }\r
+                       list.push_back(one);\r
                        i++;\r
                }\r
        }\r
index f5ecb8e..1549658 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
index c0701e2..a02bf1c 100644 (file)
@@ -817,6 +817,8 @@ bool CBrowseRefsDlg::PickRefForCombo(CComboBoxEx* pComboBox, int pickRef_Kind)
        for(int i = 0; i < pComboBox->GetCount(); ++i)\r
        {\r
                pComboBox->GetLBText(i, comboRefName);\r
+               if(comboRefName.Find(L'/') < 0 && !comboRefName.IsEmpty())\r
+                       comboRefName.Insert(0,L"heads/"); // If combo contains single level ref name, it is usualy from 'heads/'\r
                if(matchLength < comboRefName.GetLength() && resultRef.Right(comboRefName.GetLength()) == comboRefName)\r
                {\r
                        matchLength = comboRefName.GetLength();\r
index f644b94..e616fa3 100644 (file)
@@ -6,6 +6,8 @@
 #include "FormatPatchDlg.h"\r
 #include "git.h"\r
 #include "BrowseFolder.h"\r
+#include "LogDlg.h"\r
+#include "BrowseRefsDlg.h"\r
 // CFormatPatchDlg dialog\r
 \r
 IMPLEMENT_DYNAMIC(CFormatPatchDlg, CResizableStandAloneDialog)\r
@@ -51,6 +53,7 @@ BEGIN_MESSAGE_MAP(CFormatPatchDlg, CResizableStandAloneDialog)
        ON_BN_CLICKED(IDC_RADIO_SINCE, &CFormatPatchDlg::OnBnClickedRadio)\r
        ON_BN_CLICKED(IDC_RADIO_NUM, &CFormatPatchDlg::OnBnClickedRadio)\r
        ON_BN_CLICKED(IDC_RADIO_RANGE, &CFormatPatchDlg::OnBnClickedRadio)\r
+       ON_BN_CLICKED(IDC_BUTTON_REF, &CFormatPatchDlg::OnBnClickedButtonRef)\r
 END_MESSAGE_MAP()\r
 \r
 BOOL CFormatPatchDlg::OnInitDialog()\r
@@ -83,6 +86,7 @@ BOOL CFormatPatchDlg::OnInitDialog()
 \r
        STRING_VECTOR list;\r
        g_Git.GetBranchList(list,NULL,CGit::BRANCH_ALL);\r
+       m_cSince.SetMaxHistoryItems(list.size());\r
        m_cSince.AddString(list);\r
 \r
        if(!m_Since.IsEmpty())\r
@@ -126,12 +130,38 @@ void CFormatPatchDlg::OnBnClickedButtonDir()
 \r
 void CFormatPatchDlg::OnBnClickedButtonFrom()\r
 {\r
-       // TODO: Add your control notification handler code here\r
+       CLogDlg dlg;\r
+       // tell the dialog to use mode for selecting revisions\r
+       dlg.SetSelect(true);\r
+       // only one revision must be selected however\r
+       dlg.SingleSelection(true);\r
+       if ( dlg.DoModal() == IDOK )\r
+       {\r
+               // get selected hash if any\r
+               CString selectedHash = dlg.GetSelectedHash();\r
+               // load into window, do this even if empty so that it is clear that nothing has been selected\r
+               m_cFrom.AddString(selectedHash);\r
+               CheckRadioButton(IDC_RADIO_SINCE, IDC_RADIO_RANGE, IDC_RADIO_RANGE);\r
+               OnBnClickedRadio();\r
+       }\r
 }\r
 \r
 void CFormatPatchDlg::OnBnClickedButtonTo()\r
 {\r
-       // TODO: Add your control notification handler code here\r
+       CLogDlg dlg;\r
+       // tell the dialog to use mode for selecting revisions\r
+       dlg.SetSelect(true);\r
+       // only one revision must be selected however\r
+       dlg.SingleSelection(true);\r
+       if ( dlg.DoModal() == IDOK )\r
+       {\r
+               // get selected hash if any\r
+               CString selectedHash = dlg.GetSelectedHash();\r
+               // load into window, do this even if empty so that it is clear that nothing has been selected\r
+               m_cTo.AddString(selectedHash);\r
+               CheckRadioButton(IDC_RADIO_SINCE, IDC_RADIO_RANGE, IDC_RADIO_RANGE);\r
+               OnBnClickedRadio();\r
+       }\r
 }\r
 \r
 void CFormatPatchDlg::OnBnClickedOk()\r
@@ -169,3 +199,12 @@ void CFormatPatchDlg::OnBnClickedRadio()
                m_cTo.EnableWindow(TRUE);\r
        }\r
 }\r
+\r
+void CFormatPatchDlg::OnBnClickedButtonRef()\r
+{\r
+       if(CBrowseRefsDlg::PickRefForCombo(&m_cSince, gPickRef_NoTag))\r
+       {\r
+               CheckRadioButton(IDC_RADIO_SINCE, IDC_RADIO_RANGE, IDC_RADIO_SINCE);\r
+               OnBnClickedRadio();\r
+       }\r
+}\r
index e008749..3cdcf0a 100644 (file)
@@ -43,4 +43,5 @@ public:
        afx_msg void OnBnClickedButtonTo();\r
        afx_msg void OnBnClickedOk();\r
        afx_msg void OnBnClickedRadio();\r
+       afx_msg void OnBnClickedButtonRef();\r
 };\r
index 412adcb..463cef3 100644 (file)
@@ -1388,7 +1388,7 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
                        if(m_ContextMenuMask&GetContextMenuBit(ID_CHERRY_PICK))\r
                                popup.AppendMenuIcon(ID_CHERRY_PICK, IDS_CHERRY_PICK_VERSION, IDI_EXPORT);\r
 \r
-                       if(GetSelectedCount()<=2)\r
+                       if(GetSelectedCount()<=2 || (IsSelectionContinuous() && GetSelectedCount() > 0))\r
                                if(m_ContextMenuMask&GetContextMenuBit(ID_CREATE_PATCH))\r
                                        popup.AppendMenuIcon(ID_CREATE_PATCH, IDS_CREATE_PATCH, IDI_PATCH);\r
                        \r
index fe25ee2..a36a24f 100644 (file)
Binary files a/src/TortoiseProc/resource.h and b/src/TortoiseProc/resource.h differ