Package com.aragost.javahg

Examples of com.aragost.javahg.Repository


public class ParentsCommandTest extends AbstractTestCase {
   
    @Test
    public void test() throws IOException {
        Repository repo = getTestRepository();
        ParentsCommand cmd = ParentsCommand.on(repo);
        List<Changeset> parents = cmd.execute();
        Assert.assertEquals(0, parents.size());
       
        writeFile("a");
View Full Code Here


public class BackoutCommandTest extends AbstractTestCase {

    @Test
    public void testBackoutMerge() throws Exception {

        Repository repo = getTestRepository();
        CommitCommand commitCmd = CommitCommand.on(repo).message("m")
                .user("user");

        writeFile("a", "boo");
        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());
        Assert.assertEquals(backoutCs, repo.workingCopy().getParent2()
                .getParent1());

        commitCmd.execute();

        Assert.assertEquals("bar", readFile("b"));
View Full Code Here

    }

    @Test
    public void testBackoutUpdate() throws Exception {

        Repository repo = getTestRepository();
        CommitCommand commitCmd = CommitCommand.on(repo).message("m")
                .user("user");

        writeFile("a", "boo");
        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())
                .message("BackoutMerge").user("user").execute();

        Assert.assertEquals(curCs, repo.workingCopy().getParent1());
        Assert.assertNull(repo.workingCopy().getParent2());

        commitCmd.execute();
        Assert.assertEquals("bar", readFile("b"));
        Assert.assertEquals(4, LogCommand.on(repo).execute().size());
    }
View Full Code Here

    }

    @Test
    public void testBackoutMergeConflict() throws Exception {

        Repository repo = getTestRepository();
        CommitCommand commitCmd = CommitCommand.on(repo).message("m")
                .user("user");

        writeFile("a", "boo");
        writeFile("b", "boo");
View Full Code Here

    }

    @Test
    public void testBackoutUpdateConflict() throws Exception {

        Repository repo = getTestRepository();
        CommitCommand commitCmd = CommitCommand.on(repo).message("m")
                .user("user");

        writeFile("a", "boo");
        writeFile("b", "boo");
View Full Code Here

    }
   
    @Test
    public void testBackoutTipMerge() throws Exception {

        Repository repo = getTestRepository();
        CommitCommand commitCmd = CommitCommand.on(repo).message("m")
                .user("user");

        writeFile("a", "boo");
        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());

        Assert.assertEquals("bar", readFile("b"));
        Assert.assertEquals(3, LogCommand.on(repo).execute().size());
    }
View Full Code Here

    }
   
    @Test
    public void testBackoutTipUpdate() throws Exception {

        Repository repo = getTestRepository();
        CommitCommand commitCmd = CommitCommand.on(repo).message("m")
                .user("user");

        writeFile("a", "boo");
        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());

        commitCmd.execute();

        Assert.assertEquals("bar", readFile("b"));
        Assert.assertEquals(3, LogCommand.on(repo).execute().size());
View Full Code Here

public class BranchesTest extends AbstractTestCase {

    @Test
    public void testBranches() throws IOException {
        Repository repo = getTestRepository();
        writeFile("default");
        Changeset defaultBranch = commit();
        BranchCommand.on(repo).set(" branch A ");
        commit();
        update(defaultBranch);
View Full Code Here

        Assert.assertFalse(bDefault.isClosed());
    }

    @Test
    public void testCloseBranch() throws IOException {
        Repository repo = getTestRepository();
        BranchCommand.on(repo).set(" x");
        commit();
        CommitCommand.on(repo).message("test").user("user").closeBranch().execute();

        List<Branch> branches = BranchesCommand.on(repo).closed().execute();
View Full Code Here

public class VersionCommandTest extends AbstractTestCase {

    @Test
    public void test() throws IOException {
        Repository repository = getTestRepository();
        HgVersion v = VersionCommand.on(repository).execute();
        Assert.assertFalse(v.isUnknown());
    }
View Full Code Here

TOP

Related Classes of com.aragost.javahg.Repository

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.