From 4329a6273f282eb5a5527dabdd294b508e67a64e Mon Sep 17 00:00:00 2001 From: Frank Li Date: Tue, 20 Jan 2009 22:11:58 +0800 Subject: [PATCH] Add show one file log at dialog box. Signed-off-by: Frank Li --- src/Git/Git.cpp | 19 +++++-- src/Git/Git.h | 9 ++- src/Git/GitRev.cpp | 5 +- src/TortoiseProc/Commands/LogCommand.cpp | 16 ++++-- src/TortoiseProc/Commands/PrevDiffCommand.cpp | 3 +- src/TortoiseProc/GitLogListBase.cpp | 9 ++- src/TortoiseProc/LogDataVector.cpp | 9 ++- src/TortoiseProc/LogDlg.cpp | 1 + src/TortoiseProc/LogDlgHelper.h | 2 +- .../TortoiseProcLang.vcproj.FSL.B20596.user | 65 ---------------------- 10 files changed, 53 insertions(+), 85 deletions(-) delete mode 100644 src/TortoiseProc/TortoiseProcLang.vcproj.FSL.B20596.user diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index 89e4fd290..d81542bb5 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -222,21 +222,31 @@ int CGit::GetLog(CString& logOut, CString &hash, CTGitPath *path ,int count,int param += _T(" --full-history "); if(mask& LOG_INFO_BOUNDARY) - param += _T("--left-right --boundary "); + param += _T(" --left-right --boundary "); + + if(mask& CGit::LOG_INFO_ALL_BRANCH) + param += _T(" --all "); + + if(mask& CGit::LOG_INFO_DETECT_COPYRENAME) + param += _T(" -C "); + + if(mask& CGit::LOG_INFO_DETECT_RENAME ) + param += _T(" -M "); param+=hash; - cmd.Format(_T("git.exe log %s -C --topo-order --parents %s --pretty=format:\""), + cmd.Format(_T("git.exe log %s --topo-order --parents %s --pretty=format:\""), num,param); - BuildOutputFormat(log); + BuildOutputFormat(log,!(mask&CGit::LOG_INFO_ONLY_HASH)); + cmd += log; cmd += CString(_T("\" "))+hash+file; return Run(cmd,&logOut); } - +#if 0 int CGit::GetShortLog(CString &logOut,CTGitPath * path, int count) { CString cmd; @@ -254,6 +264,7 @@ int CGit::GetShortLog(CString &logOut,CTGitPath * path, int count) //cmd += CString(_T("\" HEAD~40..HEAD")); return Run(cmd,&logOut); } +#endif #define BUFSIZE 512 void GetTempPath(CString &path) diff --git a/src/Git/Git.h b/src/Git/Git.h index 96a0186f5..b9da969fc 100644 --- a/src/Git/Git.h +++ b/src/Git/Git.h @@ -51,7 +51,10 @@ public: LOG_INFO_PATCH=0x4, LOG_INFO_FULLHISTORY=0x8, LOG_INFO_BOUNDARY=0x10, - LOG_INFO_ALL=0x20 + LOG_INFO_ALL_BRANCH=0x20, + LOG_INFO_ONLY_HASH=0x40, + LOG_INFO_DETECT_RENAME=0x80, + LOG_INFO_DETECT_COPYRENAME=0x100 }LOG_INFO_MASK; int GetRemoteList(STRING_VECTOR &list); @@ -60,12 +63,12 @@ public: int GetMapHashToFriendName(MAP_HASH_NAME &map); //hash is empty means all. -1 means all - int GetLog(CString& logOut,CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY); + int GetLog(CString& logOut,CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY|LOG_INFO_DETECT_COPYRENAME); git_revnum_t GetHash(CString &friendname); int BuildOutputFormat(CString &format,bool IsFull=TRUE); - int GetShortLog(CString &log,CTGitPath * path=NULL, int count =-1); + //int GetShortLog(CString &log,CTGitPath * path=NULL, int count =-1); static void StringAppend(CString *str,char *p); BOOL IsInitRepos(); diff --git a/src/Git/GitRev.cpp b/src/Git/GitRev.cpp index 083f517c5..d5e9edbdb 100644 --- a/src/Git/GitRev.cpp +++ b/src/Git/GitRev.cpp @@ -160,15 +160,16 @@ int GitRev::SafeFetchFullInfo(CGit *git) CString onelog; TCHAR oldmark=this->m_Mark; - git->GetLog(onelog,m_CommitHash,NULL,1,CGit::LOG_INFO_STAT|CGit::LOG_INFO_FILESTATE); + git->GetLog(onelog,m_CommitHash,NULL,1,CGit::LOG_INFO_STAT|CGit::LOG_INFO_FILESTATE|CGit::LOG_INFO_DETECT_COPYRENAME); CString oldhash=m_CommitHash; + GIT_REV_LIST oldlist=this->m_ParentHash; ParserFromLog(onelog); //ASSERT(oldhash==m_CommitHash); if(oldmark!=0) this->m_Mark=oldmark; //parser full log will cause old mark overwrited. //So we need keep old bound mark. - + this->m_ParentHash=oldlist; InterlockedExchange(&m_IsUpdateing,FALSE); InterlockedExchange(&m_IsFull,TRUE); return 0; diff --git a/src/TortoiseProc/Commands/LogCommand.cpp b/src/TortoiseProc/Commands/LogCommand.cpp index a5b78be63..70cde2292 100644 --- a/src/TortoiseProc/Commands/LogCommand.cpp +++ b/src/TortoiseProc/Commands/LogCommand.cpp @@ -25,21 +25,21 @@ bool LogCommand::Execute() { //the log command line looks like this: //command:log path: [startrev:] [endrev:] -#if 0 + CString val = parser.GetVal(_T("startrev")); if ( val.IsEmpty() ) { // support deprecated parameter prior 1.5.0 val = parser.GetVal(_T("revstart")); } - SVNRev revstart = val.IsEmpty() ? SVNRev() : SVNRev(val); + GitRev revstart ; val = parser.GetVal(_T("endrev")); if ( val.IsEmpty() ) { // support deprecated parameter prior 1.5.0 val = parser.GetVal(_T("revend")); } - SVNRev revend = val.IsEmpty() ? SVNRev() : SVNRev(val); + GitRev revend ; val = parser.GetVal(_T("limit")); int limit = _tstoi(val); val = parser.GetVal(_T("pegrev")); @@ -48,11 +48,16 @@ bool LogCommand::Execute() // support deprecated parameter prior 1.5.0 val = parser.GetVal(_T("revpeg")); } + + GitRev pegrev; + +#if 0 SVNRev pegrev = val.IsEmpty() ? SVNRev() : SVNRev(val); if (!revstart.IsValid()) revstart = SVNRev::REV_HEAD; if (!revend.IsValid()) revend = 0; +#endif if (limit == 0) { @@ -64,11 +69,12 @@ bool LogCommand::Execute() { bStrict = TRUE; } -#endif + CLogDlg dlg; theApp.m_pMainWnd = &dlg; -// dlg.SetParams(cmdLinePath, pegrev, revstart, revend, limit, bStrict); + //dlg.SetParams(cmdLinePath); + dlg.SetParams(cmdLinePath, pegrev, revstart, revend, limit, bStrict); // dlg.SetIncludeMerge(!!parser.HasKey(_T("merge"))); // val = parser.GetVal(_T("propspath")); // if (!val.IsEmpty()) diff --git a/src/TortoiseProc/Commands/PrevDiffCommand.cpp b/src/TortoiseProc/Commands/PrevDiffCommand.cpp index b8fa0378b..28ddea63c 100644 --- a/src/TortoiseProc/Commands/PrevDiffCommand.cpp +++ b/src/TortoiseProc/Commands/PrevDiffCommand.cpp @@ -49,7 +49,8 @@ bool PrevDiffCommand::Execute() CString logout; CLogDataVector revs; - revs.ParserShortLog(&cmdLinePath,2); + + revs.ParserShortLog(&cmdLinePath,hash,2); if( revs.size() == 0) { CMessageBox::Show(hWndExplorer, IDS_ERR_NOPREVREVISION, IDS_APPNAME, MB_ICONERROR); diff --git a/src/TortoiseProc/GitLogListBase.cpp b/src/TortoiseProc/GitLogListBase.cpp index ed13ed881..8d1c16253 100644 --- a/src/TortoiseProc/GitLogListBase.cpp +++ b/src/TortoiseProc/GitLogListBase.cpp @@ -1340,7 +1340,14 @@ int CGitLogListBase::FillGitShortLog() else path=&this->m_Path; - this->m_logEntries.ParserShortLog(path,-1); + CString hash; + int mask; + mask = CGit::LOG_INFO_ONLY_HASH | CGit::LOG_INFO_BOUNDARY; + if(this->m_bAllBranch) + mask |= CGit::LOG_INFO_ALL_BRANCH; + + this->m_logEntries.ParserShortLog(path,hash,-1,mask); + //this->m_logEntries.ParserFromLog(); SetItemCountEx(this->m_logEntries.size()); diff --git a/src/TortoiseProc/LogDataVector.cpp b/src/TortoiseProc/LogDataVector.cpp index b7e40968c..b276d1f40 100644 --- a/src/TortoiseProc/LogDataVector.cpp +++ b/src/TortoiseProc/LogDataVector.cpp @@ -63,7 +63,8 @@ //#include "EditPropertiesDlg.h" #include "FileDiffDlg.h" -int CLogDataVector::ParserShortLog(CTGitPath *path ,int count ) + +int CLogDataVector::ParserShortLog(CTGitPath *path ,CString &hash,int count ,int mask ) { CString log; GitRev rev; @@ -74,7 +75,10 @@ int CLogDataVector::ParserShortLog(CTGitPath *path ,int count ) CString begin; begin.Format(_T("#<%c>"),LOG_REV_ITEM_BEGIN); - g_Git.GetShortLog(log,path,count); + //g_Git.GetShortLog(log,path,count); + + g_Git.GetLog(log,hash,path,count,mask); + if(log.GetLength()==0) return 0; @@ -99,7 +103,6 @@ int CLogDataVector::ParserShortLog(CTGitPath *path ,int count ) } return 0; - return 0; } int CLogDataVector::FetchFullInfo(int i) diff --git a/src/TortoiseProc/LogDlg.cpp b/src/TortoiseProc/LogDlg.cpp index e85e71e88..1fa14ffec 100644 --- a/src/TortoiseProc/LogDlg.cpp +++ b/src/TortoiseProc/LogDlg.cpp @@ -348,6 +348,7 @@ BOOL CLogDlg::OnInitDialog() //m_tTo = 0; //m_tFrom = (DWORD)-1; + m_LogList.m_Path=m_path; m_LogList.FetchLogAsync(LogCallBack,this); GetDlgItem(IDC_LOGLIST)->SetFocus(); diff --git a/src/TortoiseProc/LogDlgHelper.h b/src/TortoiseProc/LogDlgHelper.h index f0dbc2d72..2d4c5e2bc 100644 --- a/src/TortoiseProc/LogDlgHelper.h +++ b/src/TortoiseProc/LogDlgHelper.h @@ -59,7 +59,7 @@ public: } void ClearAll(); int ParserFromLog(CTGitPath *path =NULL,int count = -1,int infomask=CGit::LOG_INFO_STAT|CGit::LOG_INFO_FILESTATE); - int ParserShortLog(CTGitPath *path =NULL,int count = -1 ); + int ParserShortLog(CTGitPath *path ,CString &hash,int count=-1 ,int mask=CGit::LOG_INFO_ONLY_HASH ); int FetchFullInfo(int i); Lanes m_Lns; diff --git a/src/TortoiseProc/TortoiseProcLang.vcproj.FSL.B20596.user b/src/TortoiseProc/TortoiseProcLang.vcproj.FSL.B20596.user deleted file mode 100644 index 834912e67..000000000 --- a/src/TortoiseProc/TortoiseProcLang.vcproj.FSL.B20596.user +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - -- 2.11.4.GIT