diff --git a/changelog.d/453.misc b/changelog.d/453.misc index c3ee3c32..22ba14ba 100644 --- a/changelog.d/453.misc +++ b/changelog.d/453.misc @@ -1 +1 @@ -Include Sydent's version number when reporting to Sentry. \ No newline at end of file +Include Sydent's version number (and git commit hash if available) when reporting to Sentry. diff --git a/changelog.d/454.misc b/changelog.d/454.misc new file mode 100644 index 00000000..8375cd05 --- /dev/null +++ b/changelog.d/454.misc @@ -0,0 +1 @@ +Include Sydent's version number (and git commit hash if available) when reporting to Sentry. \ No newline at end of file diff --git a/sydent/util/versionstring.py b/sydent/util/versionstring.py index a4885a0d..8a4d2981 100644 --- a/sydent/util/versionstring.py +++ b/sydent/util/versionstring.py @@ -10,6 +10,15 @@ def get_version_string() -> str: """Calculate a git-aware version string for sydent. + The version string is `sydent@x.y.z`, where `x.y.z` comes from + `sydent.__version__`. If the `sydent` module belongs to a git repository on + disk, we the current branch, tag and commit hash, plus a flag to indicate + if the working tree is dirty. + + An example probably illustrates best. Testing locally, I get + `sydent@2.4.6 (b=dmr/version-in-sentry,05e1fa8,dirty)`. + If this wasn't done from within the repository, I'd just get `sydent@2.4.6`. + Implementation nicked from Synapse. """ version_string = sydent.__version__