コード例 #1
0
ファイル: Repository.cs プロジェクト: arleyschrock/opentf
        public int QueryHistory(string workspaceName, string workspaceOwner,
                                ItemSpec itemSpec, VersionSpec version,
                                string user, VersionSpec versionFrom,
                                VersionSpec versionTo, int maxCount,
                                bool includeFiles, bool slotMode,
                                bool generateDownloadUrls, ref List <Changeset> changes)
        {
            Message msg = new Message(GetWebRequest(new Uri(Url)), "QueryHistory");

            if (!String.IsNullOrEmpty(workspaceName))
            {
                msg.Body.WriteElementString("workspaceName", workspaceName);
            }
            if (!String.IsNullOrEmpty(workspaceOwner))
            {
                msg.Body.WriteElementString("workspaceOwner", workspaceOwner);
            }

            itemSpec.ToXml(msg.Body, "itemSpec");
            if (version != null)
            {
                version.ToXml(msg.Body, "versionItem");
            }
            if (versionFrom != null)
            {
                versionFrom.ToXml(msg.Body, "versionFrom");
            }
            if (versionTo != null)
            {
                versionTo.ToXml(msg.Body, "versionTo");
            }

            if (!String.IsNullOrEmpty(user))
            {
                msg.Body.WriteElementString("user", user);
            }
            msg.Body.WriteElementString("maxCount", Convert.ToString(maxCount));
            msg.Body.WriteElementString("includeFiles", Convert.ToString(includeFiles).ToLower());
            msg.Body.WriteElementString("generateDownloadUrls", Convert.ToString(generateDownloadUrls).ToLower());
            msg.Body.WriteElementString("slotMode", Convert.ToString(slotMode).ToLower());

            int cnt = 0;

            using (HttpWebResponse response = Invoke(msg))
            {
                XmlReader results = msg.ResponseReader(response);

                while (results.Read())
                {
                    if (results.NodeType == XmlNodeType.Element &&
                        results.Name == "Changeset")
                    {
                        changes.Add(Changeset.FromXml(this, results));
                        cnt++;
                    }
                }
            }

            return(cnt);
        }
コード例 #2
0
        public Changeset QueryChangeset(int changeSetId, bool includeChanges = false, bool includeDownloadUrls = false, bool includeSourceRenames = true)
        {
            var invoker = new SoapInvoker(this);
            var msg     = invoker.CreateEnvelope("QueryChangeset");

            msg.Add(new XElement(MessageNs + "changesetId", changeSetId));
            msg.Add(new XElement(MessageNs + "includeChanges", includeChanges));
            msg.Add(new XElement(MessageNs + "generateDownloadUrls", includeDownloadUrls));
            msg.Add(new XElement(MessageNs + "includeSourceRenames", includeSourceRenames));

            var result = invoker.InvokeResult();

            return(Changeset.FromXml(result));
        }
コード例 #3
0
ファイル: Repository.cs プロジェクト: arleyschrock/opentf
        public Changeset QueryChangeset(int changesetId, bool includeChanges,
                                        bool generateDownloadUrls)
        {
            Message msg = new Message(GetWebRequest(new Uri(Url)), "QueryChangeset");

            msg.Body.WriteElementString("changesetId", Convert.ToString(changesetId));
            msg.Body.WriteElementString("includeChanges", Convert.ToString(includeChanges).ToLower());
            msg.Body.WriteElementString("generateDownloadUrls", Convert.ToString(generateDownloadUrls).ToLower());

            Changeset changeset = null;

            using (HttpWebResponse response = Invoke(msg))
            {
                XmlReader results = msg.ResponseReader(response);
                changeset = Changeset.FromXml(this, results);
            }

            return(changeset);
        }
コード例 #4
0
ファイル: Repository.cs プロジェクト: arleyschrock/opentf
        public ChangesetMerge[] QueryMerges(string workspaceName, string workspaceOwner,
                                            ItemSpec source, VersionSpec versionSource,
                                            ItemSpec target, VersionSpec versionTarget,
                                            VersionSpec versionFrom, VersionSpec versionTo,
                                            int maxChangesets)
        {
            Message msg = new Message(GetWebRequest(new Uri(Url)), "QueryMerges");

            if (!String.IsNullOrEmpty(workspaceName))
            {
                msg.Body.WriteElementString("workspaceName", workspaceName);
            }
            if (!String.IsNullOrEmpty(workspaceOwner))
            {
                msg.Body.WriteElementString("workspaceOwner", workspaceOwner);
            }

            if (source != null)
            {
                source.ToXml(msg.Body, "source");
            }
            if (versionSource != null)
            {
                versionSource.ToXml(msg.Body, "versionSource");
            }

            target.ToXml(msg.Body, "target");
            versionTarget.ToXml(msg.Body, "versionTarget");

            if (versionFrom != null)
            {
                versionFrom.ToXml(msg.Body, "versionFrom");
            }
            if (versionTo != null)
            {
                versionTo.ToXml(msg.Body, "versionTo");
            }

            msg.Body.WriteElementString("maxChangesets", Convert.ToString(maxChangesets));

            List <ChangesetMerge>       merges     = new List <ChangesetMerge>();
            Dictionary <int, Changeset> changesets = new Dictionary <int, Changeset>();

            using (HttpWebResponse response = Invoke(msg))
            {
                XmlReader results = msg.ResponseReader(response);

                while (results.Read())
                {
                    if (results.NodeType != XmlNodeType.Element)
                    {
                        continue;
                    }

                    if (results.Name == "ChangesetMerge")
                    {
                        merges.Add(ChangesetMerge.FromXml(this, results));
                    }
                    else if (results.Name == "Changeset")
                    {
                        Changeset changeset = Changeset.FromXml(this, results);
                        changesets.Add(changeset.ChangesetId, changeset);
                    }
                }
            }

            foreach (ChangesetMerge merge in merges)
            {
                Changeset changeset;
                if (changesets.TryGetValue(merge.TargetVersion, out changeset))
                {
                    merge.TargetChangeset = changeset;
                }
            }

            return(merges.ToArray());
        }