Esempio n. 1
0
        public ConvertedArguments Convert(DiffToolArguments arguments)
        {
            string baseSha = arguments.LeftSHA;
            string headSha = arguments.RightSHA;

            throwOnEmptySha(new[] { baseSha, headSha });

            FileStorageDiffCacheFolder diffFolder = getDiffFolder(baseSha, headSha);

            Debug.Assert(diffFolder != null);

            var configValue = GitTools.GetConfigKeyValue(GitTools.ConfigScope.Global, Constants.GitDiffToolConfigKey);

            if (String.IsNullOrEmpty(configValue.FirstOrDefault()))
            {
                throw new ArgumentConversionException("Diff Tool is not registered", null);
            }

            string diffToolPath = configValue.FirstOrDefault()
                                  .Replace("$LOCAL", diffFolder.LeftSubfolder)
                                  .Replace("$REMOTE", diffFolder.RightSubfolder)
                                  .Replace("//", "/");

            return(new ConvertedArguments(diffToolPath, String.Empty));
        }
 public int LaunchDiffTool(DiffToolArguments arguments)
 {
     try
     {
         return((int)runCommand(arguments));
     }
     catch (GitCommandServiceInternalException ex)
     {
         ExceptionHandlers.Handle(ex.Message, ex);
         throw new DiffToolLaunchException(ex);
     }
 }
 protected override object runCommand(DiffToolArguments arguments)
 {
     try
     {
         ConvertedArguments converted = _argumentConverter.Convert(arguments);
         return(startExternalProcess(converted.App, converted.Arguments, _path, false, null).PID);
     }
     catch (ArgumentConversionException ex)
     {
         throw new GitCommandServiceInternalException(ex);
     }
 }
 abstract protected object runCommand(DiffToolArguments arguments);
 protected override object runCommand(DiffToolArguments arguments)
 {
     return(startExternalProcess("git", arguments.ToString(), _path, false, null).PID);
 }