示例#1
0
        public void SyncTestFile()
        {
            SDIniLocation = Environment.ExpandEnvironmentVariables(@"%SRCROOT%\..\sd.ini");
            var SDRootDirectory = Environment.GetEnvironmentVariable("SRCROOT");
            var language        = "pl-pl";

            FilePattern = string.Format(@"{0}\intl\word\{1}\main_dll\bibform.xml.lcl", SDRootDirectory, language);
            using (SourceDepot store = new SourceDepot(SDIniLocation))
            {
                DumpResults = r =>
                {
                    TestContext.WriteLine(r.ResultType.ToString());
                    foreach (SDCommandOutput x in r.Outputs)
                    {
                        TestContext.WriteLine(x.Message);
                    }
                };
                TestContext.WriteLine("Reverting...");
                var revertResults = store.Revert(FilePattern);
                DumpResults(revertResults);
                TestContext.WriteLine("Forced syncing...");
                var results = store.ForceSync(FilePattern);
                DumpResults(results);
                TestContext.WriteLine("Reference file {0} is now hot-synced.", FilePattern);
            }
        }
示例#2
0
        /// <summary>
        /// Uses normal sync or forced sync (depending on retry attempt) to the appropriate depot.
        /// </summary>
        /// <param name="depot">Depot to synchronize</param>
        /// <param name="retryNumber">Number of the current retry. If it is 1, normal sync is used. If it is greater than 1, uses forced sync.</param>
        /// <param name="filePattern">Pattern of files to sync.</param>
        /// <param name="branchName">Branch on which to synchronize the files.</param>
        /// <returns>Command results.</returns>
        protected static SourceDepotCommandResult SyncDepotToBranch(SourceDepot depot, string branchName, int retryNumber, string filePattern)
        {
            Console.WriteLine("Attempt {0}...", retryNumber);

            SourceDepotCommandResult results = null;

            if (retryNumber == 1)
            {
                results = depot.Sync(filePattern, branchName);
            }
            else
            {
                results = depot.ForceSync(filePattern, branchName);
            }
            return(results);
        }