OSDN Git Service

Fixed issue #110: Feature Requeest: Default settings from local repositories pushing...
authorFrank Li <lznuaa@gmail.com>
Mon, 13 Jul 2009 14:41:15 +0000 (22:41 +0800)
committerFrank Li <lznuaa@gmail.com>
Mon, 13 Jul 2009 14:41:15 +0000 (22:41 +0800)
Choose track remote and remote branch!
Add short-cut at push dialog

src/Resources/TortoiseProcENG.rc
src/TortoiseProc/PushDlg.cpp

index b2d8149..959e282 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
index 37e2521..48291a3 100644 (file)
@@ -105,8 +105,6 @@ BOOL CPushDlg::OnInitDialog()
 \r
        Refresh();\r
 \r
-       m_BranchRemote.LoadHistory(CString(_T("Software\\TortoiseGit\\History\\RemoteBranch\\"))+WorkingDir, _T("branch"));\r
-       m_BranchRemote.SetCurSel(0);\r
 \r
        //m_BranchRemote.SetWindowTextW(m_BranchSource.GetString());\r
 \r
@@ -123,6 +121,29 @@ void CPushDlg::Refresh()
        m_RemoteReg = remote;\r
        int sel=0;\r
 \r
+       CString currentBranch = g_Git.GetSymbolicRef();\r
+       CString configName;\r
+\r
+       configName.Format(L"branch.%s.pushremote", currentBranch);\r
+       CString pushRemote = g_Git.GetConfigValue(configName);\r
+       if( pushRemote.IsEmpty() )\r
+       {\r
+               configName.Format(L"branch.%s.remote", currentBranch);\r
+               pushRemote = g_Git.GetConfigValue(configName);\r
+       }\r
+\r
+       if( !pushRemote.IsEmpty() )\r
+               remote=pushRemote;\r
+\r
+       //Select pull-branch from current branch\r
+       configName.Format(L"branch.%s.pushbranch", currentBranch);\r
+       CString pushBranch = CGit::StripRefName(g_Git.GetConfigValue(configName));\r
+       if( pushBranch.IsEmpty() )\r
+       {\r
+               configName.Format(L"branch.%s.merge", currentBranch);\r
+               pushBranch = CGit::StripRefName(g_Git.GetConfigValue(configName));              \r
+       }\r
+\r
        STRING_VECTOR list;\r
        m_Remote.Reset();\r
 \r
@@ -147,6 +168,12 @@ void CPushDlg::Refresh()
        }\r
        m_BranchSource.SetCurSel(current);\r
 \r
+       m_BranchRemote.LoadHistory(CString(_T("Software\\TortoiseGit\\History\\RemoteBranch\\"))+WorkingDir, _T("branch"));\r
+       if( !pushBranch.IsEmpty() )\r
+               m_BranchRemote.AddString(pushBranch);\r
+\r
+       m_BranchRemote.SetCurSel(0);\r
+\r
 }\r
 // CPushDlg message handlers\r
 \r