Examples of HgCheckoutCommand


Examples of org.apache.maven.scm.provider.hg.command.checkout.HgCheckOutCommand

    /** {@inheritDoc} */
    public CheckOutScmResult checkout( ScmProviderRepository repository, ScmFileSet fileSet,
                                       CommandParameters parameters )
        throws ScmException
    {
        HgCheckOutCommand command = new HgCheckOutCommand();

        command.setLogger( getLogger() );

        return (CheckOutScmResult) command.execute( repository, fileSet, parameters );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.checkout.HgCheckOutCommand

    /** {@inheritDoc} */
    public CheckOutScmResult checkout( ScmProviderRepository repository, ScmFileSet fileSet,
                                       CommandParameters parameters )
        throws ScmException
    {
        HgCheckOutCommand command = new HgCheckOutCommand();

        command.setLogger( getLogger() );

        return (CheckOutScmResult) command.execute( repository, fileSet, parameters );
    }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgCheckoutCommand

    HgRevertCommand cmd = new HgRevertCommand(hgRepo);
    cmd.file(Path.create("a.txt")).execute();
  }
 
  private void testCheckout() throws Exception {
    HgCheckoutCommand coCmd = new HgCheckoutCommand(hgRepo);
    coCmd.changeset(17).execute();
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgCheckoutCommand

    File testRepoLoc = cloneRepoToTempLocation("log-1", "test-checkout-clean", true);
    repo = new HgLookup().detect(testRepoLoc);
    // nothing but .hg dir
    assertEquals("[sanity]", 0, testRepoLoc.listFiles(new FilesOnlyFilter()).length);
   
    new HgCheckoutCommand(repo).clean(true).changeset(1).execute();
    errorCollector.assertEquals(2, testRepoLoc.listFiles(new FilesOnlyFilter()).length);

    Pair<Nodeid, Nodeid> workingCopyParents = repo.getWorkingCopyParents();
    errorCollector.assertEquals("da3461cd828dae8eb5fd11189d40e9df1961f191", workingCopyParents.first().toString());
    errorCollector.assertEquals(Nodeid.NULL, workingCopyParents.second());
    errorCollector.assertEquals(HgRepository.DEFAULT_BRANCH_NAME, repo.getWorkingCopyBranchName());

    StatusOutputParser statusOutputParser = new StatusOutputParser();
    eh = new ExecHelper(statusOutputParser, testRepoLoc);
    eh.run("hg", "status", "-A");
    errorCollector.assertEquals(2, statusOutputParser.getClean().size());
    errorCollector.assertTrue(statusOutputParser.getClean().contains(Path.create("a")));
    errorCollector.assertTrue(statusOutputParser.getClean().contains(Path.create("b")));
   
    new HgCheckoutCommand(repo).clean(true).changeset(3).execute();
    statusOutputParser.reset();
    eh.run("hg", "status", "-A");
    errorCollector.assertEquals(3, statusOutputParser.getClean().size());
    errorCollector.assertTrue(statusOutputParser.getClean().contains(Path.create("b")));
    errorCollector.assertTrue(statusOutputParser.getClean().contains(Path.create("d")));
View Full Code Here

Examples of org.tmatesoft.hg.core.HgCheckoutCommand

    final long modifiedFileInitialLen = modifiedFile.length();
    RepoUtils.modifyFileAppend(modifiedFile, "the change shall not survive");
    assertTrue("[sanity]", modifiedFile.length() > modifiedFileInitialLen);
    //
    repo = new HgLookup().detect(repoLoc);
    new HgCheckoutCommand(repo).clean(true).changeset(TIP).execute();
    errorCollector.assertTrue(untrackedFile.canRead());
    errorCollector.assertEquals(modifiedFileInitialLen, modifiedFile.length());
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgCheckoutCommand

  @Test
  public void testBranchCheckout() throws Exception {
    File testRepoLoc = cloneRepoToTempLocation("log-branches", "test-checkoutBranch", true);
    repo = new HgLookup().detect(testRepoLoc);
   
    new HgCheckoutCommand(repo).clean(true).changeset(3 /*branch test*/).execute();

    StatusOutputParser statusOutputParser = new StatusOutputParser();
    eh = new ExecHelper(statusOutputParser, testRepoLoc);
    eh.run("hg", "status", "-A");
    errorCollector.assertEquals(3, statusOutputParser.getClean().size());
View Full Code Here

Examples of org.tmatesoft.hg.core.HgCheckoutCommand

 
  @Test
  public void testCheckoutLinkAndExec() throws Exception {
    File testRepoLoc = cloneRepoToTempLocation("test-flags", "test-checkout-flags", true);
    repo = new HgLookup().detect(testRepoLoc);
    new HgCheckoutCommand(repo).clean(true).changeset(0).execute();

    Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(testRepoLoc), repo.getToRepoPathHelper()));
    FileWalker fw = new FileWalker(repo, testRepoLoc, pathSrc, null);
    int execFound, linkFound, regularFound;
    execFound = linkFound = regularFound = 0;
View Full Code Here

Examples of org.tmatesoft.hg.core.HgCheckoutCommand

    RepoUtils.modifyFileAppend(f1, "change1");
    HgCommitCommand commitCmd = new HgCommitCommand(srcRepo).message("Commit 1");
    assertTrue(commitCmd.execute().isOk());
    final Nodeid cmt1 = commitCmd.getCommittedRevision();
    // commit 2
    new HgCheckoutCommand(srcRepo).changeset(7).clean(true).execute();
    assertEquals("[sanity]", "no-merge", srcRepo.getWorkingCopyBranchName());
    RepoUtils.createFile(new File(srcRepoLoc, "file-new"), "whatever");
    new HgAddRemoveCommand(srcRepo).add(Path.create("file-new")).execute();
    commitCmd = new HgCommitCommand(srcRepo).message("Commit 2");
    assertTrue(commitCmd.execute().isOk());
View Full Code Here

Examples of org.tmatesoft.hg.core.HgCheckoutCommand

    HgRepository dstRepo = hgLookup.detect(dstRepoLoc);
    PhasesHelper phaseHelper = new PhasesHelper(HgInternals.getImplementationRepo(dstRepo));
    //
    // new child revision for shared public parent
    assertEquals(HgPhase.Public, phaseHelper.getPhase(4, null));
    new HgCheckoutCommand(dstRepo).changeset(4).clean(true).execute();
    RepoUtils.modifyFileAppend(f1, "// aaa");
    HgCommitCommand commitCmd = new HgCommitCommand(dstRepo).message("Commit 1");
    assertTrue(commitCmd.execute().isOk());
    final Nodeid cmt1 = commitCmd.getCommittedRevision();
    //
    // new child rev for parent locally draft, remotely public
    assertEquals(HgPhase.Draft, phaseHelper.getPhase(5, null));
    assertEquals(HgPhase.Draft, phaseHelper.getPhase(7, null));
    assertEquals(HgPhase.Draft, phaseHelper.getPhase(8, null));
    new HgCheckoutCommand(dstRepo).changeset(8).clean(true).execute();
    RepoUtils.modifyFileAppend(f1, "// bbb");
    commitCmd = new HgCommitCommand(dstRepo).message("Commit 2");
    assertTrue(commitCmd.execute().isOk());
    final Nodeid cmt2 = commitCmd.getCommittedRevision();
    // both new revisions shall be draft
View Full Code Here

Examples of org.tmatesoft.hg.core.HgCheckoutCommand

      final HgLookup hgLookup = new HgLookup();
      final HgRepository srcRepo = hgLookup.detect(srcRepoLoc);
      final HgRemoteRepository dstRemote = hgLookup.detect(server.getURL());
      RepoUtils.modifyFileAppend(f1, "change1");
      new HgCommitCommand(srcRepo).message("Commit 1").execute();
      new HgCheckoutCommand(srcRepo).changeset(7).clean(true).execute();
      assertEquals("[sanity]", "no-merge", srcRepo.getWorkingCopyBranchName());
      RepoUtils.modifyFileAppend(f1, "change2");
      new HgCommitCommand(srcRepo).message("Commit 2").execute();
      //
      new HgPushCommand(srcRepo).destination(dstRemote).execute();
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.