public void LabelSourceControl(IIntegrationResult result)
        {
            if (ApplyLabel && result.Succeeded)
            {
                Log.Debug(String.Format("Applying label \"{0}\"", result.Label));
                VersionControlLabel Label = new VersionControlLabel(this.SourceControl, result.Label, _SourceControl.AuthenticatedUser, this.ProjectPath, "Labeled by CruiseControl.NET");

                Changeset Set = this.ChangesetQueue.GetCurrentIntegrationSet();

                LabelItemSpec[] LabelSpec = new LabelItemSpec[] {
                    new LabelItemSpec(new ItemSpec(this.ProjectPath, RecursionType.Full), new ChangesetVersionSpec(Set.ChangesetId), false)
                };

                this.SourceControl.CreateLabel(Label, LabelSpec, LabelChildOption.Replace);
            }
            this.ChangesetQueue.EndIntegration();
        }
示例#2
0
        public LabelResult[] CreateLabel(VersionControlLabel label,
																			LabelItemSpec[] labelSpecs,
																			LabelChildOption childOption)
        {
            Workspace workspace = GetWorkspace(labelSpecs[0].ItemSpec.Item);
            return repository.LabelItem(workspace, label, labelSpecs, childOption);
        }
示例#3
0
        public void LabelSourceControl(IIntegrationResult result)
        {
            if (ApplyLabel && result.Succeeded)
            {
                Log.Debug(String.Format("Applying label \"{0}\"", result.Label));
                VersionControlLabel label = new VersionControlLabel(this.SourceControl, result.Label, sourceControl.AuthenticatedUser, this.ProjectPath, "Labeled by CruiseControl.NET");

                // Create Label Item Spec.
                ItemSpec itemSpec = new ItemSpec(this.ProjectPath, RecursionType.Full);
                LabelItemSpec[] labelItemSpec = new LabelItemSpec[] {  
                    new LabelItemSpec(itemSpec, this.WorkingVersion, false)
                };

                this.SourceControl.CreateLabel(label, labelItemSpec, LabelChildOption.Replace);
            }
        }
示例#4
0
        public LabelResult[] LabelItem(Workspace workspace, VersionControlLabel label, 
																	 LabelItemSpec[] labelSpecs, LabelChildOption children)
        {
            Message msg = new Message(GetWebRequest (new Uri(Url)), "LabelItem");

            msg.Body.WriteElementString("workspaceName", workspace.Name);
            msg.Body.WriteElementString("workspaceOwner", workspace.OwnerName);
            label.ToXml(msg.Body, "label");

            msg.Body.WriteStartElement("labelSpecs");
            foreach (LabelItemSpec labelSpec in labelSpecs)
                {
                    labelSpec.ToXml(msg.Body, "LabelItemSpec");
                }
            msg.Body.WriteEndElement();

            msg.Body.WriteElementString("children", children.ToString());

            List<LabelResult> labelResults = new List<LabelResult>();
            List<Failure> faillist = new List<Failure>();

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

                    while (results.Read())
                        {
                            if (results.NodeType == XmlNodeType.Element)
                                {
                                    switch (results.Name)
                                        {
                                        case "LabelResult":
                                            labelResults.Add(LabelResult.FromXml(this, results));
                                            break;
                                        case "Failure":
                                            faillist.Add(Failure.FromXml(this, results));
                                            break;
                                        }
                                }
                        }
                }

            foreach (Failure failure in faillist)
                {
                    versionControlServer.OnNonFatalError(workspace, failure);
                }

            return labelResults.ToArray();
        }