Package org.tmatesoft.hg.util

Examples of org.tmatesoft.hg.util.ProgressSupport$Target


        gen.setNotBefore(new Date(System.currentTimeMillis() - 50000));
        gen.setNotAfter(new Date(System.currentTimeMillis() + 50000));
        gen.setSerialNumber(BigInteger.valueOf(1));
        gen.setSignatureAlgorithm("SHA1WithRSAEncryption");

        Target targetName = new Target(Target.targetName, new GeneralName(GeneralName.dNSName,
            "www.test.com"));

        Target targetGroup = new Target(Target.targetGroup, new GeneralName(
            GeneralName.directoryName, "o=Test, ou=Test"));
        Target[] targets = new Target[2];
        targets[0] = targetName;
        targets[1] = targetGroup;
        TargetInformation targetInformation = new TargetInformation(targets);
View Full Code Here


        gen.setNotBefore(new Date(System.currentTimeMillis() - 50000));
        gen.setNotAfter(new Date(System.currentTimeMillis() + 50000));
        gen.setSerialNumber(BigInteger.ONE);
        gen.setSignatureAlgorithm("SHA1WithRSAEncryption");

        Target targetName = new Target(Target.targetName, new GeneralName(GeneralName.dNSName,
            "www.test.com"));

        Target targetGroup = new Target(Target.targetGroup, new GeneralName(
            GeneralName.directoryName, "o=Test, ou=Test"));
        Target[] targets = new Target[2];
        targets[0] = targetName;
        targets[1] = targetGroup;
        TargetInformation targetInformation = new TargetInformation(targets);
View Full Code Here

      return;
    }
    //
    // in fact, neither cancel nor progress of any use, need them just to check comamnd API
    final CancelSupport noCancel = CancelSupport.Factory.get(null);
    final ProgressSupport noProgress = ProgressSupport.Factory.get(null);
    //
    final Dump dump = new Dump(hgRepo);
    dump.complete(cmdLineOpts.getBoolean("--debug"));
    dump.verbose(cmdLineOpts.getBoolean("-v", "--verbose"));
    final boolean reverseOrder = !cmdLineOpts.getBoolean("--hg4j-order-direct");
View Full Code Here

   *
   * @return branch manager instance, never <code>null</code>
   * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
   */
  public HgBranches getBranches() throws HgRuntimeException {
    final ProgressSupport ps = ProgressSupport.Factory.get(null);
    if (branches == null) {
      branches = new HgBranches(impl);
      branches.collect(ps);
    } else {
      branches.reloadIfChanged(ps);
View Full Code Here

      assert delegate != null;
      inspector = delegate;
      csetBuilder = new ChangesetParser(sessionContext, new RawCsetFactory(true));
      inspectorLifecycle = Adaptable.Factory.getAdapter(delegate, Lifecycle.class, null);
      if (inspectorLifecycle == null) {
        ProgressSupport ph = Adaptable.Factory.getAdapter(delegate, ProgressSupport.class, null);
        CancelSupport cs = Adaptable.Factory.getAdapter(delegate, CancelSupport.class, null);
        if (cs != null || ph != null) {
          lifecycleStub = new LifecycleBridge(ph, cs);
        } else {
          lifecycleStub = null;
View Full Code Here

      throw new IllegalArgumentException();
    }
    if (file == null) {
      throw new HgBadArgumentException("Command needs file argument", null);
    }
    final ProgressSupport progress = getProgressSupport(inspector);
    final CancelSupport cancellation = getCancelSupport(inspector, true);
    cancellation.checkCancelled();
    progress.start(200);
    try {
      HgDataFile df = repo.getFileNode(file);
      if (!df.exists()) {
        return;
      }
      final int changesetStart = followRename ? 0 : df.getChangesetRevisionIndex(0);
      final int annotateRevIndex = annotateRevision.get(TIP);
      HgDiffCommand cmd = new HgDiffCommand(repo).file(df);
      cmd.range(changesetStart, annotateRevIndex);
      cmd.set(cancellation);
      cmd.set(new ProgressSupport.Sub(progress, 100));
      //
//      ReverseAnnotateInspector ai = new ReverseAnnotateInspector();
      ForwardAnnotateInspector ai = new ForwardAnnotateInspector();
      cmd.order(ai.iterateDirection());
      //
      cmd.executeAnnotate(ai);
      cancellation.checkCancelled();
      final int lastCsetWithFileChange;
      Nodeid fileRev = repo.getManifest().getFileRevision(annotateRevIndex, df.getPath());
      if (fileRev != null) {
        lastCsetWithFileChange = df.getChangesetRevisionIndex(df.getRevisionIndex(fileRev));
      } else {
        lastCsetWithFileChange = annotateRevIndex;
      }
      ai.report(lastCsetWithFileChange, inspector, new ProgressSupport.Sub(progress, 100), cancellation);
    } catch (HgRuntimeException ex) {
      throw new HgLibraryFailureException(ex);
    }
    progress.done();
  }
View Full Code Here

   * @throws HgRemoteConnectionException when failed to communicate with remote repository
   * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state
   * @throws CancelledException if execution of the command was cancelled
   */
  public List<Nodeid> executeLite() throws HgRemoteConnectionException, HgException, CancelledException {
    final ProgressSupport ps = getProgressSupport(null);
    try {
      return getOutgoingRevisions(ps, getCancelSupport(null, true));
    } catch (HgRuntimeException ex) {
      throw new HgLibraryFailureException(ex);
    } finally {
      ps.done();
    }
  }
View Full Code Here

   */
  public void executeFull(final HgChangesetHandler handler) throws HgCallbackTargetException, HgException, CancelledException {
    if (handler == null) {
      throw new IllegalArgumentException("Delegate can't be null");
    }
    final ProgressSupport ps = getProgressSupport(handler);
    final CancelSupport cs = getCancelSupport(handler, true);
    try {
      ps.start(200);
      ChangesetTransformer inspector = new ChangesetTransformer(localRepo, handler, getParentHelper(), new ProgressSupport.Sub(ps, 100), cs);
      inspector.limitBranches(branches);
      List<Nodeid> out = getOutgoingRevisions(new ProgressSupport.Sub(ps, 100), cs);
      int[] outRevIndex = new int[out.size()];
      int i = 0;
      for (Nodeid o : out) {
        outRevIndex[i++] = localRepo.getChangelog().getRevisionIndex(o);
      }
      localRepo.getChangelog().range(inspector, outRevIndex);
      inspector.checkFailure();
    } catch (HgRuntimeException ex) {
      throw new HgLibraryFailureException(ex);
    } finally {
      ps.done();
    }
  }
View Full Code Here

   * @throws CancelledException if execution of the command was cancelled
   * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state
   */
  public void executeAnnotate(HgBlameInspector insp) throws HgCallbackTargetException, CancelledException, HgException {
    checkFile();
    ProgressSupport progress = null;
    try {
      if (!df.exists()) {
        return;
      }
      final CancelSupport cancel = getCancelSupport(insp, true);
      BlameHelper bh = new BlameHelper(insp);
      final int startRevIndex = clogRevIndexStart.get(0);
      final int endRevIndex = clogRevIndexEnd.get(TIP);
      FileHistory fileHistory = bh.prepare(df, startRevIndex, endRevIndex);
      //
      cancel.checkCancelled();
      int totalWork = 0;
      for (FileRevisionHistoryChunk fhc : fileHistory.iterate(iterateDirection)) {
        totalWork += fhc.revisionCount();
      }
      progress = getProgressSupport(insp);
      progress.start(totalWork + 1);
      progress.worked(1); // BlameHelper.prepare
      //
      int[] fileClogParentRevs = new int[2];
      int[] fileParentRevs = new int[2];
      for (FileRevisionHistoryChunk fhc : fileHistory.iterate(iterateDirection)) {
        for (int fri : fhc.fileRevisions(iterateDirection)) {
          int clogRevIndex = fhc.changeset(fri);
          // the way we built fileHistory ensures we won't walk past [changelogRevIndexStart..changelogRevIndexEnd]
          assert clogRevIndex >= startRevIndex;
          assert clogRevIndex <= endRevIndex;
          fhc.fillFileParents(fri, fileParentRevs);
          fhc.fillCsetParents(fri, fileClogParentRevs);
          bh.annotateChange(fri, clogRevIndex, fileParentRevs, fileClogParentRevs);
          progress.worked(1);
          cancel.checkCancelled();
        }
      }
    } catch (HgRuntimeException ex) {
      throw new HgLibraryFailureException(ex);
    } finally {
      if (progress != null) {
        progress.done();
      }
    }
  }
View Full Code Here

   * @throws CancelledException if execution of the command was cancelled
   * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state
   */
  public void executeParentsAnnotate(HgBlameInspector insp) throws HgCallbackTargetException, CancelledException, HgException {
    checkFile();
    final ProgressSupport progress = getProgressSupport(insp);
    progress.start(2);
    try {
      final CancelSupport cancel = getCancelSupport(insp, true);
      int changelogRevisionIndex = clogRevIndexEnd.get(TIP);
      // TODO detect if file is text/binary (e.g. looking for chars < ' ' and not \t\r\n\f
      int fileRevIndex = fileRevIndex(df, changelogRevisionIndex);
      int[] fileRevParents = new int[2];
      df.parents(fileRevIndex, fileRevParents, null, null);
      if (changelogRevisionIndex == TIP) {
        changelogRevisionIndex = df.getChangesetRevisionIndex(fileRevIndex);
      }
      int[] fileClogParentRevs = new int[2];
      fileClogParentRevs[0] = fileRevParents[0] == NO_REVISION ? NO_REVISION : df.getChangesetRevisionIndex(fileRevParents[0]);
      fileClogParentRevs[1] = fileRevParents[1] == NO_REVISION ? NO_REVISION : df.getChangesetRevisionIndex(fileRevParents[1]);
      BlameHelper bh = new BlameHelper(insp);
      int clogIndexStart = fileClogParentRevs[0] == NO_REVISION ? (fileClogParentRevs[1] == NO_REVISION ? 0 : fileClogParentRevs[1]) : fileClogParentRevs[0];
      bh.prepare(df, clogIndexStart, changelogRevisionIndex);
      progress.worked(1);
      cancel.checkCancelled();
      bh.annotateChange(fileRevIndex, changelogRevisionIndex, fileRevParents, fileClogParentRevs);
      progress.worked(1);
      cancel.checkCancelled();
    } catch (HgRuntimeException ex) {
      throw new HgLibraryFailureException(ex);
    } finally {
      progress.done();
    }
  }
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.util.ProgressSupport$Target

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.