Examples of HgLookup


Examples of org.tmatesoft.hg.repo.HgLookup

        progress.done();
      }
    } catch (HgRuntimeException ex) {
      throw new HgLibraryFailureException(ex);
    }
    return new HgLookup().detect(destination);
  }
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgLookup

    public void initEmptyRepository() throws HgIOException, HgRepositoryNotFoundException {
      repoInit.initEmptyRepository(hgDir);
      assert (repoInit.getRequires() & FNCACHE) != 0;
      // XXX perhaps, with WriteDownMate moving to a more appropriate location,
      // we could instantiate HgRepository (or Internals) by other means, without exception?
      fncacheFile = new FNCacheFile(Internals.getInstance(new HgLookup(ctx).detect(hgDir)));
    }
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgLookup

  }

  @Test
  public void testParentsEmptyRepo() throws Exception {
    // check contract return values for empty/nonexistent dirstate
    repo = new HgLookup().detect(RepoUtils.initEmptyTempRepo("testParentsEmptyRepo"));
    final Pair<Nodeid, Nodeid> wcParents = repo.getWorkingCopyParents();
    Assert.assertTrue(wcParents.first().isNull());
    Assert.assertTrue(wcParents.second().isNull());
  }
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgLookup

 
  @Test
  public void testResolver() throws Exception {
    File repoLoc1 = RepoUtils.copyRepoToTempLocation("merge-1", "test-merge-no-conflicts");
    File repoLoc2 = RepoUtils.copyRepoToTempLocation("merge-1", "test-merge-with-conflicts");
    HgRepository repo = new HgLookup().detect(repoLoc1);
    Assert.assertEquals("[sanity]", repo.getChangelog().getRevisionIndex(repo.getWorkingCopyParents().first()), 1);

    HgMergeCommand cmd = new HgMergeCommand(repo);
    cmd.changeset(2).execute(new HgMergeCommand.MediatorBase() {
     
      public void resolve(HgFileRevision base, HgFileRevision first, HgFileRevision second, Resolver resolver) throws HgCallbackTargetException {
        errorCollector.fail("There's no conflict in changesets 1 and 2 merge");
      }
    });
    RepoUtils.assertHgVerifyOk(errorCollector, repoLoc1);
    TestStatus.StatusCollector status = new TestStatus.StatusCollector();
    new HgStatusCommand(repo).all().execute(status);
    final List<Path> clean = status.get(Kind.Clean);
    final List<Path> modified = status.get(Kind.Modified);
    Collections.sort(clean);
    Collections.sort(modified);
    errorCollector.assertEquals(new Path[] {create("file1"), create("file3"), create("file4")}, clean.toArray());
    errorCollector.assertEquals(new Path[] {create("file2"), create("file5")}, modified.toArray());
    repo = new HgLookup().detect(repoLoc2);
    cmd = new HgMergeCommand(repo);
    cmd.changeset(3).execute(new HgMergeCommand.MediatorBase());
    RepoUtils.assertHgVerifyOk(errorCollector, repoLoc2);
    new HgStatusCommand(repo).all().execute(status = new TestStatus.StatusCollector());
    errorCollector.assertEquals(1, status.get(Kind.Modified).size());
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgLookup

  }

  @Test
  public void testSimple() throws Exception {
    int x = 0;
    HgLookup lookup = new HgLookup();
    for (HgRemoteRepository hgRemote : Configuration.get().allRemote()) {
      File dest = RepoUtils.createEmptyDir("test-outgoing-" + x++);
      ExecHelper eh0 = new ExecHelper(new OutputParser.Stub(false), null);
      eh0.run("hg", "clone", hgRemote.getLocation(), dest.toString());
      eh0.cwd(dest);
      Assert.assertEquals("initial clone failed", 0, eh0.getExitValue());
      HgOutgoingCommand cmd = new HgOutgoingCommand(lookup.detect(dest)).against(hgRemote);
      LogOutputParser outParser = new LogOutputParser(true);
      ExecHelper eh = new ExecHelper(outParser, dest);
      HgLogCommand.CollectHandler collector = new HgLogCommand.CollectHandler();
      //
      cmd.executeFull(collector);
      List<Nodeid> liteResult = cmd.executeLite();
      eh.run("hg", "outgoing", "--debug", hgRemote.getLocation());
      TestIncoming.report(collector, outParser, liteResult, errorCollector);
      //
      File f = new File(dest, "Test.txt");
      RepoUtils.createFile(f, "1");
      eh0.run("hg", "add");
      eh0.run("hg", "commit", "-m", "1");
      RepoUtils.modifyFileAppend(f, "2");
      eh0.run("hg", "commit", "-m", "2");
      //
      cmd = new HgOutgoingCommand(lookup.detect(dest)).against(hgRemote);
      cmd.executeFull(collector = new HgLogCommand.CollectHandler());
      liteResult = cmd.executeLite();
      outParser.reset();
      eh.run("hg", "outgoing", "--debug", hgRemote.getLocation());
      TestIncoming.report(collector, outParser, liteResult, errorCollector);
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgLookup

    File dstRepoLoc = RepoUtils.cloneRepoToTempLocation("test-annotate", "test-outgoing-dst", false);
    File f1 = new File(srcRepoLoc, "file1");
    assertTrue("[sanity]", f1.canWrite());
    HgServer server = new HgServer().start(dstRepoLoc);
    try {
      final HgLookup hgLookup = new HgLookup();
      final HgRepository srcRepo = hgLookup.detect(srcRepoLoc);
      final HgRemoteRepository dstRemote = hgLookup.detect(server.getURL());
      new HgCheckoutCommand(srcRepo).changeset(6).clean(true).execute();
      assertEquals("[sanity]", "with-merge", srcRepo.getWorkingCopyBranchName());
      RepoUtils.modifyFileAppend(f1, "change1");
      new HgCommitCommand(srcRepo).message("Commit 1").execute();
      new HgCheckoutCommand(srcRepo).changeset(5).clean(true).execute();
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgLookup

    tm.testWalkFileRevisions();
    tm.errorCollector.verify();
  }
 
  public TestManifest() throws Exception {
    this(new HgLookup().detectFromWorkingDir());
  }
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgLookup

  @Test
  public void testRefreshOnChange() throws Exception {
    File repoLoc = RepoUtils.cloneRepoToTempLocation("log-1", "test-refresh-hgignore", false);
    File hgignoreFile = new File(repoLoc, HgRepositoryFiles.HgIgnore.getPath());
    RepoUtils.createFile(hgignoreFile, "bin/");
    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    final Path p1 = Path.create("bin/a/b/c");
    final Path p2 = Path.create("src/a/b/c");
    HgIgnore ignore = hgRepo.getIgnore();
    errorCollector.assertTrue(ignore.isIgnored(p1));
    errorCollector.assertFalse(ignore.isIgnored(p2));
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgLookup

    test.testLowLevel();
    test.testStatusCommand();
    test.testPerformance();
    test.errorCollector.verify();
    //
    TestStatus t2 = new TestStatus(new HgLookup().detect("/temp/hg/hg4j-merging/hg4j"));
    t2.testDirstateParentOtherThanTipWithUpdate();
    t2.errorCollector.verify();
    TestStatus t3 = new TestStatus(new HgLookup().detect("/temp/hg/cpython"));
    t3.testDirstateParentOtherThanTipNoUpdate();
    t3.errorCollector.verify();
  }
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgLookup

    t3.testDirstateParentOtherThanTipNoUpdate();
    t3.errorCollector.verify();
  }

  public TestStatus() throws Exception {
    this(new HgLookup().detectFromWorkingDir());
  }
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.