Package org.tmatesoft.hg.internal

Examples of org.tmatesoft.hg.internal.CommitFacility.commit()


    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), 0);
    HgDataFile df = hgRepo.getFileNode("file1");
    cf.add(df, new ByteArrayDataSource("hello\nworld".getBytes()));
    Transaction tr = newTransaction(hgRepo);
    Nodeid secondRev = cf.commit("SECOND", tr);
    tr.commit();
    //
    List<HgChangeset> commits = new HgLogCommand(hgRepo).execute();
    errorCollector.assertEquals(2, commits.size());
    HgChangeset c1 = commits.get(0);
View Full Code Here


    HgDataFile df = hgRepo.getFileNode(fname);
    final byte[] initialContent = "hello\nworld".getBytes();
    cf.add(df, new ByteArrayDataSource(initialContent));
    String comment = "commit 1";
    Transaction tr = newTransaction(hgRepo);
    Nodeid c1Rev = cf.commit(comment,  tr);
    tr.commit();
    List<HgChangeset> commits = new HgLogCommand(hgRepo).execute();
    errorCollector.assertEquals(1, commits.size());
    HgChangeset c1 = commits.get(0);
    errorCollector.assertEquals(1, c1.getAffectedFiles().size());
View Full Code Here

    CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), parentCsetRevIndex);
    FileContentSupplier contentProvider = new FileContentSupplier(hgRepo, fileD);
    cf.add(dfD, contentProvider);
    cf.branch("branch1");
    Transaction tr = newTransaction(hgRepo);
    Nodeid commitRev1 = cf.commit("FIRST",  tr);
    tr.commit();
    //
    List<HgChangeset> commits = new HgLogCommand(hgRepo).range(parentCsetRevIndex+1, TIP).execute();
    assertEquals(1, commits.size());
    HgChangeset c1 = commits.get(0);
View Full Code Here

    CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), hgRepo.getChangelog().getLastRevision());
    FileContentSupplier contentProvider = new FileContentSupplier(hgRepo, new File(repoLoc, "xx"));
    cf.add(hgRepo.getFileNode("xx"), contentProvider);
    cf.forget(hgRepo.getFileNode("d"));
    Transaction tr = newTransaction(hgRepo);
    Nodeid commitRev = cf.commit("Commit with add/remove cmd",  tr);
    tr.commit();
    //
    List<HgChangeset> commits = new HgLogCommand(hgRepo).changeset(commitRev).execute();
    HgChangeset cmt = commits.get(0);
    errorCollector.assertEquals(1, cmt.getAddedFiles().size());
View Full Code Here

    CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), parentCsetRevIndex);
    FileContentSupplier contentProvider = new FileContentSupplier(hgRepo, fileD);
    cf.add(dfD, contentProvider);
    cf.branch("branch1");
    Transaction tr = newTransaction(hgRepo);
    Nodeid commitRev1 = cf.commit("FIRST",  tr);
    //
    RepoUtils.modifyFileAppend(fileD, " 2 \n");
    cf.add(dfD, contentProvider = new FileContentSupplier(hgRepo, fileD));
    cf.branch("branch2");
    Nodeid commitRev2 = cf.commit("SECOND",  tr);
View Full Code Here

    Nodeid commitRev1 = cf.commit("FIRST",  tr);
    //
    RepoUtils.modifyFileAppend(fileD, " 2 \n");
    cf.add(dfD, contentProvider = new FileContentSupplier(hgRepo, fileD));
    cf.branch("branch2");
    Nodeid commitRev2 = cf.commit("SECOND",  tr);
    //
    RepoUtils.modifyFileAppend(fileD, " 2 \n");
    cf.add(dfD, contentProvider = new FileContentSupplier(hgRepo, fileD));
    cf.branch(DEFAULT_BRANCH_NAME);
    Nodeid commitRev3 = cf.commit("THIRD",  tr);
View Full Code Here

    Nodeid commitRev2 = cf.commit("SECOND",  tr);
    //
    RepoUtils.modifyFileAppend(fileD, " 2 \n");
    cf.add(dfD, contentProvider = new FileContentSupplier(hgRepo, fileD));
    cf.branch(DEFAULT_BRANCH_NAME);
    Nodeid commitRev3 = cf.commit("THIRD",  tr);
    tr.commit();
    //
    List<HgChangeset> commits = new HgLogCommand(hgRepo).range(parentCsetRevIndex+1, TIP).execute();
    assertEquals(3, commits.size());
    HgChangeset c1 = commits.get(0);
View Full Code Here

    // HgCommitCommand can't do branch yet
    CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), parentCsetRevIndex);
    cf.add(hgRepo.getFileNode("a"), new FileContentSupplier(hgRepo, new File(repoLoc, "a")));
    cf.branch(branch);
    Transaction tr = newTransaction(hgRepo);
    Nodeid commit = cf.commit("FIRST",  tr);
    tr.commit();
    errorCollector.assertEquals("commit with branch shall update WC", branch, hgRepo.getWorkingCopyBranchName());
   
    ExecHelper eh = new ExecHelper(new OutputParser.Stub(), repoLoc);
    eh.run("hg", "tag", tag);
View Full Code Here

    cf.add(hgRepo.getFileNode("xx"), new FileContentSupplier(hgRepo, newFile));
    cf.add(dfB, new FileContentSupplier(hgRepo, modifiedFile));
    cf.forget(dfD);
    cf.branch("another-branch");
    Transaction tr = newTransaction(hgRepo);
    Nodeid commitRev = cf.commit("Commit to fail",  tr);
    tr.rollback();
    //
    errorCollector.assertEquals(lastClogRevision, hgRepo.getChangelog().getLastRevision());
    errorCollector.assertEquals(lastManifestRev, hgRepo.getManifest().getLastRevision());
    errorCollector.assertEquals(DEFAULT_BRANCH_NAME, DirstateReader.readBranch(Internals.getInstance(hgRepo)));
View Full Code Here

      cf.branch(detectBranch());
      cf.user(detectUser());
      Transaction.Factory trFactory = implRepo.getTransactionFactory();
      Transaction tr = trFactory.create(repo);
      try {
        newRevision = cf.commit(message, tr);
        tr.commit();
      } catch (RuntimeException ex) {
        tr.rollback();
        throw ex;
      } catch (HgException ex) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.