public VersionControlLogReader(
            Uri sourceControlUrl,
            string serverPath,
            StringFilter usersFilter,
            StringFilter filesFilter)
        {
            m_changesetConverter = new ChangesetConverter(usersFilter, filesFilter);
            m_serverPath         = serverPath;

            m_tpc = new TfsTeamProjectCollection(sourceControlUrl);
        }
        private static bool CreateGourceLogFile(
            string outputFile,
            HashSet <string> outputCommiters,
            VersionControlServer vcs,
            string serverPath,
            VisualizationSettings settings,
            ref bool cancel,
            Action <int> progressReporter)
        {
//			int latestChangesetId = vcs.GetLatestChangesetId();
            if (cancel)
            {
                return(false);
            }

            var versionFrom = new DateVersionSpec(settings.DateFrom);
            var versionTo   = new DateVersionSpec(settings.DateTo);

            int latestChangesetId;
            // Getting latest changeset ID for current search criteria
            {
                var latestChanges = vcs.QueryHistory(
                    serverPath,
                    VersionSpec.Latest,
                    0,
                    RecursionType.Full,
                    null,        //any user
                    versionFrom, // from first changeset
                    versionTo,   // to last changeset
                    1,
                    false,       // with changes
                    false,
                    false,
                    false); // sorted

                var latestChangeset = latestChanges.Cast <Changeset>().FirstOrDefault();
                if (latestChangeset == null)
                {
                    // History not found
                    return(false);
                }
                latestChangesetId = latestChangeset.ChangesetId;
                if (cancel)
                {
                    return(false);        //-V3022
                }
            }

            var firstChangesetId = 0;

            var changesetConverter = new ChangesetConverter(settings.UsersFilter, settings.FilesFilter);

            using (var writer = new StreamWriter(outputFile))
            {
                var csList = vcs.QueryHistory(
                    serverPath,
                    VersionSpec.Latest,
                    0,
                    RecursionType.Full,
                    null,        //any user
                    versionFrom, // from first changeset
                    versionTo,   // to last changeset
                    int.MaxValue,
                    true,        // with changes
                    false,
                    false,
                    true);                     // sorted

                var hasLines = false;

                foreach (var changeset in csList.Cast <Changeset>())
                {
                    if (cancel)
                    {
                        return(false);        //-V3022
                    }
                    if (firstChangesetId == 0)
                    {
                        firstChangesetId = changeset.ChangesetId;
                    }

                    if (progressReporter != null)
                    {
                        var progressValue = changeset.ChangesetId - firstChangesetId;
                        var progressTotal = latestChangesetId - firstChangesetId;

                        progressReporter(progressTotal > 0 ? progressValue * 100 / progressTotal : 100);
                    }

                    var usefulChangeset = false;
                    foreach (var line in changesetConverter.GetLogLines(changeset))
                    {
                        usefulChangeset = true;
                        writer.WriteLine(line);
                    }

                    if (usefulChangeset)
                    {
                        hasLines = true;
                        if (outputCommiters != null)
                        {
                            outputCommiters.Add(changeset.OwnerDisplayName);
                        }
                    }
                }

                return(hasLines);
            }
        }