Files
shorebird-updater/patch
Bryan Oltman d30931771b fix: Don't make network request while holding config lock (#161)
* Add test to demonstrate hang when attempting to init while waiting for a patch check request

* Fix thread contention when initing during patch check

* Clean up test

* revert change to fake_yaml

* reorg

* lower timeout in test
2024-05-14 10:05:38 -04:00
..
2024-02-27 14:58:58 -05:00

patch command line tool

This is the tool used by the shorebird command line to compute the patch file for uploading to the server.

This currently uses the rust bidiff crate to compute the patch file. and could just use the bic command line tool included in that crate. However we're explicitly writing our own command line to allow us to change the underlying compression without affecting the shorebird command line callers.

Usage

patch <old> <new> <patch>

Generating test expectations

The string_patch target can be used to generate test expectations for testing the updater. It takes two strings as arguments and prints the necessary variables you will need in your test to stdout.

% cargo run --bin=string_patch "foo" "bar"
Base: foo
New: bar
Patch: [40, 181, 47, 253, 0, 128, 113, 0, 0, 223, 177, 0, 0, 0, 16, 0, 0, 0, 3, 98, 97, 114, 0]
Hash (new): fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9

Which will translate into:

let base = "foo";
let new = "bar";
let patch: Vec<u8> = vec![40, 181, 47, 253, 0, 128, 113, 0, 0, 223, 177, 0, 0, 0, 16, 0, 0, 0, 3, 98, 97, 114, 0];
let hash = "fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9";