コード例 #1
0
        public IEnumerable<IRevision> GetRevisions(IRevisionVersion sourceRevision, IRevisionVersion targetRevision)
        {
            System.Collections.IEnumerable changesets = m_versionControlServer.QueryHistory(
            m_sourceControlRootPath,
            targetRevision.GetSpec(),
            0, 
            RecursionType.Full, 
            null,
            sourceRevision.GetSpec(),
            targetRevision.GetSpec(),
            int.MaxValue,
            true, 
            false);

            int? sourceChangeSetId = null;
            if (sourceRevision.GetSpec() is ChangesetVersionSpec)
            {
                sourceChangeSetId = (sourceRevision.GetSpec() as ChangesetVersionSpec).ChangesetId;
            }

            HashSet<string> items = new HashSet<string>();
            foreach (var changeset in changesets.OfType<Changeset>())
            {
                if (!sourceChangeSetId.HasValue || sourceChangeSetId.Value != changeset.ChangesetId)
                {
                    foreach (Change change in changeset.Changes)
                    {
                        if (change.Item.ServerItem.StartsWith(m_sourceControlRootPath,
                            StringComparison.OrdinalIgnoreCase))
                        {
                            var item = change.Item.ServerItem.Substring(m_sourceControlRootPath.Length);
                            items.Add(item);
                        }
                    }
                }
            }
            return items.Select(p=> new TfsRevision(MakeFileSystemType(p))).ToList();
        }
コード例 #2
0
        public IRevisionVersion GetRevisionOfItem(IRevisionVersion maxRevisionVersion, string path)
        {
            try
            {
                if (!m_workspace.IsValueCreated)
                {
                    var invoker = m_workspace.Value;
                }

                var item = m_versionControlServer.GetItem(
                    System.IO.Path.Combine(m_sourceControlRootPath, path),
                    maxRevisionVersion.GetSpec(),
                    DeletedState.NonDeleted, GetItemsOptions.None);

                return new TFSRevisionVersion(new ChangesetVersionSpec(item.ChangesetId));
            }
            catch (Exception e)
            {
                return new TFSRevisionVersion(new DateVersionSpec(new DateTime(1973, 1, 1))); ; // The begining of time;
            }
        }