Example #1
0
        private ITfsChangeset BuildTfsChangeset(Changeset changeset, GitTfsRemote remote)
        {
            var tfsChangeset = _container.With <ITfsHelper>(this).With <IChangeset>(_bridge.Wrap <WrapperForChangeset, Changeset>(changeset)).GetInstance <TfsChangeset>();

            tfsChangeset.Summary = new TfsChangesetInfo {
                ChangesetId = changeset.ChangesetId, Remote = remote
            };

            if (changeset.WorkItems != null)
            {
                tfsChangeset.Summary.Workitems = changeset.WorkItems.Select(wi => new TfsWorkitem
                {
                    Id          = wi.Id,
                    Title       = wi.Title,
                    Description = wi.Description,
                    Url         = Linking.GetArtifactUrl(wi.Uri.AbsoluteUri)
                });
            }

            return(tfsChangeset);
        }
        private ITfsChangeset BuildTfsChangeset(Changeset changeset, IGitTfsRemote remote)
        {
            var tfsChangeset = _container.With <ITfsHelper>(this).With <IChangeset>(_bridge.Wrap <WrapperForChangeset, Changeset>(changeset)).GetInstance <TfsChangeset>();

            tfsChangeset.Summary = new TfsChangesetInfo {
                ChangesetId = changeset.ChangesetId, Remote = remote
            };

            if (HasWorkItems(changeset))
            {
                tfsChangeset.Summary.Workitems = changeset.WorkItems.Select(wi => new TfsWorkitem
                {
                    Id          = wi.Id,
                    Title       = wi.Title,
                    Description = wi.Description,
                    Url         = Linking.GetArtifactUrl(wi.Uri.AbsoluteUri)
                });
            }
            foreach (var checkinNote in changeset.CheckinNote.Values)
            {
                switch (checkinNote.Name)
                {
                case GitTfsConstants.CodeReviewer:
                    tfsChangeset.Summary.CodeReviewer = checkinNote.Value;
                    break;

                case GitTfsConstants.SecurityReviewer:
                    tfsChangeset.Summary.SecurityReviewer = checkinNote.Value;
                    break;

                case GitTfsConstants.PerformanceReviewer:
                    tfsChangeset.Summary.PerformanceReviewer = checkinNote.Value;
                    break;
                }
            }
            tfsChangeset.Summary.PolicyOverrideComment = changeset.PolicyOverride.Comment;

            return(tfsChangeset);
        }