diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2023-03-24 11:53:28 +0100 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2023-03-29 17:04:12 +0200 |
commit | c47fc2bea58870b44b88bf6f4f0347eaa04e4620 (patch) | |
tree | 1ccb1d799f306770169175c57700afb619b89d32 /src/setuptools_scm/hg_git.py | |
parent | 71e839f1d7a74ce7f2f24d3661ef76524d2ed814 (diff) | |
download | setuptools-scm-c47fc2bea58870b44b88bf6f4f0347eaa04e4620.tar.gz |
make scmworkdir.path always a Path
Diffstat (limited to 'src/setuptools_scm/hg_git.py')
-rw-r--r-- | src/setuptools_scm/hg_git.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/setuptools_scm/hg_git.py b/src/setuptools_scm/hg_git.py index f2ea360..b3ce4b2 100644 --- a/src/setuptools_scm/hg_git.py +++ b/src/setuptools_scm/hg_git.py @@ -4,7 +4,7 @@ import logging import os from contextlib import suppress from datetime import date -from datetime import datetime +from pathlib import Path from subprocess import CompletedProcess from . import _types as _t @@ -31,7 +31,7 @@ class GitWorkdirHgClient(GitWorkdir, HgWorkdir): res = _run(["hg", "root"], cwd=wd) if res.returncode: return None - return cls(res.stdout) + return cls(Path(res.stdout)) def is_dirty(self) -> bool: res = _run(["hg", "id", "-T", "{dirty}"], cwd=self.path, check=True) @@ -47,12 +47,9 @@ class GitWorkdirHgClient(GitWorkdir, HgWorkdir): def get_head_date(self) -> date | None: res = _run('hg log -r . -T "{shortdate(date)}"', cwd=self.path) if res.returncode: - log.info( - "head date err %s", - res, - ) + log.info("head date err %s", res) return None - return datetime.strptime(res.stdout, r"%Y-%m-%d").date() + return date.fromisoformat(res.stdout) def is_shallow(self) -> bool: return False |