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


C# HgRepository.AddAndCheckinFile方法代码示例

本文整理汇总了C#中HgRepository.AddAndCheckinFile方法的典型用法代码示例。如果您正苦于以下问题:C# HgRepository.AddAndCheckinFile方法的具体用法?C# HgRepository.AddAndCheckinFile怎么用?C# HgRepository.AddAndCheckinFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HgRepository的用法示例。


在下文中一共展示了HgRepository.AddAndCheckinFile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

        public void Setup()
        {
            _progress = new ConsoleProgress();
            _testRoot = new TemporaryFolder("ChorusRetrieveTest");
            _tempFile = new TempFileFromFolder(_testRoot);
                File.WriteAllText(_tempFile.Path,"one");

                HgRepository.CreateRepositoryInExistingDir(_testRoot.Path,_progress);
            _repo = new HgRepository(_testRoot.Path, new NullProgress());
            _repo.AddAndCheckinFile(_tempFile.Path);
                _repo.Commit(true, "initial");

                File.WriteAllText(_tempFile.Path, "two");
                _repo.AddAndCheckinFile(_tempFile.Path);
                _repo.Commit(true, "changed to two");

            _changesets = _repo.GetAllRevisions();
            Assert.AreEqual(2, _changesets.Count);
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:19,代码来源:RetrieveVersionTests.cs

示例2: AddingRepositoryWithinAnotherRepositoryWithEmptyStringDirectoryThrows

        public void AddingRepositoryWithinAnotherRepositoryWithEmptyStringDirectoryThrows()
        {
            using (var tempParent = new TemporaryFolder("ChorusParent"))
            {
                var parentRepo = new HgRepository(tempParent.Path, new NullProgress());
                parentRepo.Init();
                var parentFile = tempParent.GetNewTempFile(true);
                File.WriteAllText(parentFile.Path, "New Content");
                parentRepo.AddAndCheckinFile(parentFile.Path);

                Assert.Throws<ArgumentNullException>(() => HgRepository.CreateOrUseExisting("", new NullProgress()));
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:13,代码来源:RepositoryTests.cs

示例3: AddingRepositoryWithinAnotherRepositoryWithNonexistantDirectoryThrows

        public void AddingRepositoryWithinAnotherRepositoryWithNonexistantDirectoryThrows()
        {
            using (var tempParent = new TemporaryFolder("ChorusParent"))
            {
                var parentRepo = new HgRepository(tempParent.Path, new NullProgress());
                parentRepo.Init();
                var parentFile = tempParent.GetNewTempFile(true);
                File.WriteAllText(parentFile.Path, "New Content");
                parentRepo.AddAndCheckinFile(parentFile.Path);

                var parentFolder = tempParent.Path;
                var nonexistantDirectory = Path.Combine(parentFolder, "Child");
                Assert.Throws<InvalidOperationException>(() => HgRepository.CreateOrUseExisting(nonexistantDirectory, new NullProgress()));
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:15,代码来源:RepositoryTests.cs

示例4: AddingRepositoryWithinAnotherRepositoryFromDirectoryNameIsDifferentRepository

        public void AddingRepositoryWithinAnotherRepositoryFromDirectoryNameIsDifferentRepository()
        {
            using (var tempParent = new TemporaryFolder("ChorusParent"))
            {
                var parentRepo = new HgRepository(tempParent.Path, new NullProgress());
                parentRepo.Init();
                var parentFile = tempParent.GetNewTempFile(true);
                File.WriteAllText(parentFile.Path, "New Content");
                parentRepo.AddAndCheckinFile(parentFile.Path);

                var parentFolder = tempParent.Path;
                var dirInfo = Directory.CreateDirectory(Path.Combine(parentFolder, "Child"));
                var childRepo = HgRepository.CreateOrUseExisting(dirInfo.FullName, new NullProgress());
                Assert.AreNotEqual(parentFolder, childRepo.PathToRepo);
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:16,代码来源:RepositoryTests.cs

示例5: HasExtantRepositories

        public void HasExtantRepositories()
        {
            using (var parentFolder = new TemporaryFolder("parentFolder"))
            using (var childFolder = new TemporaryFolder(parentFolder, "childFolder"))
            {
                var newFile = Path.Combine(childFolder.Path, "test.txt");
                File.WriteAllText(newFile, "some stuff");
                var repo = new HgRepository(childFolder.Path, new NullProgress());
                repo.Init();
                repo.AddAndCheckinFile(newFile);

                var extantRepoIdentifiers = GetSharedProjectModel.ExtantRepoIdentifiers(parentFolder.Path, null);
                Assert.AreEqual(1, extantRepoIdentifiers.Count);
                Assert.IsTrue(extantRepoIdentifiers.ContainsKey(repo.Identifier));
                Assert.That(extantRepoIdentifiers[repo.Identifier], Is.EqualTo("childFolder"));
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:17,代码来源:GetSharedProjectModelTests.cs

示例6: GetFilesInRevision_OnlyOneRevisionInRepo_GivesAllFiles

        public void GetFilesInRevision_OnlyOneRevisionInRepo_GivesAllFiles()
        {
            using (var testRoot = new TemporaryFolder("ChorusRetrieveTest"))
            using (var f = new TempFileFromFolder(testRoot))
                {
                    File.WriteAllText(f.Path, "one");

                    HgRepository.CreateRepositoryInExistingDir(testRoot.Path,_progress);
                    var repo = new HgRepository(testRoot.Path, _progress);

                    repo.AddAndCheckinFile(f.Path);
                    repo.Commit(true, "initial");
                    var revisions = repo.GetAllRevisions();
                    Assert.AreEqual(1, revisions.Count);
                    var files = repo.GetFilesInRevision(revisions[0]);
                    Assert.AreEqual(1, files.Count());
                    Assert.AreEqual(f.Path, files.First().FullPath);
                }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:19,代码来源:FileInRevisionTests.cs

示例7: GetFilesInRevision_MultipleRevisionsInRepo_GivesCorrectFiles

        public void GetFilesInRevision_MultipleRevisionsInRepo_GivesCorrectFiles()
        {
            using (var testRoot = new TemporaryFolder("ChorusRetrieveTest"))
            {
                var temp = testRoot.Combine("filename with spaces");
                File.WriteAllText(temp, "one");
                using (var f = TempFile.TrackExisting(temp))
                {
                    HgRepository.CreateRepositoryInExistingDir(testRoot.Path,_progress);
                    var repo = new HgRepository(testRoot.Path, _progress);

                    repo.AddAndCheckinFile(f.Path);
                    repo.Commit(true, "initial");
                    File.WriteAllText(f.Path, "one two");
                    repo.Commit(true, "second");

                    var revisions = repo.GetAllRevisions();
                    Assert.AreEqual(2, revisions.Count);
                    var files = repo.GetFilesInRevision(revisions[0]);
                    Assert.AreEqual(1, files.Count());
                    Assert.AreEqual(f.Path, files.First().FullPath);
                }
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:24,代码来源:FileInRevisionTests.cs

示例8: GetRevisionWorkingSetIsBasedOn_OneCheckin_Gives0

 public void GetRevisionWorkingSetIsBasedOn_OneCheckin_Gives0()
 {
     using (var testRoot = new TemporaryFolder("ChorusHgWrappingTest"))
     {
         HgRepository.CreateRepositoryInExistingDir(testRoot.Path, _progress);
         var repo = new HgRepository(testRoot.Path, new NullProgress());
         using(var f = testRoot.GetNewTempFile(true))
         {
             repo.AddAndCheckinFile(f.Path);
             var rev = repo.GetRevisionWorkingSetIsBasedOn();
             Assert.AreEqual("0", rev.Number.LocalRevisionNumber);
             Assert.AreEqual(12, rev.Number.Hash.Length);
         }
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:15,代码来源:HgWrappingTests.cs

示例9: NotesFileInOtherHgRepoNotInThisAnnotationrepository

        public void NotesFileInOtherHgRepoNotInThisAnnotationrepository()
        {
            using (var fred = new RepositorySetup("fred"))
            {
                var fredNotesPathname = Path.Combine(fred.ProjectFolder.Path, "fred.ChorusNotes");
                File.WriteAllText(fredNotesPathname, "<notes version='0'><annotation><message/></annotation></notes>");
                fred.Repository.AddAndCheckinFile(fredNotesPathname);

                var sallyRepoPath = Path.Combine(fred.ProjectFolder.Path, "SallyRepo");
                Directory.CreateDirectory(sallyRepoPath);
                var sallyRepo = new HgRepository(sallyRepoPath, new NullProgress());
                sallyRepo.Init();
                var sallyNotesPathname = Path.Combine(sallyRepoPath, "sally.ChorusNotes");
                File.WriteAllText(sallyNotesPathname, "<notes version='0'><annotation><message/></annotation></notes>");
                sallyRepo.AddAndCheckinFile(sallyNotesPathname);

                var annRepositories = AnnotationRepository.CreateRepositoriesFromFolder(fred.ProjectFolder.Path, new NullProgress()).ToList();
                Assert.AreEqual(1, annRepositories.Count);
                Assert.AreEqual("fred.ChorusNotes", Path.GetFileName(annRepositories[0].AnnotationFilePath));
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:21,代码来源:AnnotationRepositoryTests.cs

示例10: RepositoryRecoversFromIncompleteMerge

 public void RepositoryRecoversFromIncompleteMerge()
 {
     using (var tempRepo = new TemporaryFolder("ChorusIncompleteMerge"))
     {
         var baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
     #if MONO
         baseDir = baseDir.Replace(@"file:", null);
     #else
         baseDir = baseDir.Replace(@"file:\", null);
     #endif
         var zipFile = new ZipFile(Path.Combine(baseDir, Path.Combine("VcsDrivers", Path.Combine("TestData", "incompletemergerepo.zip"))));
         zipFile.ExtractAll(tempRepo.Path);
         var hgRepo = new HgRepository(tempRepo.Path, new NullProgress());
         hgRepo.CheckAndUpdateHgrc();
         var parentFile = tempRepo.GetNewTempFile(true);
         File.WriteAllText(parentFile.Path, "New Content");
         var exception = Assert.Throws<ApplicationException>(() => hgRepo.AddAndCheckinFile(parentFile.Path));
         Assert.That(exception.Message.Contains("Unable to recover") && !exception.Message.Contains("unresolved merge"), "Repository should have conflict in retrying the merge, but not have an incomplete merge");
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:20,代码来源:RepositoryTests.cs


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