当前位置: 首页>>代码示例>>C++>>正文


C++ GitRev::GetAuthorName方法代码示例

本文整理汇总了C++中GitRev::GetAuthorName方法的典型用法代码示例。如果您正苦于以下问题:C++ GitRev::GetAuthorName方法的具体用法?C++ GitRev::GetAuthorName怎么用?C++ GitRev::GetAuthorName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GitRev的用法示例。


在下文中一共展示了GitRev::GetAuthorName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
    }
}
开发者ID:murank,项目名称:TortoiseGitMod,代码行数:21,代码来源:RebaseDlg.cpp

示例2: ParseBlameOutput


//.........这里部分代码省略.........
                                {
                                    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();
}
开发者ID:TortoiseGit,项目名称:TortoiseGit,代码行数:101,代码来源:TortoiseGitBlameData.cpp

示例3: ParseBlameOutput


//.........这里部分代码省略.........
                                    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();
}
开发者ID:545546460,项目名称:TortoiseGit,代码行数:101,代码来源:TortoiseGitBlameData.cpp

示例4: GetRevParsingTests

void GetRevParsingTests()
{
    GitRev rev;
    EXPECT_TRUE(rev.m_CommitHash.IsEmpty());
    EXPECT_EQ(0, rev.GetCommit(_T("HEAD")));
    EXPECT_STREQ(_T("7c3cbfe13a929d2291a574dca45e4fd2d2ac1aa6"), rev.m_CommitHash.ToString());
    EXPECT_STREQ(_T("Sven Strickroth"), rev.GetAuthorName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetAuthorEmail());
    EXPECT_STREQ(_T("2015-03-07 18:03:58"), rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Sven Strickroth"), rev.GetCommitterName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetCommitterEmail());
    EXPECT_STREQ(_T("2015-03-07 18:03:58"), rev.GetCommitterDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Changed ASCII file"), rev.GetSubject());
    EXPECT_STREQ(_T(""), rev.GetBody());
    EXPECT_TRUE(rev.GetLastErr().IsEmpty());
    EXPECT_EQ(0, rev.ParentsCount());
    EXPECT_EQ(0, rev.GetParentFromHash(rev.m_CommitHash));
    ASSERT_EQ(1, rev.ParentsCount());
    EXPECT_STREQ(_T("1fc3c9688e27596d8717b54f2939dc951568f6cb"), rev.m_ParentHash[0].ToString());
    EXPECT_TRUE(rev.GetLastErr().IsEmpty());
    rev.Clear();
    EXPECT_EQ(0, rev.GetCommit(GitRev::GetWorkingCopy()));
    EXPECT_TRUE(rev.m_CommitHash.IsEmpty());
    EXPECT_STREQ(_T(""), rev.GetAuthorName());
    EXPECT_STREQ(_T(""), rev.GetAuthorEmail());
    EXPECT_STREQ(_T(""), rev.GetCommitterName());
    EXPECT_STREQ(_T(""), rev.GetCommitterEmail());
    EXPECT_STREQ(_T("Working Copy"), rev.GetSubject());
    EXPECT_STREQ(_T(""), rev.GetBody());
    EXPECT_EQ(0, rev.ParentsCount());
    EXPECT_TRUE(rev.GetLastErr().IsEmpty());
    rev.Clear();
    EXPECT_TRUE(rev.GetLastErr().IsEmpty());
    EXPECT_EQ(0, rev.GetCommit(_T("aa5b97f89cea6863222823c8289ce392d06d1691")));
    EXPECT_STREQ(_T("aa5b97f89cea6863222823c8289ce392d06d1691"), rev.m_CommitHash.ToString());
    EXPECT_STREQ(_T("Another dummy with ümlaut"), rev.GetAuthorName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetAuthorEmail());
    EXPECT_STREQ(_T("2015-03-14 22:30:06"), rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Another dummy with ümlaut"), rev.GetCommitterName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetCommitterEmail());
    EXPECT_STREQ(_T("2015-03-14 22:30:06"), rev.GetCommitterDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Subject line"), rev.GetSubject());
    EXPECT_STREQ(_T("\nalso some more lines\n\nhere in body\n\nSigned-off-by: Another dummy with ümlaut <[email protected]>\n"), rev.GetBody());
    EXPECT_TRUE(rev.GetLastErr().IsEmpty());
    rev.Clear();
    EXPECT_TRUE(rev.m_CommitHash.IsEmpty());
    EXPECT_EQ(0, rev.GetCommit(_T("1fc3c9688e27596d8717b54f2939dc951568f6cb")));
    EXPECT_STREQ(_T("1fc3c9688e27596d8717b54f2939dc951568f6cb"), rev.m_CommitHash.ToString());
    EXPECT_STREQ(_T("Some other User"), rev.GetAuthorName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetAuthorEmail());
    EXPECT_STREQ(_T("2015-03-07 18:03:39"), rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Sven Strickroth"), rev.GetCommitterName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetCommitterEmail());
    EXPECT_STREQ(_T("2015-03-07 18:03:39"), rev.GetCommitterDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Added an ascii file"), rev.GetSubject());
    EXPECT_STREQ(_T(""), rev.GetBody());
    EXPECT_TRUE(rev.GetLastErr().IsEmpty());
    rev.Clear();
    EXPECT_EQ(-1, rev.GetCommit(_T("does-not-exist")));
    EXPECT_FALSE(rev.GetLastErr().IsEmpty());
    EXPECT_TRUE(rev.m_CommitHash.IsEmpty());
    rev.Clear();
    CGitHash hash(_T("aa5b97f89cea6863222823c8289ce392d06d1691"));
    EXPECT_EQ(0, rev.GetCommitFromHash(hash));
    EXPECT_EQ(hash, rev.m_CommitHash);
    EXPECT_STREQ(_T("Another dummy with ümlaut"), rev.GetAuthorName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetAuthorEmail());
    EXPECT_STREQ(_T("2015-03-14 22:30:06"), rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Another dummy with ümlaut"), rev.GetCommitterName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetCommitterEmail());
    EXPECT_STREQ(_T("2015-03-14 22:30:06"), rev.GetCommitterDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Subject line"), rev.GetSubject());
    EXPECT_STREQ(_T("\nalso some more lines\n\nhere in body\n\nSigned-off-by: Another dummy with ümlaut <[email protected]>\n"), rev.GetBody());
    EXPECT_TRUE(rev.GetLastErr().IsEmpty());
    rev.Clear();
    EXPECT_EQ(0, rev.GetCommit(_T("8d1ebbcc7eeb63af10ff8bcf7712afb9fcc90b8a")));
    EXPECT_STREQ(_T("8d1ebbcc7eeb63af10ff8bcf7712afb9fcc90b8a"), rev.m_CommitHash.ToString());
    EXPECT_STREQ(_T("Sven Strickroth"), rev.GetAuthorName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetAuthorEmail());
    EXPECT_STREQ(_T("2015-03-04 17:50:24"), rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Sven Strickroth"), rev.GetCommitterName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetCommitterEmail());
    EXPECT_STREQ(_T("2015-03-04 17:50:24"), rev.GetCommitterDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Merge branch 'for-merge' into subdir/branch"), rev.GetSubject());
    EXPECT_STREQ(_T(""), rev.GetBody());
    EXPECT_EQ(0, rev.ParentsCount());
    EXPECT_EQ(0, rev.GetParentFromHash(rev.m_CommitHash));
    ASSERT_EQ(2, rev.ParentsCount());
    EXPECT_STREQ(_T("3686b9cf74f1a4ef96d6bfe736595ef9abf0fb8d"), rev.m_ParentHash[0].ToString());
    EXPECT_STREQ(_T("1ce788330fd3a306c8ad37654063ceee13a7f172"), rev.m_ParentHash[1].ToString());
    EXPECT_TRUE(rev.GetLastErr().IsEmpty());
    rev.Clear();
    EXPECT_TRUE(rev.m_CommitHash.IsEmpty());
    EXPECT_EQ(0, rev.GetCommit(_T("844309789a13614b52d5e7cbfe6350dd73d1dc72"))); // root-commit
    EXPECT_STREQ(_T("844309789a13614b52d5e7cbfe6350dd73d1dc72"), rev.m_CommitHash.ToString());
    EXPECT_STREQ(_T("Sven Strickroth"), rev.GetAuthorName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetAuthorEmail());
    EXPECT_STREQ(_T("2015-03-04 17:35:13"), rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));
    EXPECT_STREQ(_T("Sven Strickroth"), rev.GetCommitterName());
    EXPECT_STREQ(_T("[email protected]"), rev.GetCommitterEmail());
//.........这里部分代码省略.........
开发者ID:gunsafighter,项目名称:TortoiseGit,代码行数:101,代码来源:GitRevTest.cpp


注:本文中的GitRev::GetAuthorName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。