comparison hg-web/repository_sync_test.sh @ 249:c5129452493e

[deploy] Bundle Mercurial with hg-web Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Tue, 04 Aug 2026 04:16:45 -0700
parents
children
comparison
equal deleted inserted replaced
248:b8b6e726964a 249:c5129452493e
1 #!/usr/bin/env bash
2 set -Eeuo pipefail
3
4 if [[ -n "${RUNFILES_DIR:-}" ]]; then
5 source "$RUNFILES_DIR/bazel_tools/tools/bash/runfiles/runfiles.bash"
6 elif [[ -n "${RUNFILES_MANIFEST_FILE:-}" ]]; then
7 runfiles_library="$(
8 grep -sm1 '^bazel_tools/tools/bash/runfiles/runfiles.bash ' \
9 "$RUNFILES_MANIFEST_FILE" | cut -d' ' -f2-
10 )"
11 source "$runfiles_library"
12 else
13 echo "Bazel runfiles are unavailable." >&2
14 exit 1
15 fi
16
17 hg_binary="$(rlocation _main/third_party/mercurial/runtime/bin/hg)"
18 root="${TEST_TMPDIR:?}/repository-sync"
19 source_repository="$root/source"
20 production_repository="$root/production"
21 bundle="$root/workspace.hg"
22 mkdir -p "$root"
23
24 HGRCPATH= "$hg_binary" init "$source_repository"
25 printf 'base\n' > "$source_repository/file.txt"
26 HGRCPATH= "$hg_binary" --cwd "$source_repository" add file.txt
27 HGRCPATH= "$hg_binary" --cwd "$source_repository" \
28 commit -u test -m base
29
30 HGRCPATH= "$hg_binary" clone \
31 "$source_repository" "$production_repository"
32
33 printf 'workspace\n' >> "$source_repository/file.txt"
34 HGRCPATH= "$hg_binary" --cwd "$source_repository" \
35 commit -u test -m workspace
36
37 printf 'production\n' >> "$production_repository/file.txt"
38 HGRCPATH= "$hg_binary" --cwd "$production_repository" \
39 commit -u test -m production
40
41 HGRCPATH= "$hg_binary" --repository "$source_repository" \
42 bundle --all "$bundle"
43 HGRCPATH= "$hg_binary" --repository "$production_repository" \
44 pull "$bundle"
45
46 descriptions="$(
47 HGRCPATH= "$hg_binary" --repository "$production_repository" \
48 log -T '{desc}\n'
49 )"
50 grep -qx workspace <<<"$descriptions"
51 grep -qx production <<<"$descriptions"
52 [[ "$(
53 HGRCPATH= "$hg_binary" --repository "$production_repository" \
54 heads -T '.'
55 )" == ".." ]]