public PluginCommandResponseMessage Execute(string args)
        {
            var response = new ContentResponse();
            var fileArgs = args.Deserialize<FileViewDiffArgs>();

            try
            {
                var revision = _repository.GetRevisionId(fileArgs.TpRevisionId);

                if (revision != null)
                {
                    var vcs = _vcsFactory.Get(revision.Profile);
                    response.Content = vcs.GetTextFileContent(revision.RevisionId.RevisionId, fileArgs.Path).Replace("\t", "    ");
                }

                return new PluginCommandResponseMessage
                       	{
                       		PluginCommandStatus = PluginCommandStatus.Succeed,
                       		ResponseData = response.Serialize()
                       	};
            }
            catch
            {
                return new PluginCommandResponseMessage
                       	{
                       		PluginCommandStatus = PluginCommandStatus.Error,
                       		ResponseData = "Unable to connect to a remote repository"
                       	};
            }
        }
Esempio n. 2
0
        public PluginCommandResponseMessage Execute(string args)
        {
            var response = new ContentResponse();
            var fileArgs = args.Deserialize <FileViewDiffArgs>();

            try
            {
                var revision = _repository.GetRevisionId(fileArgs.TpRevisionId);

                if (revision != null)
                {
                    var vcs = _vcsFactory.Get(revision.Profile);
                    response.Content = vcs.GetTextFileContent(revision.RevisionId.RevisionId, fileArgs.Path).Replace("\t", "    ");
                }

                return(new PluginCommandResponseMessage
                {
                    PluginCommandStatus = PluginCommandStatus.Succeed,
                    ResponseData = response.Serialize()
                });
            }
            catch
            {
                return(new PluginCommandResponseMessage
                {
                    PluginCommandStatus = PluginCommandStatus.Error,
                    ResponseData = "Unable to connect to a remote repository"
                });
            }
        }