本文整理汇总了C#中LibChorus.TestUtilities.RepositorySetup.ChangeFileAndCommit方法的典型用法代码示例。如果您正苦于以下问题:C# RepositorySetup.ChangeFileAndCommit方法的具体用法?C# RepositorySetup.ChangeFileAndCommit怎么用?C# RepositorySetup.ChangeFileAndCommit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibChorus.TestUtilities.RepositorySetup
的用法示例。
在下文中一共展示了RepositorySetup.ChangeFileAndCommit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Find2WayDifferencesShouldReportOneChangeNoMatterHowManyWereMade
public void Find2WayDifferencesShouldReportOneChangeNoMatterHowManyWereMade()
{
// There are actually more than one change, but we don't fret about that at this point.
const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<ProjectLexiconSettings>
</ProjectLexiconSettings>";
const string child =
@"<?xml version='1.0' encoding='utf-8'?>
<ProjectLexiconSettings>
<WritingSystems addToSldr='true' />
</ProjectLexiconSettings>";
using (var repositorySetup = new RepositorySetup("randy-" + Guid.NewGuid()))
{
repositorySetup.AddAndCheckinFile("some.plsx", parent);
repositorySetup.ChangeFileAndCommit("some.plsx", child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = _projectLexiconSettingsFileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository);
Assert.AreEqual(1, result.Count());
Assert.AreEqual("Edited", result.First().ActionLabel);
}
}
示例2: Find2WayDifferencesShouldReportOneChangeNoMatterHowManyWereMade
public void Find2WayDifferencesShouldReportOneChangeNoMatterHowManyWereMade()
{
// There are actually more than one change, but we don't fret about that at this point.
const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<ldml>
<special xmlns:palaso='urn://palaso.org/ldmlExtensions/v1' />
</ldml>";
const string child =
@"<?xml version='1.0' encoding='utf-8'?>
<ldml>
<identity />
<special xmlns:fw='urn://fieldworks.sil.org/ldmlExtensions/v1' />
<special xmlns:palaso='urn://palaso.org/ldmlExtensions/v1' />
</ldml>";
using (var repositorySetup = new RepositorySetup("randy-" + Guid.NewGuid()))
{
repositorySetup.AddAndCheckinFile("some.ldml", parent);
repositorySetup.ChangeFileAndCommit("some.ldml", child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = _ldmlFileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository);
Assert.AreEqual(1, result.Count());
Assert.AreEqual("Edited", result.First().ActionLabel);
}
}
示例3: SampleDiff
public void SampleDiff()
{
const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<ImportSettings>
<ScrImportSet guid='0a0be0c1-39c4-44d4-842e-231680c7cd56' >
<ImportType val='2' />
</ScrImportSet>
</ImportSettings>";
var child = parent.Replace("val='2'", "val='3'");
using (var repositorySetup = new RepositorySetup("randy"))
{
repositorySetup.AddAndCheckinFile(SharedConstants.ImportSettingsFilename, parent);
repositorySetup.ChangeFileAndCommit(SharedConstants.ImportSettingsFilename, child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
Assert.AreEqual(1, result.Count);
var onlyReport = result[0];
Assert.IsInstanceOf<XmlChangedRecordReport>(onlyReport);
Assert.AreEqual(firstFiR.FullPath, onlyReport.PathToFile);
}
}
示例4: SampleDiff
public void SampleDiff()
{
const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<TranslatedScripture>
<Scripture guid='06425922-3258-4094-a9ec-3c2fe5b52b39'>
<VerseSepr>
<Uni>,</Uni>
</VerseSepr>
</Scripture>
</TranslatedScripture>";
var child = parent.Replace("<Uni>,</Uni>", "<Uni>+</Uni>");
using (var repositorySetup = new RepositorySetup("randy"))
{
repositorySetup.AddAndCheckinFile(SharedConstants.ScriptureTransFilename, parent);
repositorySetup.ChangeFileAndCommit(SharedConstants.ScriptureTransFilename, child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
Assert.AreEqual(1, result.Count);
var onlyReport = result[0];
Assert.IsInstanceOf<XmlChangedRecordReport>(onlyReport);
Assert.AreEqual(firstFiR.FullPath, onlyReport.PathToFile);
}
}
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:33,代码来源:FieldWorksScriptureTranslationTypeHandlerTests.cs
示例5: SampleDiff
public void SampleDiff()
{
const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<LayoutInventory>
<layout class='CmLocation' type='jtview' name='publishStemLocation#Stem-612' version='19'>
<generate class='LexExampleSentence' fieldType='mlstring' restrictions='customOnly' />
</layout>
</LayoutInventory>";
var child = parent.Replace("19", "20");
using (var repositorySetup = new RepositorySetup("randy"))
{
repositorySetup.AddAndCheckinFile("Sample." + SharedConstants.fwlayout, parent);
repositorySetup.ChangeFileAndCommit("Sample." + SharedConstants.fwlayout, child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
Assert.AreEqual(1, result.Count);
var onlyReport = result[0];
Assert.IsInstanceOf<XmlChangedRecordReport>(onlyReport);
Assert.AreEqual(firstFiR.FullPath, onlyReport.PathToFile);
}
}
示例6: SynchNow_OnNamedBranchAndDefaultBranchExists_DoesNotMergeWithIt
public void SynchNow_OnNamedBranchAndDefaultBranchExists_DoesNotMergeWithIt()
{
using (var repo = new RepositorySetup("bob"))
{
if (repo.Synchronizer == null)
repo.Synchronizer = repo.CreateSynchronizer();
repo.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct("default");
repo.AddAndCheckinFile("test.txt", "apple");
var afterFirstCheckin = repo.CreateBookmarkHere();
repo.ChangeFileAndCommit("test.txt", "pear", "second on default");
afterFirstCheckin.Go();
repo.Repository.BranchingHelper.Branch(new ConsoleProgress(), "animals");
repo.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct("animals");
repo.ChangeFileAndCommit("test.txt", "dog", "first on animals");
var animalHead = repo.CreateBookmarkHere();
repo.AssertHeadCount(2);
repo.CheckinAndPullAndMerge();
repo.AssertHeadCount(2);
animalHead.AssertRepoIsAtThisPoint();
}
}
示例7: SynchNow_OnDefaultBranchAndAnotherBranchExists_DoesNotMergeWithIt
public void SynchNow_OnDefaultBranchAndAnotherBranchExists_DoesNotMergeWithIt()
{
using (var repo = new RepositorySetup("bob"))
{
repo.AddAndCheckinFile("test.txt", "hello");
repo.AssertHeadCount(1);
repo.ChangeFileOnNamedBranchAndComeBack("test.txt", "blah", "mybranch");
//NB: this used to pass prior to hg 1.5, but, well, it shouldn't!
// Shouldn't there be two heads after the branch, above? (jh, April 2010)
// repo.AssertHeadCount(1);
repo.ChangeFileAndCommit("test.txt", "hello there", "second");
repo.AssertHeadCount(2);
repo.CheckinAndPullAndMerge();
repo.AssertHeadCount(2);
}
}
示例8: DeletionReport_Not_ProducedForDeletedAnnotationUsingNotesHandler
public void DeletionReport_Not_ProducedForDeletedAnnotationUsingNotesHandler()
{
const string parent = @"<?xml version='1.0' encoding='utf-8'?>
<notes version='0'>
<annotation guid='old1'/>
<annotation guid='soonToBeGoner'/>
</notes>";
const string child = @"<?xml version='1.0' encoding='utf-8'?>
<notes version='0'>
<annotation guid='old1'/>
</notes>";
// Make sure the common differ code does produce the deletion report.
using (var parentTempFile = new TempFile(parent))
using (var childTempFile = new TempFile(child))
{
var listener = new ListenerForUnitTests();
var differ = Xml2WayDiffer.CreateFromFiles(parentTempFile.Path, childTempFile.Path,
listener,
null,
"annotation",
"guid");
differ.ReportDifferencesToListener();
listener.AssertExpectedChangesCount(1);
listener.AssertFirstChangeType<XmlDeletionChangeReport>();
}
// Now make sure the ChorusNotesFileHandler filters it out, and does not return it,
// as per the original notes differ code.
var notesHandler = (from handler in ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers
where handler.GetType().Name == "ChorusNotesFileHandler"
select handler).First();
using (var repositorySetup = new RepositorySetup("randy"))
{
repositorySetup.AddAndCheckinFile("notestest.ChorusNotes", parent);
repositorySetup.ChangeFileAndCommit("notestest.ChorusNotes", child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = notesHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository);
Assert.AreEqual(0, result.Count());
}
}
示例9: Find2WayDifferencesShouldReportOneChangeEvenWhenNoneArePresent
public void Find2WayDifferencesShouldReportOneChangeEvenWhenNoneArePresent()
{
// One 'change' reported, even for the exact same file.
const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<ProjectLexiconSettings>
</ProjectLexiconSettings>";
using (var repositorySetup = new RepositorySetup("randy-" + Guid.NewGuid()))
{
repositorySetup.AddAndCheckinFile("some.plsx", parent);
repositorySetup.ChangeFileAndCommit("some.plsx", parent, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var result = _projectLexiconSettingsFileHandler.Find2WayDifferences(firstFiR, firstFiR, hgRepository);
Assert.AreEqual(1, result.Count());
Assert.AreEqual("Edited", result.First().ActionLabel);
}
}
示例10: SampleDiff
public void SampleDiff()
{
const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<ReferenceSystem>
<ScrRefSystem guid='0a0be0c1-39c4-44d4-842e-231680c7cd56' >
<Books>
<ScrBookRef guid='51caa4a0-8cd1-4c66-acac-7daead917510'>
<BookName>
<AUni ws='en'>Genesis</AUni>
</BookName>
</ScrBookRef>
</Books>
</ScrRefSystem>
</ReferenceSystem>";
var child = parent.Replace("Genesis", "Startup");
using (var repositorySetup = new RepositorySetup("randy"))
{
repositorySetup.AddAndCheckinFile(SharedConstants.ScriptureReferenceSystemFilename, parent);
repositorySetup.ChangeFileAndCommit(SharedConstants.ScriptureReferenceSystemFilename, child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
Assert.AreEqual(1, result.Count);
var onlyReport = result[0];
Assert.IsInstanceOf<XmlChangedRecordReport>(onlyReport);
Assert.AreEqual(firstFiR.FullPath, onlyReport.PathToFile);
}
}
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:37,代码来源:FieldWorksScriptureReferenceSystemTypeHandlerTests.cs
示例11: FileDeletedRemotelyAndChangedLocallyKeepsChanged
public void FileDeletedRemotelyAndChangedLocallyKeepsChanged()
{
using(var localRepo = new RepositorySetup("unbundleTests"))
{
var localFilePath = localRepo.ProjectFolder.GetNewTempFile(true).Path;
localRepo.AddAndCheckinFile(localFilePath, "file to change and delete");
using(var remoteRepo = new RepositorySetup("remote", localRepo))
{
remoteRepo.CheckinAndPullAndMerge();
var remoteFilePath = Path.Combine(remoteRepo.ProjectFolder.Path, Path.GetFileName(localFilePath));
remoteRepo.ChangeFileAndCommit(remoteFilePath, "new contents", "changed file");
File.Delete(localFilePath);
localRepo.SyncWithOptions(new SyncOptions { CheckinDescription = "delete file", DoMergeWithOthers = false, DoPullFromOthers = false, DoSendToOthers = false });
localRepo.CheckinAndPullAndMerge(remoteRepo);
Assert.That(File.Exists(localFilePath), Is.True, "Did not keep changed file.");
var chorusNotesPath = localFilePath + ".ChorusNotes";
Assert.That(File.Exists(chorusNotesPath), "Did not record conflict");
AssertThatXmlIn.File(chorusNotesPath).HasAtLeastOneMatchForXpath("//annotation[@class='mergeconflict']");
}
}
}
示例12: Find2WayDifferencesShouldReportOneChange
public void Find2WayDifferencesShouldReportOneChange()
{
const string parent = "{\"modelversion\": 7000000}";
// One change.
const string child = "{\"modelversion\": 7000002}";
using (var repositorySetup = new RepositorySetup("randy"))
{
repositorySetup.AddAndCheckinFile("FLExProject.ModelVersion", parent);
repositorySetup.ChangeFileAndCommit("FLExProject.ModelVersion", child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
Assert.AreEqual(1, result.Count);
Assert.IsInstanceOf(typeof(FieldWorksModelVersionUpdatedReport), result[0]);
}
}
示例13: Find2WayDifferencesShouldReportThreeChanges
public void Find2WayDifferencesShouldReportThreeChanges()
{
const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<AdditionalFields>
<CustomField class='WfiWordform' key='WfiWordformCertified' name='Certified' type='Boolean' />
<CustomField class='WfiWordform' key='WfiWordformGoner' name='Goner' type='Boolean' />
<CustomField class='WfiWordform' key='WfiWordformDirtball' name='Dirtball' type='Boolean' />
</AdditionalFields>";
// One deletion, one change, and one insertion, and one unchanged.
const string child =
@"<?xml version='1.0' encoding='utf-8'?>
<AdditionalFields>
<CustomField class='WfiWordform' key='WfiWordformCertified' name='Certified' type='Boolean' />
<CustomField class='WfiWordform' key='WfiWordformDirtball' name='Dirtball' type='Integer' />
<CustomField class='WfiWordform' key='WfiWordformNewby' name='Newby' type='Boolean' />
</AdditionalFields>";
using (var repositorySetup = new RepositorySetup("randy"))
{
repositorySetup.AddAndCheckinFile(SharedConstants.CustomPropertiesFilename, parent);
repositorySetup.ChangeFileAndCommit(SharedConstants.CustomPropertiesFilename, child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
Assert.AreEqual(3, result.Count);
}
}
示例14: SampleDiff
public void SampleDiff()
{
const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<Lexicon>
<header>
<LexDb guid='06425922-3258-4094-a9ec-3c2fe5b52b39' >
<Introduction>
<StText guid='45b78bcf-2400-48d5-a9c1-973447d36d4e'>
<DateModified val='2011-2-2 19:39:28.829' />
<Paragraphs>
<ownseq class='StTxtPara' guid='9edbb6e1-2bdd-481c-b84d-26c69f22856c'>
<ParseIsCurrent val='False' />
</ownseq>
</Paragraphs>
</StText>
</Introduction>
</LexDb>
</header>
<LexEntry guid='016f2759-ed12-42a5-abcb-7fe3f53d05b0' />
</Lexicon>";
var child = parent.Replace("False", "True");
using (var repositorySetup = new RepositorySetup("randy"))
{
repositorySetup.AddAndCheckinFile(string.Format("{0}_01.{1}", SharedConstants.Lexicon, SharedConstants.Lexdb), parent);
repositorySetup.ChangeFileAndCommit(string.Format("{0}_01.{1}", SharedConstants.Lexicon, SharedConstants.Lexdb), child, "change it");
var hgRepository = repositorySetup.Repository;
var allRevisions = (from rev in hgRepository.GetAllRevisions()
orderby rev.Number.LocalRevisionNumber
select rev).ToList();
var first = allRevisions[0];
var second = allRevisions[1];
var firstFiR = hgRepository.GetFilesInRevision(first).First();
var secondFiR = hgRepository.GetFilesInRevision(second).First();
var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
Assert.AreEqual(1, result.Count);
var onlyReport = result[0];
Assert.IsInstanceOf<XmlChangedRecordReport>(onlyReport);
Assert.AreEqual(firstFiR.FullPath, onlyReport.PathToFile);
}
}
示例15: Sync_ExistingRejectChangeSet_NotMergedIn
public void Sync_ExistingRejectChangeSet_NotMergedIn()
{
using (var bob = new RepositorySetup("bob"))
{
bob.AddAndCheckinFile("test.txt", "original");
bob.CreateRejectForkAndComeBack();
bob.ChangeFileAndCommit("test.txt", "ok", "goodGuy"); //move on so we have two distinct branches
bob.AssertHeadCount(2);
bob.CheckinAndPullAndMerge(null);
Assert.AreEqual("goodGuy", bob.Repository.GetRevisionWorkingSetIsBasedOn().Summary);
bob.AssertLocalRevisionNumber(3);
bob.AssertHeadCount(2);
}
}