From 25bd4c961830590ffdb51202e935fd168b7b2484 Mon Sep 17 00:00:00 2001 From: Johan 't Hart Date: Fri, 26 Jun 2009 20:59:58 +0200 Subject: [PATCH 1/1] Pull/Fetch Dlg: Used git config to determine default remote and remote branch. Also enabled 'branch' option when pulling from known remote. Also started implementing rebase option (rebase instead of merge) when pulling. Disabled this though, because I think the rebase dialog should be used for this. It needs some work. --- src/Resources/TortoiseProcENG.rc | Bin 436384 -> 436864 bytes src/TortoiseProc/Commands/PullCommand.cpp | 5 ++- src/TortoiseProc/PullFetchDlg.cpp | 65 ++++++++++++++++++++++++++---- src/TortoiseProc/PullFetchDlg.h | 2 + src/TortoiseProc/resource.h | Bin 161400 -> 161508 bytes 5 files changed, 63 insertions(+), 9 deletions(-) diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 7df8a5fb845a17780d662a6bba19a291b0535a00..1b8630e0706ea33a5e0bd00d77c6f01f166b5b29 100644 GIT binary patch delta 318 zcmZ2*QL5ppR6`5n7ABpY%q9#L(?2#c9o_zAC(}MwUPA^;1|1+a0+JTfCw4H3PXBP6 zQEmFK{Y>lF4S<4%3`UbTrbtgeV9e;oX~|#;7qXpx;UE*wbi1caTHJ;V1`Osv88Zg+ z$@Ra)Coiy70?AH6Heph)(qw~)BGV0S19kno$0WgN0k+kQ!E}1yZ6?Xd>++Q*JA|@m zCov>46f>kUC@^R+xH41#S;-8g3?*QZARvj5_nbaal~t6{cRFtxllXK#MP?rEAfOf} z21kZq2G_|Suhjxw4Dtfdb<-afFlx3>ImEPm${}Vyt?3&Ym?frvYhV_eK4Bt|`0<9> ZgwbTWAuEe+d(>NIAZFPf^_JCbHvnqbUiJV0 delta 168 zcmZp;Dz)IER6`5n7ABpYjK|&NH#GTQV3i=rCAJpV+}DI{m|O zMz!g`_A{;H1PK}fq0#h>2bdD4FVJLUV+QgjZ!EH&e&HY!&-4$^n6#$*6)()-OxxX#F#BmuUoeANZ2FCN%qG+O-Z1O6TfJunVwUYz J?^)e;0{}BGJq-W= diff --git a/src/TortoiseProc/Commands/PullCommand.cpp b/src/TortoiseProc/Commands/PullCommand.cpp index ddab7fe..5419e0d 100644 --- a/src/TortoiseProc/Commands/PullCommand.cpp +++ b/src/TortoiseProc/Commands/PullCommand.cpp @@ -44,7 +44,10 @@ bool PullCommand::Execute() CString cmd; CString hashOld = g_Git.GetHash(L"HEAD"); - cmd.Format(_T("git.exe pull \"%s\" %s"),url,dlg.m_RemoteBranchName); + CString cmdRebase; + if(dlg.m_bRebase) + cmdRebase = "--rebase "; + cmd.Format(_T("git.exe pull %s\"%s\" %s"),cmdRebase, url, dlg.m_RemoteBranchName); CProgressDlg progress; progress.m_GitCmd = cmd; progress.m_bAutoCloseOnSuccess = true; diff --git a/src/TortoiseProc/PullFetchDlg.cpp b/src/TortoiseProc/PullFetchDlg.cpp index 106297e..18073cd 100644 --- a/src/TortoiseProc/PullFetchDlg.cpp +++ b/src/TortoiseProc/PullFetchDlg.cpp @@ -6,13 +6,14 @@ #include "PullFetchDlg.h" #include "Git.h" #include "AppUtils.h" - +#include "BrowseRefsDlg.h" // CPullFetchDlg dialog IMPLEMENT_DYNAMIC(CPullFetchDlg, CResizableStandAloneDialog) CPullFetchDlg::CPullFetchDlg(CWnd* pParent /*=NULL*/) - : CResizableStandAloneDialog(CPullFetchDlg::IDD, pParent) + : CResizableStandAloneDialog(CPullFetchDlg::IDD, pParent), + m_bRebase(false) { m_IsPull=TRUE; m_bAutoLoad = CAppUtils::IsSSHPutty(); @@ -31,6 +32,7 @@ void CPullFetchDlg::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_REMOTE_BRANCH, this->m_RemoteBranch); DDX_Control(pDX,IDC_REMOTE_MANAGE, this->m_RemoteManage); DDX_Check(pDX,IDC_PUTTYKEY_AUTOLOAD,m_bAutoLoad); + DDX_Check(pDX,IDC_CHECK_REBASE,m_bRebase); } @@ -40,6 +42,7 @@ BEGIN_MESSAGE_MAP(CPullFetchDlg,CResizableStandAloneDialog ) ON_BN_CLICKED(IDC_OTHER_RD, &CPullFetchDlg::OnBnClickedRd) ON_BN_CLICKED(IDOK, &CPullFetchDlg::OnBnClickedOk) ON_STN_CLICKED(IDC_REMOTE_MANAGE, &CPullFetchDlg::OnStnClickedRemoteManage) + ON_BN_CLICKED(IDC_BUTTON_BROWSE_REF, &CPullFetchDlg::OnBnClickedButtonBrowseRef) END_MESSAGE_MAP() BOOL CPullFetchDlg::OnInitDialog() @@ -54,6 +57,7 @@ BOOL CPullFetchDlg::OnInitDialog() AddAnchor(IDCANCEL,BOTTOM_RIGHT); AddAnchor(IDC_GROUPT_REMOTE,TOP_LEFT,BOTTOM_RIGHT); AddAnchor(IDC_PUTTYKEY_AUTOLOAD,BOTTOM_LEFT); + AddAnchor(IDC_CHECK_REBASE,BOTTOM_LEFT); AddAnchor(IDC_REMOTE_MANAGE,BOTTOM_LEFT); AddAnchor(IDHELP, BOTTOM_RIGHT); @@ -64,7 +68,12 @@ BOOL CPullFetchDlg::OnInitDialog() CheckRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD,IDC_REMOTE_RD); m_Remote.EnableWindow(TRUE); m_Other.EnableWindow(FALSE); - m_RemoteBranch.EnableWindow(FALSE); + if(!m_IsPull) + m_RemoteBranch.EnableWindow(FALSE); + +// if(!m_IsPull) + //Todo: implement rebase option sometime with rebase dialog + GetDlgItem(IDC_CHECK_REBASE)->ShowWindow(SW_HIDE); m_Other.SetURLHistory(TRUE); m_Other.LoadHistory(_T("Software\\TortoiseGit\\History\\PullURLS"), _T("url")); @@ -90,12 +99,26 @@ BOOL CPullFetchDlg::OnInitDialog() m_RemoteReg = remote; int sel=0; + //Select pull-remote from current branch + CString currentBranch = g_Git.GetSymbolicRef(); + CString configName; + configName.Format(L"branch.%s.remote", currentBranch); + CString pullRemote = g_Git.GetConfigValue(configName); + + //Select pull-branch from current branch + configName.Format(L"branch.%s.merge", currentBranch); + CString pullBranch = CGit::StripRefName(g_Git.GetConfigValue(configName)); + m_RemoteBranch.AddString(pullBranch); + + if(pullRemote.IsEmpty()) + pullRemote = remote; + if(!g_Git.GetRemoteList(list)) { for(unsigned int i=0;i= 0) + m_Remote.SetCurSel(ixFound); + m_RemoteBranch.AddString(remoteBranch); + + CheckRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD,IDC_REMOTE_RD); +} diff --git a/src/TortoiseProc/PullFetchDlg.h b/src/TortoiseProc/PullFetchDlg.h index 3297236..61a5428 100644 --- a/src/TortoiseProc/PullFetchDlg.h +++ b/src/TortoiseProc/PullFetchDlg.h @@ -29,6 +29,7 @@ protected: public: BOOL m_IsPull; BOOL m_bAutoLoad; + BOOL m_bRebase; BOOL m_bAutoLoadEnable; CHyperLink m_RemoteManage; @@ -37,4 +38,5 @@ public: CString m_RemoteURL; CString m_RemoteBranchName; afx_msg void OnStnClickedRemoteManage(); + afx_msg void OnBnClickedButtonBrowseRef(); }; diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index 005da05df5f13aa8ea776317c7f620ae1f10342d..845fa2248a1cc92387461e8410f5a64dec8aba2a 100644 GIT binary patch delta 68 zcmezIhV#i=&I#*yT^Lds%78eBA)le3arM^KjDVQvoBpGeNo@Lr YW=6H`cD0PVeoT+6WfYsvSH_eD0Gj(5*8l(j delta 46 zcmV+}0MY;C?Fsno36QRVzO}vqZhV)}d;uDlFogjKx2k;sy7-rFeE}Aiz;yx?myUJ< ERwHK=^#A|> -- 2.11.0