Package org.tmatesoft.hg.internal.DataSerializer

Examples of org.tmatesoft.hg.internal.DataSerializer.ByteArrayDataSource


    new ExecHelper(new OutputParser.Stub(), repoLoc).run("hg", "commit", "--addremove", "-m", "FIRST");
    //
    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), 0);
    HgDataFile df = hgRepo.getFileNode("file1");
    cf.add(df, new ByteArrayDataSource("hello\nworld".getBytes()));
    Transaction tr = newTransaction(hgRepo);
    Nodeid secondRev = cf.commit("SECOND", tr);
    tr.commit();
    //
    List<HgChangeset> commits = new HgLogCommand(hgRepo).execute();
View Full Code Here


    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    assertEquals("[sanity]", 0, new HgLogCommand(hgRepo).execute().size());
    CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), NO_REVISION);
    HgDataFile df = hgRepo.getFileNode(fname);
    final byte[] initialContent = "hello\nworld".getBytes();
    cf.add(df, new ByteArrayDataSource(initialContent));
    String comment = "commit 1";
    Transaction tr = newTransaction(hgRepo);
    Nodeid c1Rev = cf.commit(comment,  tr);
    tr.commit();
    List<HgChangeset> commits = new HgLogCommand(hgRepo).execute();
View Full Code Here

          assert patchBaseRev != NO_REVISION;
          ReadContentInspector insp = new ReadContentInspector().read(revlogStream, patchBaseRev);
          complete = p.apply(new ByteArrayDataAccess(insp.content), -1);
          baseRev = lastEntryIndex + 1;
        }
        ds = new ByteArrayDataSource(complete);
        revLen = complete.length;
      } catch (IOException ex) {
        // unlikely to happen, as ByteArrayDataSource throws IOException only in case of programming errors
        // hence, throwing rt exception here makes more sense here than HgIOException (even that latter is in throws)
        throw new HgInvalidDataFormatException("Failed to reconstruct revision", ex);
View Full Code Here

    }
    //
    Patch patch = GeneratePatchInspector.delta(lastFullContent.second(), contentByteArray);
    int patchSerializedLength = patch.serializedLength();
    final boolean writeComplete = preferCompleteOverPatch(patchSerializedLength, contentByteArray.length);
    DataSerializer.DataSource dataSource = writeComplete ? new ByteArrayDataSource(contentByteArray) : patch.new PatchDataSource();
    //
    doAdd(newRev, p1, p2, linkRevision, writeComplete ? lastEntryIndex+1 : lastEntryBase, contentByteArray.length, dataSource);
    lastFullContent = new Pair<Integer, byte[]>(lastEntryIndex, contentByteArray);
    return new Pair<Integer, Nodeid>(lastEntryIndex, lastEntryRevision);
  }
View Full Code Here

        if (writeComplete) {
          revlogHeader.baseRevision(revisionSequence.size());
        }
        assert revlogHeader.baseRevision() >= 0;

        DataSerializer.DataSource dataSource = writeComplete ? new ByteArrayDataSource(content) : patch.new PatchDataSource();
        revlogDataZip.reset(dataSource);
        final int compressedLen;
        final boolean useUncompressedData = preferCompressedOverComplete(revlogDataZip.getCompressedLength(), dataSource.serializeLength());
        if (useUncompressedData) {
          // compression wasn't too effective,
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.internal.DataSerializer.ByteArrayDataSource

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.