Examples of Patch


Examples of org.locationtech.geogig.api.plumbing.diff.Patch

    protected  Patch _call() throws RuntimeException {
        Preconditions.checkArgument(patch != null, "No patch file provided");

        VerifyPatchResults verify = command(VerifyPatchOp.class).setPatch(patch)
                .setReverse(reverse).call();
        Patch toReject = verify.getToReject();
        Patch toApply = verify.getToApply();

        if (!applyPartial) {
            if (!toReject.isEmpty()) {
                throw new CannotApplyPatchException(toReject);
            }
View Full Code Here

Examples of org.netbeans.modules.exceptions.entity.Patch

        InputStream is = new FileInputStream(log);
        LogRecords.scan(is, hand);
        EntityManager em = perUtils.createEntityManager();
        Nbversion nbVersion = PersistenceUtils.getAll(em, Nbversion.class).get(0);
        Exceptions exc = PersistenceUtils.getAll(em, Exceptions.class).get(0);
        Patch patch = new Patch(PatchName, ModuleName, "1.1", nbVersion);
        em.getTransaction().begin();
        em.persist(patch);
        em.getTransaction().commit();
        List<String> list = new DetailAction().getPatches(em, exc, hand.list);
        assertNotNull(list);
View Full Code Here

Examples of org.nlogo.agent.Patch

  public Object report(Context context) {
    return report_1(context);
  }

  public Object report_1(Context context) {
    Patch patch;
    if (context.agent instanceof Patch) {
      patch = ((Patch) context.agent).getPatchEast();
    } else if (context.agent instanceof Turtle) {
      patch = ((Turtle) context.agent).getPatchHere().getPatchEast();
    } else {
View Full Code Here

Examples of org.nlogo.api.Patch

      mouseState.xcor_$eq(xi);
      mouseState.ycor_$eq(yi);

      if (agents != null) {
        try {
          Patch patch = world.getPatchAt(xi, yi);
          agents.add(patch);
        } catch (AgentException e) {
          org.nlogo.util.Exceptions.ignore(e);
        }
      }
View Full Code Here

Examples of org.rhq.common.wildfly.Patch

            if (patchInfo == null) {
                throw new UnknownRecipeException();
            }

            if (patchInfo.is(Patch.class)) {
                Patch patch = patchInfo.as(Patch.class);

                String version = patch.getType() == Patch.Type.ONE_OFF ? patch.getTargetVersion() + "+" + patch.getId()
                    : patch.getTargetVersion();

                DeploymentProperties props = new DeploymentProperties(0, patch.getIdentityName(),
                    version, patch.getDescription(), DestinationComplianceMode.full);

                ConfigurationDefinition config = new ConfigurationDefinition("wildfly-patch", null);
                PropertyDefinitionSimple patchIdProp = new PropertyDefinitionSimple("patchId", "The ID of the patch",
                    true,
                    PropertySimpleType.STRING);
                patchIdProp.setDefaultValue(patch.getId());
                patchIdProp.setReadOnly(true);
                PropertyDefinitionSimple patchTypeProp = new PropertyDefinitionSimple("patchType",
                    "The type of the patch",
                    true, PropertySimpleType.STRING);
                patchTypeProp.setDefaultValue(patch.getType().toString());
                patchTypeProp.setReadOnly(true);

                config.put(patchIdProp);
                config.put(patchTypeProp);
                addCommonProperties(config);

                parseResults = new RecipeParseResults(props, config, null);
                fileName = patch.getId();
                recipe = patch.getContents();
            } else if (patchInfo.is(PatchBundle.class)) {
                PatchBundle patchBundle = patchInfo.as(PatchBundle.class);

                Patch lastPatch = null;
                StringBuilder allPatchIds = new StringBuilder();

                for (PatchBundle.Element p : patchBundle) {
                    lastPatch = p.getPatch();
                    allPatchIds.append(p.getPatch().getId()).append("#");
                }
                allPatchIds.replace(allPatchIds.length() - 1, allPatchIds.length(), "");

                if (lastPatch == null) {
                    throw new UnknownRecipeException("Not a Wildfly patch");
                }

                DeploymentProperties props = new DeploymentProperties(0, lastPatch.getIdentityName(),
                    lastPatch.getTargetVersion(), lastPatch.getDescription(), DestinationComplianceMode.full);

                ConfigurationDefinition config = new ConfigurationDefinition("wildfly-patch", null);
                PropertyDefinitionSimple allPatchIdsProp = new PropertyDefinitionSimple("allPatchIds",
                    "Hash-separated list of all individual patches the patch bundle is composed of.", true,
                    PropertySimpleType.STRING);
View Full Code Here

Examples of org.tmatesoft.hg.internal.Patch

    }
    ByteArrayDataAccess baseRevisionContent = new ByteArrayDataAccess(baseRevision.array(), baseRevision.arrayOffset(), baseRevision.remaining());
    //
    final long start = System.currentTimeMillis();
    int n = 1419;
    Patch seqPatch = new Patch(false), normalizedPatch = new Patch(true);
    while (rr.hasMore() && n-- > 0) {
      rr.readNext();
      if (!rr.isPatch()) {
        break;
      }
      if (rr.getDataLength() == 0) {
        System.out.printf("Empty content of revision %d\n", rr.entryIndex);
        continue;
      }
      Patch p1 = createPatch(rr);
      if (n < 1) {
        System.out.println("+" + p1);
        System.currentTimeMillis();
      }
        seqPatch = seqPatch.apply(p1);
        normalizedPatch = normalizedPatch.apply(p1);
//        if (n <= 1) {
//          System.out.println("=" + seqPatch);
//        }
//        if (n == 0) {
//          System.out.println("A" + ppp);
//          System.out.println("N" + normalizedPatch);
//          normalizedPatch = ppp;
//        }
        //
      if (!thoroughCheck) {
        if (baseRevisionContent.length() + seqPatch.patchSizeDelta() != rr.actualLen) {
          System.out.printf("Sequential patches:\tPatchRevision #%d (+%d, cset:%d) failed\n", rr.entryIndex, rr.entryIndex - startEntryIndex, rr.linkRevision);
        }
        if (baseRevisionContent.length() + normalizedPatch.patchSizeDelta() != rr.actualLen) {
          System.out.printf("Normalized patches:\tPatchRevision #%d (+%d, cset:%d) failed\n", rr.entryIndex, rr.entryIndex - startEntryIndex, rr.linkRevision);
        }
      } else {
        byte[] origin = getRevisionTrueContent(indexFile.getParentFile(), rr.entryIndex, rr.linkRevision);
        try {
          byte[] result1 = seqPatch.apply(baseRevisionContent, rr.actualLen);
          if (!Arrays.equals(result1, origin)) {
            System.out.printf("Sequential patches:\tPatchRevision #%d (+%d, cset:%d) failed\n", rr.entryIndex, rr.entryIndex - startEntryIndex, rr.linkRevision);
          }
        } catch (ArrayIndexOutOfBoundsException ex) {
          System.err.printf("Failure at entry %d (+%d)\n", rr.entryIndex, rr.entryIndex - startEntryIndex);
          ex.printStackTrace();
        }
//          try {
//            byte[] result2 = normalizedPatch.apply(baseRevisionContent, rr.actualLen);
//            if (!Arrays.equals(result2, origin)) {
//              System.out.printf("Normalized patches:\tPatchRevision #%d (+%d, cset:%d) failed\n", rr.entryIndex, rr.entryIndex - startEntryIndex, rr.linkRevision);
//            }
//          } catch (ArrayIndexOutOfBoundsException ex) {
//            System.err.printf("Failure at entry %d (+%d)\n", rr.entryIndex, rr.entryIndex - startEntryIndex);
//            ex.printStackTrace();
//          }
      }
    }
    final long end1 = System.currentTimeMillis();
    //
    byte[] result = seqPatch.apply(baseRevisionContent, rr.actualLen);
//    byte[] result = normalizedPatch.apply(baseRevisionContent, rr.actualLen);
    final long end2 = System.currentTimeMillis();
    byte[] origin = getRevisionTrueContent(indexFile.getParentFile(), rr.entryIndex, rr.linkRevision);
    final long end3 = System.currentTimeMillis();
    rr.done();
    System.out.printf("Collected patches up to revision %d. Patches total: %d, sequentialPatch contains %d elements, normalized: %d\n", rr.entryIndex, rr.entryIndex - startEntryIndex + 1, seqPatch.count(), normalizedPatch.count());
    if (!Arrays.equals(result, origin)) {
      if (shallDumpDiff) {
        diff(result, origin);
        dumpLineDifference(result, origin);
      } else {
        System.out.println("FAILURE!");
      }
    } else {
      System.out.println("OK!");
      System.out.printf("Iterate: %d ms, read base:%d, apply collected: %d ms, total=%d ms; Conventional: %d ms\n", (end1-start), (start-s0), (end2-end1), (end2-s0), (end3-end2));
    }
    Patch normalized = seqPatch.normalize();
    System.out.printf("N%s\n%d => %d patch elements\n", normalized, seqPatch.count(), normalized.count());
//    System.out.println(rs);
  }
View Full Code Here

Examples of org.tmatesoft.hg.internal.Patch

    } else {
      patchData.clear();
    }
    rr.getData(patchData);
    patchData.flip();
    Patch patch1 = new Patch();
    patch1.read(new ByteArrayDataAccess(patchData.array(), patchData.arrayOffset(), patchData.remaining()));
    return patch1;
  }
View Full Code Here

Examples of org.tmatesoft.hg.internal.Patch

    }
   
    /*package-local*/ Patch patch() throws IOException {
      if (patches == null) {
        dataAccess.reset();
        patches = new Patch();
        patches.read(dataAccess);
      }
      return patches;
    }
View Full Code Here

Examples of org.tmatesoft.hg.internal.Patch

            String m = String.format("Revision %s import failed: delta base %s is not the last node we've handled (and know content for) %s", ge.node(), deltaBase, prevRevision);
            throw new HgInvalidStateException(m);
          }
        }
        //
        Patch patch = HgInternals.patchFromData(ge);
        byte[] content = patch.apply(prevRevContent, -1);
        Nodeid p1 = ge.firstParent();
        Nodeid p2 = ge.secondParent();
        byte[] calculated = dh.sha1(p1, p2, content).asBinary();
        final Nodeid node = ge.node();
        if (!node.equalsTo(calculated)) {
          String m = String.format("Checksum failed: expected %s, calculated %s. File %s", node, calculated, filename);
          throw new HgRevisionIntegrityException(m, null, new File(hgDir, filename));
        }
        revlogHeader.nodeid(node);
        //
        if (collectChangelogIndexes) {
          changelogIndexes.put(node, revisionSequence.size());
          revlogHeader.linkRevision(revisionSequence.size());
        } else {
          Integer csRev = changelogIndexes.get(ge.cset());
          if (csRev == null) {
            throw new HgInvalidStateException(String.format("Changelog doesn't contain revision %s of %s", ge.cset().shortNotation(), filename));
          }
          revlogHeader.linkRevision(csRev.intValue());
        }
        //
        revlogHeader.parents(knownRevision(p1), knownRevision(p2));
        //
        int patchSerializedLength = patch.serializedLength();
        // no reason to keep patch if it's close (here, >75%) in size to the complete contents,
        // save patching effort in this case
        writeComplete = writeComplete || preferCompleteOverPatch(patchSerializedLength, content.length);

        if (writeComplete) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.