Skip to content

Commit

Permalink
Merge pull request #1024 from danchr/hg-archive-branch
Browse files Browse the repository at this point in the history
Read branch data from Mercurial archives
  • Loading branch information
RonnyPfannschmidt authored Apr 22, 2024
2 parents d8d2b86 + 53e9930 commit d75201a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/setuptools_scm/hg.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def archival_to_version(data: dict[str, str], config: Configuration) -> ScmVersi
data["latesttag"],
distance=int(data["latesttagdistance"]),
node=node,
branch=data.get("branch"),
config=config,
)
else:
Expand Down
10 changes: 8 additions & 2 deletions testing/test_mercurial.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ def wd(wd: WorkDir) -> WorkDir:

archival_mapping = {
"1.0": {"tag": "1.0"},
"1.1.dev3+h000000000000": {
"1.1.0.dev3+h000000000000": {
"latesttag": "1.0",
"latesttagdistance": "3",
"node": "0" * 20,
},
"1.0.1.dev3+h000000000000": {
"latesttag": "1.0.0",
"latesttagdistance": "3",
"branch": "1.0",
"node": "0" * 20,
},
"0.0": {"node": "0" * 20},
"1.2.2": {"tag": "release-1.2.2"},
"1.2.2.dev0": {"tag": "release-1.2.2.dev"},
Expand All @@ -45,7 +51,7 @@ def wd(wd: WorkDir) -> WorkDir:
@pytest.mark.parametrize(("expected", "data"), sorted(archival_mapping.items()))
def test_archival_to_version(expected: str, data: dict[str, str]) -> None:
config = Configuration(
version_scheme="guess-next-dev", local_scheme="node-and-date"
version_scheme="release-branch-semver", local_scheme="node-and-date"
)
version = archival_to_version(data, config=config)
assert format_version(version) == expected
Expand Down

0 comments on commit d75201a

Please sign in to comment.