Пример #1
0
        private void SaveChangeSetLink(ChangeSetInfo info, Asset savedAsset)
        {
            var name             = string.Format(info.Link.Name, info.Revision);
            var url              = string.Format(info.Link.Url, info.Revision);
            var linkUrlAttribute = savedAsset.GetAttribute(ChangeSetType.GetAttributeDefinition("Links.URL"));

            if (linkUrlAttribute != null)
            {
                foreach (string value in linkUrlAttribute.Values)
                {
                    if (value.Equals(url, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return;
                    }
                }
            }

            var newlink = V1Connection.Data.New(LinkType, savedAsset.Oid.Momentless);

            newlink.SetAttributeValue(LinkNameDef, name);
            newlink.SetAttributeValue(LinkUrlDef, url);
            newlink.SetAttributeValue(LinkOnMenuDef, info.Link.OnMenu);

            V1Connection.Data.Save(newlink, changecomment);
        }
Пример #2
0
        private Asset SaveChangeSetAsset(Asset changeSet, ChangeSetInfo info, IEnumerable <Oid> primaryworkitems)
        {
            changeSet.SetAttributeValue(ChangeSetNameDef, string.Format("'{0}' on '{1}'", info.Author, GetFormattedTime(info.ChangeDate)));
            changeSet.SetAttributeValue(ChangeSetDescriptionDef, info.Message);

            foreach (Oid oid in primaryworkitems)
            {
                changeSet.AddAttributeValue(ChangeSetPrimaryWorkitemsDef, oid);
            }

            V1Connection.Data.Save(changeSet, changecomment);
            return(changeSet);
        }
        protected override void ProcessRevision(int revision, string author, DateTime changeDate, string message, IList<string> filesChanged, ChangeSetDictionary changedPathInfos) 
        {
            List<string> references = GetReferences(message);

            var changeSet = new ChangeSetInfo(author, message, filesChanged, revision, RepositoryUuid, changeDate, references, linkInfo, RepositoryFriendlyName);

            var referenceStrings = new string[changeSet.References.Count];
            changeSet.References.CopyTo(referenceStrings, 0);
            string referenceMessage = (referenceStrings.Length > 0) ? "references: " + string.Join(", ", referenceStrings) : "No References found.";
            Logger.Log(string.Format("Publishing ChangeSet: {0}, \"{1}\"; {2}", changeSet.Revision, changeSet.Message, referenceMessage));
            PublishChangeSet(changeSet);

            base.ProcessRevision(revision, author, changeDate, message, filesChanged, changedPathInfos);
        }
        protected override void ProcessRevision(int revision, string author, DateTime changeDate, string message, IList <string> filesChanged, ChangeSetDictionary changedPathInfos)
        {
            List <string> references = GetReferences(message);

            var changeSet = new ChangeSetInfo(author, message, filesChanged, revision, RepositoryUuid, changeDate, references, linkInfo, RepositoryFriendlyName);

            var referenceStrings = new string[changeSet.References.Count];

            changeSet.References.CopyTo(referenceStrings, 0);
            string referenceMessage = (referenceStrings.Length > 0) ? "references: " + string.Join(", ", referenceStrings) : "No References found.";

            Logger.Log(string.Format("Publishing ChangeSet: {0}, \"{1}\"; {2}", changeSet.Revision, changeSet.Message, referenceMessage));
            PublishChangeSet(changeSet);

            base.ProcessRevision(revision, author, changeDate, message, filesChanged, changedPathInfos);
        }
        private void ProcessChangeSetInfo(ChangeSetInfo info) 
        {
            IList<Oid> affectedworkitems = GetAffectedWorkitems(info.References);

            Asset changeSet = GetChangeSet(info, affectedworkitems);
            if(changeSet == null) 
            {
                return;
            }

            Asset savedAsset = SaveChangeSetAsset(changeSet, info, affectedworkitems);

            if(info.Link != null) 
            {
                SaveChangeSetLink(info, savedAsset);
            }
        }
Пример #6
0
        private void ProcessChangeSetInfo(ChangeSetInfo info)
        {
            IList <Oid> affectedworkitems = GetAffectedWorkitems(info.References);

            Asset changeSet = GetChangeSet(info, affectedworkitems);

            if (changeSet == null)
            {
                return;
            }

            Asset savedAsset = SaveChangeSetAsset(changeSet, info, affectedworkitems);

            if (info.Link != null)
            {
                SaveChangeSetLink(info, savedAsset);
            }
        }
Пример #7
0
        private Asset GetChangeSet(ChangeSetInfo info, IList <Oid> affectedworkitems)
        {
            Asset     changeSet = null;
            AssetList list      = FindExistingChangeset(info.Revision).Assets;

            if (list.Count > 0)
            {
                changeSet = list[0];
                Logger.Log(string.Format("Using existing Change Set: {0} ({1})", info.Revision, changeSet.Oid));
            }
            else
            {
                if (ShouldCreate(affectedworkitems))
                {
                    changeSet = V1Connection.Data.New(ChangeSetType, Oid.Null);
                    changeSet.SetAttributeValue(ChangeSetReferenceDef, info.Revision);
                }
                else
                {
                    Logger.Log("No Change Set References. Ignoring Change Set: " + info.Revision);
                }
            }
            return(changeSet);
        }
 protected virtual void PublishChangeSet(ChangeSetInfo changeSet)
 {
     EventManager.Publish(changeSet);
 }
        private Asset GetChangeSet(ChangeSetInfo info, IList<Oid> affectedworkitems) 
        {
            Asset changeSet = null;
            AssetList list = FindExistingChangeset(info.Revision).Assets;

            if(list.Count > 0) 
            {
                changeSet = list[0];
                Logger.Log(string.Format("Using existing Change Set: {0} ({1})", info.Revision, changeSet.Oid));
            } 
            else 
            {
                if(ShouldCreate(affectedworkitems)) 
                {
                    changeSet = V1Connection.Data.New(ChangeSetType, Oid.Null);
                    changeSet.SetAttributeValue(ChangeSetReferenceDef, info.Revision);
                } 
                else 
                {
                    Logger.Log("No Change Set References. Ignoring Change Set: " + info.Revision);
                }
            }
            return changeSet;
        }
        private void SaveChangeSetLink(ChangeSetInfo info, Asset savedAsset) 
        {
            var name = string.Format(info.Link.Name, info.Revision);
            var url = string.Format(info.Link.Url, info.Revision);
            var linkUrlAttribute = savedAsset.GetAttribute(ChangeSetType.GetAttributeDefinition("Links.URL"));

            if(linkUrlAttribute != null) 
            {
                foreach(string value in linkUrlAttribute.Values) 
                {
                    if(value.Equals(url, StringComparison.InvariantCultureIgnoreCase)) 
                    {
                        return;
                    }
                }
            }

            var newlink = V1Connection.Data.New(LinkType, savedAsset.Oid.Momentless);
            newlink.SetAttributeValue(LinkNameDef, name);
            newlink.SetAttributeValue(LinkUrlDef, url);
            newlink.SetAttributeValue(LinkOnMenuDef, info.Link.OnMenu);

            V1Connection.Data.Save(newlink, changecomment);
        }
        private Asset SaveChangeSetAsset(Asset changeSet, ChangeSetInfo info, IEnumerable<Oid> primaryworkitems) 
        {
            changeSet.SetAttributeValue(ChangeSetNameDef, string.Format("'{0}' on '{1}'", info.Author, GetFormattedTime(info.ChangeDate)));
            changeSet.SetAttributeValue(ChangeSetDescriptionDef, info.Message);

            foreach(Oid oid in primaryworkitems) 
            {
                changeSet.AddAttributeValue(ChangeSetPrimaryWorkitemsDef, oid);
            }

            V1Connection.Data.Save(changeSet, changecomment);
            return changeSet;
        }
 protected virtual void PublishChangeSet(ChangeSetInfo changeSet) 
 {
     EventManager.Publish(changeSet);
 }