Package org.tmatesoft.hg.core

Examples of org.tmatesoft.hg.core.HgMergeCommand$ResolverImpl


    HgMergeCommand.Mediator m = null;
    if (cmdLineOpts.getBoolean("--dry-run") || Boolean.TRUE.booleanValue()) {
      m = new Dump();
    }
    final String revParam = cmdLineOpts.getSingle("-r", "--rev");
    final HgMergeCommand cmd = hgRepo.createMergeCommand();
    if (revParam.trim().length() == Nodeid.SIZE_ASCII) {
      cmd.changeset(Nodeid.fromAscii(revParam.trim()));
    } else {
      cmd.changeset(Integer.parseInt(revParam));
    }
    cmd.execute(m);
  }
View Full Code Here


  @Test
  public void testMediator() throws Exception {
    HgRepository repo = Configuration.get().find("merge-1");
    Assert.assertEquals("[sanity]", repo.getChangelog().getRevisionIndex(repo.getWorkingCopyParents().first()), 1);

    HgMergeCommand cmd = new HgMergeCommand(repo);

    MergeNotificationCollector c;
    // (fastForward(file1, file2, file3) changes, newInB(file5), same(file4))
    cmd.changeset(2).execute(c = new MergeNotificationCollector());
    errorCollector.assertTrue("file1", c.fastForwardA.contains("file1"));
    errorCollector.assertTrue("file2", c.fastForwardB.contains("file2"));
    errorCollector.assertTrue("file3", c.fastForwardA.contains("file3"));
    errorCollector.assertTrue("file4", c.same.contains("file4"));
    errorCollector.assertTrue("file5", c.newInB.contains("file5"));
    // (conflict(file1), onlyInA(file3), same(file4))
    cmd.changeset(3).execute(c = new MergeNotificationCollector());
    errorCollector.assertTrue("file1", c.conflict.contains("file1"));
    errorCollector.assertTrue("file2", c.same.contains("file2"));
    errorCollector.assertTrue("file3", c.onlyA.contains("file3"));
    errorCollector.assertTrue("file4", c.same.contains("file4"));
  }
View Full Code Here

    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());
    errorCollector.assertEquals(create("file1"), status.get(Kind.Modified).get(0));
    final HgMergeState ms = repo.getMergeState();
View Full Code Here

    // rev4: *file3
    RepoUtils.modifyFileAppend(fileC, "C1");
    commitCmd.message("FIFTH").execute();
    // rev5: merge rev2 with rev3
    new HgCheckoutCommand(hgRepo).changeset(2).clean(true).execute();
    new HgMergeCommand(hgRepo).changeset(3).execute(new HgMergeCommand.MediatorBase());
    commitCmd.message("SIXTH: merge rev2 and rev3");
    errorCollector.assertTrue(commitCmd.isMergeCommit());
    HgMergeState ms = hgRepo.getMergeState();
    ms.refresh();
    errorCollector.assertTrue(ms.isMerging());
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.core.HgMergeCommand$ResolverImpl

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.