CDictionaryBasedTempPath CDictionaryBasedTempPath::ReplaceParent
    ( const CDictionaryBasedPath& oldParent
    , const CDictionaryBasedPath& newParent) const
{
    assert (oldParent.IsSameOrParentOf (*this));

    // I admit, this is the most stupid implementation possible ;)

    std::string newPath = newParent.GetPath()
                        + GetPath().substr (oldParent.GetPath().length());

    return CDictionaryBasedTempPath (GetDictionary(), newPath);
}
Exemplo n.º 2
0
void CCSVWriter::WriteSkipRanges (std::ostream& os, const CCachedLogInfo& cache)
{
	// header

	os << "PathID,Path,StartRevision,Length\n";

	// content

    const CSkipRevisionInfo& info = cache.GetSkippedRevisions();

	// ids will be added on-the-fly

	for (size_t i = 0; i < info.GetPathCount(); ++i)
	{
        CDictionaryBasedPath path = info.GetPath(i);
        CSkipRevisionInfo::TRanges ranges = info.GetRanges(i);

        for (size_t k = 0, count = ranges.size(); k < count; ++k)
        {
            os << path.GetIndex() << ",\"" 
               << path.GetPath().c_str() << "\","
			   << ranges[k].first << ','
			   << ranges[k].second
			   << "\n";
		}
	}
}
Exemplo n.º 3
0
CString CLogChangedPath::GetUIPath (const CDictionaryBasedPath& p) const
{
    std::string utf8Path = p.GetPath();

    // we don't need to adjust the path length as
    // the conversion will automatically stop at \0.

    return CUnicodeUtils::UTF8ToUTF16 (utf8Path);
}
CRemovePathsBySubString::PathClassification
CRemovePathsBySubString::QuickClassification (const CDictionaryBasedPath& path) const
{
    // ensure the index is valid within classification cache

    if (pathClassification.size() <= path.GetIndex())
    {
        size_t newSize = max (8, pathClassification.size()) * 2;
        while (newSize <= path.GetIndex())
            newSize *= 2;

        pathClassification.resize (newSize, UNKNOWN);
    }

    // auto-calculate the entry

    PathClassification& classification = pathClassification[path.GetIndex()];
    if (classification == UNKNOWN)
        classification = Classify (path.GetPath());

    // done here

    return classification;
}