Package org.tmatesoft.hg.internal.diff.DiffHelper

Examples of org.tmatesoft.hg.internal.diff.DiffHelper.LineSequence


  }
 
  public static Patch delta(byte[] prev, byte[] content) {
    Patch rv = new Patch();
    DiffHelper<LineSequence> pg = new DiffHelper<LineSequence>();
    pg.init(new LineSequence(prev).splitByNewlines(), new LineSequence(content).splitByNewlines());
    pg.findMatchingBlocks(new GeneratePatchInspector(rv));
    return rv;
  }
View Full Code Here


  }
 
  // NO_REVISION is not allowed as any argument
  public void diff(int fileRevIndex1, int clogRevIndex1, int fileRevIndex2, int clogRevIndex2) throws HgCallbackTargetException, HgRuntimeException {
    HgDataFile targetFile = linesCache.getFile(clogRevIndex2);
    LineSequence c1 = linesCache.lines(clogRevIndex1, fileRevIndex1);
    LineSequence c2 = linesCache.lines(clogRevIndex2, fileRevIndex2);
    DiffHelper<LineSequence> pg = new DiffHelper<LineSequence>();
    pg.init(c1, c2);
    BlameBlockInspector bbi = new BlameBlockInspector(targetFile, fileRevIndex2, insp, clogRevIndex1, clogRevIndex2);
    pg.findMatchingBlocks(bbi);
    bbi.checkErrors();
View Full Code Here

    bbi.checkErrors();
  }

  public void annotateChange(int fileRevIndex, int csetRevIndex, int[] fileParentRevs, int[] fileParentClogRevs) throws HgCallbackTargetException, HgRuntimeException {
    HgDataFile targetFile = linesCache.getFile(csetRevIndex);
    final LineSequence fileRevLines = linesCache.lines(csetRevIndex, fileRevIndex);
    if (fileParentClogRevs[0] != NO_REVISION && fileParentClogRevs[1] != NO_REVISION) {
      int p1ClogIndex = fileParentClogRevs[0];
      int p2ClogIndex = fileParentClogRevs[1];
      LineSequence p1Lines = linesCache.lines(p1ClogIndex, fileParentRevs[0]);
      LineSequence p2Lines = linesCache.lines(p2ClogIndex, fileParentRevs[1]);
      MergeResolutionStrategy mergeResolver = createMergeStrategy(fileRevLines, p1Lines, p2Lines, csetRevIndex, fileParentClogRevs);
      //
      DiffHelper<LineSequence> pg = new DiffHelper<LineSequence>();
      pg.init(p1Lines, fileRevLines);
      BlameBlockInspector bbi = new BlameBlockInspector(targetFile, fileRevIndex, insp, p1ClogIndex, csetRevIndex);
      bbi.setMergeParent2(mergeResolver, p2ClogIndex);
      pg.findMatchingBlocks(bbi);
      bbi.checkErrors();
    } else if (fileParentClogRevs[0] == fileParentClogRevs[1]) {
      // may be equal iff both are unset
      assert fileParentClogRevs[0] == NO_REVISION;
      // everything added
      BlameBlockInspector bbi = new BlameBlockInspector(targetFile, fileRevIndex, insp, NO_REVISION, csetRevIndex);
      bbi.begin(LineSequence.newlines(new byte[0]), fileRevLines);
      bbi.match(0, fileRevLines.chunkCount()-1, 0);
      bbi.end();
      bbi.checkErrors();
    } else {
      int soleParentIndex = fileParentClogRevs[0] == NO_REVISION ? 1 : 0;
      assert fileParentClogRevs[soleParentIndex] != NO_REVISION;
      LineSequence parentLines = linesCache.lines(fileParentClogRevs[soleParentIndex], fileParentRevs[soleParentIndex]);
     
      DiffHelper<LineSequence> pg = new DiffHelper<LineSequence>();
      pg.init(parentLines, fileRevLines);
      BlameBlockInspector bbi = new BlameBlockInspector(targetFile, fileRevIndex, insp, fileParentClogRevs[soleParentIndex], csetRevIndex);
      pg.findMatchingBlocks(bbi);
View Full Code Here

          }
        }
       
      });
      //
      LineSequence baseLines = getBaseRevisionLines(csetRevIndex, fileParentClogRevs);
      pg.init(p1Lines, baseLines);
      DiffRangeMap p1ToBase = new DiffRangeMap().fill(pg);
      pg.init(baseLines, p2Lines);
      DiffRangeMap baseToP2 = new DiffRangeMap().fill(pg);
      return new MergeStrategy2(allMatches, p1ToBase, baseToP2);
View Full Code Here

      }
      HgDataFile df = getFile(clogRevIndex);
      try {
        ByteArrayChannel c;
        df.content(fileRevIndex, c = new ByteArrayChannel());
        LineSequence rv = LineSequence.newlines(c.toArray());
        lruCache.addFirst(new Pair<Integer, LineSequence>(clogRevIndex, rv));
        if (lruCache.size() > limit) {
          lruCache.removeLast();
        }
        return rv;
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.internal.diff.DiffHelper.LineSequence

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.