Пример #1
0
		public void Setup()
		{
			m_temp = new TempDir();
			Directory.CreateDirectory(m_temp.GetPath("CVS"));
			File.WriteAllText(m_temp.GetPath(@"CVS\Repository"), "module");
			m_sandbox = m_temp.Path;
			m_branchMatcher = new InclusionMatcher();
		}
Пример #2
0
		public void GitDir_NotEmpty_NoImportSpecified()
		{
			using (var temp = new TempDir())
			{
				File.WriteAllText(temp.GetPath("file.txt"), "blah");

				var switches = new Switches();
				switches.Parse("--sandbox", Path.GetTempPath(), "--gitdir", temp.Path, "--noimport");
			}
		}
Пример #3
0
		public void Init_CreatesGitFiles()
		{
			using (var temp = new TempDir())
			{
				var git = new GitRepo(m_log, temp.Path);
				git.Init(Enumerable.Empty<GitConfigOption>());

				Assert.IsTrue(Directory.Exists(temp.GetPath("refs")));
				Assert.IsTrue(File.Exists(temp.GetPath("HEAD")));
			}
		}
Пример #4
0
		public void Init_CreatesDirectoryIfItDoesNotExist()
		{
			using (var temp = new TempDir())
			{
				var gitdir = temp.GetPath(@"dir1\dir2");
				var git = new GitRepo(m_log, gitdir);
				git.Init(Enumerable.Empty<GitConfigOption>());

				Assert.IsTrue(Directory.Exists(gitdir));
				Assert.IsTrue(Directory.Exists(temp.GetPath(@"dir1\dir2\refs")));
			}
		}
Пример #5
0
		public void CvsLogFileName_Specified_DoesNotExist()
		{
			using (var temp = new TempDir())
			{
				var logFilename = temp.GetPath("blah.log");
				var switches = new Switches()
				{
					CvsLog = logFilename,
				};
				var config = new Config(switches);

				Assert.AreEqual(logFilename, config.CvsLogFileName);
				Assert.IsTrue(config.CreateCvsLog);
			}
		}
Пример #6
0
		public void CvsLogFileName_Specified_Exists()
		{
			using (var temp = new TempDir())
			{
				var logFilename = temp.GetPath("blah.log");
				File.WriteAllText(logFilename, "blah");
				var switches = new Switches()
				{
					CvsLog = logFilename,
				};
				var config = new Config(switches);

				Assert.AreEqual(logFilename, config.CvsLogFileName);
				Assert.IsFalse(config.CreateCvsLog);
			}
		}
Пример #7
0
		public void Init_Option_Set()
		{
			using (var temp = new TempDir())
			{
				var git = new GitRepo(m_log, temp.Path);
				git.Init(new[] { new GitConfigOption("foo.bar", "blah", add: false) });

				var configFile = temp.GetPath("config");
				var configContents = File.ReadAllLines(configFile);

				var sectionLineNumber = FindSectionHeader(configContents, "foo");
				Assert.IsTrue(sectionLineNumber >= 0);

				Assert.IsTrue(Regex.IsMatch(configContents[sectionLineNumber + 1].Trim(), @"bar\s*=\s*blah"));
			}
		}
Пример #8
0
		public void ConfFile_VerifyNotCalledUntilAllSwitchesProcessed()
		{
			using (var temp = new TempDir())
			{
				var confFileName = temp.GetPath("test.conf");
				File.WriteAllText(confFileName, "noimport\r\n");
				var sandbox = temp.GetPath("sandbox");
				Directory.CreateDirectory(sandbox);

				// specify sandbox directory after the conf file has been processed
				var switches = new Switches();
				switches.Parse("-C", confFileName, "--sandbox", sandbox);

				Assert.IsTrue(switches.NoImport);
				Assert.AreEqual(sandbox, switches.Sandbox);
			}
		}
Пример #9
0
		public void NonAsciiFile()
		{
			using (var temp = new TempDir())
			{
				// write the log file in the default encoding, which is what the CVS log will typically be in
				var cvsLog = temp.GetPath("cvs.log");
				File.WriteAllText(cvsLog, CvsLogParserResources.NonAscii, Encoding.Default);

				var parser = new CvsLogParser(m_sandbox, cvsLog, m_branchMatcher);
				parser.Parse().ToList();
				var file = parser.Files.Single();

				Assert.AreEqual(file.Name, "demo©.xje");
			}
		}
Пример #10
0
		public void MarkerTag_LeftBlank()
		{
			using (var temp = new TempDir())
			{
				var confFileName = temp.GetPath("test.conf");
				File.WriteAllText(confFileName, "import-marker-tag  \"\"\r\n");

				var sandbox = temp.GetPath("sandbox");
				Directory.CreateDirectory(sandbox);

				var switches = new Switches();
				switches.Parse("-C", confFileName, "--sandbox", sandbox);

				Assert.AreEqual(switches.MarkerTag, "");
			}
		}
		public void Setup()
		{
			m_temp = new TempDir();
		}