Package com.aragost.javahg

Examples of com.aragost.javahg.Bundle


        if (this.bundleFile == null) {
            this.bundleFile = Utils.createTempFile(".bundle");
            cmdAppend("--bundle", this.bundleFile.getPath());
        }
        HgInputStream stream = launchStream(src);
        Bundle bundle = new Bundle(getRepository().getBaseRepository(), this.bundleFile, true);
        List<Changeset> changesets = Changeset.readListFromStream(bundle.getOverlayRepository(), stream);
        if (changesets.isEmpty()) {
            bundle.close();
            return null;
        }
        bundle.init(changesets);
        return bundle;
    }
View Full Code Here


    return super.getRemote();
  }

  public Bundle getBackupBundle() {
    if (backupBundleFile != null) {
      return new Bundle(getRepository().getBaseRepository(),
          backupBundleFile, false);
    }

    return null;
  }
View Full Code Here

        if (this.bundleFile == null) {
            this.bundleFile = Utils.createTempFile("javahg", "hg");
        }
        cmdAppend("--bundle", this.bundleFile.getPath());
        HgInputStream stream = launchStream(src);
        Bundle bundle = new Bundle(getRepository().getBaseRepository(), this.bundleFile);
        List<Changeset> changesets = Changeset.readListFromStream(bundle.getOverlayRepository(), stream);
        if (changesets.isEmpty()) {
            bundle.close();
            return null;
        }
        bundle.init(changesets);
        return bundle;
    }
View Full Code Here

        if (this.bundleFile == null) {
            this.bundleFile = File.createTempFile("javahg", "hg");
        }
        cmdAppend("--bundle", this.bundleFile.getPath());
        HgInputStream stream = launchStream(src);
        Bundle bundle = new Bundle(getRepository().getBaseRepository(), this.bundleFile);
        List<Changeset> changesets = Changeset.readListFromStream(bundle.getOverlayRepository(), stream);
        if (changesets.isEmpty()) {
            bundle.close();
            return null;
        }
        bundle.init(changesets);
        return bundle;
    }
View Full Code Here

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

        Bundle bundle = IncomingCommand.on(repo).execute(repo2.getDirectory().getPath());
        Assert.assertNull(bundle);
    }
View Full Code Here

        Changeset cs0 = createChangeset();
        Changeset cs1 = createChangeset();

        Repository repo2 = getTestRepository2();

        Bundle bundle = IncomingCommand.on(repo2).execute(repo);
        List<Changeset> changesets = bundle.getChangesets();
        Assert.assertEquals(2, changesets.size());
        // The changesets are not the same objects, because one set is
        // in the base repo, while the other set is in the overlay
        // repo
        Assert.assertEquals(cs0.getNode(), changesets.get(0).getNode());
        Assert.assertEquals(cs1.getNode(), changesets.get(1).getNode());
        Changeset bundleCs = changesets.get(0);
        Assert.assertNotSame(cs0, bundleCs);
        Assert.assertFalse(cs0.equals(bundleCs));
        bundle.close();
    }
View Full Code Here

        ServeState serveState = startServing(repoA);
        try {
            int port = serveState.getPort();

            Repository repoB = getTestRepository2();
            Bundle b = IncomingCommand.on(repoB).execute("http://localhost:" + port);
            List<Changeset> changesets = b.getChangesets();
            Assert.assertEquals(1, changesets.size());
            Changeset cs = changesets.get(0);
            Assert.assertEquals("user", cs.getUser());
            Assert.assertEquals("added x", cs.getMessage());

            List<Changeset> heads = b.getOverlayRepository().heads();
            Assert.assertEquals(1, heads.size());
            Assert.assertEquals(cs, heads.get(0));
        } finally {
            serveState.stop();
        }
View Full Code Here

    public void testServerRefCount() throws IOException {
        BaseRepository repo = getTestRepository();
        BaseRepository repo2 = getTestRepository2();
        writeFile("a");
        commit();
        Bundle bundle = IncomingCommand.on(repo2).execute(repo);
        Repository repo3 = bundle.getOverlayRepository();
        Assert.assertSame(repo2.getServerPool(), repo3.getServerPool());
        ServerPool pool = repo2.getServerPool();
        Assert.assertEquals(1, pool.getServers().size());
        Assert.assertNotNull(pool.getServers().get(0).getProcess());
        repo2.close();
        Assert.assertNotNull(pool.getServers().get(0).getProcess());
        Server server = pool.getServers().get(0);
        bundle.close();
        Assert.assertNull(server.getProcess());
        Assert.assertTrue(pool.getServers().isEmpty());
    }
View Full Code Here

    public void testServerRefCount() throws IOException {
        BaseRepository repo = getTestRepository();
        BaseRepository repo2 = getTestRepository2();
        writeFile("a");
        commit();
        Bundle bundle = IncomingCommand.on(repo2).execute(repo);
        Repository repo3 = bundle.getOverlayRepository();
        Assert.assertSame(repo2.getServerPool(), repo3.getServerPool());
        ServerPool pool = repo2.getServerPool();
        Assert.assertEquals(1, pool.getServers().size());
        Assert.assertNotNull(pool.getServers().get(0).getProcess());
        repo2.close();
        Assert.assertNotNull(pool.getServers().get(0).getProcess());
        Server server = pool.getServers().get(0);
        bundle.close();
        Assert.assertNull(server.getProcess());
        Assert.assertTrue(pool.getServers().isEmpty());
    }
View Full Code Here

        if (this.bundleFile == null) {
            this.bundleFile = Utils.createTempFile(".bundle");
            cmdAppend("--bundle", this.bundleFile.getPath());
        }
        HgInputStream stream = launchStream(src);
        Bundle bundle = new Bundle(getRepository().getBaseRepository(), this.bundleFile, true);
        List<Changeset> changesets = Changeset.readListFromStream(bundle.getOverlayRepository(), stream);
        if (changesets.isEmpty()) {
            bundle.close();
            return null;
        }
        bundle.init(changesets);
        return bundle;
    }
View Full Code Here

TOP

Related Classes of com.aragost.javahg.Bundle

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.