diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2023-04-10 12:49:41 +0200 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2023-04-10 12:50:06 +0200 |
commit | 34021926d8ca1d0e597f3a1a8f177bd68de4a024 (patch) | |
tree | 217a56c3e6c7b0d22c42814648741fb79466b0aa | |
parent | 6f73cd875df1f84afb3dad9f7980ffb80713dc4a (diff) | |
download | setuptools-scm-34021926d8ca1d0e597f3a1a8f177bd68de4a024.tar.gz |
chore: mercurial - simplify fresh workdir handling
pass parsed version and make the test more concrete
-rw-r--r-- | src/setuptools_scm/hg.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/setuptools_scm/hg.py b/src/setuptools_scm/hg.py index 7feec51..522dfb6 100644 --- a/src/setuptools_scm/hg.py +++ b/src/setuptools_scm/hg.py @@ -51,10 +51,14 @@ class HgWorkdir(Workdir): dirty = bool(int(dirty_str)) node_date = datetime.date.fromisoformat(dirty_date if dirty else node_date_str) - if node.count("0") == len(node): + if node == "0" * len(node): log.debug("initial node %s", self.path) return meta( - "0.0", config=config, dirty=dirty, branch=branch, node_date=node_date + Version("0.0"), + config=config, + dirty=dirty, + branch=branch, + node_date=node_date, ) node = "h" + node[:7] @@ -177,7 +181,7 @@ def archival_to_version(data: dict[str, str], config: Configuration) -> ScmVersi config=config, ) else: - return meta("0.0", node=node, config=config) + return meta(config.version_cls("0.0"), node=node, config=config) def parse_archival(root: _t.PathT, config: Configuration) -> ScmVersion: |