コード例 #1
0
        protected override void ExecuteTask()
        {
            RecursionType TypeOfRecursion = this.GetRecustiveOption();
            VersionSpec   FromVersion     = this.GetFromVersion();
            VersionSpec   Version         = FromVersion;

            if (Version == null)
            {
                Version = VersionSpec.Latest;
            }
            VersionSpec ToVersion = this.GetToVersion();

            using (XmlTextWriter DocWriter = new XmlTextWriter(this.ReportFile, System.Text.Encoding.UTF8))
            {
                DocWriter.Formatting = Formatting.Indented;
                DocWriter.WriteStartDocument();
                XmlWriterHelper Write = new XmlWriterHelper(DocWriter);
                Write.ElementBegining("History");

                IEnumerable ChangesetList =
                    this.ServerConnection.SourceControl.QueryHistory(
                        this.ItemSpec,
                        Version,
                        0,
                        TypeOfRecursion,
                        null,
                        FromVersion,
                        ToVersion,
                        int.MaxValue,
                        true,
                        false);

                foreach (Changeset CurrentChangeset in ChangesetList)
                {
                    Write.ElementBegining("ChangeSet");
                    Write.Attribute("ChangesetId", CurrentChangeset.ChangesetId.ToString());
                    Write.Attribute("Committer", CurrentChangeset.Committer);
                    Write.Attribute("Comment", CurrentChangeset.Comment);
                    Write.Attribute("CreationDate", CurrentChangeset.CreationDate.ToString());

                    Log(Level.Verbose, CurrentChangeset.ToString());

                    foreach (Change CurrentChange in CurrentChangeset.Changes)
                    {
                        Write.ElementBegining("Change");
                        Write.Attribute("ChangeType", CurrentChange.ChangeType.ToString());
                        Write.Attribute("CheckinDate", CurrentChange.Item.CheckinDate.ToString());
                        Write.Attribute("ItemType", CurrentChange.Item.ItemType.ToString());
                        Write.Attribute("ArtifactUri", CurrentChange.Item.ArtifactUri.ToString());
                        Write.Attribute("ServerItem", CurrentChange.Item.ServerItem);
                        Write.ElementEnd();
                    }
                    Write.ElementEnd();
                }
                Write.ElementEnd();
            }
        }