コード例 #1
0
ファイル: Synchronizer.cs プロジェクト: marksvc/chorus
        /// <returns>false if nothing needed to be merged, true if the merge was done. Throws exception if there is an error.</returns>
        private bool MergeTwoChangeSets(Revision head, Revision theirHead)
        {
            string chorusMergeFilePath = Path.Combine(ExecutionEnvironment.DirectoryOfExecutingAssembly, "ChorusMerge.exe");

#if MONO
            // The replace is only useful for use with the MonoDevelop environment whcih doesn't honor $(Configuration) in the csproj files.
            // When this is exported as an environment var it needs escaping to prevent the shell from replacing it with an empty string.
            // When MonoDevelop is fixed this can be removed.
            chorusMergeFilePath = chorusMergeFilePath.Replace("$(Configuration)", "\\$(Configuration)");
#endif
            using (new ShortTermEnvironmentalVariable("HGMERGE", '"' + chorusMergeFilePath + '"'))
            {
                // Theory has it that is a tossup on who ought to win, unless there is some more principled way to decide.
                // If 'they' end up being the right answer, or if it ends up being more exotic,
                // then be sure to change the alpha and beta info in the MergeSituation class.
                //using (new ShortTermEnvironmentalVariable(MergeOrder.kConflictHandlingModeEnvVarName, MergeOrder.ConflictHandlingModeChoices.TheyWin.ToString()))
                // Go with 'WeWin', since that is the default and that is how the alpha and beta data of MergeSituation is set, right before this method is called.
                using (new ShortTermEnvironmentalVariable(MergeOrder.kConflictHandlingModeEnvVarName, MergeOrder.ConflictHandlingModeChoices.WeWin.ToString()))
                {
                    var didMerge = Repository.Merge(_localRepositoryPath, theirHead.Number.LocalRevisionNumber);
                    FailureSimulator.IfTestRequestsItThrowNow("SychronizerAdjunct");
                    return(didMerge);
                }
            }
        }
コード例 #2
0
ファイル: Synchronizer.cs プロジェクト: nishanth2143/chorus
 /// <returns>false if nothing needed to be merged, true if the merge was done. Throws exception if there is an error.</returns>
 private bool MergeTwoChangeSets(Revision head, Revision theirHead)
 {
     // Theory has it that is a tossup on who ought to win, unless there is some more principled way to decide.
     // If 'they' end up being the right answer, or if it ends up being more exotic,
     // then be sure to change the alpha and beta info in the MergeSituation class.
     //using (new ShortTermEnvironmentalVariable(MergeOrder.kConflictHandlingModeEnvVarName, MergeOrder.ConflictHandlingModeChoices.TheyWin.ToString()))
     // Go with 'WeWin', since that is the default and that is how the alpha and beta data of MergeSituation is set, right before this method is called.
     using (new ShortTermEnvironmentalVariable(MergeOrder.kConflictHandlingModeEnvVarName, MergeOrder.ConflictHandlingModeChoices.WeWin.ToString()))
     {
         var didMerge = Repository.Merge(_localRepositoryPath, theirHead.Number.LocalRevisionNumber);
         FailureSimulator.IfTestRequestsItThrowNow("SychronizerAdjunct");
         return(didMerge);
     }
 }
コード例 #3
0
ファイル: TextFileTypeHandler.cs プロジェクト: ddaspit/chorus
        public void Do3WayMerge(MergeOrder order)
        {
            // Debug.Fail("hello");
            // FailureSimulator is only used by tests to force a failure.
            FailureSimulator.IfTestRequestsItThrowNow("TextMerger");

            //trigger on a particular file name
            // FailureSimulator is only used by tests to force a failure.
            FailureSimulator.IfTestRequestsItThrowNow("TextMerger-" + Path.GetFileName(order.pathToOurs));

            //Throws on conflict
            var contents = GetRawMerge(order.pathToOurs, order.pathToCommonAncestor, order.pathToTheirs);

            File.WriteAllText(order.pathToOurs, contents);
        }
コード例 #4
0
ファイル: LiftMerger.cs プロジェクト: marksvc/chorus
 private static XmlNode FindEntry(XmlNode doc, string id)
 {
     FailureSimulator.IfTestRequestsItThrowNow("LiftMerger.FindEntryById");
     return(doc.SelectSingleNode("lift/entry[@id=\"" + id + "\"]"));
 }