Package org.tmatesoft.hg.internal.DataSerializer

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


    // Register new/changed
    FNCacheFile.Mediator fncache = new FNCacheFile.Mediator(repo, transaction);
    ArrayList<Path> touchInDirstate = new ArrayList<Path>();
    for (Pair<HgDataFile, DataSource> e : files.values()) {
      HgDataFile df = e.first();
      DataSource bds = e.second();
      Pair<Integer, Integer> fp = fileParents.get(df.getPath());
      if (fp == null) {
        // NEW FILE, either just added or resurrected from p2
        Nodeid fileRevInP2;
        if ((fileRevInP2 = c2Manifest.nodeid(df.getPath())) != null) {
          fp = new Pair<Integer, Integer>(df.getRevisionIndex(fileRevInP2), NO_REVISION);
        } else {
          // brand new
          fp = new Pair<Integer, Integer>(NO_REVISION, NO_REVISION);
        }
      }
      // TODO if fp.first() != NO_REVISION and fp.second() != NO_REVISION check if one
      // revision is ancestor of another and use the latest as p1, then
      Nodeid fileRev = null;
      final boolean isNewFile = !df.exists();
      if (fp.first() != NO_REVISION && fp.second() == NO_REVISION && !isNewFile) {
        // compare file contents to see if anything has changed, and reuse old revision, if unchanged.
        // XXX ineffective, need better access to revision conten
        ByteArraySerializer bas = new ByteArraySerializer();
        bds.serialize(bas);
        final byte[] newContent = bas.toByteArray();
        // unless there's a way to reset DataSource, replace it with the content just read
        bds = new DataSerializer.ByteArrayDataSource(newContent);
        if (new ComparatorChannel(newContent).same(df, fp.first())) {
          fileRev = df.getRevision(fp.first());
View Full Code Here


    //
    final Nodeid patchBase = ge.patchBase();
    int patchBaseRev = patchBase.isNull() ? NO_REVISION : revlogRevs.revisionIndex(patchBase);
    int baseRev = lastEntryIndex == NO_REVISION ? 0 : revlogStream.baseRevision(patchBaseRev);
    int revLen;
    DataSource ds;
    byte[] complete = null;
    if (patchBaseRev == lastEntryIndex && lastEntryIndex != NO_REVISION) {
      // we may write patch from GroupElement as is
      int patchBaseLen = dataLength(patchBaseRev);
      revLen = patchBaseLen + p.patchSizeDelta();
View Full Code Here

TOP

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

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.