Package com.aragost.javahg

Examples of com.aragost.javahg.Repository


        Assert.assertEquals(1024 * 1024, ByteStreams.toByteArray(stream).length);
    }

    @Test
    public void testNoSuchFile() throws IOException {
        Repository repo = getTestRepository();
        CatCommand cmd = CatCommand.on(repo);
        try {
            cmd.execute("a");
            assertFailedExecution(cmd);
        } catch (ExecutionException e) {
View Full Code Here


public class AddRemoveCommandTest extends AbstractTestCase {

    @Test
    public void test() throws IOException {
        Repository repo = getTestRepository();
        writeFile("a", "");
        new File(repo.getDirectory(), "dir").mkdir();
        writeFile("dir/a", "");
        writeFile("dir/b", "");

        List<String> result = AddRemoveCommand.on(repo).execute();
        CommitCommand commit = CommitCommand.on(repo);
View Full Code Here

public class ExportCommandTest extends AbstractTestCase {

    @Test
    public void test() throws IOException {
        Repository repo = getTestRepository();

        CommitCommand commit = CommitCommand.on(repo);
        commit.user("user").date(DateTime.parse("0 0"));

        writeFile("x", "abc\n");
View Full Code Here

        Assert.assertEquals(2, status.size());
    }

    @Test
    public void testAllFlag() throws IOException {
        Repository repo = getTestRepository();
        writeFile(".hgignore", "");
        writeFile("modified");
        writeFile("removed");
        writeFile("clean");
        writeFile("missing");
        commit();
        writeFile("modified", "new content");
        RemoveCommand.on(repo).execute("removed");
        CopyCommand.on(repo).execute("clean", "copied");
        new File(repo.getDirectory(), "missing").delete();
        writeFile("added");
        AddCommand.on(repo).execute("added");

        writeFile(".hgignore", "syntax: glob\nignored\n");
        CommitCommand.on(repo).message("message").user("user").execute(".hgignore");
        writeFile("ignored");
        writeFile("unknown");

        // Because of issue3278 open a new repo (and start a new
        // server process). Issue is fixed in 2.1.1
        boolean notFixed = repo.getHgVersion().isBefore(HgVersion.fromString("2.1.1"));
        Repository repo2 = repo;
        if (notFixed) {
            repo2 = Repository.open(repo.getDirectory());
        }

        StatusCommand statusCmd = StatusCommand.on(repo2).all();
        StatusResult result = statusCmd.execute();

        Assert.assertArrayEquals(new String[] { "modified" }, result.getModified().toArray());
        Assert.assertArrayEquals(new String[] { "added" }, result.getAdded().toArray());
        Assert.assertArrayEquals(new String[] { "removed" }, result.getRemoved().toArray());
        Assert.assertArrayEquals(new String[] { ".hgignore", "clean" }, result.getClean().toArray());
        Assert.assertArrayEquals(new String[] { "missing" }, result.getMissing().toArray());
        Assert.assertArrayEquals(new String[] { "unknown" }, result.getUnknown().toArray());
        Assert.assertArrayEquals(new String[] { "ignored" }, result.getIgnored().toArray());

        if (notFixed) {
            repo2.close();
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testCopy() throws IOException {
        Repository repo = getTestRepository();
        writeFile("a");
        commit();
        CopyCommand.on(repo).execute("a", "c");
        StatusResult result = StatusCommand.on(repo).copies().execute();
        Assert.assertEquals("a", result.getCopied().get("c"));
View Full Code Here

    @Test
    public void testErrorActionReport() throws IOException {
        assumeTrue(System.getProperty("os.name").equals("Linux"));
        assumeTrue(System.getProperty("file.encoding").equals("ISO-8859-1"));

        Repository repo = getTestRepository();
        File dir = repo.getDirectory();

        // Keep this file in ASCII so that it works when Eclipse is
        // started in both ISO-8859-1 and UTF-8 locales.

        // \u00C6 is the AE ligature.
View Full Code Here

    @Test
    public void testErrorActionReplace() throws IOException {
        assumeTrue(System.getProperty("os.name").equals("Linux"));
        assumeTrue(System.getProperty("file.encoding").equals("ISO-8859-1"));

        Repository repo = getTestRepository();
        File dir = repo.getDirectory();

        // Keep this file in ASCII so that it works when Eclipse is
        // started in both ISO-8859-1 and UTF-8 locales.

        // \u00C6 is the AE ligature.
View Full Code Here

    @Test
    public void testErrorActionIgnore() throws IOException {
        assumeTrue(System.getProperty("os.name").equals("Linux"));
        assumeTrue(System.getProperty("file.encoding").equals("ISO-8859-1"));

        Repository repo = getTestRepository();
        File dir = repo.getDirectory();

        // Keep this file in ASCII so that it works when Eclipse is
        // started in both ISO-8859-1 and UTF-8 locales.

        // \u00C6 is the AE ligature.
View Full Code Here

        Assert.assertEquals(1, result.getUnknown().size());
        Assert.assertEquals("bler.txt", result.getUnknown().get(0));
    }

    private StatusCommand setup() throws IOException {
        Repository repo = getTestRepository();
        File dir = repo.getDirectory();
        StatusCommand cmd = StatusCommand.on(repo);
        StatusResult result = cmd.execute();
        Assert.assertTrue(result.getAdded().isEmpty());
        Assert.assertTrue(result.getClean().isEmpty());
        Assert.assertTrue(result.getCopied().isEmpty());
View Full Code Here

public class OutgoingCommandTest extends AbstractTestCase {

    @Test
    public void testEmpty() throws IOException {
        Repository repo = getTestRepository();
        Repository repo2 = getTestRepository2();

        List<Changeset> csets = OutgoingCommand.on(repo).execute(repo2.getDirectory().getPath());
        Assert.assertTrue(csets.isEmpty());
    }
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.