Sep.Git.Tfs.Core.GitTfsRemote.FetchChangesets C# (CSharp) Method

FetchChangesets() private method

private FetchChangesets ( bool byLots, int lastVersion = -1 ) : IEnumerable
byLots bool
lastVersion int
return IEnumerable
        private IEnumerable<ITfsChangeset> FetchChangesets(bool byLots, int lastVersion = -1)
        {
            int lowerBoundChangesetId;

            // If we're starting at the Root side of a branch commit (e.g. C1), but there ar
            // invalid commits between C1 and the actual branch side of the commit operation
            // (e.g. a Folder with the branch name was created [C2] and then deleted [C3],
            // then the root-side was branched [C4; C1 --branch--> C4]), this will detecte
            // only the folder creation and deletion operations due to the lowerBound being
            // detected as the root-side of the commit +1 (C1+1=C2) instead of referencing
            // the branch-side of the branching operation [C4].
            if (_properties.InitialChangeset.HasValue)
                lowerBoundChangesetId = Math.Max(MaxChangesetId + 1, _properties.InitialChangeset.Value);
            else
                lowerBoundChangesetId = MaxChangesetId + 1;
            Trace.WriteLine(RemoteRef + ": Getting changesets from " + lowerBoundChangesetId +
                " to " + lastVersion + " ...", "info");
            if (!IsSubtreeOwner)
                return Tfs.GetChangesets(TfsRepositoryPath, lowerBoundChangesetId, this, lastVersion, byLots);

            return _globals.Repository.GetSubtrees(this)
                .SelectMany(x => Tfs.GetChangesets(x.TfsRepositoryPath, lowerBoundChangesetId, x, lastVersion, byLots))
                .OrderBy(x => x.Summary.ChangesetId);
        }