当前位置: 首页>>代码示例>>C#>>正文


C# PatchApply.PatchManager类代码示例

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


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

示例1: ViewPatch

        public ViewPatch(GitUICommands aCommands)
            : base(aCommands)
        {
            InitializeComponent(); Translate();

            PatchManager = new PatchManager();
        }
开发者ID:robin521111,项目名称:gitextensions,代码行数:7,代码来源:FormViewPatch.cs

示例2: TestLoadPatch

        public void TestLoadPatch()
        {
            PatchManager manager = new PatchManager();

            PatchApply.Patch expectedPatch = new PatchApply.Patch();
            expectedPatch.Type = PatchApply.Patch.PatchType.ChangeFile;
            expectedPatch.Apply = true;
            expectedPatch.PatchHeader = "diff --git a/thisisatest.txt b/thisisatest.txt";
            expectedPatch.PatchIndex = "index 5e4dce2..5eb1e6f 100644";
            expectedPatch.FileNameA = "thisisatest.txt";
            expectedPatch.FileNameB = "thisisatest.txt";
            expectedPatch.AppendTextLine(expectedPatch.PatchHeader);
            expectedPatch.AppendTextLine(expectedPatch.PatchIndex);
            expectedPatch.AppendTextLine("--- a/thisisatest.txt");
            expectedPatch.AppendTextLine("+++ b/thisisatest.txt");
            expectedPatch.AppendTextLine("@@ -1,2 +1,2 @@");
            expectedPatch.AppendTextLine("iiiiii");
            expectedPatch.AppendTextLine("-asdkjaldskjlaksd");
            expectedPatch.AppendTextLine("+changed again");

            manager.LoadPatch(expectedPatch.Text, false, Encoding.Default);

            PatchApply.Patch createdPatch = manager.Patches.First();
            Assert.AreEqual(expectedPatch.Text, createdPatch.Text);
        }
开发者ID:Copro,项目名称:gitextensionstest,代码行数:25,代码来源:PatchManagerTest.cs

示例3: TestCorrectlyLoadsTheRightNumberOfDiffsInAPatchFile

        public void TestCorrectlyLoadsTheRightNumberOfDiffsInAPatchFile()
        {
            var manager = new PatchManager();
            var testPatch = Encoding.UTF8.GetString(TestResource.TestPatch);
            manager.LoadPatch(testPatch, false);

            Assert.AreEqual(12, manager.Patches.Count);
        }
开发者ID:ultonis,项目名称:gitextensions,代码行数:8,代码来源:PatchTest.cs

示例4: TestCorrectlyLoadsTheRightFilenamesInAPatchFile

        public void TestCorrectlyLoadsTheRightFilenamesInAPatchFile()
        {
            var manager = new PatchManager();
            var testPatch = Encoding.UTF8.GetString(TestResource.TestPatch);
            manager.LoadPatch(testPatch, false);

            Assert.AreEqual(12, manager.Patches.Select(p => p.FileNameA).Distinct().Count());
            Assert.AreEqual(12, manager.Patches.Select(p => p.FileNameB).Distinct().Count());
        }
开发者ID:ultonis,项目名称:gitextensions,代码行数:9,代码来源:PatchTest.cs

示例5: TestCorrectlyLoadsTheRightTypeOfDiffsInAPatchFile

        public void TestCorrectlyLoadsTheRightTypeOfDiffsInAPatchFile()
        {
            var manager = new PatchManager();
            var testPatch = Encoding.UTF8.GetString(TestResource.TestPatch);
            manager.LoadPatch(testPatch, false);

            Assert.IsTrue(manager.Patches.Any(p => p.Type == Patch.PatchType.NewFile));
            Assert.IsTrue(manager.Patches.Any(p => p.Type == Patch.PatchType.ChangeFile));
            Assert.IsTrue(manager.Patches.Any(p => p.Type == Patch.PatchType.DeleteFile));
        }
开发者ID:ultonis,项目名称:gitextensions,代码行数:10,代码来源:PatchTest.cs

示例6: GetCombinedDiffContent

        public string GetCombinedDiffContent(GitRevision revisionOfMergeCommit, string filePath,
            string extraArgs, Encoding encoding)
        {
            var cmd = string.Format("diff-tree {4} --no-commit-id {0} {1} {2} -- {3}",
                extraArgs,
                revisionOfMergeCommit.Guid,
                AppSettings.UsePatienceDiffAlgorithm ? "--patience" : "",
                filePath,
                AppSettings.OmitUninterestingDiff ? "--cc" : "-c -p");

            var patchManager = new PatchManager();
            var patch = RunCacheableCmd(AppSettings.GitCommand, cmd, LosslessEncoding);

            if (string.IsNullOrWhiteSpace(patch))
            {
                return "";
            }

            patchManager.LoadPatch(patch, false, encoding);
            return GetPatch(patchManager, filePath, filePath).Text;
        }
开发者ID:pmiossec,项目名称:gitextensions,代码行数:21,代码来源:GitModule.cs

示例7: GetSingleDiff

        public static Patch GetSingleDiff(string from, string to, string filter, string extraDiffArguments)
        {
            filter = FixPath(filter);
            from = FixPath(from);
            to = FixPath(to);

            var patchManager = new PatchManager();
            var arguments = string.Format("diff{0} \"{1}\" \"{2}\" -- \"{3}\"", extraDiffArguments, to, from, filter);
            patchManager.LoadPatch(RunCachableCmd(Settings.GitCommand, arguments), false);

            return patchManager.patches.Count > 0 ? patchManager.patches[0] : null;
        }
开发者ID:TwistedHope,项目名称:gitextensions,代码行数:12,代码来源:GitCommands.cs

示例8: GetStashedItems

        public IList<Patch> GetStashedItems(string stashName)
        {
            var patchManager = new PatchManager();
            patchManager.LoadPatch(RunGitCmd("stash show -p " + stashName, LosslessEncoding), false, FilesEncoding);

            return patchManager.Patches;
        }
开发者ID:saland,项目名称:gitextensions,代码行数:7,代码来源:GitModule.cs

示例9: GetCurrentChanges

        public Patch GetCurrentChanges(string fileName, string oldFileName, bool staged, string extraDiffArguments, Encoding encoding)
        {
            fileName = string.Concat("\"", FixPath(fileName), "\"");
            if (!string.IsNullOrEmpty(oldFileName))
                oldFileName = string.Concat("\"", FixPath(oldFileName), "\"");

            if (AppSettings.UsePatienceDiffAlgorithm)
                extraDiffArguments = string.Concat(extraDiffArguments, " --patience");

            var args = string.Concat("diff ", extraDiffArguments, " -- ", fileName);
            if (staged)
                args = string.Concat("diff -M -C --cached", extraDiffArguments, " -- ", fileName, " ", oldFileName);

            String result = RunGitCmd(args, LosslessEncoding);
            var patchManager = new PatchManager();
            patchManager.LoadPatch(result, false, encoding);

            return patchManager.Patches.Count > 0 ? patchManager.Patches[patchManager.Patches.Count - 1] : null;
        }
开发者ID:saland,项目名称:gitextensions,代码行数:19,代码来源:GitModule.cs

示例10: GetStashedItems

        public static List<Patch> GetStashedItems(string stashName)
        {
            var patchManager = new PatchManager();
            patchManager.LoadPatch(RunCmd(Settings.GitCommand, "stash show -p " + stashName), false);

            return patchManager.Patches;
        }
开发者ID:avish,项目名称:gitextensions,代码行数:7,代码来源:GitCommandsHelper.cs

示例11: GetDiff

        public static List<Patch> GetDiff(string from, string to, string extraDiffArguments)
        {
            PatchManager patchManager = new PatchManager();
            patchManager.LoadPatch(GitCommands.RunCachableCmd(Settings.GitCommand, "diff" + extraDiffArguments + " \"" + from + "\" \"" + to + "\""), false);

            return patchManager.patches;
        }
开发者ID:Gitulf,项目名称:gitextensions,代码行数:7,代码来源:GitCommands.cs

示例12: GetStashedItems

        public List<Patch> GetStashedItems(string stashName)
        {
            var patchManager = new PatchManager();
            patchManager.LoadPatch(RunGitCmd("stash show -p " + stashName), false);

            return patchManager.Patches;
        }
开发者ID:nitoyon,项目名称:gitextensions,代码行数:7,代码来源:GitModule.cs

示例13: GetMD5Hash_AString_ReturnsMD5ForString

 public void GetMD5Hash_AString_ReturnsMD5ForString()
 {
     var pm = new PatchManager();
     var res = pm.GetMD5Hash("hello world");
     Assert.AreEqual("5eb63bbbe01eeed093cb22bb8f5acdc3", res);
 }
开发者ID:dominiqueplante,项目名称:gitextensions,代码行数:6,代码来源:PatchManagerTest.cs

示例14: Clear

        private void Clear()
        {
            CurrentPatch = null;

            patchManager = new PatchManager();

            GridChangedFiles.DataSource = null;

            PatchedFileEdit.Text = "";
            PatchedFileEdit.Refresh();

            FileToPatchEdit.Text = "";
            FileToPatchEdit.Refresh();

            ChangesList.Text = "";
        }
开发者ID:arBmind,项目名称:gitextensions,代码行数:16,代码来源:ApplyPatch.cs

示例15: TestPatchManagerConstructor

 public void TestPatchManagerConstructor()
 {
     PatchManager manager = new PatchManager();
     Assert.IsNotNull(manager);
 }
开发者ID:Copro,项目名称:gitextensionstest,代码行数:5,代码来源:PatchManagerTest.cs


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