Package org.tmatesoft.hg.repo

Examples of org.tmatesoft.hg.repo.HgInvalidStateException


      final String nullmerge = "-2";
      while (it.hasNext()) {
        String line = it.next();
        int x = line.indexOf(':');
        if (x == -1) {
          throw new HgInvalidStateException(line);
        }
        Nodeid oldRev = Nodeid.fromAscii(line.substring(0, x));
        Nodeid newRev;
        if (line.regionMatches(x+1, nullmerge, 0, nullmerge.length())) {
          newRev = null;
View Full Code Here


    if (sha1 == null) {
      try {
        sha1 = MessageDigest.getInstance("SHA-1");
      } catch (NoSuchAlgorithmException ex) {
        // could hardly happen, JDK from Sun always has sha1.
        HgInvalidStateException t = new HgInvalidStateException("Need SHA-1 algorithm for nodeid calculation");
        t.initCause(ex);
        throw t;
      }
    }
    return sha1;
  }
View Full Code Here

      // no-op
    }

    @Override
    public void rollback() throws HgIOException {
      throw new HgInvalidStateException("This transaction doesn't support rollback");
    }
View Full Code Here

        dataFile = revlogStream.getDataStreamWriter(transaction);
      }
      if (useCompressedData) {
        int actualCompressedLenWritten = revlogDataZip.writeCompressedData(dataFile);
        if (actualCompressedLenWritten != compressedLen) {
          throw new HgInvalidStateException(String.format("Expected %d bytes of compressed data, but actually wrote %d in %s", compressedLen, actualCompressedLenWritten, revlogStream.getDataFileName()));
        }
      } else {
        dataFile.writeByte((byte) 'u');
        dataSource.serialize(dataFile);
      }
View Full Code Here

    processInconsistent = !onlyConsistent;
  }

  public ByteBuffer filter(ByteBuffer src) {
    if (!processInconsistent && !previewDone) {
      throw new HgInvalidStateException("This filter requires preview operation prior to actual filtering when eol.only-consistent is true");
    }
    if (!processInconsistent && foundLoneLF && foundCRLF) {
      // do not process inconsistent newlines
      return src;
    }
View Full Code Here

    for (int i = max(pos-10, 0), x = min(pos + 10, b.limit()); i < x; i++) {
      sb.append(String.format("%02x ", b.get(i)));
    }
    // TODO post-1.0 need HgBadDataException (not InvalidState but smth closer to data stream error)
    // but don't want to add class for the single use now
    throw new HgInvalidStateException(String.format("Inconsistent newline characters in the stream %s (char 0x%x, local index:%d)", sb.toString(), b.get(pos), pos));
  }
View Full Code Here

   * @throws HgRemoteConnectionException
   */
  HttpAuthMethod(SessionContext sessionContext, URL url) throws HgRemoteConnectionException {
    ctx = sessionContext;
    if (!"http".equals(url.getProtocol()) && !"https".equals(url.getProtocol())) {
      throw new HgInvalidStateException(String.format("http protocol expected: %s", url.toString()));
    }
    this.url = url;
    if ("https".equals(url.getProtocol())) {
      try {
        sslContext = SSLContext.getInstance("SSL");
View Full Code Here

  @Override
  public void commit() throws HgIOException {
    for (Iterator<RollbackEntry> it = entries.iterator(); it.hasNext();) {
      RollbackEntry e = it.next();
      if (!e.success) {
        throw new HgInvalidStateException(String.format("Attempt to commit transaction without successful clearance of file %s", e.origin));
      }
      if (e.failure != null) {
        throw new HgIOException("Can't close transaction with a failure.", e.failure, e.origin);
      }
      if (!e.keepBackup && e.backup != null) {
View Full Code Here

      if (failure[0] != null) {
        throw failure[0];
      }
      throw new HgIOException("Write failure", ex, new File(file.getRepo().getWorkingDir(), file.getPath().toString()));
    } catch (CancelledException ex) {
      throw new HgInvalidStateException("Our channel doesn't cancel here");
    }
  }
View Full Code Here

        // we didn't see this target revision as origin yet
        // the only way this may happen is that this revision was a merge parent
        activeEquals = mergedRanges.get(rd.targetChangesetIndex());
        activeEqualsComesFromMerge = true;
        if (activeEquals == null) {
          throw new HgInvalidStateException(String.format("Can't find previously visited revision %d (while in %d->%1$d diff)", rd.targetChangesetIndex(), rd.originChangesetIndex()));
        }
      }
    }
  }
View Full Code Here

TOP

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

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.