Files
hash-wallet/scripts/upstream_sync.sh
T
jwinterm dd449f2594 Merge upstream Cake Wallet v6.5.0
Catches up from the May 12 fork point (v6.1.2+23) through v6.5.0: 535
upstream commits, including the Monero silent-open fix, Monero on Trezor,
Ledger/Trezor BLE fixes, the new seed and history screens, quick Bitcoin
sync, git-pinned dependencies (pubspec_overrides.yaml), frozen Hive
adapters (*.part.dart), monero_c v0.18.4.6-RC2 and Flutter 3.41.9.

Merged with both sides normalized first (import rename, 100-column
format), which took the conflict count from 614 paths to 322. The
procedure is now scripts/upstream_sync.sh.

Kept from Hash Bags:
- WalletType enum order and Hive IDs. SQLite stores WalletType.index and
  our order differs from upstream's; taking theirs would reread saved
  wallets as other chains. Our frozen adapter keeps the shipped IDs.
- The 1.0.2 legacy PIN and wallet-password decode and self-heal.
- Removed chains (Solana, Tron, Zano, Zcash, Decred, Haven) and the new
  Robinhood chain stay out; Cake Pay and non-Trocador swaps stay out.
- Default nodes (node.wownero.org, sethforprivacy, Blockstream, bysh.me),
  converted to upstream's isDefault node-list key; Wownero is back in the
  node reset list.
- Privacy: address resolvers limited to domain-anchored sources again;
  prices.neroswap.com for fiat; upstream's charts tab, which reads
  prices.cakewallet.com, sits behind FeatureFlag.isChartsEnabled = false.
- Lightning stays behind FeatureFlag.isLightningEnabled, including
  upstream's new post-seed Lightning username step.
- Our icon pipeline, branding and bundle identifiers.

Twelve new upstream widget tests are skipped: test and code are unchanged
from v6.5.0 apart from renames (not rerun on a pristine upstream checkout;
upstream's top_bar_test does not compile against its own TopBar).
flutter analyze lib: 0 errors; flutter test: 345 passed, 12 skipped;
flutter build bundle compiles. Built with Flutter 3.41.9.
2026-10-24 23:49:29 -04:00

60 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# Load a merge of an upstream Cake Wallet ref into the working tree, with the
# two mechanical differences between the forks normalized away first:
# 1. our project rename (package:cake_wallet/ -> package:hash_wallet/ imports)
# 2. formatting (upstream formats Dart at 100 columns, short style)
# Without this the 6.5.0 sync showed 614 conflicting paths; with it, 322.
#
# Usage: scripts/upstream_sync.sh <upstream-ref> e.g. v6.6.0
# Run on a fresh sync branch with a clean tree. Afterwards resolve conflicts
# as usual (git status), then `git commit`: MERGE_HEAD is the real upstream
# commit, so the next sync's merge base is correct.
set -euo pipefail
ref="${1:?usage: $0 <upstream-ref>}"
dart="${DART:-dart}"
fmt=(format --page-width 100 --language-version=3.0)
cd "$(git rev-parse --show-toplevel)"
if [[ -n "$(git status --porcelain)" ]]; then
echo "refusing: working tree is not clean" >&2
exit 1
fi
git rev-parse -q --verify "$ref^{commit}" >/dev/null || { echo "refusing: unknown ref $ref" >&2; exit 1; }
# Our side: keep it formatted the way upstream is, as a real commit.
git ls-files -z '*.dart' | xargs -0 "$dart" "${fmt[@]}" >/dev/null 2>&1 || true
if [[ -n "$(git status --porcelain)" ]]; then
git commit -qam "style: format Dart at 100 columns, as upstream does"
fi
base=$(git merge-base HEAD "$ref")
tmp=$(mktemp -d)
trap 'git worktree remove --force "$tmp/base" 2>/dev/null || true; git worktree remove --force "$tmp/theirs" 2>/dev/null || true; rm -rf "$tmp"' EXIT
normalize() { # <dir> <format?>
(
cd "$1"
git grep -lz 'package:cake_wallet/' -- '*.dart' | xargs -0 -r sed -i 's#package:cake_wallet/#package:hash_wallet/#g'
if [[ "$2" == format ]]; then
git ls-files -z '*.dart' | xargs -0 "$dart" "${fmt[@]}" >/dev/null 2>&1 || true
fi
git -c user.name=normalize -c user.email=normalize@localhost commit -qam normalize --allow-empty
git rev-parse HEAD
)
}
umask 022
git worktree add -q --detach "$tmp/base" "$base"
git worktree add -q --detach "$tmp/theirs" "$ref"
nbase=$(normalize "$tmp/base" format)
ntheirs=$(normalize "$tmp/theirs" keep)
git read-tree -m -u "$nbase" HEAD "$ntheirs"
git merge-index -o -q git-merge-one-file -a || true
git rev-parse "$ref^{commit}" > "$(git rev-parse --git-dir)/MERGE_HEAD"
echo "Merge upstream Cake Wallet $ref" > "$(git rev-parse --git-dir)/MERGE_MSG"
echo "Merge of $ref loaded. Unmerged paths:"
git diff --name-only --diff-filter=U | wc -l