Exemple #1
0
        internal List <ChangesetData> GetChangesets(HashSet <int> changeSets)
        {
            List <ChangesetData> result         = new List <ChangesetData>(changeSets.Count);
            HashSet <int>        changeSetsCopy = new HashSet <int>(changeSets);

            foreach (var item in changeSets)
            {
                ChangesetData found;
                if (changesetCache.TryGetValue(item, out found))
                {
                    result.Add(found);
                    changeSetsCopy.Remove(item);
                }
            }

            if (changeSetsCopy.Count == 0)
            {
                return(result);
            }

            var min = new ChangesetVersionSpec(changeSetsCopy.Min());
            var max = new ChangesetVersionSpec(changeSetsCopy.Max());

            var changes = VersionControlServer.QueryHistory(ProjectPath, VersionSpec.Latest, 0, RecursionType.Full, null, min, max, Int32.MaxValue, false, false);

            foreach (Changeset item in changes)
            {
                ChangesetData found;
                if (!changesetCache.TryGetValue(item.ChangesetId, out found))
                {
                    found = new ChangesetData(item.Comment, null);
                    changesetCache[item.ChangesetId] = found;
                }

                if (changeSetsCopy.Contains(item.ChangesetId))
                {
                    result.Add(found);
                }
            }

            return(result);
        }
Exemple #2
0
        public ChangesetData GetChangesetWithChanges(int id)
        {
            ChangesetData found;

            if (!changesetCache.TryGetValue(id, out found))
            {
                var cs = VersionControlServer.GetChangeset(id, true, false);

                found = new ChangesetData(cs.Comment, ToVersionedAssetList(cs));
                changesetCache[id] = found;
            }
            else if (found.Changes == null)
            {
                // if the cache was populated with a changeset without changes, fill it  now

                var cs = VersionControlServer.GetChangeset(id, true, false);

                found.Changes = ToVersionedAssetList(cs);
            }

            return(found);
        }