Package com.aragost.javahg

Examples of com.aragost.javahg.Changeset


        ParentsCommand cmd = ParentsCommand.on(repo);
        List<Changeset> parents = cmd.execute();
        Assert.assertEquals(0, parents.size());
       
        writeFile("a");
        Changeset csRoot = commit();
        parents = cmd.execute();
        Assert.assertEquals(1, parents.size());
        Assert.assertEquals(csRoot, parents.get(0));

        writeFile("b");
        Changeset csB = commit();
        parents = cmd.execute();
        Assert.assertEquals(1, parents.size());
        Assert.assertEquals(csB, parents.get(0));
       
        update(csRoot);
        writeFile("c");
        Changeset csC = commit();
        parents = cmd.execute();
        Assert.assertEquals(1, parents.size());
        Assert.assertEquals(csC, parents.get(0));
       
        MergeCommand.on(repo).execute(null);
        parents = cmd.execute();
        Assert.assertEquals(2, parents.size());
        Assert.assertEquals(csC, parents.get(0));
        Assert.assertEquals(csB, parents.get(1));
       
        writeFile("a");
        Changeset csA2 = commit();
        parents = cmd.execute();
        Assert.assertEquals(1, parents.size());
        Assert.assertEquals(csA2, parents.get(0));
       
        writeFile("a");
        Changeset csA3 = commit();
        parents = cmd.execute();
        Assert.assertEquals(1, parents.size());
        Assert.assertEquals(csA3, parents.get(0));

        parents = cmd.execute("a");
        Assert.assertEquals(1, parents.size());
        Assert.assertEquals(csA3, parents.get(0));

        parents = cmd.execute("b");
        Assert.assertEquals(1, parents.size());
        Assert.assertEquals(csB, parents.get(0));

        parents = cmd.rev(csA3.getNode()).execute("a");
        Assert.assertEquals(1, parents.size());
        Assert.assertEquals(csA2, parents.get(0));
       
        // Diamond shape give two parents with the same node
        parents = cmd.rev(csA2.getNode()).execute("a");
View Full Code Here


        writeFile("b", "bar");
        AddCommand.on(repo).execute();
        commitCmd.execute();

        writeFile("b", "booo");
        Changeset backoutCs = commitCmd.execute();

        writeFile("a", "foo");
        Changeset curCs = commitCmd.execute();

        BackoutCommand.on(repo).rev(backoutCs.getNode()).merge()
                .message("BackoutMerge").user("user").execute();

        Assert.assertEquals(curCs, repo.workingCopy().getParent1());
View Full Code Here

        AddCommand.on(repo).execute();
        commitCmd.execute();

        writeFile("b", "booo");

        Changeset backoutCs = commitCmd.execute();

        writeFile("a", "foo");
        Changeset curCs = commitCmd.execute();

        BackoutCommand.on(repo).rev(backoutCs.getNode())
                .message("BackoutMerge").user("user").execute();

        Assert.assertEquals(curCs, repo.workingCopy().getParent1());
View Full Code Here

        AddCommand.on(repo).execute();
        commitCmd.execute();

        writeFile("a", "bar");
        writeFile("b", "bar");
        Changeset backoutCs = commitCmd.execute();

        writeFile("a", "foo");
        writeFile("b", "foo");
        commitCmd.execute();

        BackoutCommand command = BackoutCommand.on(repo)
                .rev(backoutCs.getNode()).merge().message("BackoutMerge")
                .user("user");
        BackoutConflictResolvingContext ctx;

        ctx = command.execute();
View Full Code Here

        AddCommand.on(repo).execute();
        commitCmd.execute();

        writeFile("a", "bar");
        writeFile("b", "bar");
        Changeset backoutCs = commitCmd.execute();

        writeFile("a", "foo");
        writeFile("b", "foo");
        commitCmd.execute();

        BackoutCommand command = BackoutCommand.on(repo)
                .rev(backoutCs.getNode()).message("BackoutMerge").user("user");
        BackoutConflictResolvingContext ctx;

        ctx = command.execute();

        Assert.assertEquals(2, ctx.getMergeConflicts().size());
View Full Code Here

        writeFile("b", "bar");
        AddCommand.on(repo).execute();
        commitCmd.execute();

        writeFile("b", "booo");
        Changeset backoutCs = commitCmd.execute();

        BackoutCommand.on(repo).rev(backoutCs.getNode()).merge()
                .message("BackoutMerge").user("user").execute();

        Assert.assertEquals(backoutCs, repo.workingCopy().getParent1().getParent1());
        Assert.assertEquals(null, repo.workingCopy().getParent2());       
        Assert.assertEquals(null, repo.workingCopy().getParent1().getParent2());
View Full Code Here

        writeFile("b", "bar");
        AddCommand.on(repo).execute();
        commitCmd.execute();

        writeFile("b", "booo");
        Changeset backoutCs = commitCmd.execute();

        BackoutCommand.on(repo).rev(backoutCs.getNode())
                .message("BackoutMerge").user("user").execute();

        Assert.assertEquals(backoutCs, repo.workingCopy().getParent1().getParent1());
        Assert.assertEquals(null, repo.workingCopy().getParent2());       
        Assert.assertEquals(null, repo.workingCopy().getParent1().getParent2());
View Full Code Here

    @Test
    public void testBranches() throws IOException {
        Repository repo = getTestRepository();
        writeFile("default");
        Changeset defaultBranch = commit();
        BranchCommand.on(repo).set(" branch A ");
        commit();
        update(defaultBranch);
        BranchCommand.on(repo).set(" branch B ");
        Changeset branchB = commit(); // B is inactive
        BranchCommand.on(repo).force().set(" branch A ");
        Changeset branchATip = commit();
        BranchCommand.on(repo).set("branch C");
        commit();
        Changeset branchC = CommitCommand.on(repo).message("test").user("user").closeBranch().execute();

        List<Branch> branches = BranchesCommand.on(repo).closed().execute();
        Collections.sort(branches);

        Assert.assertEquals(4, branches.size());
View Full Code Here

    @Test
    public void test() throws IOException {
        Assume.assumeTrue(isPhasesSupported());
        BaseRepository repo = getTestRepository();
        Changeset cs1 = createChangeset();
        Changeset cs2 = createChangeset();
        Assert.assertEquals(DRAFT, cs1.phase());
        Assert.assertEquals(DRAFT, cs2.phase());
        PhaseCommand cmd = PhaseCommand.on(repo).pub().rev(cs2.getNode());
        cmd.execute();
        Assert.assertEquals(PUBLIC, cs1.phase());
        Assert.assertEquals(PUBLIC, cs2.phase());

        cmd = PhaseCommand.on(repo).secret().rev(cs2.getNode());
        Assert.assertFalse(cmd.execute());
        Assert.assertEquals(PUBLIC, cs1.phase());
        Assert.assertEquals(PUBLIC, cs2.phase());

        cmd = PhaseCommand.on(repo).secret().force().rev(cs1.getNode());
        Assert.assertTrue(cmd.execute());
        Assert.assertEquals(SECRET, cs1.phase());
        Assert.assertEquals(SECRET, cs2.phase());
       
        cmd = PhaseCommand.on(repo).pub().force().rev(cs1.getNode());
        cmd.execute();
        Assert.assertEquals(PUBLIC, cs1.phase());
        Assert.assertEquals(SECRET, cs2.phase());
    }
View Full Code Here

    @Test
    public void testPhaseMakesNoChanges() throws IOException {
        Assume.assumeTrue(isPhasesSupported());
        BaseRepository repo = getTestRepository();
        Changeset cs = createChangeset();
        PhaseCommand cmd = PhaseCommand.on(repo).draft().rev(cs.getNode());
        Assert.assertFalse(cmd.execute());
    }
View Full Code Here

TOP

Related Classes of com.aragost.javahg.Changeset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.