Package org.tmatesoft.hg.repo

Examples of org.tmatesoft.hg.repo.HgLookup


   */
  public boolean initFrom(File repoLocation) throws HgRepositoryNotFoundException {
    if (repoLocation == null) {
      throw new IllegalArgumentException();
    }
    repo = new HgLookup(context).detect(repoLocation);
    return repo != null && !repo.isInvalid();
  }
View Full Code Here


  /**
   * This factory method doesn't need this facade to be initialized with a repository.
   * @return command instance, never <code>null</code>
   */
  public HgInitCommand createInitCommand() {
    return new HgInitCommand(new HgLookup(context));
  }
View Full Code Here

    // turn off lock timeout, to fail fast
    File hgrc = new File(repoLoc, ".hg/hgrc");
    RepoUtils.createFile(hgrc, "[ui]\ntimeout=0\n"); // or 1
    final OutputParser.Stub p = new OutputParser.Stub();
    ExecHelper eh = new ExecHelper(p, repoLoc);
    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    final HgRepositoryLock wdLock = hgRepo.getWorkingDirLock();
    try {
      wdLock.acquire();
      eh.run("hg", "tag", "tag-aaa");
      Assert.assertNotSame(0 /*returns 0 on success*/, eh.getExitValue());
View Full Code Here

  }

  public static void main(String[] args) throws Exception {
    Map<String, Object> po = new HashMap<String, Object>();
    po.put(DataAccessProvider.CFG_PROPERTY_MAPIO_LIMIT, 0);
    final HgLookup hgLookup = new HgLookup(new BasicSessionContext(po , null));
    final File rebaseFromRepoLoc = RepoUtils.cloneRepoToTempLocation(new File("/temp/hg/junit-test-repos/test-annotate"), "repo-lock-remote", false, true);
    final File rebaseToRepoLoc = RepoUtils.cloneRepoToTempLocation(rebaseFromRepoLoc, "repo-lock-local", false, true);
    final File remoteChanges = new File(rebaseFromRepoLoc, "file1");
    //
    // create commit in the "local" repository that will be rebased on top of changes
View Full Code Here

  private HgRepository repo;
  private final ExecHelper eh;
  private LogOutputParser changelogParser;
 
  public static void main(String[] args) throws Throwable {
    TestHistory th = new TestHistory(new HgLookup().detectFromWorkingDir());
    th.testCompleteLog();
    th.testFollowHistory();
    th.errorCollector.verify();
//    th.testPerformance();
    th.testOriginalTestLogRepo();
View Full Code Here

        //
        // prepare bundle
        BundleGenerator bg = new BundleGenerator(implRepo);
        File bundleFile = bg.create(outgoing.asList());
        progress.worked(20);
        b = new HgLookup(repo.getSessionContext()).loadBundle(bundleFile);
        //
        // send changes
        remoteRepo.unbundle(b, comparator.getRemoteHeads());
      } // update phase information nevertheless
      progress.worked(20);
View Full Code Here

 

  // revision == 2406  -   5 ms per run (baseRevision == 2406)
  // revision == 2405  -  69 ms per run (baseRevision == 1403)
  public void measurePatchAffectsArbitraryRevisionRead() throws Exception {
    final HgRepository repository = new HgLookup().detect(new File("/temp/hg/cpython"));
    final DoNothingManifestInspector insp = new DoNothingManifestInspector();
    final int revision = 2405;
    // warm-up.
    repository.getManifest().walk(revision, revision, insp);
    final int runs = 10;
View Full Code Here

   * Approach 1: total 309, init: 6, iteration: 302
   * Approach 2: total 213, init: 63, iteration: 150
   * Approach 3: total 140
    */
  private void buildFile2ChangelogRevisionMap(String... fileNames) throws Exception {
    final HgRepository repository = new HgLookup().detect(new File("/home/artem/hg/cpython"));
    final HgChangelog clog = repository.getChangelog();
    // warm-up
    HgRevisionMap<HgChangelog> clogMap = new HgRevisionMap<HgChangelog>(clog).init();

    for (String fname : fileNames) {
View Full Code Here

   * each 1000'th revision, total 71 revision: 1 230 vs 270
   * each 2000'th revision, total 36 revision: 620 vs 270
   * each 3000'th revision, total 24 revision: 410 vs 275
   */
  public void revisionMap() throws Exception {
    final HgRepository repository = new HgLookup().detect(new File("/temp/hg/cpython"));
    final HgChangelog clog = repository.getChangelog();
    ArrayList<Nodeid> revisions = new ArrayList<Nodeid>();
    final int step = 5000;
    for (int i = 0, top = clog.getLastRevision(); i < top; i += step) {
      revisions.add(clog.getRevision(i));
View Full Code Here

    }
    System.out.printf("RevisionMap time: %d ms, of that init() %,d ns\n", (System.nanoTime() - s2) / 1000000, s3 - s2);
  }

  public void changelogWalk() throws Exception {
    final HgRepository repository = new HgLookup().detect(new File("/temp/hg/cpython"));
    final long start = System.currentTimeMillis();
    repository.getChangelog().all(new HgChangelog.Inspector() {
      public int xx = 0;
     
      public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) {
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.repo.HgLookup

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.