Esempio n. 1
0
 public string LooseObjectStep()
 {
     return(this.CallGSD(
                "dehydrate \"" + this.enlistmentRoot + "\"",
                failOnError: true,
                internalParameter: GSDHelpers.GetInternalParameter("\\\"LooseObjects\\\"")));
 }
Esempio n. 2
0
        private static string GetModifiedPathsContents(GSDFunctionalTestEnlistment enlistment, FileSystemRunner fileSystem)
        {
            enlistment.WaitForBackgroundOperations();
            string modifiedPathsDatabase = Path.Combine(enlistment.DotGSDRoot, TestConstants.Databases.ModifiedPaths);

            modifiedPathsDatabase.ShouldBeAFile(fileSystem);
            return(GSDHelpers.ReadAllTextFromWriteLockedFile(modifiedPathsDatabase));
        }
Esempio n. 3
0
        public string PostFetchStep()
        {
            string internalParameter = GSDHelpers.GetInternalParameter("\\\"PostFetch\\\"");

            return(this.CallGSD(
                       "dehydrate \"" + this.enlistmentRoot + "\"",
                       failOnError: true,
                       internalParameter: internalParameter));
        }
Esempio n. 4
0
        public string PackfileMaintenanceStep(long?batchSize)
        {
            string sizeString        = batchSize.HasValue ? $"\\\"{batchSize.Value}\\\"" : "null";
            string internalParameter = GSDHelpers.GetInternalParameter("\\\"PackfileMaintenance\\\"", sizeString);

            return(this.CallGSD(
                       "dehydrate \"" + this.enlistmentRoot + "\"",
                       failOnError: true,
                       internalParameter: internalParameter));
        }
Esempio n. 5
0
        private string CallGSD(string args, bool failOnError = false, string trace = null, string standardInput = null, string internalParameter = null)
        {
            ProcessStartInfo processInfo = null;

            processInfo = new ProcessStartInfo(this.pathToGSD);

            if (internalParameter == null)
            {
                internalParameter = GSDHelpers.GetInternalParameter();
            }

            processInfo.Arguments = args + " " + TestConstants.InternalUseOnlyFlag + " " + internalParameter;

            processInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            processInfo.UseShellExecute        = false;
            processInfo.RedirectStandardOutput = true;
            if (standardInput != null)
            {
                processInfo.RedirectStandardInput = true;
            }

            if (trace != null)
            {
                processInfo.EnvironmentVariables["GIT_TRACE"] = trace;
            }

            using (Process process = Process.Start(processInfo))
            {
                if (standardInput != null)
                {
                    process.StandardInput.Write(standardInput);
                    process.StandardInput.Close();
                }

                string result = process.StandardOutput.ReadToEnd();
                process.WaitForExit();

                if (failOnError)
                {
                    process.ExitCode.ShouldEqual(0, result);
                }

                return(result);
            }
        }