private void testPatch(Patch patch) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(out, Charsets.UTF_8); PatchSerializer.write(writer, patch); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); Patch serializedPatch = PatchSerializer.read(reader); assertEquals(patch, serializedPatch); }
private void testPatch(Patch patch) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(out, Charsets.UTF_8); PatchSerializer.write(writer, patch); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); Patch serializedPatch = PatchSerializer.read(reader); assertEquals(patch, serializedPatch); }
/** * Executes the format-patch command with the specified options. */ @Override protected void runInternal(GeogigCLI cli) throws IOException { checkParameter(refSpec.size() < 3, "Commit list is too long :%s", refSpec); GeoGIG geogig = cli.getGeogig(); checkParameter(file != null, "Patch file not specified"); try (AutoCloseableIterator<DiffEntry> entries = buildEntries(cli)) { if (!entries.hasNext()) { cli.getConsole().println("No differences found"); return; } Patch patch = geogig.command(CreatePatchOp.class).setDiffs(entries).call(); FileOutputStream fos = new FileOutputStream(file); OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8"); PatchSerializer.write(out, patch); } }
/** * Executes the format-patch command with the specified options. */ @Override protected void runInternal(GeogigCLI cli) throws IOException { checkParameter(refSpec.size() < 3, "Commit list is too long :%s", refSpec); GeoGIG geogig = cli.getGeogig(); checkParameter(file != null, "Patch file not specified"); try (AutoCloseableIterator<DiffEntry> entries = buildEntries(cli)) { if (!entries.hasNext()) { cli.getConsole().println("No differences found"); return; } Patch patch = geogig.command(CreatePatchOp.class).setDiffs(entries).call(); FileOutputStream fos = new FileOutputStream(file); OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8"); PatchSerializer.write(out, patch); } }
/** * Executes the format-patch command with the specified options. */ @Override protected void runInternal(GeogigCLI cli) throws IOException { checkParameter(refSpec.size() < 3, "Commit list is too long :%s", refSpec); GeoGIG geogig = cli.getGeogig(); checkParameter(file != null, "Patch file not specified"); try (AutoCloseableIterator<DiffEntry> entries = buildEntries(cli)) { if (!entries.hasNext()) { cli.getConsole().println("No differences found"); return; } Patch patch = geogig.command(CreatePatchOp.class).setDiffs(entries).call(); FileOutputStream fos = new FileOutputStream(file); OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8"); PatchSerializer.write(out, patch); } }
sb.append(Integer.toString(rejected.count()) + " changes were rejected.\n"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); PatchSerializer.write(writer, patch); writer.flush(); writer.close();
sb.append(Integer.toString(rejected.count()) + " changes were rejected.\n"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); PatchSerializer.write(writer, patch); writer.flush(); writer.close();
sb.append(Integer.toString(rejected.count()) + " changes were rejected.\n"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); PatchSerializer.write(writer, patch); writer.flush(); writer.close();
@Given("^I have a patch file$") public void I_have_a_patch_file() throws Throwable { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object oldValue = points1.getProperty("sp").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, "new"); map.put(pointsType.getDescriptor("sp"), diff); FeatureDiff feaureDiff = new FeatureDiff(path, map, RevFeatureTypeBuilder.build(pointsType), RevFeatureTypeBuilder.build(pointsType)); patch.addModifiedFeature(feaureDiff); File file = new File(localRepo.platform.pwd(), "test.patch"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); PatchSerializer.write(writer, patch); writer.flush(); writer.close(); }
@Given("^I have a patch file$") public void I_have_a_patch_file() throws Throwable { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object oldValue = points1.getProperty("sp").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, "new"); map.put(pointsType.getDescriptor("sp"), diff); FeatureDiff feaureDiff = new FeatureDiff(path, map, RevFeatureTypeBuilder.build(pointsType), RevFeatureTypeBuilder.build(pointsType)); patch.addModifiedFeature(feaureDiff); File file = new File(localRepo.platform.pwd(), "test.patch"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); PatchSerializer.write(writer, patch); writer.flush(); writer.close(); }
@Given("^I have a patch file$") public void I_have_a_patch_file() throws Throwable { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object oldValue = points1.getProperty("sp").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, "new"); map.put(pointsType.getDescriptor("sp"), diff); FeatureDiff feaureDiff = new FeatureDiff(path, map, RevFeatureType.builder().type(pointsType).build(), RevFeatureType.builder().type(pointsType).build()); patch.addModifiedFeature(feaureDiff); File file = new File(localRepo.platform.pwd(), "test.patch"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); PatchSerializer.write(writer, patch); writer.flush(); writer.close(); }