Page MenuHomeSoftware Heritage

D4313.id16421.diff
No OneTemporary

D4313.id16421.diff

diff --git a/swh/loader/mercurial/tests/data/example.json b/swh/loader/mercurial/tests/data/example.json
new file mode 100644
--- /dev/null
+++ b/swh/loader/mercurial/tests/data/example.json
@@ -0,0 +1 @@
+{"directories": ["048960a9eff9a9f22ce2fc2e2bc9b5f73cdfc26a", "09a1bb68db049b4e37540e52ebde76f59126b3a8", "0dad640e1eb9f31cb9d874158318f1f180be9b3a", "181a22e7ad8bbad9bb5846f51c377a7597a0c914", "218ccb1594f7026492c72309974b44aba353d7dc", "93e88b135dc8c3420cd4984e21d8d1eb2781ddce", "d476a11ddfcfce07236a0a03f78e3c1a73bc20ae", "ecf37a29314efe473b399b700c7e5eacc063ba6e", "fa5e6af79e30fc26ab4acbd96388fde22b4c2f36"], "revisions": ["1171aa960a675f8b8327199ff084b6e7c879361d", "23459c9c498542cde67d8d130bc4c0b3084edf5f", "486d227d252ee8a3a01ef40348964f68e21018a5", "65de9d553502aa1f1cb20df179a6ea04e6d2039e", "8f392d7f64419bf4672a75a07f61ce243a7f2c67", "acd77cd84bfca51b3d4f928109a9de52a45618f2", "bb1befca13ceb1a8ebde25cec05966be3eed9bca", "bf91ae31bdb938c2927e741b53af815380340ea7", "c88ea3f5892a5e726739a10eca3afe5d7fa648ce"], "releases": [], "snapshot": "831e126d30afd81b62030547778225577fe5d0d6"}
\ No newline at end of file
diff --git a/swh/loader/mercurial/tests/data/example.sh b/swh/loader/mercurial/tests/data/example.sh
new file mode 100644
--- /dev/null
+++ b/swh/loader/mercurial/tests/data/example.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# TODO HG_REPO from $1 else from environment
+if [ ! -z "$1" ]; then
+ HG_REPO="$1"
+fi
+
+# prepare repository
+hg init "$HG_REPO"
+cd "$HG_REPO"
+cat > .hg/hgrc << EOL
+ [ui]
+ username = Full Name<full.name@domain.tld>
+EOL
+
+# simple file
+echo "# My Project" >> README.md
+hg add README.md
+hg commit -m "Add README"
+
+# file with modification
+echo "Short project description." >> README.md
+hg commit -m "Add project description"
+
+# file in directory
+mkdir -p myproject
+echo '__version__ = "0.0.1"' >> myproject/__init__.py
+hg add myproject/__init__.py
+hg commit -m "Create python package"
+
+# public changesets
+hg phase --public -r ::.
+
+# closed branch
+hg branch v0.0.2
+echo '__version__ = "0.0.2"' > myproject/__init__.py
+hg commit -m "Bump version to 0.0.2"
+hg update default
+echo "# This is the CLI module" >> myproject/cli.py
+hg add myproject/cli.py
+hg commit -m "Create myproject.cli module"
+hg update v0.0.2
+hg merge -r default
+hg commit --close-branch -m "Close branch v0.0.2"
+hg update default
+
+# living branch
+hg branch v0.1.x
+echo '__version__ = "0.1.0"' > myproject/__init__.py
+hg commit -m "Bump version to 0.1.0"
+hg update default
+echo "# This is the utils module" >> myproject/utils.py
+hg add myproject/utils.py
+hg commit -m "Create myproject.utils module"
+hg update v0.1.x
+hg merge -r default
+hg commit -m "Merge default"
+hg update default
diff --git a/swh/loader/mercurial/tests/data/example.tgz b/swh/loader/mercurial/tests/data/example.tgz
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/swh/loader/mercurial/tests/test_loader.py b/swh/loader/mercurial/tests/test_loader.py
--- a/swh/loader/mercurial/tests/test_loader.py
+++ b/swh/loader/mercurial/tests/test_loader.py
@@ -26,7 +26,7 @@
def test_examples(swh_config, datadir, tmp_path):
- for archive_name in ("hello", "transplant", "the-sandbox"):
+ for archive_name in ("hello", "transplant", "the-sandbox", "example"):
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
json_path = os.path.join(datadir, f"{archive_name}.json")
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 17, 2:29 PM (2 d, 22 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217408

Event Timeline