• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# merge.MergeOrder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Chorus.merge.MergeOrder的典型用法代码示例。如果您正苦于以下问题:C# MergeOrder类的具体用法?C# MergeOrder怎么用?C# MergeOrder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MergeOrder类属于Chorus.merge命名空间,在下文中一共展示了MergeOrder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BothModifiedExampleFormTextWorksWithConflict

        public void BothModifiedExampleFormTextWorksWithConflict()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
            <lift version='0.10' producer='WeSay 1.0.0.0'>
            <entry id='test'  guid='F169EB3D-16F2-4eb0-91AA-FDB91636F8F6'>
            <sense id='123'>
             <example>
            <form lang='chorus'>
              <text>This is my example sentence.</text>
            </form>
              </example>
            </sense>
            </entry>
            </lift>";
            var ours = ancestor.Replace(@"This is my example", @"This was your example");
            var theirs = ancestor.Replace(@"This is my example", @"It's mine don't touch it.");

            using (var oursTemp = new TempFile(ours))
            using (var theirsTemp = new TempFile(theirs))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var listener = new ListenerForUnitTests();
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                Assert.AreEqual(1, listener.Conflicts.Count);
                var warning = listener.Conflicts[0];
                Assert.AreEqual(typeof(XmlTextBothEditedTextConflict), warning.GetType(), warning.ToString());
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "//example/form");
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:35,代码来源:ExampleSentenceMergingTests.cs


示例2: BothAddedHeaderButWithDifferentContentInEach

        public void BothAddedHeaderButWithDifferentContentInEach()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='parent' guid='c1ed1fa3-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='a'>
                                    <text>form parent</text>
                                </form>
                            </lexical-unit>
                         </entry>
                    </lift>";
            var alpha = ancestor.Replace("<entry id", "<header><description>alphastuff</description></header><entry id");
            var beta = ancestor.Replace("<entry id", "<header><ranges>betastuff</ranges></header><entry id");

            using (var oursTemp = new TempFile(alpha))
            using (var theirsTemp = new TempFile(beta))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var listener = new ListenerForUnitTests();
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry",
                    "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                Assert.IsTrue(result.Contains("<header>"));
                Assert.IsTrue(result.Contains("<description>"));
                Assert.IsTrue(result.Contains("<ranges>"));
                listener.AssertExpectedChangesCount(2);
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:34,代码来源:FileLevelMergeTests.cs


示例3: OneAddedOneTranslationOtherEditedFormText

        public void OneAddedOneTranslationOtherEditedFormText()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
            <lift version='0.10' producer='WeSay 1.0.0.0'>
            <entry id='test'  guid='F169EB3D-16F2-4eb0-91AA-FDB91636F8F6'>
            <sense id='123'>
             <example>
            <form lang='chorus'>
              <text>This is my example sentence.</text>
            </form>
              </example>
            </sense>
            </entry>
            </lift>";
            var ours = ancestor.Replace(@"This is my example", @"This was your example");
            var theirs = ancestor.Replace(@"</example>", @"<form lang='en'><text>hello new entry</text></form></example>");

            using (var oursTemp = new TempFile(ours))
            using (var theirsTemp = new TempFile(theirs))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var listener = new ListenerForUnitTests();
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "//example");
                AssertThatXmlIn.String(result).HasSpecifiedNumberOfMatchesForXpath("//example/form", 2);
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:33,代码来源:ExampleSentenceMergingTests.cs


示例4: Do3WayMerge

 public void Do3WayMerge(MergeOrder order)
 {
     XmlMergeService.Do3WayMerge(order,
         new ChorusNotesAnnotationMergingStrategy(order),
         false,
         null,
         "annotation", "guid");
 }
开发者ID:sillsdev,项目名称:chack,代码行数:8,代码来源:ChorusNotesFileHandler.cs


示例5: FixtureSetup

		public void FixtureSetup()
		{
			_mdc = MetadataCache.TestOnlyNewCache;
			var mergeOrder = new MergeOrder(null, null, null, new NullMergeSituation())
			{
				EventListener = new ListenerForUnitTests()
			};
			_merger = FieldWorksMergeServices.CreateXmlMergerForFieldWorksData(mergeOrder, _mdc);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:9,代码来源:TimeDataTypeReportTests.cs


示例6: ChorusNotesAnnotationMergingStrategy

        /// <summary>
        /// Produce a string that represents the 3-way merger of the given three elements.
        /// </summary>
        public ChorusNotesAnnotationMergingStrategy(MergeOrder order)
        {
            _annotationMerger = new XmlMerger(order.MergeSituation)
                {
                    EventListener = order.EventListener
                };

            SetupElementStrategies();
        }
开发者ID:sillsdev,项目名称:chack,代码行数:12,代码来源:ChorusNotesAnnotationMergingStrategy.cs


示例7: CreateXmlMergerForFieldWorksData

 internal static XmlMerger CreateXmlMergerForFieldWorksData(MergeOrder mergeOrder, MetadataCache mdc)
 {
     var merger = new XmlMerger(mergeOrder.MergeSituation)
         {
             EventListener = mergeOrder.EventListener
         };
     BootstrapSystem(mdc, merger);
     return merger;
 }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:9,代码来源:FieldWorksMergeServices.cs


示例8: DoMerge

 internal static void DoMerge(MergeOrder mergeOrder, XmlMerger merger)
 {
     XmlNode ours;
     XmlNode theirs;
     XmlNode common;
     DoPreMerge(mergeOrder, out ours, out theirs, out common);
     var results = merger.Merge(ours, theirs, common);
     DoPostMerge(mergeOrder.pathToOurs, results.MergedNode);
 }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:9,代码来源:CustomLayoutMergeService.cs


示例9: Do3WayMerge

		public void Do3WayMerge(MetadataCache mdc, MergeOrder mergeOrder)
		{
			var merger = new XmlMerger(mergeOrder.MergeSituation)
				{
					EventListener = mergeOrder.EventListener
				};
			CustomLayoutMergeStrategiesMethod.AddElementStrategies(merger.MergeStrategies);
			CustomLayoutMergeService.DoMerge(mergeOrder, merger);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:9,代码来源:FieldWorksConfigurationLayoutTypeHandlerStrategy.cs


示例10: MergeSituation

        //this one is only for deserializing
        private MergeSituation(string relativePathToFile, MergeOrder.ConflictHandlingModeChoices conflictHandlingMode)
        {
            ConflictHandlingMode = conflictHandlingMode;

            if (relativePathToFile != null)
                relativePathToFile = relativePathToFile.Trim(new[] { Path.DirectorySeparatorChar });

            PathToFileInRepository = relativePathToFile;
        }
开发者ID:sillsdev,项目名称:chack,代码行数:10,代码来源:MergeSituation.cs


示例11: DoMerge

		internal static void DoMerge(MergeOrder mergeOrder, XmlMerger merger)
		{
			XmlNode ours;
			XmlNode theirs;
			XmlNode common;
			DoPreMerge(mergeOrder, out ours, out theirs, out common);
			// The document element is being returned here, so our parent isn't relevant and won't be used by the merge
			var results = merger.Merge(null, ours, theirs, common);
			DoPostMerge(mergeOrder.pathToOurs, results.MergedNode);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:10,代码来源:CustomLayoutMergeService.cs


示例12: LiftRangesMergingStrategy

        /// <summary>
        /// Constructor
        /// </summary>
        public LiftRangesMergingStrategy(MergeOrder mergeOrder)
        {
            _merger = new XmlMerger(mergeOrder.MergeSituation)
                {
                    EventListener = mergeOrder.EventListener
                };

            LiftBasicElementStrategiesMethod.AddLiftBasicElementStrategies(_merger.MergeStrategies);
            LiftRangesElementStrategiesMethod.AddLiftRangeElementStrategies(_merger.MergeStrategies);
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:13,代码来源:LiftRangesMergingStrategy.cs


示例13: LiftEntryMergingStrategy

        /// <summary>
        /// Produce a string that represents the 3-way merger of the given three elements.
        /// </summary>
        public LiftEntryMergingStrategy(MergeOrder mergeOrder)
        {
            _entryMerger = new XmlMerger(mergeOrder.MergeSituation)
                           	{
                           		MergeStrategies = {ElementToMergeStrategyKeyMapper = new LiftElementToMergeStrategyKeyMapper()},
                                EventListener = mergeOrder.EventListener
                           	};

            LiftElementStrategiesMethod.AddLiftElementStrategies(_entryMerger.MergeStrategies);
        }
开发者ID:sillsdev,项目名称:chack,代码行数:13,代码来源:LiftEntryMergingStrategy.cs


示例14: TestSetup

		public override void TestSetup()
		{
			base.TestSetup();
			Mdc.UpgradeToVersion(MetadataCache.MaximumModelVersion);
			var mergeOrder = new MergeOrder(null, null, null, new NullMergeSituation())
			{
				EventListener = new ListenerForUnitTests()
			};
			_merger = FieldWorksMergeServices.CreateXmlMergerForFieldWorksData(mergeOrder, Mdc);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:10,代码来源:ReferenceAtomicDataTypeReportTests.cs


示例15: Do3WayMerge

		/// <summary>
		/// All callers merging FieldWorks data need to pass 'true', so the MDC will know about  any custom properties for their classes.
		///
		/// Non-object callers (currently only the merge of the custom property definitions themselves) shoudl pass 'false'.
		/// </summary>
		internal static void Do3WayMerge(MergeOrder mergeOrder, MetadataCache mdc, bool addcustomPropertyInformation)
		{
			// Skip doing this for the Custom property definiton file, since it has no real need for the custom prop definitions,
			// which are being merged (when 'false' is provided).
			if (addcustomPropertyInformation)
				mdc.AddCustomPropInfo(mergeOrder); // NB: Must be done before FieldWorksCommonMergeStrategy is created. since it used the MDC.

			var merger = FieldWorksMergeServices.CreateXmlMergerForFieldWorksData(mergeOrder, mdc);
			merger.EventListener = mergeOrder.EventListener;
			var mergeResults = merger.MergeFiles(mergeOrder.pathToOurs, mergeOrder.pathToTheirs, mergeOrder.pathToCommonAncestor);
			// Write out merged data.
			FileWriterService.WriteNestedFile(mergeOrder.pathToOurs, mergeResults.MergedNode);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:18,代码来源:FieldWorksCommonFileHandler.cs


示例16: Do3WayMerge

 public void Do3WayMerge(MergeOrder mergeOrder)
 {
     // <mergenotice>
     // When the WeSay1.3 branch gets merged, do this:
     // 1. Keep this code and reject the WeSay1.3 changes. They were done as a partial port of some other code changes.
     // 2. Remove this <mergenotice> comment and its 'end tag' comment.
     // 3. The parm change from 'false' to 'true' is to be kept.
     XmlMergeService.Do3WayMerge(mergeOrder,
         new LiftEntryMergingStrategy(mergeOrder),
         true,
         "header",
         "entry", "guid");
     // </mergenotice>
 }
开发者ID:regnrand,项目名称:chorus,代码行数:14,代码来源:LiftFileHandler.cs


示例17: Main

        public static int Main(string[] args)
        {
            try
            {

            #if MONO
                var ourFilePath = args[0];
                var commonFilePath = args[1];
                var theirFilePath = args[2];
            #else
                // Convert the input arguments from cp1252 -> utf8 -> ucs2
                // It always seems to be 1252, even when the input code page is actually something else. CP 2012-03
                // var inputEncoding = Console.InputEncoding;
                var inputEncoding = Encoding.GetEncoding(1252);
                var ourFilePath = Encoding.UTF8.GetString(inputEncoding.GetBytes(args[0]));
                var commonFilePath = Encoding.UTF8.GetString(inputEncoding.GetBytes(args[1]));
                var theirFilePath = Encoding.UTF8.GetString(inputEncoding.GetBytes(args[2]));
                Console.WriteLine("ChorusMerge: Input encoding {0}", inputEncoding.EncodingName);
            #endif

                //this was originally put here to test if console writes were making it out to the linux log or not
                Console.WriteLine("ChorusMerge: {0}, {1}, {2}", ourFilePath, commonFilePath, theirFilePath);

            #if RUNINDEBUGGER
                var order = new MergeOrder(ourFilePath, commonFilePath, theirFilePath, new MergeSituation(ourFilePath, "Me", "CHANGETHIS", "YOU", "CHANGETHIS", MergeOrder.ConflictHandlingModeChoices.WeWin));
            #else
                MergeOrder order = MergeOrder.CreateUsingEnvironmentVariables(ourFilePath, commonFilePath, theirFilePath);
            #endif
                var handlers = ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers();
                var handler = handlers.GetHandlerForMerging(order.pathToOurs);

                //DispatchingMergeEventListener listenerDispatcher = new DispatchingMergeEventListener();
                //using (HumanLogMergeEventListener humanListener = new HumanLogMergeEventListener(order.pathToOurs + ".ChorusNotes.txt"))
                using (ChorusNotesMergeEventListener xmlListener = new ChorusNotesMergeEventListener(order.pathToOurs + ".NewChorusNotes"))
                {
            //                    listenerDispatcher.AddEventListener(humanListener);
            //                    listenerDispatcher.AddEventListener(xmlListener);
                    order.EventListener = xmlListener;

                    handler.Do3WayMerge(order);
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("ChorusMerge Error: " + e.Message);
                Console.Error.WriteLine(e.StackTrace);
                return 1;
            }
            return 0;//no error
        }
开发者ID:sillsdev,项目名称:chack,代码行数:50,代码来源:Program.cs


示例18: MergeConflictFiles_AncestorDidNotExist

        public void MergeConflictFiles_AncestorDidNotExist()
        {
            using (GroupOfConflictFiles group = new GroupOfConflictFiles("",
                                                                      "<notes><annotation guid='bobGuid'/></notes>",
                                                                      "<notes><annotation guid='sallyGuid'/></notes>"))
            {
                MergeOrder order = new MergeOrder(group.BobFile.Path,
                                                  group.AncestorFile.Path, group.SallyFile.Path, new NullMergeSituation());
                new ChorusNotesFileHandler().Do3WayMerge(order);

                XmlDocument doc = new XmlDocument();
                doc.Load(group.BobFile.Path);
                Assert.AreEqual(2, doc.SelectNodes("notes/annotation").Count);
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:15,代码来源:ChorusMLFileSyncTests.cs


示例19: Conflict_TheirsAppearsInCollisionNote

        public void Conflict_TheirsAppearsInCollisionNote()
        {
            const string ours = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='lexicalformcollission' guid='c1ed1fa7-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='x'>
                                    <text>ours</text>
                                </form>
                            </lexical-unit>
                        </entry>
                    </lift>";

            const string theirs = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='lexicalformcollission' guid='c1ed1fa7-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='x'>
                                    <text>theirs</text>
                                </form>
                            </lexical-unit>
                        </entry>
                    </lift>";
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='lexicalformcollission' guid='c1ed1fa7-e382-11de-8a39-0800200c9a66' />
                    </lift>";

            using (var oursTemp = new TempFile(ours))
            using (var theirsTemp = new TempFile(theirs))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var listener = new ListenerForUnitTests();
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new PoorMansMergeStrategy(),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry[@id='lexicalformcollission']");
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry");//just one
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry/field[@type='mergeConflict']/trait[@name = 'looserData']");
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry/field[@type='mergeConflict' and @dateCreated]");
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:46,代码来源:PoorMansMergingStrategyTests.cs


示例20: RangeSectionMergedCorrectly

 public void RangeSectionMergedCorrectly()
 {
     using (var oursTemp = new TempFile(_ours))
     using (var theirsTemp = new TempFile(_theirs))
     using (var ancestorTemp = new TempFile(_ancestor))
     {
         var listener = new ListenerForUnitTests();
         var situation = new NullMergeSituation();
         var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
         XmlMergeService.Do3WayMerge(mergeOrder, new LiftEntryMergingStrategy(mergeOrder),
             false,
             "header",
             "entry", "guid");
         var result = File.ReadAllText(mergeOrder.pathToOurs);
         XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry[@id='usOnly']");
         AssertThatXmlIn.String(result).HasSpecifiedNumberOfMatchesForXpath(@"lift/header/ranges/range", 4);
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:18,代码来源:LiftHeaderMergingTests.cs



注:本文中的Chorus.merge.MergeOrder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# merge.NullMergeSituation类代码示例发布时间:2022-05-24
下一篇:
C# Mercurial.FileInRevision类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap