public void SingleBranch_PlaysInSequence()
		{
			var now = DateTime.Now;
			var file1 = new FileInfo("file1");
			var file2 = new FileInfo("file2").WithBranch("branch", "1.1.0.2");

			var commit0 = new Commit("id0") { Index = 1 }
					.WithRevision(file1, "1.1", time: now)
					.WithRevision(file2, "1.1", time: now);

			var commit1 = new Commit("id1") { Index = 2 }
					.WithRevision(file1, "1.2", time: now + TimeSpan.FromMinutes(2))
					.WithRevision(file2, "1.2", time: now + TimeSpan.FromMinutes(2), mergepoint: "1.1.2.1");

			var commit2 = new Commit("branch0") { Index = 3 }
					.WithRevision(file2, "1.1.2.1", time: now + TimeSpan.FromMinutes(1));

			var commits = new[] { commit0, commit1, commit2 };
			var branchpoints = new Dictionary<string, Commit>()
			{
				{ "branch", commit0 }
			};
			var branches = new BranchStreamCollection(commits, branchpoints);
			commit1.MergeFrom = commit2;

			var player = new CommitPlayer(MockRepository.GenerateStub<ILogger>(), branches);
			var result = player.Play().Select(c => c.CommitId).ToList();

			Assert.IsTrue(result.SequenceEqual("id0", "branch0", "id1"));
		}
Example #2
0
 public Importer(ILogger log, IConfig config, UserMap userMap, BranchStreamCollection branches,
                 IDictionary <string, Commit> tags, Cvs cvs)
 {
     m_log      = log;
     m_config   = config;
     m_userMap  = userMap;
     m_branches = branches;
     m_tags     = tags;
     m_cvs      = cvs;
     m_player   = new CommitPlayer(log, branches);
 }
Example #3
0
		public Importer(ILogger log, IConfig config, UserMap userMap, BranchStreamCollection branches,
				IDictionary<string, Commit> tags, Cvs cvs)
		{
			m_log = log;
			m_config = config;
			m_userMap = userMap;
			m_branches = branches;
			m_tags = tags;
			m_cvs = cvs;
			m_player = new CommitPlayer(log, branches);
		}
		public void NoBranches_PlaysInSequence()
		{
			var file1 = new FileInfo("file1");
			var file2 = new FileInfo("file2");

			var commit0 = new Commit("id0") { Index = 1 }
					.WithRevision(file1, "1.1")
					.WithRevision(file2, "1.1");

			var commit1 = new Commit("id1") { Index = 2 }
					.WithRevision(file1, "1.2");

			var commit2 = new Commit("id2") { Index = 3 }
					.WithRevision(file2, "1.2");

			var commits = new[] { commit0, commit1, commit2 };
			var branches = new BranchStreamCollection(commits, new Dictionary<string, Commit>());

			var player = new CommitPlayer(MockRepository.GenerateStub<ILogger>(), branches);
			var result = player.Play().ToList();

			Assert.IsTrue(result.SequenceEqual(commits));
		}
		public void NestedBranches_Merges_OutOfOrder()
		{
			var now = DateTime.Now;
			var commits = CreateNestedBranches(true);
			var branchpoints = new Dictionary<string, Commit>()
			{
				{ "branch0", commits[0] },
				{ "branch1", commits[2] }
			};
			var branches = new BranchStreamCollection(commits, branchpoints);

			var player = new CommitPlayer(MockRepository.GenerateStub<ILogger>(), branches);
			var result = player.Play().Select(c => c.CommitId).ToList();

			Assert.IsTrue(result.SequenceEqual(new[] { "id0", "branch0_0", "branch1_0", "branch0_1", "id1" }));
		}