OSDN Git Service

Fixed issue #187: Allow start new rebase after finish rebase
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / RebaseDlg.cpp
index 0b0afea..0e6d8eb 100644 (file)
@@ -7,6 +7,8 @@
 #include "AppUtils.h"\r
 #include "MessageBox.h"\r
 #include "UnicodeUtils.h"\r
+#include "BrowseRefsDlg.h"\r
+#include "ProgressDlg.h"\r
 // CRebaseDlg dialog\r
 \r
 IMPLEMENT_DYNAMIC(CRebaseDlg, CResizableStandAloneDialog)\r
@@ -21,6 +23,8 @@ CRebaseDlg::CRebaseDlg(CWnd* pParent /*=NULL*/)
        m_CurrentRebaseIndex=-1;\r
        m_bThreadRunning =FALSE;\r
        this->m_IsCherryPick = FALSE;\r
+       m_bForce=FALSE;\r
+       m_IsFastForward=FALSE;\r
 }\r
 \r
 CRebaseDlg::~CRebaseDlg()\r
@@ -39,7 +43,8 @@ void CRebaseDlg::DoDataExchange(CDataExchange* pDX)
        DDX_Control(pDX,IDC_COMMIT_LIST,m_CommitList);\r
        DDX_Control(pDX,IDC_REBASE_COMBOXEX_BRANCH, this->m_BranchCtrl);\r
        DDX_Control(pDX,IDC_REBASE_COMBOXEX_UPSTREAM,   this->m_UpstreamCtrl);\r
-\r
+       DDX_Check(pDX, IDC_REBASE_CHECK_FORCE,m_bForce);\r
+       DDX_Control(pDX,IDC_REBASE_POST_BUTTON,m_PostButton);\r
 }\r
 \r
 \r
@@ -54,6 +59,10 @@ BEGIN_MESSAGE_MAP(CRebaseDlg, CResizableStandAloneDialog)
        ON_CBN_SELCHANGE(IDC_REBASE_COMBOXEX_BRANCH,   &CRebaseDlg::OnCbnSelchangeBranch)\r
        ON_CBN_SELCHANGE(IDC_REBASE_COMBOXEX_UPSTREAM, &CRebaseDlg::OnCbnSelchangeUpstream)\r
        ON_MESSAGE(MSG_REBASE_UPDATE_UI, OnRebaseUpdateUI)\r
+       ON_BN_CLICKED(IDC_BUTTON_BROWSE, &CRebaseDlg::OnBnClickedButtonBrowse)\r
+       ON_BN_CLICKED(IDC_REBASE_CHECK_FORCE, &CRebaseDlg::OnBnClickedRebaseCheckForce)\r
+       ON_STN_CLICKED(IDC_STATUS_STATIC, &CRebaseDlg::OnStnClickedStatusStatic)\r
+       ON_BN_CLICKED(IDC_REBASE_POST_BUTTON, &CRebaseDlg::OnBnClickedRebasePostButton)\r
 END_MESSAGE_MAP()\r
 \r
 void CRebaseDlg::AddRebaseAnchor()\r
@@ -72,7 +81,11 @@ void CRebaseDlg::AddRebaseAnchor()
        AddAnchor(IDC_REBASE_COMBOXEX_BRANCH,TOP_LEFT);\r
        AddAnchor(IDC_REBASE_STATIC_UPSTREAM,TOP_LEFT);\r
        AddAnchor(IDC_REBASE_STATIC_BRANCH,TOP_LEFT);\r
+       AddAnchor(IDHELP, BOTTOM_RIGHT);\r
+       AddAnchor(IDC_REBASE_CHECK_FORCE,TOP_RIGHT);\r
+       AddAnchor(IDC_REBASE_POST_BUTTON,BOTTOM_LEFT);\r
        \r
+       this->AddOthersToAnchor();\r
 }\r
 \r
 BOOL CRebaseDlg::OnInitDialog()\r
@@ -123,8 +136,13 @@ BOOL CRebaseDlg::OnInitDialog()
        m_wndOutputRebase.Call(SCI_SETREADONLY, TRUE);\r
        \r
        m_tooltips.Create(this);\r
+       \r
+       m_tooltips.AddTool(IDC_REBASE_CHECK_FORCE,IDS_REBASE_FORCE_TT);\r
+       m_tooltips.AddTool(IDC_REBASE_ABORT,IDS_REBASE_ABORT_TT);\r
+       \r
 \r
-       m_FileListCtrl.Init(SVNSLC_COLEXT | SVNSLC_COLSTATUS |IDS_STATUSLIST_COLADD|IDS_STATUSLIST_COLDEL , _T("RebaseDlg"),(SVNSLC_POPALL ^ SVNSLC_POPCOMMIT),false);\r
+\r
+       m_FileListCtrl.Init(SVNSLC_COLEXT | SVNSLC_COLSTATUS |SVNSLC_COLADD|SVNSLC_COLDEL , _T("RebaseDlg"),(SVNSLC_POPALL ^ SVNSLC_POPCOMMIT),false);\r
 \r
        m_ctrlTabCtrl.AddTab(&m_FileListCtrl,_T("Conflict File"));\r
        m_ctrlTabCtrl.AddTab(&m_LogMessageCtrl,_T("Commit Message"),1);\r
@@ -172,6 +190,14 @@ BOOL CRebaseDlg::OnInitDialog()
 \r
        this->SetControlEnable();\r
 \r
+       if(!this->m_PreCmd.IsEmpty())\r
+       {\r
+               CProgressDlg progress;\r
+               progress.m_GitCmd=m_PreCmd;\r
+               progress.m_bAutoCloseOnSuccess=true;\r
+               progress.DoModal();\r
+       }\r
+\r
        if(m_IsCherryPick)\r
        {\r
                this->m_BranchCtrl.SetCurSel(-1);\r
@@ -195,6 +221,12 @@ BOOL CRebaseDlg::OnInitDialog()
                                                                                m_CommitList.GetContextMenuBit(CGitLogListBase::ID_REVERTTOREV)|\r
                                                                                m_CommitList.GetContextMenuBit(CGitLogListBase::ID_COMBINE_COMMIT));\r
 \r
+       if(m_CommitList.m_IsOldFirst)\r
+               this->m_CurrentRebaseIndex = -1;\r
+       else\r
+               this->m_CurrentRebaseIndex = m_CommitList.m_logEntries.size();\r
+\r
+\r
        return TRUE;\r
 }\r
 // CRebaseDlg message handlers\r
@@ -280,6 +312,7 @@ void CRebaseDlg::DoSize(int delta)
        CSplitterControl::ChangePos(GetDlgItem(IDC_SQUASH_ALL),0,delta);\r
        CSplitterControl::ChangePos(GetDlgItem(IDC_PICK_ALL),0,delta);\r
        CSplitterControl::ChangePos(GetDlgItem(IDC_EDIT_ALL),0,delta);\r
+       CSplitterControl::ChangePos(GetDlgItem(IDC_REBASE_CHECK_FORCE),0,delta);\r
        \r
        this->AddRebaseAnchor();\r
        // adjust the minimum size of the dialog to prevent the resizing from\r
@@ -358,6 +391,24 @@ void CRebaseDlg::LoadBranchInfo()
                m_UpstreamCtrl.AddString(m_Upstream);\r
                m_UpstreamCtrl.SetCurSel(m_UpstreamCtrl.GetCount()-1);\r
        }\r
+       else\r
+       {\r
+               //Select pull-remote from current branch\r
+               CString currentBranch = g_Git.GetSymbolicRef();\r
+               CString configName;\r
+               configName.Format(L"branch.%s.remote", currentBranch);\r
+               CString pullRemote = g_Git.GetConfigValue(configName);\r
+\r
+               //Select pull-branch from current branch\r
+               configName.Format(L"branch.%s.merge", currentBranch);\r
+               CString pullBranch = CGit::StripRefName(g_Git.GetConfigValue(configName));\r
+\r
+               CString defaultUpstream;\r
+               defaultUpstream.Format(L"remotes/%s/%s", pullRemote, pullBranch);\r
+               int found = m_UpstreamCtrl.FindStringExact(0, defaultUpstream);\r
+               if(found >= 0)\r
+                       m_UpstreamCtrl.SetCurSel(found);\r
+       }\r
 }\r
 \r
 void CRebaseDlg::OnCbnSelchangeBranch()\r
@@ -372,12 +423,82 @@ void CRebaseDlg::OnCbnSelchangeUpstream()
 \r
 void CRebaseDlg::FetchLogList()\r
 {\r
+       CString base,hash;\r
+       CString cmd;\r
+       m_IsFastForward=FALSE;\r
+       cmd.Format(_T("git.exe merge-base %s %s"), m_UpstreamCtrl.GetString(),m_BranchCtrl.GetString());\r
+       if(g_Git.Run(cmd,&base,CP_ACP))\r
+       {\r
+               CMessageBox::Show(NULL,base,_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+               return;\r
+       }\r
+       base=base.Left(40);\r
+\r
+       hash=g_Git.GetHash(m_BranchCtrl.GetString());\r
+\r
+       if(hash == g_Git.GetHash(this->m_UpstreamCtrl.GetString()))\r
+       {\r
+               m_CommitList.Clear();\r
+               CString text,fmt;\r
+               fmt.LoadString(IDS_REBASE_EQUAL_FMT);\r
+               text.Format(fmt,m_BranchCtrl.GetString(),this->m_UpstreamCtrl.GetString());\r
+\r
+               m_CommitList.ShowText(text);\r
+               this->GetDlgItem(IDC_REBASE_CONTINUE)->EnableWindow(false);\r
+               return;\r
+       }\r
+\r
+       hash=hash.Left(40);\r
+       \r
+       if(hash == base )\r
+       {\r
+               //fast forword\r
+               this->m_IsFastForward=TRUE;\r
+\r
+               m_CommitList.Clear();\r
+               CString text,fmt;\r
+               fmt.LoadString(IDS_REBASE_FASTFORWARD_FMT);\r
+               text.Format(fmt,m_BranchCtrl.GetString(),this->m_UpstreamCtrl.GetString(),\r
+                                               m_BranchCtrl.GetString(),this->m_UpstreamCtrl.GetString());\r
+\r
+               m_CommitList.ShowText(text);\r
+               this->GetDlgItem(IDC_REBASE_CONTINUE)->EnableWindow(true);\r
+               SetContinueButtonText();\r
+               \r
+               return ;\r
+       }\r
+\r
+       hash.Empty();\r
+\r
+       if(!this->m_bForce)\r
+       {\r
+               cmd.Format(_T("git.exe rev-parse %s"), m_UpstreamCtrl.GetString());\r
+               if( g_Git.Run(cmd,&hash,CP_ACP))\r
+               {\r
+                       CMessageBox::Show(NULL,base,_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+                       return;\r
+               }\r
+               hash=hash.Left(40);\r
+               \r
+               if( base == hash )\r
+               {\r
+                       m_CommitList.Clear();\r
+                       CString text,fmt;\r
+                       fmt.LoadString(IDS_REBASE_UPTODATE_FMT);\r
+                       text.Format(fmt,m_BranchCtrl.GetString());\r
+                       m_CommitList.ShowText(text);\r
+                       this->GetDlgItem(IDC_REBASE_CONTINUE)->EnableWindow(m_CommitList.GetItemCount());\r
+                       SetContinueButtonText();\r
+                       return;\r
+               }\r
+       }\r
+\r
        m_CommitList.Clear();\r
        this->m_CommitList.FillGitLog(NULL,0,&m_UpstreamCtrl.GetString(),&m_BranchCtrl.GetString());\r
        if( m_CommitList.GetItemCount() == 0 )\r
-               m_CommitList.ShowText(_T("Nothing Rebase"));\r
+               m_CommitList.ShowText(_T("Nothing to Rebase"));\r
 \r
-       CString hash=g_Git.GetHash(m_UpstreamCtrl.GetString());\r
+       hash=g_Git.GetHash(m_UpstreamCtrl.GetString());\r
        \r
 #if 0\r
        if(m_CommitList.m_logEntries[m_CommitList.m_logEntries.size()-1].m_ParentHash.size() >=0 )\r
@@ -398,7 +519,7 @@ void CRebaseDlg::FetchLogList()
        {\r
                m_CommitList.m_logEntries[i].m_Action = CTGitPath::LOGACTIONS_REBASE_PICK;\r
        }\r
-       \r
+\r
        m_CommitList.Invalidate();\r
 \r
        if(m_CommitList.m_IsOldFirst)\r
@@ -406,6 +527,8 @@ void CRebaseDlg::FetchLogList()
        else\r
                this->m_CurrentRebaseIndex = m_CommitList.m_logEntries.size();\r
        \r
+       this->GetDlgItem(IDC_REBASE_CONTINUE)->EnableWindow(m_CommitList.GetItemCount());\r
+       SetContinueButtonText();\r
 }\r
 \r
 void CRebaseDlg::AddBranchToolTips(CHistoryCombo *pBranch)\r
@@ -458,14 +581,18 @@ int CRebaseDlg::CheckRebaseCondition()
 int CRebaseDlg::StartRebase()\r
 {\r
        CString cmd,out;\r
-       //Todo call comment_for_reflog\r
-       cmd.Format(_T("git.exe checkout %s"),this->m_BranchCtrl.GetString());\r
-       this->AddLogString(cmd);\r
+       m_FileListCtrl.m_bIsRevertTheirMy = !m_IsCherryPick;\r
+       if(!this->m_IsCherryPick)\r
+       {\r
+               //Todo call comment_for_reflog\r
+               cmd.Format(_T("git.exe checkout %s"),this->m_BranchCtrl.GetString());\r
+               this->AddLogString(cmd);\r
 \r
-       if(g_Git.Run(cmd,&out,CP_UTF8))\r
-               return -1;\r
+               if(g_Git.Run(cmd,&out,CP_UTF8))\r
+                       return -1;\r
 \r
-       this->AddLogString(out);\r
+               this->AddLogString(out);\r
+       }\r
 \r
        cmd=_T("git.exe rev-parse --verify HEAD");\r
        if(g_Git.Run(cmd,&out,CP_UTF8))\r
@@ -484,17 +611,18 @@ int CRebaseDlg::StartRebase()
                return -1;\r
        }\r
        \r
-       cmd.Format(_T("git.exe update-ref ORIG_HEAD HEAD"));\r
-\r
-       cmd.Format(_T("git.exe checkout %s"),this->m_UpstreamCtrl.GetString());\r
-       this->AddLogString(cmd);\r
-\r
-       out.Empty();\r
-       if(g_Git.Run(cmd,&out,CP_UTF8))\r
+       if( !this->m_IsCherryPick )\r
        {\r
-               return -1;\r
-       }\r
+               cmd.Format(_T("git.exe checkout %s"),this->m_UpstreamCtrl.GetString());\r
+               this->AddLogString(cmd);\r
 \r
+               out.Empty();\r
+               if(g_Git.Run(cmd,&out,CP_UTF8))\r
+               {\r
+                       return -1;\r
+               }\r
+       }\r
+       \r
        m_OrigUpstreamHash.Empty();\r
        m_OrigUpstreamHash= g_Git.GetHash(this->m_UpstreamCtrl.GetString());\r
        if(m_OrigUpstreamHash.IsEmpty())\r
@@ -503,14 +631,19 @@ int CRebaseDlg::StartRebase()
                return -1;\r
        }\r
 \r
-       cmd.Format(_T("git.exe rev-parse %s"),this->m_BranchCtrl.GetString());\r
-       if(g_Git.Run(cmd,&this->m_OrigBranchHash,CP_UTF8))\r
+       if( !this->m_IsCherryPick )\r
        {\r
-               this->AddLogString(m_OrigBranchHash);\r
-               return -1;\r
-       }\r
+               cmd.Format(_T("git.exe rev-parse %s"),this->m_BranchCtrl.GetString());\r
+               if(g_Git.Run(cmd,&this->m_OrigBranchHash,CP_UTF8))\r
+               {\r
+                       this->AddLogString(m_OrigBranchHash);\r
+                       return -1;\r
+               }\r
+               this->AddLogString(_T("Start Rebase\r\n"));\r
 \r
-       this->AddLogString(_T("Start Rebase\r\n"));\r
+       }else\r
+               this->AddLogString(_T("Start Cherry-pick\r\n"));\r
+       \r
        return 0;\r
 }\r
 int  CRebaseDlg::VerifyNoConflict()\r
@@ -531,6 +664,9 @@ int  CRebaseDlg::VerifyNoConflict()
 }\r
 int CRebaseDlg::FinishRebase()\r
 {\r
+       if(this->m_IsCherryPick) //cherry pick mode no "branch", working at upstream branch\r
+               return 0;\r
+\r
        CString cmd,out;\r
        cmd.Format(_T("git.exe branch -f %s"),this->m_BranchCtrl.GetString());\r
        if(g_Git.Run(cmd,&out,CP_UTF8))\r
@@ -556,6 +692,57 @@ int CRebaseDlg::FinishRebase()
 }\r
 void CRebaseDlg::OnBnClickedContinue()\r
 {\r
+       if( m_RebaseStage == REBASE_DONE)\r
+       {\r
+               OnOK();\r
+               return;\r
+       }\r
+\r
+       if( this->m_IsFastForward )\r
+       {\r
+               CString cmd,out;\r
+               CString oldbranch = g_Git.GetCurrentBranch();\r
+               if( oldbranch != m_BranchCtrl.GetString() )\r
+               {\r
+                       cmd.Format(_T("git.exe checkout %s"),m_BranchCtrl.GetString());\r
+                       AddLogString(cmd);\r
+                       if( g_Git.Run(cmd,&out,CP_ACP) )\r
+                       {\r
+                               this->m_ctrlTabCtrl.SetActiveTab(REBASE_TAB_LOG);\r
+                               AddLogString(out);\r
+                               return;\r
+                       }\r
+               }\r
+               AddLogString(out);\r
+               out.Empty();\r
+               m_OrigBranchHash = g_Git.GetHash(m_BranchCtrl.GetString());\r
+               m_OrigUpstreamHash = g_Git.GetHash(this->m_UpstreamCtrl.GetString());\r
+                       \r
+               if(!g_Git.IsFastForward(this->m_BranchCtrl.GetString(),this->m_UpstreamCtrl.GetString()))\r
+               {\r
+                       this->m_ctrlTabCtrl.SetActiveTab(REBASE_TAB_LOG);\r
+                       AddLogString(_T("No fast forward\r\nMaybe repository changed"));\r
+                       return;\r
+               }\r
+               \r
+               cmd.Format(_T("git.exe reset --hard %s"),this->m_UpstreamCtrl.GetString());\r
+               this->AddLogString(CString(_T("Fast forward to "))+m_UpstreamCtrl.GetString());\r
+\r
+               AddLogString(cmd);\r
+               this->m_ctrlTabCtrl.SetActiveTab(REBASE_TAB_LOG);\r
+               if(g_Git.Run(cmd,&out,CP_ACP))\r
+               {\r
+                       AddLogString(_T("Fail"));\r
+                       AddLogString(out);\r
+                       return;\r
+               }\r
+               AddLogString(out);\r
+               AddLogString(_T("Done"));\r
+               m_RebaseStage = REBASE_DONE;\r
+               UpdateCurrentStatus();\r
+               return;\r
+\r
+       }\r
        if( m_RebaseStage == CHOOSE_BRANCH|| m_RebaseStage == CHOOSE_COMMIT_PICK_MODE )\r
        {\r
                if(CheckRebaseCondition())\r
@@ -563,10 +750,6 @@ void CRebaseDlg::OnBnClickedContinue()
                m_RebaseStage = REBASE_START;\r
        }\r
 \r
-       if( m_RebaseStage == REBASE_DONE)\r
-       {\r
-               OnOK();\r
-       }\r
 \r
        if( m_RebaseStage == REBASE_FINISH )\r
        {\r
@@ -752,7 +935,10 @@ void CRebaseDlg::SetContinueButtonText()
        {\r
        case CHOOSE_BRANCH:\r
        case CHOOSE_COMMIT_PICK_MODE:\r
-               Text = _T("Start");\r
+               if(this->m_IsFastForward)\r
+                       Text = _T("Start(FastFwd)");\r
+               else\r
+                       Text = _T("Start");\r
                break;\r
 \r
        case REBASE_START:\r
@@ -794,10 +980,12 @@ void CRebaseDlg::SetControlEnable()
                this->GetDlgItem(IDC_PICK_ALL)->EnableWindow(TRUE);\r
                this->GetDlgItem(IDC_EDIT_ALL)->EnableWindow(TRUE);\r
                this->GetDlgItem(IDC_SQUASH_ALL)->EnableWindow(TRUE);\r
+               \r
                if(!m_IsCherryPick)\r
                {\r
                        this->GetDlgItem(IDC_REBASE_COMBOXEX_BRANCH)->EnableWindow(TRUE);\r
                        this->GetDlgItem(IDC_REBASE_COMBOXEX_UPSTREAM)->EnableWindow(TRUE);\r
+                       this->GetDlgItem(IDC_REBASE_CHECK_FORCE)->EnableWindow(TRUE);                   \r
                }\r
                //this->m_CommitList.m_IsEnableRebaseMenu=TRUE;\r
                this->m_CommitList.m_ContextMenuMask |= m_CommitList.GetContextMenuBit(CGitLogListBase::ID_REBASE_PICK)|\r
@@ -819,11 +1007,21 @@ void CRebaseDlg::SetControlEnable()
                this->GetDlgItem(IDC_SQUASH_ALL)->EnableWindow(FALSE);\r
                this->GetDlgItem(IDC_REBASE_COMBOXEX_BRANCH)->EnableWindow(FALSE);\r
                this->GetDlgItem(IDC_REBASE_COMBOXEX_UPSTREAM)->EnableWindow(FALSE);\r
+               this->GetDlgItem(IDC_REBASE_CHECK_FORCE)->EnableWindow(FALSE);\r
                //this->m_CommitList.m_IsEnableRebaseMenu=FALSE;\r
                this->m_CommitList.m_ContextMenuMask &= ~(m_CommitList.GetContextMenuBit(CGitLogListBase::ID_REBASE_PICK)|\r
                                                                                                m_CommitList.GetContextMenuBit(CGitLogListBase::ID_REBASE_SQUASH)|\r
                                                                                                m_CommitList.GetContextMenuBit(CGitLogListBase::ID_REBASE_EDIT)|\r
                                                                                                m_CommitList.GetContextMenuBit(CGitLogListBase::ID_REBASE_SKIP));\r
+\r
+               if( m_RebaseStage == REBASE_DONE && (this->m_PostButtonTexts.GetCount() != 0) )\r
+               {\r
+                       this->GetDlgItem(IDC_STATUS_STATIC)->ShowWindow(SW_HIDE);\r
+                       this->GetDlgItem(IDC_REBASE_POST_BUTTON)->ShowWindow(SW_SHOWNORMAL);\r
+                       this->m_PostButton.RemoveAll();\r
+                       this->m_PostButton.AddEntries(m_PostButtonTexts);\r
+                       //this->GetDlgItem(IDC_REBASE_POST_BUTTON)->SetWindowText(this->m_PostButtonText);\r
+               }\r
                break;\r
        }\r
 \r
@@ -1096,6 +1294,8 @@ void CRebaseDlg::ListConflictFile()
        CTGitPath path;\r
        list.AddPath(path);\r
 \r
+       m_FileListCtrl.m_bIsRevertTheirMy = !m_IsCherryPick;\r
+\r
        this->m_FileListCtrl.GetStatus(&list,true);\r
        this->m_FileListCtrl.Show(CTGitPath::LOGACTIONS_UNMERGED|CTGitPath::LOGACTIONS_MODIFIED|CTGitPath::LOGACTIONS_ADDED|CTGitPath::LOGACTIONS_DELETED,\r
                                                           CTGitPath::LOGACTIONS_UNMERGED);\r
@@ -1152,10 +1352,21 @@ void CRebaseDlg::OnBnClickedAbort()
                return;\r
        }\r
 \r
-       if(CMessageBox::Show(NULL,_T("Are you sure abort rebase"),_T("TortoiseGit"),MB_YESNO) != IDYES)\r
+       if(CMessageBox::Show(NULL,_T("Are you sure you want to abort the rebase process?"),_T("TortoiseGit"),MB_YESNO) != IDYES)\r
                return;\r
 \r
-       cmd.Format(_T("git checkout -f %s"),this->m_UpstreamCtrl.GetString());\r
+       if(this->m_IsFastForward)\r
+       {\r
+               cmd.Format(_T("git.exe reset --hard  %s"),this->m_OrigBranchHash.Left(40));\r
+               if(g_Git.Run(cmd,&out,CP_UTF8))\r
+               {\r
+                       AddLogString(out);\r
+                       return ;\r
+               }\r
+               __super::OnCancel();\r
+               return;\r
+       }\r
+       cmd.Format(_T("git.exe checkout -f %s"),this->m_UpstreamCtrl.GetString());\r
        if(g_Git.Run(cmd,&out,CP_UTF8))\r
        {\r
                AddLogString(out);\r
@@ -1169,6 +1380,9 @@ void CRebaseDlg::OnBnClickedAbort()
                return ;\r
        }\r
        \r
+       if(this->m_IsCherryPick) //there are not "branch" at cherry pick mode\r
+               return;\r
+\r
        cmd.Format(_T("git checkout -f %s"),this->m_BranchCtrl.GetString());\r
        if(g_Git.Run(cmd,&out,CP_UTF8))\r
        {\r
@@ -1184,3 +1398,30 @@ void CRebaseDlg::OnBnClickedAbort()
        }\r
        __super::OnCancel();\r
 }\r
+\r
+void CRebaseDlg::OnBnClickedButtonBrowse()\r
+{\r
+       if(CBrowseRefsDlg::PickRefForCombo(&m_UpstreamCtrl, gPickRef_NoTag))\r
+               OnCbnSelchangeUpstream();\r
+}\r
+\r
+void CRebaseDlg::OnBnClickedRebaseCheckForce()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       this->UpdateData();\r
+       this->FetchLogList();\r
+}\r
+\r
+void CRebaseDlg::OnStnClickedStatusStatic()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+}\r
+\r
+void CRebaseDlg::OnBnClickedRebasePostButton()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       this->m_Upstream=this->m_UpstreamCtrl.GetString();\r
+       this->m_Branch=this->m_BranchCtrl.GetString();\r
+\r
+       this->EndDialog(IDC_REBASE_POST_BUTTON);\r
+}\r