本文整理汇总了C#中LibChorus.TestUtilities.RepositorySetup.AddAndCheckIn方法的典型用法代码示例。如果您正苦于以下问题:C# RepositorySetup.AddAndCheckIn方法的具体用法?C# RepositorySetup.AddAndCheckIn怎么用?C# RepositorySetup.AddAndCheckIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibChorus.TestUtilities.RepositorySetup
的用法示例。
在下文中一共展示了RepositorySetup.AddAndCheckIn方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExcludedVideosFileNotAdded
public void ExcludedVideosFileNotAdded()
{
using (var setup = new RepositorySetup("Dan"))
{
var atRoot = setup.ProjectFolder.Combine("first.wmv");
File.WriteAllText(atRoot, "hello");
var pictures = setup.ProjectFolder.Combine("pictures");
Directory.CreateDirectory(pictures);
var videoExtensions = ProjectFolderConfiguration.VideoExtensions.ToList();
foreach (var videoExtension in videoExtensions)
{
var bad = Path.Combine(pictures, "nested." + videoExtension);
File.WriteAllText(bad, "hello");
}
setup.ProjectFolderConfig.ExcludePatterns.Clear();
setup.ProjectFolderConfig.IncludePatterns.Clear();
LiftFolder.AddLiftFileInfoToFolderConfiguration(setup.ProjectFolderConfig);
setup.AddAndCheckIn();
setup.AssertFileDoesNotExistInRepository("first.wmv");
foreach (var videoExtension in videoExtensions)
setup.AssertFileDoesNotExistInRepository("pictures/nested." + videoExtension);
}
}
示例2: IncludeAllButExcludeOne_FileNotAdded
public void IncludeAllButExcludeOne_FileNotAdded()
{
using (var setup = new RepositorySetup("Dan"))
{
var path = setup.ProjectFolder.Combine("test.1w1");
File.WriteAllText(path, "hello");
setup.ProjectFolderConfig.IncludePatterns.Clear();
setup.ProjectFolderConfig.IncludePatterns.Add("*.*");
setup.ProjectFolderConfig.ExcludePatterns.Clear();
setup.ProjectFolderConfig.ExcludePatterns.Add("*.1w1");
setup.AddAndCheckIn();
setup.AssertFileDoesNotExistInRepository("test.1w1");
}
}
示例3: AddUtf8FileName_CloneUpdatedFileExists
public void AddUtf8FileName_CloneUpdatedFileExists()
{
using (var setup = new RepositorySetup("Dan"))
{
const string utf8FilePath = "açesbsun.wav";
setup.ChangeFile(utf8FilePath, "hello");
setup.ProjectFolderConfig.IncludePatterns.Add("*.wav");
setup.AddAndCheckIn();
using (var other = new RepositorySetup("Bob", setup))
{
other.AssertFileExists(utf8FilePath);
}
}
}
示例4: ChangedUtf8File_FileCanBePulledAndUpdated
public void ChangedUtf8File_FileCanBePulledAndUpdated()
{
using (var setup = new RepositorySetup("Dan"))
{
const string utf8FilePath = "açesbsun.wav";
setup.ChangeFile(utf8FilePath, "hello1");
setup.ProjectFolderConfig.IncludePatterns.Add("*.wav");
setup.AddAndCheckIn();
using (var other = new RepositorySetup("Bob", setup))
{
setup.ChangeFile(utf8FilePath, "hello2");
setup.Repository.Commit(false, "update");
other.CheckinAndPullAndMerge(setup); // Fix: Currently this modifies Dan adding bogus file unexpectedly.
other.AssertFileExists(utf8FilePath);
string[] fileNames = Directory.GetFiles(other.ProjectFolder.Path, "*.wav");
Assert.AreEqual(1, fileNames.Length);
}
}
}
示例5: EnsureRepoIdIsCorrect
public void EnsureRepoIdIsCorrect()
{
using (var setup = new RepositorySetup("Dan"))
{
var id = setup.Repository.Identifier;
Assert.IsTrue(String.IsNullOrEmpty(id));
var path = setup.ProjectFolder.Combine("test.1w1");
File.WriteAllText(path, "hello");
setup.ProjectFolderConfig.IncludePatterns.Clear();
setup.ProjectFolderConfig.ExcludePatterns.Clear();
setup.ProjectFolderConfig.IncludePatterns.Add("*.1w1");
setup.AddAndCheckIn(); // Need to have one commit.
id = setup.Repository.Identifier;
Assert.IsFalse(String.IsNullOrEmpty(id));
var results = HgRunner.Run("log -r0 --template " + "\"{node}\"", setup.Repository.PathToRepo, 10, setup.Progress);
// This will probably fail, if some other version of Hg is used,
// as it may include multiple lines (complaining about deprecated extension Chorus uses),
// where the last one will be the id.
Assert.AreEqual(results.StandardOutput.Trim(), id);
}
}
示例6: Utf8ExtensionPresent_LocalMercurialIniIncorrect_MercurialOpStillWorks
public void Utf8ExtensionPresent_LocalMercurialIniIncorrect_MercurialOpStillWorks()
{
using (new MercurialIniHider())
using (var setup = new RepositorySetup("Dan"))
{
const string utf8FilePath = "açesbsun.wav";
setup.ChangeFile(utf8FilePath, "hello1");
setup.ProjectFolderConfig.IncludePatterns.Add("*.wav");
setup.AddAndCheckIn();
setup.AssertFileExistsInRepository("açesbsun.wav");
}
}
示例7: Utf8ExtensionPresent_CloneLocalWithUpdateDoesNotHaveBogusFiles
public void Utf8ExtensionPresent_CloneLocalWithUpdateDoesNotHaveBogusFiles()
{
using (var setup = new RepositorySetup("Dan"))
{
const string utf8FilePath = "açesbsun.wav";
setup.ChangeFile(utf8FilePath, "hello1");
setup.ProjectFolderConfig.IncludePatterns.Add("*.wav");
setup.AddAndCheckIn();
using (var other = new RepositorySetup("Bob", false))
{
setup.Repository.CloneLocalWithoutUpdate(other.ProjectFolder.Path); // Somewhat surprisingly this works as it is using the settings of the source hgrc during the clone
other.Repository.Update();
other.AssertFileExists(utf8FilePath);
string[] fileNames = Directory.GetFiles(other.ProjectFolder.Path, "*.wav");
Assert.AreEqual(1, fileNames.Length);
//Assert.IsTrue(setup.GetProgressString().Contains());
}
}
}
示例8: Utf8ExtensionPresent_CloneDoesNotHaveBogusFiles
public void Utf8ExtensionPresent_CloneDoesNotHaveBogusFiles()
{
using (var setup = new RepositorySetup("Dan"))
{
const string utf8FilePath = "açesbsun.wav";
setup.ChangeFile(utf8FilePath, "hello1");
setup.ProjectFolderConfig.IncludePatterns.Add("*.wav");
setup.AddAndCheckIn();
using (var other = new RepositorySetup("Bob", false))
{
//var uri = new Uri(String.Format("file:///{0}", setup.ProjectFolder.Path));
HgRepository.Clone(new HttpRepositoryPath("utf test repo", setup.ProjectFolder.Path, false), other.ProjectFolder.Path, other.Progress);
other.Repository.Update();
other.AssertFileExists(utf8FilePath);
string[] fileNames = Directory.GetFiles(other.ProjectFolder.Path, "*.wav");
Assert.AreEqual(1, fileNames.Length);
//Assert.IsTrue(setup.GetProgressString().Contains());
}
}
}
示例9: MakeListItemWhenRepoInUse_MakesDisabledItem
public void MakeListItemWhenRepoInUse_MakesDisabledItem()
{
using (var setup = new RepositorySetup("Dan"))
{
// Set a project up sufficiently to have an ID.
var tempFilePath = setup.ProjectFolder.Combine("test.1w1");
File.WriteAllText(tempFilePath, "hello");
setup.ProjectFolderConfig.IncludePatterns.Clear();
setup.ProjectFolderConfig.ExcludePatterns.Clear();
setup.ProjectFolderConfig.IncludePatterns.Add("*.1w1");
setup.AddAndCheckIn(); // Need to have one commit.
var id = setup.Repository.Identifier;
var path = setup.Repository.PathToRepo;
var model = new CloneFromUsb();
model.ReposInUse = new Dictionary<string, string>();
model.ReposInUse[id] = "myname";
var item = model.CreateListItemFor(path);
Assert.That(item, Is.Not.Null, "model should have made a list item");
Assert.That(item.Text, Is.EqualTo(Path.GetFileName(path)));
Assert.That(item.Tag, Is.EqualTo(path));
var last = File.GetLastWriteTime(path);
string expectedSubitem = last.ToShortDateString() + " " + last.ToShortTimeString();
// Not a great test, basically duplicates the impl
Assert.That(item.SubItems[1].Text, Is.EqualTo(expectedSubitem));
Assert.That(item.ToolTipText, Is.EqualTo(string.Format(CloneFromUsb.ProjectInUseTemplate, "myname")));
Assert.That(item.ImageIndex, Is.EqualTo(1));
Assert.That(item.ForeColor, Is.EqualTo(CloneFromUsb.DisabledItemForeColor));
}
}
示例10: IncludeFilesInSubFolders
public void IncludeFilesInSubFolders()
{
using (var setup = new RepositorySetup("Dan"))
{
var subpictures = setup.ProjectFolder.Combine("pictures", "subpictures");
Directory.CreateDirectory(subpictures);
var goodpicture = setup.ProjectFolder.Combine(subpictures, "good.picture");
File.WriteAllText(goodpicture, "hello"); // Not a real jpeg file
var subaudio = setup.ProjectFolder.Combine("audio", "subaudio");
Directory.CreateDirectory(subaudio);
var goodaudio = setup.ProjectFolder.Combine(subaudio, "good.audio");
File.WriteAllText(goodaudio, "hello"); // Not a real mp3 file
var subothers = setup.ProjectFolder.Combine("others", "subothers");
Directory.CreateDirectory(subothers);
var goodother = setup.ProjectFolder.Combine(subothers, "good.other");
File.WriteAllText(goodother, "hello");
setup.ProjectFolderConfig.ExcludePatterns.Clear();
setup.ProjectFolderConfig.IncludePatterns.Clear();
LiftFolder.AddLiftFileInfoToFolderConfiguration(setup.ProjectFolderConfig);
setup.AddAndCheckIn();
setup.AssertFileExistsInRepository("pictures/subpictures/good.picture");
setup.AssertFileExistsInRepository("audio/subaudio/good.audio");
setup.AssertFileExistsInRepository("others/subothers/good.other");
}
}
示例11: WavFileInRepoEvenWhenExcluded
public void WavFileInRepoEvenWhenExcluded()
{
using (var setup = new RepositorySetup("Dan"))
{
var path = setup.ProjectFolder.Combine("test.wav");
File.WriteAllText(path, "hello");
setup.ProjectFolderConfig.IncludePatterns.Clear();
setup.ProjectFolderConfig.IncludePatterns.Add("*.*");
setup.ProjectFolderConfig.ExcludePatterns.Clear();
setup.ProjectFolderConfig.ExcludePatterns.Add("test.wav");
setup.AddAndCheckIn();
// TODO: If Hg is fixed to exclude "wav" files,
// revise this test to assert it is *not* in repo.
// Very important: Also fix the "wav" extension hacks in LargeFileFilter AND AudioFileTypeHandlerTests
setup.AssertFileExistsInRepository("test.wav");
}
}
示例12: StarDotExtensionPatternSpecified_FileAdded
public void StarDotExtensionPatternSpecified_FileAdded()
{
using (var setup = new RepositorySetup("Dan"))
{
var path = setup.ProjectFolder.Combine("test.1w1");
File.WriteAllText(path, "hello");
setup.ProjectFolderConfig.IncludePatterns.Clear();
setup.ProjectFolderConfig.IncludePatterns.Add("*.1w1");
setup.ProjectFolderConfig.ExcludePatterns.Clear();
setup.AddAndCheckIn();
setup.AssertFileExistsInRepository("test.1w1");
}
}
示例13: IncludeInGeneralButExcludeInSubfolder_FileNotAdded
public void IncludeInGeneralButExcludeInSubfolder_FileNotAdded()
{
using (var setup = new RepositorySetup("Dan"))
{
var good = setup.ProjectFolder.Combine("good.lift");
File.WriteAllText(good, "hello");
var export = setup.ProjectFolder.Combine("export");
Directory.CreateDirectory(export);
var bad = Path.Combine(export, "bad.lift");
File.WriteAllText(bad, "hello");
var goodFontCss = Path.Combine(export, "customFonts.css");
File.WriteAllText(goodFontCss, "hello");
var goodLayoutCss = Path.Combine(export, "customLayout.css");
File.WriteAllText(goodLayoutCss, "hello");
var other = setup.ProjectFolder.Combine("other");
Directory.CreateDirectory(other);
var otherBad = Path.Combine(export, "otherBad.lift");
File.WriteAllText(otherBad, "hello");
setup.ProjectFolderConfig.ExcludePatterns.Clear();
setup.ProjectFolderConfig.IncludePatterns.Clear();
LiftFolder.AddLiftFileInfoToFolderConfiguration(setup.ProjectFolderConfig);
setup.AddAndCheckIn();
setup.AssertFileExistsInRepository("good.lift");
setup.AssertFileExistsInRepository("export/customFonts.css");
setup.AssertFileExistsInRepository("export/customLayout.css");
setup.AssertFileDoesNotExistInRepository("export/bad.lift");
setup.AssertFileDoesNotExistInRepository("other/otherBad.lift");
}
}
示例14: Utf8ExtensionNotPresent_CloneLocalWithoutUpdateThrows
#if !MONO
[Test]
public void Utf8ExtensionNotPresent_CloneLocalWithoutUpdateThrows()
{
using (var setup = new RepositorySetup("Dan"))
{
const string utf8FilePath = "açesbsun.wav";
setup.ChangeFile(utf8FilePath, "hello1");
setup.ProjectFolderConfig.IncludePatterns.Add("*.wav");
setup.AddAndCheckIn();
using (new MercurialExtensionHider())
using (var other = new RepositorySetup("Bob", false))
{
Assert.Throws<ApplicationException>(
() => setup.Repository.CloneLocalWithoutUpdate(other.ProjectFolder.Path)
);
//string log = setup.GetProgressString();
//Assert.That(log, Contains.Substring("Failed to set up extensions"));
//Assert.IsTrue(setup.GetProgressString().Contains());
}