diff --git a/suites/hg/setup-data/mercurial.quick-repo-desc.sh b/suites/hg/setup-data/setup-00-minimal.sh similarity index 63% rename from suites/hg/setup-data/mercurial.quick-repo-desc.sh rename to suites/hg/setup-data/setup-00-minimal.sh index bdcb9368efd63598d8b0b0d592edd06eb3c95bb1_c3VpdGVzL2hnL3NldHVwLWRhdGEvbWVyY3VyaWFsLnF1aWNrLXJlcG8tZGVzYy5zaA==..16556cfccbf842947f8f7e09731f893499d64a71_c3VpdGVzL2hnL3NldHVwLWRhdGEvc2V0dXAtMDAtbWluaW1hbC5zaA== 100755 --- a/suites/hg/setup-data/mercurial.quick-repo-desc.sh +++ b/suites/hg/setup-data/setup-00-minimal.sh @@ -5,7 +5,14 @@ # You still have to build the env by hand. set -euo pipefail +if [ $# -ne 3 ]; then + echo >&2 "USAGE: setup-00-minimal.sh ENV-NAME DATA-ENV-PATH REPO-PATH" + echo >&2 " ENV-NAME: the name that will be recorded for the data-env" + echo >&2 " DATA-ENV-PATH: the path to that data-env" + echo >&2 " REPO-PATH: the path of the main repository within that data-env" +fi + env_name=$1 data_env_directory=$2 repository_path=$3 @@ -8,8 +15,8 @@ env_name=$1 data_env_directory=$2 repository_path=$3 -repo="$data_env_directory/$repository_path" +repo="${data_env_directory}/${repository_path}" desc="${data_env_directory}/data-env.poulpe" @@ -20,8 +27,3 @@ env-desc set "$desc" poulpe-environment.setup-method manual env-desc set "$desc" data-env-vars.name "$env_name" env-desc set "$desc" bench-input-vars.mercurial.main-repo-path "$repository_path" -env-desc set "$desc" bench-input-vars.mercurial.status.clean.no-iu "$repository_path" - -for line in `hg debugformat -R $repo | sed 's/: \+/;/' | grep -v ' '`; do - env-desc set "$desc" data-env-vars.mercurial.repo.format.`echo $line | sed 's/;/ /'` -done diff --git a/suites/hg/setup-data/mercurial.quick-repo-desc.sh b/suites/hg/setup-data/setup-10-format.sh similarity index 36% copy from suites/hg/setup-data/mercurial.quick-repo-desc.sh copy to suites/hg/setup-data/setup-10-format.sh index bdcb9368efd63598d8b0b0d592edd06eb3c95bb1_c3VpdGVzL2hnL3NldHVwLWRhdGEvbWVyY3VyaWFsLnF1aWNrLXJlcG8tZGVzYy5zaA==..16556cfccbf842947f8f7e09731f893499d64a71_c3VpdGVzL2hnL3NldHVwLWRhdGEvc2V0dXAtMTAtZm9ybWF0LnNo 100755 --- a/suites/hg/setup-data/mercurial.quick-repo-desc.sh +++ b/suites/hg/setup-data/setup-10-format.sh @@ -1,7 +1,10 @@ #!/bin/bash # -# Simple script to record a directory containing a mercurial clone as a data-env +# Simple script to record the format variant of a data-envs +# +# This only record the variant of the main repository. The side repository are +# assumed to have the format. # # You still have to build the env by hand. set -euo pipefail @@ -4,8 +7,9 @@ # # You still have to build the env by hand. set -euo pipefail -env_name=$1 -data_env_directory=$2 -repository_path=$3 +if [ $# -ne 1 ]; then + echo >&2 "USAGE: setup-10-format.sh DATA-ENV-PATH" + echo >&2 " DATA-ENV-PATH: the path to that data-env" +fi @@ -11,5 +15,4 @@ -repo="$data_env_directory/$repository_path" - +data_env_directory=$1 desc="${data_env_directory}/data-env.poulpe" @@ -14,4 +17,4 @@ desc="${data_env_directory}/data-env.poulpe" -rm -f "$desc" +repository_path="`env-desc get "$desc" bench-input-vars.mercurial.main-repo-path`" @@ -17,10 +20,5 @@ -env-desc set "$desc" poulpe-environment.environment-type data -env-desc set "$desc" poulpe-environment.format-version 0 -env-desc set "$desc" poulpe-environment.setup-method manual -env-desc set "$desc" data-env-vars.name "$env_name" -env-desc set "$desc" bench-input-vars.mercurial.main-repo-path "$repository_path" -env-desc set "$desc" bench-input-vars.mercurial.status.clean.no-iu "$repository_path" +repo="$data_env_directory/$repository_path" for line in `hg debugformat -R $repo | sed 's/: \+/;/' | grep -v ' '`; do env-desc set "$desc" data-env-vars.mercurial.repo.format.`echo $line | sed 's/;/ /'` diff --git a/suites/hg/setup-data/mercurial.quick-repo-desc.sh b/suites/hg/setup-data/setup-50-status.sh similarity index 22% copy from suites/hg/setup-data/mercurial.quick-repo-desc.sh copy to suites/hg/setup-data/setup-50-status.sh index bdcb9368efd63598d8b0b0d592edd06eb3c95bb1_c3VpdGVzL2hnL3NldHVwLWRhdGEvbWVyY3VyaWFsLnF1aWNrLXJlcG8tZGVzYy5zaA==..16556cfccbf842947f8f7e09731f893499d64a71_c3VpdGVzL2hnL3NldHVwLWRhdGEvc2V0dXAtNTAtc3RhdHVzLnNo 100755 --- a/suites/hg/setup-data/mercurial.quick-repo-desc.sh +++ b/suites/hg/setup-data/setup-50-status.sh @@ -1,4 +1,4 @@ #!/bin/bash # -# Simple script to record a directory containing a mercurial clone as a data-env +# Simple script to record bench-input-vars for status. # @@ -4,4 +4,5 @@ # -# You still have to build the env by hand. +# /!\ For now it only fills the `mercurial.status.clean.no-iu` variants, +# /!\ More work is needed to actually setup more interresting variants set -euo pipefail @@ -6,6 +7,7 @@ set -euo pipefail -env_name=$1 -data_env_directory=$2 -repository_path=$3 +if [ $# -ne 1 ]; then + echo >&2 "USAGE: setup-50-status.sh DATA-ENV-PATH" + echo >&2 " DATA-ENV-PATH: the path to that data-env" +fi @@ -11,5 +13,4 @@ -repo="$data_env_directory/$repository_path" - +data_env_directory=$1 desc="${data_env_directory}/data-env.poulpe" @@ -14,4 +15,4 @@ desc="${data_env_directory}/data-env.poulpe" -rm -f "$desc" +repository_path="`env-desc get "$desc" bench-input-vars.mercurial.main-repo-path`" @@ -17,7 +18,2 @@ -env-desc set "$desc" poulpe-environment.environment-type data -env-desc set "$desc" poulpe-environment.format-version 0 -env-desc set "$desc" poulpe-environment.setup-method manual -env-desc set "$desc" data-env-vars.name "$env_name" -env-desc set "$desc" bench-input-vars.mercurial.main-repo-path "$repository_path" env-desc set "$desc" bench-input-vars.mercurial.status.clean.no-iu "$repository_path" @@ -23,5 +19,1 @@ env-desc set "$desc" bench-input-vars.mercurial.status.clean.no-iu "$repository_path" - -for line in `hg debugformat -R $repo | sed 's/: \+/;/' | grep -v ' '`; do - env-desc set "$desc" data-env-vars.mercurial.repo.format.`echo $line | sed 's/;/ /'` -done diff --git a/suites/hg/setup-data/mercurial.quick-repo-desc.sh b/suites/hg/setup-data/setup-full.sh similarity index 14% copy from suites/hg/setup-data/mercurial.quick-repo-desc.sh copy to suites/hg/setup-data/setup-full.sh index bdcb9368efd63598d8b0b0d592edd06eb3c95bb1_c3VpdGVzL2hnL3NldHVwLWRhdGEvbWVyY3VyaWFsLnF1aWNrLXJlcG8tZGVzYy5zaA==..16556cfccbf842947f8f7e09731f893499d64a71_c3VpdGVzL2hnL3NldHVwLWRhdGEvc2V0dXAtZnVsbC5zaA== 100755 --- a/suites/hg/setup-data/mercurial.quick-repo-desc.sh +++ b/suites/hg/setup-data/setup-full.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# Simple script to record a directory containing a mercurial clone as a data-env +# Simple script to fully setup a # # You still have to build the env by hand. set -euo pipefail @@ -4,8 +4,17 @@ # # You still have to build the env by hand. set -euo pipefail +if [ $# -ne 3 ]; then + echo >&2 "USAGE: setup-full.sh ENV-NAME DATA-ENV-PATH REPO-PATH" + echo >&2 " ENV-NAME: the name that will be recorded for the data-env" + echo >&2 " DATA-ENV-PATH: the path to that data-env" + echo >&2 " REPO-PATH: the path of the main repository within that data-env" +fi + +script_dir="`dirname $0`" + env_name=$1 data_env_directory=$2 repository_path=$3 @@ -8,10 +17,7 @@ env_name=$1 data_env_directory=$2 repository_path=$3 -repo="$data_env_directory/$repository_path" - -desc="${data_env_directory}/data-env.poulpe" - -rm -f "$desc" +# XXX should probably automatically find script and run them. However there are +# few of them now so explicit listing seems simpler. @@ -17,11 +23,7 @@ -env-desc set "$desc" poulpe-environment.environment-type data -env-desc set "$desc" poulpe-environment.format-version 0 -env-desc set "$desc" poulpe-environment.setup-method manual -env-desc set "$desc" data-env-vars.name "$env_name" -env-desc set "$desc" bench-input-vars.mercurial.main-repo-path "$repository_path" -env-desc set "$desc" bench-input-vars.mercurial.status.clean.no-iu "$repository_path" - -for line in `hg debugformat -R $repo | sed 's/: \+/;/' | grep -v ' '`; do - env-desc set "$desc" data-env-vars.mercurial.repo.format.`echo $line | sed 's/;/ /'` -done +echo "create the base data-env" +"${script_dir}"/setup-00-minimal.sh $env_name $data_env_directory $repository_path +echo "register the format details" +"${script_dir}"/setup-10-format.sh $data_env_directory +echo "setup for \`hg status\` benchmark" +"${script_dir}"/setup-50-status.sh $data_env_directory diff --git a/tests/test-data-setup.t b/tests/test-data-setup.t new file mode 100644 index 0000000000000000000000000000000000000000..16556cfccbf842947f8f7e09731f893499d64a71_dGVzdHMvdGVzdC1kYXRhLXNldHVwLnQ= --- /dev/null +++ b/tests/test-data-setup.t @@ -0,0 +1,54 @@ +Test the utility to setup data environment +------------------------------------------ + +This tests the data setup script for Mercurial. + + $ PATH="${TESTDIR}/../bin:$PATH" + $ SETUP_PATH="${TESTDIR}/../suites/hg/setup-data/" + +Basic manual setup of the data-env data + + $ mkdir my-data-env + $ hg init my-data-env/base-repo/ + $ hg -R my-data-env/base-repo/ debugbuilddag +1524 --new-file + +Test the full setup +-------------------- + + $ "${SETUP_PATH}"/setup-full.sh "my-test-data-env" my-data-env base-repo + create the base data-env + creating new file: "my-data-env/data-env.poulpe" + register the format details + setup for `hg status` benchmark + + $ env-desc show my-data-env/data-env.poulpe + bench-input-vars: + mercurial: + main-repo-path = base-repo + status: + clean: + no-iu = base-repo + data-env-vars: + mercurial: + repo: + format: + changelog-v2 = no + compression = zstd + compression-level = default + copies-sdc = no + dirstate-v2 = no + dotencode = yes + fncache = yes + generaldelta = yes + persistent-nodemap = yes (rust !) + persistent-nodemap = no (no-rust !) + plain-cl-delta = yes + revlog-v2 = no + share-safe = yes + sparserevlog = yes + tracked-hint = no + name = my-test-data-env + poulpe-environment: + environment-type = data + format-version = 0 + setup-method = manual