本文整理汇总了C++中GitRev类的典型用法代码示例。如果您正苦于以下问题:C++ GitRev类的具体用法?C++ GitRev怎么用?C++ GitRev使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GitRev类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckNextCommitIsSquash
int CRebaseDlg::CheckNextCommitIsSquash()
{
int index;
if(m_CommitList.m_IsOldFirst)
index=m_CurrentRebaseIndex+1;
else
index=m_CurrentRebaseIndex-1;
GitRev *curRev;
do
{
if(index<0)
return -1;
if(index>= m_CommitList.GetItemCount())
return -1;
curRev=(GitRev*)m_CommitList.m_arShownList[index];
if( curRev->GetAction(&m_CommitList)&CTGitPath::LOGACTIONS_REBASE_SQUASH )
return 0;
if( curRev->GetAction(&m_CommitList)&CTGitPath::LOGACTIONS_REBASE_SKIP)
{
if(m_CommitList.m_IsOldFirst)
index++;
else
index--;
}
else
return -1;
}while(curRev->GetAction(&m_CommitList)&CTGitPath::LOGACTIONS_REBASE_SKIP);
return -1;
}
示例2: KillTimer
void CFileDiffDlg::OnTimer(UINT_PTR nIDEvent)
{
if (m_bThreadRunning)
return;
if( nIDEvent == IDT_FILTER)
{
CString sFilterText;
KillTimer(IDT_FILTER);
m_cFilter.GetWindowText(sFilterText);
m_cFileList.SetRedraw(FALSE);
m_cFileList.DeleteAllItems();
Filter(sFilterText);
m_cFileList.SetRedraw(TRUE);
__super::OnTimer(nIDEvent);
}
if( nIDEvent == IDT_INPUT)
{
KillTimer(IDT_INPUT);
TRACE(_T("Input Timer\r\n"));
GitRev gitrev;
CString str;
int mask = 0;
this->m_ctrRev1Edit.GetWindowText(str);
if( !gitrev.GetCommit(str) )
{
this->m_rev1=gitrev;
mask |= 0x1;
}
this->m_ctrRev2Edit.GetWindowText(str);
if( !gitrev.GetCommit(str) )
{
this->m_rev2=gitrev;
mask |= 0x2;
}
this->SetURLLabels(mask);
if(mask == 0x3)
{
InterlockedExchange(&m_bThreadRunning, TRUE);
if (AfxBeginThread(DiffThreadEntry, this)==NULL)
{
InterlockedExchange(&m_bThreadRunning, FALSE);
CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR);
}
}
}
}
示例3: _tstoi
bool LogCommand::Execute()
{
//the log command line looks like this:
//command:log path:<path_to_file_or_directory_to_show_the_log_messages> [startrev:<startrevision>] [endrev:<endrevision>]
CString val = parser.GetVal(_T("startrev"));
if ( val.IsEmpty() )
{
// support deprecated parameter prior 1.5.0
val = parser.GetVal(_T("revstart"));
}
GitRev revstart ;
val = parser.GetVal(_T("endrev"));
if ( val.IsEmpty() )
{
// support deprecated parameter prior 1.5.0
val = parser.GetVal(_T("revend"));
}
GitRev revend ;
val = parser.GetVal(_T("limit"));
int limit = _tstoi(val);
val = parser.GetVal(_T("pegrev"));
if ( val.IsEmpty() )
{
// 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)
{
CRegDWORD reg = CRegDWORD(_T("Software\\TortoiseGit\\NumberOfLogs"), 100);
limit = (int)(LONG)reg;
}
CLogDlg dlg;
theApp.m_pMainWnd = &dlg;
//dlg.SetParams(cmdLinePath);
dlg.SetParams(cmdLinePath, pegrev, revstart, revend, limit);
// dlg.SetIncludeMerge(!!parser.HasKey(_T("merge")));
// val = parser.GetVal(_T("propspath"));
// if (!val.IsEmpty())
// dlg.SetProjectPropertiesPath(CTSVNPath(val));
dlg.DoModal();
return true;
}
示例4: updateLanes
void CLogDataVector::updateLanes(GitRev& c, Lanes& lns, CGitHash &sha)
{
// we could get third argument from c.sha(), but we are in fast path here
// and c.sha() involves a deep copy, so we accept a little redundancy
if (lns.isEmpty())
lns.init(sha);
bool isDiscontinuity;
bool isFork = lns.isFork(sha, isDiscontinuity);
bool isMerge = (c.ParentsCount() > 1);
bool isInitial = (c.ParentsCount() == 0);
if (isDiscontinuity)
lns.changeActiveLane(sha); // uses previous isBoundary state
lns.setBoundary(c.IsBoundary() == TRUE); // update must be here
TRACE(_T("%s %d"),c.m_CommitHash.ToString(),c.IsBoundary());
if (isFork)
lns.setFork(sha);
if (isMerge)
lns.setMerge(c.m_ParentHash);
//if (c.isApplied)
// lns.setApplied();
if (isInitial)
lns.setInitial();
lns.getLanes(c.m_Lanes); // here lanes are snapshotted
CGitHash nextSha;
if( !isInitial)
nextSha = c.m_ParentHash[0];
lns.nextParent(nextSha);
//if (c.isApplied)
// lns.afterApplied();
if (isMerge)
lns.afterMerge();
if (isFork)
lns.afterFork();
if (lns.isBranch())
lns.afterBranch();
// QString tmp = "", tmp2;
// for (uint i = 0; i < c.lanes.count(); i++) {
// tmp2.setNum(c.lanes[i]);
// tmp.append(tmp2 + "-");
// }
// qDebug("%s %s",tmp.latin1(), c.sha.latin1());
}
示例5: git_for_each_reflog_ent
int CLogDataVector::ParserFromRefLog(CString ref)
{
if(g_Git.m_IsUseGitDLL)
{
git_for_each_reflog_ent(CUnicodeUtils::GetUTF8(ref),AddTolist,this);
for(int i=0;i<size();i++)
{
m_pLogCache->m_HashMap[at(i)].m_Ref.Format(_T("%s{%d}"), ref,i);
}
}
else
{
CString cmd, out;
GitRev rev;
cmd.Format(_T("git.exe reflog show %s"),ref);
if (g_Git.Run(cmd, &out, NULL, CP_UTF8))
return -1;
int pos=0;
while(pos>=0)
{
CString one=out.Tokenize(_T("\n"),pos);
int ref=one.Find(_T(' '),0);
if(ref<0)
continue;
rev.Clear();
rev.m_CommitHash=g_Git.GetHash(one.Left(ref));
int action=one.Find(_T(' '),ref+1);
int message;
if(action>0)
{
rev.m_Ref=one.Mid(ref+1,action-ref-2);
message=one.Find(_T(":"),action);
if(message>0)
{
rev.m_RefAction=one.Mid(action+1,message-action-1);
rev.GetSubject()=one.Right(one.GetLength()-message-1);
}
}
this->m_pLogCache->m_HashMap[rev.m_CommitHash]=rev;
this->push_back(rev.m_CommitHash);
}
}
return 0;
}
示例6: FillLogMessageCtrl
void CRebaseDlg::FillLogMessageCtrl()
{
int selCount = m_CommitList.GetSelectedCount();
if (selCount == 1 && (m_RebaseStage == CHOOSE_BRANCH || m_RebaseStage == CHOOSE_COMMIT_PICK_MODE))
{
POSITION pos = m_CommitList.GetFirstSelectedItemPosition();
int selIndex = m_CommitList.GetNextSelectedItem(pos);
GitRev* pLogEntry = reinterpret_cast<GitRev *>(m_CommitList.m_arShownList.SafeGetAt(selIndex));
m_FileListCtrl.UpdateWithGitPathList(pLogEntry->GetFiles(&m_CommitList));
m_FileListCtrl.m_CurrentVersion = pLogEntry->m_CommitHash;
m_FileListCtrl.Show(GITSLC_SHOWVERSIONED);
m_LogMessageCtrl.Call(SCI_SETREADONLY, FALSE);
m_LogMessageCtrl.SetText(pLogEntry->GetSubject() + _T("\n") + pLogEntry->GetBody());
m_LogMessageCtrl.Call(SCI_SETREADONLY, TRUE);
}
}
示例7: AddTolist
int AddTolist(unsigned char * /*osha1*/, unsigned char *nsha1, const char * /*name*/, unsigned long /*time*/, int /*sz*/, const char *msg, void *data)
{
CLogDataVector *vector = (CLogDataVector*)data;
GitRev rev;
rev.m_CommitHash=(char*)nsha1;
CString one;
g_Git.StringAppend(&one, (BYTE *)msg);
int message=one.Find(_T(":"),0);
if(message>0)
{
rev.m_RefAction=one.Left(message);
rev.GetSubject()=one.Mid(message+1);
}
vector->m_pLogCache->m_HashMap[rev.m_CommitHash]=rev;
vector->insert(vector->begin(),rev.m_CommitHash);
return 0;
}
示例8: AddToRefLoglist
int AddToRefLoglist(unsigned char * /*osha1*/, unsigned char *nsha1, const char * /*name*/, unsigned long time, int /*sz*/, const char *msg, void *data)
{
std::vector<GitRev> *vector = (std::vector<GitRev> *)data;
GitRev rev;
rev.m_CommitHash = (char *)nsha1;
rev.GetCommitterDate() = CTime(time);
CString one;
g_Git.StringAppend(&one, (BYTE *)msg);
int message = one.Find(_T(":"), 0);
if (message > 0)
{
rev.m_RefAction = one.Left(message);
rev.GetSubject() = one.Mid(message + 1);
}
vector->insert(vector->begin(), rev);
return 0;
}
示例9: AddBranchToolTips
void CRebaseDlg::AddBranchToolTips(CHistoryCombo *pBranch)
{
if(pBranch)
{
CString text=pBranch->GetString();
CString tooltip;
GitRev rev;
rev.GetCommit(text);
tooltip.Format(_T("CommitHash:%s\nCommit by: %s %s\n <b>%s</b> \n %s"),
rev.m_CommitHash.ToString(),
rev.GetAuthorName(),
CLoglistUtils::FormatDateAndTime(rev.GetAuthorDate(), DATE_LONGDATE),
rev.GetSubject(),
rev.GetBody());
pBranch->DisableTooltip();
this->m_tooltips.AddTool(pBranch->GetComboBoxCtrl(),tooltip);
}
}
示例10: git_init
//CLogDataVector Class
int CLogDataVector::ParserFromLog(CTGitPath *path ,int count ,int infomask,CString *from,CString *to)
{
// only enable --follow on files
if ((path == NULL || path->IsDirectory()) && (infomask & CGit::LOG_INFO_FOLLOW))
infomask = infomask ^ CGit::LOG_INFO_FOLLOW;
CString hash;
CString cmd=g_Git.GetLogCmd(hash,path,count,infomask,from,to,true);
if(g_Git.IsInitRepos())
return 0;
git_init();
GIT_LOG handle;
if(git_open_log(&handle,CUnicodeUtils::GetMulti(cmd,CP_ACP).GetBuffer()))
{
return -1;
}
git_get_log_firstcommit(handle);
GIT_COMMIT commit;
GitRev rev;
while (git_get_log_nextcommit(handle, &commit, infomask & CGit::LOG_INFO_FOLLOW) == 0)
{
if (commit.m_ignore == 1)
{
git_free_commit(&commit);
continue;
}
CGitHash hash = (char*)commit.m_hash ;
rev.Clear();
GitRev *pRev = this->m_pLogCache->GetCacheData(hash);
char *note=NULL;
git_get_notes(commit.m_hash,¬e);
if(note)
{
pRev->m_Notes.Empty();
g_Git.StringAppend(&pRev->m_Notes,(BYTE*)note);
}
if(pRev == NULL || !pRev->m_IsFull)
{
pRev->ParserFromCommit(&commit);
pRev->ParserParentFromCommit(&commit);
git_free_commit(&commit);
//Must call free commit before SafeFetchFullInfo, commit parent is rewrite by log.
//file list will wrong if parent rewrite.
pRev->SafeFetchFullInfo(&g_Git);
}
else
{
ASSERT(pRev->m_CommitHash == hash);
pRev->ParserParentFromCommit(&commit);
git_free_commit(&commit);
}
this->push_back(pRev->m_CommitHash);
m_HashMap[rev.m_CommitHash]=size()-1;
}
git_close_log(handle);
return 0;
}
示例11: DoRebase
int CRebaseDlg::DoRebase()
{
CString cmd,out;
if(m_CurrentRebaseIndex <0)
return 0;
if(m_CurrentRebaseIndex >= m_CommitList.GetItemCount() )
return 0;
GitRev *pRev = (GitRev*)m_CommitList.m_arShownList[m_CurrentRebaseIndex];
int mode=pRev->GetAction(&m_CommitList) & CTGitPath::LOGACTIONS_REBASE_MODE_MASK;
CString nocommit;
if( mode== CTGitPath::LOGACTIONS_REBASE_SKIP)
{
pRev->GetAction(&m_CommitList)|= CTGitPath::LOGACTIONS_REBASE_DONE;
return 0;
}
if( mode != CTGitPath::LOGACTIONS_REBASE_PICK )
{
this->m_SquashMessage+= pRev->GetSubject();
this->m_SquashMessage+= _T("\n");
this->m_SquashMessage+= pRev->GetBody();
}
else
this->m_SquashMessage.Empty();
if(mode == CTGitPath::LOGACTIONS_REBASE_SQUASH)
nocommit=_T(" --no-commit ");
CString log;
log.Format(_T("%s %d: %s"),CTGitPath::GetActionName(mode),this->GetCurrentCommitID(),pRev->m_CommitHash.ToString());
AddLogString(log);
AddLogString(pRev->GetSubject());
if (pRev->GetSubject().IsEmpty())
{
CMessageBox::Show(m_hWnd, _T("Found an empty commit message. You have to enter one or rebase cannot proceed."), _T("TortoiseGit"), MB_OK | MB_ICONEXCLAMATION);
mode = CTGitPath::LOGACTIONS_REBASE_EDIT;
}
cmd.Format(_T("git.exe cherry-pick %s %s"),nocommit,pRev->m_CommitHash.ToString());
if(g_Git.Run(cmd,&out,CP_UTF8))
{
AddLogString(out);
CTGitPathList list;
if(g_Git.ListConflictFile(list))
{
AddLogString(_T("Get conflict files fail"));
return -1;
}
if(list.GetCount() == 0 )
{
if(mode == CTGitPath::LOGACTIONS_REBASE_PICK)
{
pRev->GetAction(&m_CommitList)|= CTGitPath::LOGACTIONS_REBASE_DONE;
return 0;
}
if(mode == CTGitPath::LOGACTIONS_REBASE_EDIT)
{
this->m_RebaseStage = REBASE_EDIT ;
return -1; // Edit return -1 to stop rebase.
}
// Squash Case
if(CheckNextCommitIsSquash())
{ // no squash
// let user edit last commmit message
this->m_RebaseStage = REBASE_SQUASH_EDIT;
return -1;
}
}
if(mode == CTGitPath::LOGACTIONS_REBASE_SQUASH)
m_RebaseStage = REBASE_SQUASH_CONFLICT;
else
m_RebaseStage = REBASE_CONFLICT;
return -1;
}
else
{
AddLogString(out);
if(mode == CTGitPath::LOGACTIONS_REBASE_PICK)
{
pRev->GetAction(&m_CommitList)|= CTGitPath::LOGACTIONS_REBASE_DONE;
return 0;
}
if(mode == CTGitPath::LOGACTIONS_REBASE_EDIT)
{
this->m_RebaseStage = REBASE_EDIT ;
return -1; // Edit return -1 to stop rebase.
}
// Squash Case
if(CheckNextCommitIsSquash())
{ // no squash
// let user edit last commmit message
this->m_RebaseStage = REBASE_SQUASH_EDIT;
return -1;
}
else if(mode == CTGitPath::LOGACTIONS_REBASE_SQUASH)
//.........这里部分代码省略.........
示例12: ParserFromRefLog
int ParserFromRefLog(CString ref, std::vector<GitRev> &refloglist)
{
refloglist.clear();
if (g_Git.m_IsUseLibGit2)
{
CAutoRepository repo(g_Git.GetGitRepository());
if (!repo)
{
MessageBox(nullptr, CGit::GetLibGit2LastErr(_T("Could not open repository.")), _T("TortoiseGit"), MB_ICONERROR);
return -1;
}
CAutoReflog reflog;
if (git_reflog_read(reflog.GetPointer(), repo, CUnicodeUtils::GetUTF8(ref)) < 0)
{
MessageBox(nullptr, CGit::GetLibGit2LastErr(_T("Could not read reflog.")), _T("TortoiseGit"), MB_ICONERROR);
return -1;
}
for (size_t i = 0; i < git_reflog_entrycount(reflog); ++i)
{
const git_reflog_entry *entry = git_reflog_entry_byindex(reflog, i);
if (!entry)
continue;
GitRev rev;
rev.m_CommitHash = (char *)git_reflog_entry_id_new(entry)->id;
rev.m_Ref.Format(_T("%[email protected]{%d}"), ref, i);
rev.GetCommitterDate() = CTime(git_reflog_entry_committer(entry)->when.time);
if (git_reflog_entry_message(entry) != nullptr)
{
CString one;
g_Git.StringAppend(&one, (BYTE *)git_reflog_entry_message(entry));
int message = one.Find(_T(":"), 0);
if (message > 0)
{
rev.m_RefAction = one.Left(message);
rev.GetSubject() = one.Mid(message + 1);
}
}
refloglist.push_back(rev);
}
}
else if (g_Git.m_IsUseGitDLL)
{
git_for_each_reflog_ent(CUnicodeUtils::GetUTF8(ref), AddToRefLoglist, &refloglist);
for (size_t i = 0; i < refloglist.size(); ++i)
refloglist[i].m_Ref.Format(_T("%[email protected]{%d}"), ref, i);
}
else
{
CString cmd, out;
GitRev rev;
cmd.Format(_T("git.exe reflog show --pretty=\"%%H %%gD: %%gs\" --date=raw %s"), ref);
if (g_Git.Run(cmd, &out, NULL, CP_UTF8))
return -1;
int i = 0;
CString prefix = ref + _T("@{");
int pos = 0;
while (pos >= 0)
{
CString one = out.Tokenize(_T("\n"), pos);
int refPos = one.Find(_T(' '), 0);
if (refPos < 0)
continue;
rev.Clear();
CString hashStr = one.Left(refPos);
rev.m_CommitHash = hashStr;
rev.m_Ref.Format(_T("%[email protected]{%d}"), ref, i++);
int prefixPos = one.Find(prefix, refPos + 1);
if (prefixPos != refPos + 1)
continue;
int spacePos = one.Find(_T(' '), prefixPos + prefix.GetLength() + 1);
if (spacePos < 0)
continue;
CString timeStr = one.Mid(prefixPos + prefix.GetLength(), spacePos - prefixPos - prefix.GetLength());
rev.GetCommitterDate() = CTime(_ttoi(timeStr));
int action = one.Find(_T("}: "), spacePos + 1);
if (action > 0)
{
action += 2;
int message = one.Find(_T(":"), action);
if (message > 0)
{
rev.m_RefAction = one.Mid(action + 1, message - action - 1);
rev.GetSubject() = one.Right(one.GetLength() - message - 1);
}
}
refloglist.push_back(rev);
}
}
return 0;
}
示例13: while
//.........这里部分代码省略.........
int numberOfSubsequentLinesBegin = finalLineNumberEnd + 1;
int numberOfSubsequentLinesEnd = lineEnd;
numberOfSubsequentLines = atoi(CStringA((LPCSTR)&data[numberOfSubsequentLinesBegin], numberOfSubsequentLinesEnd - numberOfSubsequentLinesBegin));
}
}
else
{
// parse error
finalLineNumber = 0;
numberOfSubsequentLines = 0;
}
}
else
{
// parse error
finalLineNumber = 0;
numberOfSubsequentLines = 0;
}
auto it = hashToFilename.find(hash);
if (it != hashToFilename.end())
filename = it->second;
else
filename.Empty();
}
else
{
// parse error
finalLineNumber = 0;
numberOfSubsequentLines = 0;
}
}
else
{
int tokenBegin = lineBegin;
int tokenEnd = data.find(' ', tokenBegin);
if (tokenEnd >= 0)
{
if (!strncmp("filename", (const char*)&data[tokenBegin], tokenEnd - tokenBegin))
{
int filenameBegin = tokenEnd + 1;
int filenameEnd = lineEnd;
CStringA filenameA = CStringA((LPCSTR)&data[filenameBegin], filenameEnd - filenameBegin);
filename = UnquoteFilename(filenameA);
auto r = hashToFilename.insert(std::make_pair(hash, filename));
if (!r.second)
{
r.first->second = filename;
}
}
}
}
}
else
{
expectHash = true;
// remove <TAB> at start
BYTE_VECTOR line;
if (lineEnd - 1 > lineBegin)
line.append(&data[lineBegin + 1], lineEnd-lineBegin - 1);
hashes.push_back(hash);
filenames.push_back(filename);
originalLineNumbers.push_back(originalLineNumber);
rawLines.push_back(line);
--numberOfSubsequentLines;
}
}
pos = lineEnd + 1;
}
for (auto it = hashes.begin(), it_end = hashes.end(); it != it_end; ++it)
{
CGitHash hash = *it;
CString err;
GitRev* pRev = GetRevForHash(HashToRev, hash, &err);
if (pRev)
{
authors.push_back(pRev->GetAuthorName());
dates.push_back(CLoglistUtils::FormatDateAndTime(pRev->GetAuthorDate(), dateFormat, true, bRelativeTimes));
}
else
{
MessageBox(nullptr, err, _T("TortoiseGit"), MB_ICONERROR);
authors.push_back(CString());
dates.push_back(CString());
}
}
m_Hash.swap(hashes);
m_OriginalLineNumbers.swap(originalLineNumbers);
m_Filenames.swap(filenames);
m_RawLines.swap(rawLines);
m_Authors.swap(authors);
m_Dates.swap(dates);
// reset detected and applied encoding
m_encode = -1;
m_Utf8Lines.clear();
}
示例14: _T
//CLogDataVector Class
int CLogDataVector::ParserFromLog(CTGitPath *path, int count, int infomask, CString *range)
{
// only enable --follow on files
if ((path == NULL || path->IsDirectory()) && (infomask & CGit::LOG_INFO_FOLLOW))
infomask = infomask ^ CGit::LOG_INFO_FOLLOW;
CString gitrange = _T("HEAD");
if (range != nullptr)
gitrange = *range;
CString cmd = g_Git.GetLogCmd(gitrange, path, count, infomask, true);
if (!g_Git.CanParseRev(gitrange))
return 0;
try
{
[] { git_init(); } ();
}
catch (const char* msg)
{
MessageBox(NULL, _T("Could not initialize libgit.\nlibgit reports:\n") + CString(msg), _T("TortoiseGit"), MB_ICONERROR);
return -1;
}
GIT_LOG handle;
try
{
CAutoLocker lock(g_Git.m_critGitDllSec);
if (git_open_log(&handle,CUnicodeUtils::GetMulti(cmd, CP_UTF8).GetBuffer()))
{
return -1;
}
}
catch (char* msg)
{
MessageBox(NULL, _T("Could not open log.\nlibgit reports:\n") + CString(msg), _T("TortoiseGit"), MB_ICONERROR);
return -1;
}
try
{
CAutoLocker lock(g_Git.m_critGitDllSec);
[&]{ git_get_log_firstcommit(handle); }();
}
catch (char* msg)
{
MessageBox(NULL, _T("Could not get first commit.\nlibgit reports:\n") + CString(msg), _T("TortoiseGit"), MB_ICONERROR);
return -1;
}
int ret = 0;
while (ret == 0)
{
GIT_COMMIT commit;
try
{
CAutoLocker lock(g_Git.m_critGitDllSec);
[&]{ ret = git_get_log_nextcommit(handle, &commit, infomask & CGit::LOG_INFO_FOLLOW); }();
}
catch (char* msg)
{
MessageBox(NULL, _T("Could not get next commit.\nlibgit reports:\n") + CString(msg), _T("TortoiseGit"), MB_ICONERROR);
break;
}
if (ret)
break;
if (commit.m_ignore == 1)
{
git_free_commit(&commit);
continue;
}
CGitHash hash = (char*)commit.m_hash ;
GitRev *pRev = this->m_pLogCache->GetCacheData(hash);
char *pNote = nullptr;
{
CAutoLocker lock(g_Git.m_critGitDllSec);
git_get_notes(commit.m_hash, &pNote);
}
if (pNote)
{
pRev->m_Notes.Empty();
g_Git.StringAppend(&pRev->m_Notes,(BYTE*)pNote);
}
ASSERT(pRev->m_CommitHash == hash);
pRev->ParserFromCommit(&commit);
pRev->ParserParentFromCommit(&commit);
git_free_commit(&commit);
// Must call free commit before SafeFetchFullInfo, commit parent is rewrite by log.
// file list will wrong if parent rewrite.
if (!pRev->m_IsFull && (infomask & CGit::LOG_INFO_FULL_DIFF))
{
//.........这里部分代码省略.........
示例15: while
//.........这里部分代码省略.........
{
size_t numberOfSubsequentLinesBegin = finalLineNumberEnd + 1;
size_t numberOfSubsequentLinesEnd = lineEnd;
numberOfSubsequentLines = atoi(CStringA(reinterpret_cast<LPCSTR>(&data[numberOfSubsequentLinesBegin]), static_cast<int>(numberOfSubsequentLinesEnd - numberOfSubsequentLinesBegin)));
}
}
else
{
// parse error
numberOfSubsequentLines = 0;
}
}
else
{
// parse error
numberOfSubsequentLines = 0;
}
auto it = hashToFilename.find(hash);
if (it != hashToFilename.end())
filename = it->second;
else
filename.Empty();
}
else
{
// parse error
numberOfSubsequentLines = 0;
}
}
else
{
size_t tokenBegin = lineBegin;
size_t tokenEnd = data.find(' ', tokenBegin);
if (tokenEnd != BYTE_VECTOR::npos)
{
if (!strncmp("filename", reinterpret_cast<const char*>(&data[tokenBegin]), tokenEnd - tokenBegin))
{
size_t filenameBegin = tokenEnd + 1;
size_t filenameEnd = lineEnd;
CStringA filenameA = CStringA(reinterpret_cast<LPCSTR>(&data[filenameBegin]), static_cast<int>(filenameEnd - filenameBegin));
filename = UnquoteFilename(filenameA);
auto r = hashToFilename.emplace(hash, filename);
if (!r.second)
{
r.first->second = filename;
}
}
}
}
}
else
{
expectHash = true;
// remove <TAB> at start
BYTE_VECTOR line;
if (lineEnd - 1 > lineBegin)
line.append(&data[lineBegin + 1], lineEnd-lineBegin - 1);
while (!line.empty() && line[line.size() - 1] == 13)
line.pop_back();
hashes.push_back(hash);
filenames.push_back(filename);
originalLineNumbers.push_back(originalLineNumber);
rawLines.push_back(line);
--numberOfSubsequentLines;
}
}
pos = lineEnd + 1;
}
for (const auto& hash2 : hashes)
{
CString err;
GitRev* pRev = GetRevForHash(HashToRev, hash2, &err);
if (pRev)
{
authors.push_back(pRev->GetAuthorName());
dates.push_back(CLoglistUtils::FormatDateAndTime(pRev->GetAuthorDate(), dateFormat, true, bRelativeTimes));
}
else
{
MessageBox(nullptr, err, L"TortoiseGit", MB_ICONERROR);
authors.emplace_back();
dates.emplace_back();
}
}
m_Hash.swap(hashes);
m_OriginalLineNumbers.swap(originalLineNumbers);
m_Filenames.swap(filenames);
m_RawLines.swap(rawLines);
m_Authors.swap(authors);
m_Dates.swap(dates);
// reset detected and applied encoding
m_encode = -1;
m_Utf8Lines.clear();
}