From: Frank Li Date: Sun, 8 Mar 2009 13:29:32 +0000 (+0800) Subject: Add Diff with work copy and file list X-Git-Url: http://git.sourceforge.jp/view?p=tortoisegit%2FTortoiseGitJp.git;a=commitdiff_plain;h=880651835af8d405e30e3ac03e47bb415cdf37bc Add Diff with work copy and file list Signed-off-by: Frank Li --- diff --git a/src/Git/GitStatusListCtrl.cpp b/src/Git/GitStatusListCtrl.cpp index 50dc24f..ce9ee8d 100644 --- a/src/Git/GitStatusListCtrl.cpp +++ b/src/Git/GitStatusListCtrl.cpp @@ -2305,7 +2305,8 @@ void CGitStatusListCtrl::OnContextMenuList(CWnd * pWnd, CPoint point) if (m_dwContextMenus & this->GetContextMenuBit(IDSVNLC_COMPAREWC)) { - popup.AppendMenuIcon(IDSVNLC_COMPAREWC, IDS_LOG_POPUP_COMPARE, IDI_DIFF); + if( (!m_CurrentVersion.IsEmpty()) && m_CurrentVersion != GIT_REV_ZERO) + popup.AppendMenuIcon(IDSVNLC_COMPAREWC, IDS_LOG_POPUP_COMPARE, IDI_DIFF); } //Select one items if (GetSelectedCount() == 1) @@ -2677,6 +2678,19 @@ void CGitStatusListCtrl::OnContextMenuList(CWnd * pWnd, CPoint point) ShellExecute(this->m_hWnd, _T("explore"), filepath->GetDirectory().GetWinPath(), NULL, NULL, SW_SHOW); } break; + + // Compare current version and work copy. + case IDSVNLC_COMPAREWC: + { + POSITION pos = GetFirstSelectedItemPosition(); + while ( pos ) + { + int index = GetNextSelectedItem(pos); + StartDiffWC(index); + } + } + break; + // Compare with base version. when current version is zero, compare workcopy and HEAD. case IDSVNLC_COMPARE: { POSITION pos = GetFirstSelectedItemPosition(); @@ -3970,6 +3984,22 @@ void CGitStatusListCtrl::OnNMDblclk(NMHDR *pNMHDR, LRESULT *pResult) } } +void CGitStatusListCtrl::StartDiffWC(int fileindex) +{ + if(fileindex<0) + return; + + CString Ver; + if(this->m_CurrentVersion.IsEmpty() || m_CurrentVersion== GIT_REV_ZERO) + return; + + CTGitPath file1=*(CTGitPath*)GetItemData(fileindex); + + CGitDiff::Diff(&file1,&file1, + CString(GIT_REV_ZERO), + m_CurrentVersion); + +} void CGitStatusListCtrl::StartDiff(int fileindex) { diff --git a/src/Git/GitStatusListCtrl.h b/src/Git/GitStatusListCtrl.h index 8a2bdd8..04856f3 100644 --- a/src/Git/GitStatusListCtrl.h +++ b/src/Git/GitStatusListCtrl.h @@ -780,6 +780,7 @@ private: void RemoveListEntry(int index); ///< removes an entry from the listcontrol and both arrays bool BuildStatistics(); ///< build the statistics and correct the case of files/folders void StartDiff(int fileindex); ///< start the external diff program + void StartDiffWC(int fileindex); ///< start the external diff program /// fetch all user properties for all items void FetchUserProperties();