程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了来自 TFS ISubscriber git 服务器插件的 Grep 分支大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决来自 TFS ISubscriber git 服务器插件的 Grep 分支?

开发过程中遇到来自 TFS ISubscriber git 服务器插件的 Grep 分支的问题如何解决?下面主要结合日常开发的经验,给出你关于来自 TFS ISubscriber git 服务器插件的 Grep 分支的解决方法建议,希望对你解决来自 TFS ISubscriber git 服务器插件的 Grep 分支有所启发或帮助;

我正在编写一个响应推送的 TFS 服务器端 git 插件,并且我已经解决了大部分逻辑。有问题的 TFS 是内部部署的。

目标:我想使用库 grep 检入的分支是否存在具有特定扩展名的文件。本质上:git grep res -- '*.foo'。我已经包含了代码的简化版本。

我已经搜索并搜索了几天。可悲的是,这个库的文档记录很差,我一直非常沮丧地找到答案。我真的希望有人能帮忙。

不要建议使用“git”命令行。我希望为此目的使用该库,并避免使用命令行。

示例代码如下

using System;
using System.linq;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text.RegularExpressions;
using Microsoft.TeamFoundation.Common;
using Microsoft.TeamFoundation.Framework.Server;
using Microsoft.TeamFoundation.Git.Server;
using System.IO;
using Microsoft.TeamFoundation.sourceControl.WebAPI;
using System.Configuration;
using System.Reflection;
using System.Runtime.Interopservices;

namespace TFs.Plugins
{
    public class PluginPushSubscriber : ISubscriber
    {
        public String name { get { return this.GetType().name; } }

        public SubscriberPriority Priority { get { return SubscriberPriority.normal; } }

        public Type[] SubscribedTypes()
        {
            return new Type[1] { typeof(PushNotification) };
        }

        public String Description
        {
            get { return "PluginPushSubscriber"; }
        }

        public EventNotificationStatus ProcessEvent(
            IVssrequestContext requestContext,NotificationType notificationType,object notificationEventArgs,out int statusCode,out String statusmessage,out ExceptionPropertyCollection propertIEs)
        {
            //init the out variables
            statusCode = 0;
            statusmessage = String.Empty;
            propertIEs = null;

            //DecisionPoint is where the action result (Permitted or DenIEd) can be drawn from subscriber logic.
            if (notificationType != NotificationType.DecisionPoint) { return EventNotificationStatus.ActionPermitted; }
            if (!(notificationEventArgs is PushNotification pushNotification)) { return EventNotificationStatus.ActionPermitted; }

            try
            {
                ***// I HAVE THE REPO....  I WOulD ALSO liKE TO query (GREp) THE BRANCH*** 

                var repositoryservice = requestContext.Getservice<ITeamFoundationGitRepositoryservice>();
                using (var repository = repositoryservice.FindRepositoryByID(requestContext,pushNotification.RepositoryID))
                {
                }
            }
            catch (Exception eX)
            {
                //Todo: log the exception
                return EventNotificationStatus.ActionDenIEd;
            }

            return EventNotificationStatus.ActionApproved;
        }

    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的来自 TFS ISubscriber git 服务器插件的 Grep 分支全部内容,希望文章能够帮你解决来自 TFS ISubscriber git 服务器插件的 Grep 分支所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。