示例#1
0
void CFullHistory::AnalyzeRevisionData()
{
    // special case: empty log

    if (headRevision == NO_REVISION)
        return;

    // we don't have a peg revision yet, set it to HEAD

    if (pegRevision == NO_REVISION)
        pegRevision = headRevision;

    // in case our path was renamed and had a different name in the past,
    // we have to find out that name now, because we will analyze the data
    // from lower to higher revisions

    startPath.reset (new CDictionaryBasedTempPath (*wcPath));

    CCopyFollowingLogIterator iterator (cache, pegRevision, *startPath);
    iterator.Retry();
    startRevision = pegRevision;

    while ((iterator.GetRevision() > 0) && !iterator.EndOfPath())
    {
        if (iterator.DataIsMissing())
        {
            iterator.ToNextAvailableData();
        }
        else
        {
            startRevision = iterator.GetRevision();
            iterator.Advance();
        }
    }

    *startPath = iterator.GetAddPath();
}
示例#2
0
void CFullGraphFinalizer::InitWCRevs()
{
    // collect revisions to show

    std::vector<revision_t> revisions;

    revisions.push_back (history.GetWCInfo().minCommit);
    revisions.push_back (history.GetWCInfo().maxCommit);
    revisions.push_back (history.GetWCInfo().minAtRev);
    revisions.push_back (history.GetWCInfo().maxAtRev);

    std::sort (revisions.begin(), revisions.end());
    revisions.erase ( std::unique_copy ( revisions.begin()
                                       , revisions.end()
                                       , revisions.begin())
                    , revisions.end());

    // assign paths

    CDictionaryBasedTempPath path = *history.GetWCPath();
    revision_t pathRevision = history.GetPegRevision();

    while (   !revisions.empty()
           && (revisions.back() >= pathRevision)
           && path.IsValid())
    {
        wcRevs.insert ( wcRevs.begin()
                      , std::make_pair (revisions.back(), path.GetBasePath()));
        revisions.pop_back();
    }

    while (!revisions.empty())
    {
        revision_t revision = revisions.back();
        revisions.pop_back();

        // efficiently follow path changes only

        const CCachedLogInfo* cache = history.GetCache();
        const CRevisionIndex& revisionIndices = cache->GetRevisions();
        const CRevisionInfoContainer& info = cache->GetLogInfo();

        while (revision < pathRevision)
        {
            index_t index = revisionIndices[pathRevision];
            if (   (index != NO_INDEX)
                && (info.GetSumChanges (index) & CRevisionInfoContainer::HAS_COPY_FROM)
                && (info.GetRootPath (index).IsSameOrParentOf (path.GetBasePath())))
            {
                CCopyFollowingLogIterator iterator (cache, pathRevision, path);
                iterator.Advance();

                pathRevision = iterator.GetRevision();
                path = iterator.GetPath();
            }
            else
            {
                --pathRevision;
            }
        }

        if (path.IsValid())
            wcRevs.insert ( wcRevs.begin()
                          , std::make_pair (revision, path.GetBasePath()));
    }
}