Examples of HgAddRemoveCommand


Examples of org.tmatesoft.hg.core.HgAddRemoveCommand

    File repoLoc = RepoUtils.cloneRepoToTempLocation("log-1", "test-add-remove-commit", false);
    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    assertTrue("[sanity]", hgRepo.getFileNode("d").exists());
    assertTrue("[sanity]", new File(repoLoc, "d").canRead());
    RepoUtils.createFile(new File(repoLoc, "xx"), "xyz");
    new HgAddRemoveCommand(hgRepo).add(Path.create("xx")).remove(Path.create("d")).execute();
    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);
View Full Code Here

Examples of org.tmatesoft.hg.core.HgAddRemoveCommand

    File repoLoc = RepoUtils.cloneRepoToTempLocation("log-1", "test-commit-addfile-stream", false);
    final File newFile = new File(repoLoc, "xx");
    final byte[] newFileContent = "xyz".getBytes();
    RepoUtils.createFile(newFile, newFileContent);
    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    new HgAddRemoveCommand(hgRepo).add(Path.create("xx")).execute();
    // save the reference to HgDataFile without valid RevlogStream (entry in the dirstate
    // doesn't make it valid)
    final HgDataFile newFileNode = hgRepo.getFileNode("xx");
    assertFalse(newFileNode.exists());
    HgCommitCommand cmd = new HgCommitCommand(hgRepo).message("FIRST");
View Full Code Here

Examples of org.tmatesoft.hg.core.HgAddRemoveCommand

    assertTrue("[sanity]", dfB.exists());
    assertTrue("[sanity]", dfD.exists());
    final File modifiedFile = new File(repoLoc, "b");
    RepoUtils.modifyFileAppend(modifiedFile, " 1 \n");
    //
    new HgAddRemoveCommand(hgRepo).add(newFilePath).remove(dfD.getPath()).execute();
    //
    TestStatus.StatusCollector status = new TestStatus.StatusCollector();
    new HgStatusCommand(hgRepo).all().execute(status);
    assertTrue(status.getErrors().isEmpty());
    assertTrue(status.get(Kind.Added).contains(newFilePath));
View Full Code Here

Examples of org.tmatesoft.hg.core.HgAddRemoveCommand

    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());
    final Nodeid cmt2 = commitCmd.getCommittedRevision();
    //
    // pull
View Full Code Here

Examples of org.tmatesoft.hg.core.HgAddRemoveCommand

    statusParser.reset();
    eh.run("hg", "status", "-A");
    assertEquals("[sanity]", 2, statusParser.getUnknown().size());
    assertEquals("[sanity]", 0, statusParser.getAdded().size());
   
    new HgAddRemoveCommand(repo).add(Path.create("one"), Path.create("two")).execute();
    statusParser.reset();
    eh.run("hg", "status", "-A");
    assertEquals(0, statusParser.getUnknown().size());
    assertEquals(2, statusParser.getAdded().size());
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgAddRemoveCommand

    eh = new ExecHelper(statusParser, testRepoLoc);
    eh.run("hg", "status", "-A");
    assertEquals("[sanity]", 0, statusParser.getUnknown().size());
    assertEquals("[sanity]", 0, statusParser.getRemoved().size());
   
    new HgAddRemoveCommand(repo).remove(Path.create("b"), Path.create("d")).execute();
    statusParser.reset();
    eh.run("hg", "status", "-A");
    assertEquals(2, statusParser.getRemoved().size());
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgAddRemoveCommand

    Path fa = Path.create("a"), fb = Path.create("b");
    final File fileA = new File(repoLoc, fa.toString());
    final File fileB = new File(repoLoc, fb.toString());
    RepoUtils.createFile(fileA, "first file");
    RepoUtils.createFile(fileB, "second file");
    new HgAddRemoveCommand(hgRepo).add(fa, fb).execute();
    new HgCommitCommand(hgRepo).message("FIRST").execute();
    // add one more file
    // remove one initial file
    Path fc = Path.create("c");
    final File fileC = new File(repoLoc, fc.toString());
    RepoUtils.createFile(fileC, "third file");
    fileB.delete();
    // TODO HgAddRemoveCommand needs #copy(from, to) method
    new HgAddRemoveCommand(hgRepo).add(fc).remove(fb).execute();
    new HgCommitCommand(hgRepo).message("SECOND").execute();
    //
    assertEquals(2, hgRepo.getChangelog().getRevisionCount());
    errorCollector.assertEquals("SECOND", hgRepo.getCommitLastMessage());
    // checkout previous version
View Full Code Here

Examples of org.tmatesoft.hg.core.HgAddRemoveCommand

    final File fileA = new File(repoLoc, fa.toString());
    final File fileB = new File(repoLoc, fb.toString());
    // rev0: +file1, +file2
    RepoUtils.createFile(fileA, "first file");
    RepoUtils.createFile(fileB, "second file");
    new HgAddRemoveCommand(hgRepo).add(fa, fb).execute();
    final HgCommitCommand commitCmd = new HgCommitCommand(hgRepo);
    commitCmd.message("FIRST").execute();
    // rev1: *file1, *file2
    RepoUtils.modifyFileAppend(fileA, "A1");
    RepoUtils.modifyFileAppend(fileB, "B1");
    commitCmd.message("SECOND").execute();
    // rev2: *file1, -file2
    RepoUtils.modifyFileAppend(fileA, "A2");
    fileB.delete();
    new HgAddRemoveCommand(hgRepo).remove(fb).execute();
    commitCmd.message("THIRD").execute();
    // rev3: fork rev0, +file3, *file2
    new HgCheckoutCommand(hgRepo).changeset(0).clean(true).execute();
    final File fileC = new File(repoLoc, fc.toString());
    RepoUtils.createFile(fileC, "third file");
    RepoUtils.modifyFileAppend(fileB, "B2");
    new HgAddRemoveCommand(hgRepo).add(fc).execute();
    commitCmd.message("FOURTH").execute();
    // rev4: *file3
    RepoUtils.modifyFileAppend(fileC, "C1");
    commitCmd.message("FIFTH").execute();
    // rev5: merge rev2 with rev3
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.