public void DirectlyPrecedes_NonConsecutiveBranchRevisions() { var r1 = Revision.Create("1.3.4.5"); var r2 = Revision.Create("1.3.4.7"); Assert.IsFalse(r1.DirectlyPrecedes(r2)); Assert.IsFalse(r2.DirectlyPrecedes(r1)); }
public void DirectlyPrecedes_DifferentBranches() { var r1 = Revision.Create("1.3.4.5"); var r2 = Revision.Create("1.3.6.6"); Assert.IsFalse(r1.DirectlyPrecedes(r2)); Assert.IsFalse(r2.DirectlyPrecedes(r1)); }
public void GetTagsForRevision_RevisionTagged() { var file = new FileInfo("file.txt").WithTag("tag", "1.1"); var tags = file.GetTagsForRevision(Revision.Create("1.1")); Assert.AreEqual(tags.Single(), "tag"); }
public void DirectlyPrecedes_NonConsecutiveTrunkRevisions() { var r1 = Revision.Create("1.1"); var r2 = Revision.Create("1.3"); Assert.IsFalse(r1.DirectlyPrecedes(r2)); Assert.IsFalse(r2.DirectlyPrecedes(r1)); }
public void DirectlyPrecedes_ConsecutiveBranchRevisions() { var r1 = Revision.Create("1.1.2.5"); var r2 = Revision.Create("1.1.2.6"); Assert.IsTrue(r1.DirectlyPrecedes(r2)); Assert.IsFalse(r2.DirectlyPrecedes(r1)); }
public void GetBranchesAtRevision_Branchpoint_ReturnsMultipleBranch() { var file = new FileInfo("file.txt") .WithBranch("branch1", "1.4.0.2") .WithBranch("branch2", "1.4.0.4"); Assert.IsTrue(file.GetBranchesAtRevision(Revision.Create("1.4")).OrderBy(i => i).SequenceEqual("branch1", "branch2")); }
public void GetRevisionForTag_TagExists() { var file = new FileInfo("file.txt").WithTag("tag", "1.1"); var r = file.GetRevisionForTag("tag"); Assert.AreEqual(r, Revision.Create("1.1")); }
public void DirectlyPrecedes_Branchpoint() { var r1 = Revision.Create("1.3"); var r2 = Revision.Create("1.3.4.1"); Assert.IsTrue(r1.DirectlyPrecedes(r2)); Assert.IsFalse(r2.DirectlyPrecedes(r1)); }
public void GetCommit_RevisionExists() { var file = new FileInfo("file.txt"); var commit = new Commit("abc").WithRevision(file, "1.1"); var result = file.GetCommit(Revision.Create("1.1")); Assert.AreSame(result, commit); }
public void IsRevisionOnBranch_BranchFromBranch_NotOnBranch() { var file = new FileInfo("file.txt") .WithBranch("branch1", "1.1.0.2") .WithBranch("branch2", "1.4.0.2") .WithBranch("branch3", "1.4.2.1.0.2"); // branch from branch2 Assert.IsFalse(file.IsRevisionOnBranch(Revision.Create("1.1.2.1"), "branch3")); }
public void Mergepoint() { var parser = CreateParser(CvsLogParserResources.Mergepoint); var revisions = parser.Parse().ToList(); var rev = revisions.First(r => r.Revision == Revision.Create("1.2")); Assert.AreEqual(rev.Mergepoint, Revision.Create("1.1.2.1")); }
public static Commit WithRevision(this Commit commit, FileInfo file, string revision, DateTime time = default(DateTime), string mergepoint = null, bool isDead = false) { var mergepointRevision = (mergepoint == null) ? Revision.Empty : Revision.Create(mergepoint); var fileRevision = file.CreateRevision(revision, commit.CommitId, time: time, mergepoint: mergepoint, isDead: isDead); commit.Add(fileRevision); file.AddCommit(commit, fileRevision.Revision); return(commit); }
public void ExcludeBranches() { m_branchMatcher.AddExcludeRule(@"^branch2"); m_branchMatcher.AddIncludeRule(@"^branch1"); var parser = CreateParser(CvsLogParserResources.Branches); parser.Parse().ToList(); var file = parser.Files.Single(); Assert.AreEqual(file.GetBranchpointForBranch("branch1"), Revision.Create("1.1")); Assert.AreEqual(file.GetBranchpointForBranch("branch2"), Revision.Empty); Assert.AreEqual(parser.ExcludedBranches.Single(), "branch2"); }
/// <summary> /// Create a FileRevision for a file. /// </summary> public static FileRevision CreateRevision(this FileInfo file, string revision, string commitId, DateTime time, string author = "fred", string mergepoint = null, bool isDead = false) { var mergepointRevision = (mergepoint == null) ? Revision.Empty : Revision.Create(mergepoint); return(new FileRevision( file, commitId: commitId, revision: Revision.Create(revision), mergepoint: mergepointRevision, isDead: isDead, time: (time == default(DateTime)) ? DateTime.Now : time, author: author)); }
public static void getBestBlock(string[] args) { Block block = null; if (args != null && args.Length > 2) { var revision = Revision.Create(long.Parse(args[2])); block = BlockClient.GetBlock(revision); } else { block = BlockClient.GetBlock(Revision.BEST); } WriteLine("Block:"); WriteLine(JsonConvert.SerializeObject(block)); }
public void GetCvsRevision_CallsUnderlyingIfFileMissing() { var f = new FileRevision(new FileInfo("file.txt"), Revision.Create("1.1"), mergepoint: Revision.Empty, time: DateTime.Now, author: "fred", commitId: "c1"); var repo = MockRepository.GenerateMock <ICvsRepository>(); repo.Expect(r => r.GetCvsRevision(f)).Return(new FileContent("file.txt", FileContentData.Empty)); var cache = new CvsRepositoryCache(m_temp.Path, repo); cache.GetCvsRevision(f); repo.VerifyAllExpectations(); }
public void IsRevisionOnBranch_ManyBranches() { var file = new FileInfo("file.txt") .WithBranch("branch1", "1.4.0.2") .WithBranch("branch2", "1.4.2.3.0.2") .WithBranch("branch3", "1.4.2.3.2.1.0.6"); Assert.IsTrue(file.IsRevisionOnBranch(Revision.Create("1.3"), "branch3")); Assert.IsTrue(file.IsRevisionOnBranch(Revision.Create("1.4"), "branch3")); Assert.IsTrue(file.IsRevisionOnBranch(Revision.Create("1.4.2.2"), "branch3")); Assert.IsTrue(file.IsRevisionOnBranch(Revision.Create("1.4.2.3"), "branch3")); Assert.IsFalse(file.IsRevisionOnBranch(Revision.Create("1.4.2.4"), "branch3")); Assert.IsFalse(file.IsRevisionOnBranch(Revision.Create("1.4.4.1"), "branch3")); Assert.IsTrue(file.IsRevisionOnBranch(Revision.Create("1.4.2.3.2.1"), "branch3")); Assert.IsFalse(file.IsRevisionOnBranch(Revision.Create("1.4.2.3.2.2"), "branch3")); Assert.IsTrue(file.IsRevisionOnBranch(Revision.Create("1.4.2.3.2.1.6.1"), "branch3")); Assert.IsFalse(file.IsRevisionOnBranch(Revision.Create("1.4.2.3.2.1.2.1"), "branch3")); }
/// <summary> /// Method that is executed when command is fired /// </summary> /// <param name="app"></param> public void Execute(UIApplication app) { Revision newRev = null; using (Transaction t = new Transaction(ThisApplication.thisApp.doc, "New Revision")) { t.Start(); try { newRev = Revision.Create(ThisApplication.thisApp.doc); newRev.NumberType = RevisionNumberType.Alphanumeric; } catch (Exception ex) { MessageBox.Show(ex.Message + "/n" + ex.StackTrace); } t.Commit(); } //creates new revision - as last in the revision stack this.treeData.Items.Insert(0, new RevisionsRevisionViewModel(newRev)); }
public void ApplyCommit_FileDeleted() { var repoState = new RepositoryBranchState("MAIN"); var file1 = new FileInfo("file1"); var file2 = new FileInfo("file2"); var commit1 = new Commit("id1") .WithRevision(file1, "1.1") .WithRevision(file2, "1.1"); var commit2 = new Commit("id2") .WithRevision(file2, "1.2", isDead: true); repoState.Apply(commit1); repoState.Apply(commit2); Assert.AreEqual(repoState[file1.Name], Revision.Create("1.1")); Assert.AreEqual(repoState[file2.Name], Revision.Empty); }
public void StandardFormat() { var parser = CreateParser(CvsLogParserResources.StandardFormat); var revisions = parser.Parse().ToList(); Assert.AreEqual(revisions.Count(), 2); var r = revisions.First(); Assert.AreEqual(r.Author, "johnb"); Assert.AreEqual(r.CommitId, "c0449ae6c023bd1"); Assert.AreEqual(r.File.Name, ".cvsignore"); Assert.AreEqual(r.IsDead, false); Assert.AreEqual(r.Mergepoint, Revision.Empty); Assert.AreEqual(r.Revision, Revision.Create("1.2")); Assert.AreEqual(r.Time, new DateTime(2009, 3, 4, 11, 54, 43)); Assert.IsFalse(parser.ExcludedTags.Any(), "No tags excluded"); Assert.IsFalse(parser.ExcludedBranches.Any(), "No branches excluded"); }
public static byte GetChainTag() { var genesisBlock = BlockClient.GetBlock(Revision.Create(0)); if (genesisBlock == null) { throw new Exception("Get Genesis block error"); } string hexId = genesisBlock.Id; if (!BlockchainUtils.IsId(hexId)) { throw new Exception("Genesis block id is invalid"); } var bytesId = ByteUtils.ToByteArray(hexId); if (bytesId == null || bytesId.Length != 32) { throw new Exception("Genesis block id converted error"); } return(bytesId[31]); }
private FileRevision CreateFileRevision(FileInfo file, string revision, string commitId) { return(new FileRevision(file, Revision.Create(revision), Revision.Empty, DateTime.Now, "fred", commitId)); }
public void Validate_TrunkRevision() { Revision.Create("1.1"); }
public void IsBranch_BranchRevision() { var r = Revision.Create("1.1.0.2"); Assert.IsTrue(r.IsBranch); }
public void BranchStem_MainRevision() { var r = Revision.Create("1.1"); var stem = r.BranchStem; }
public void IsBranch_TrunkRevision() { var r = Revision.Create("1.1"); Assert.IsFalse(r.IsBranch); }
public void Validate_Invalid_OddBranchIndex_Branchpoint() { Revision.Create("1.1.0.1"); }
public void Validate_Invalid_OddBranchIndex() { Revision.Create("1.1.1.2"); }
public void Validate_Invalid_ZeroPart() { Revision.Create("1.0"); }
public void Validate_BranchRevision() { Revision.Create("1.1.0.2"); }