diff --git a/TarSCM/archive.py b/TarSCM/archive.py index 196df0b6..4f8e8c8d 100644 --- a/TarSCM/archive.py +++ b/TarSCM/archive.py @@ -104,6 +104,15 @@ def create_archive(self, scm_object, **kwargs): if commit: metafile.write("commit: " + commit + "\n") + names = {"%ci": "commit_date: ", + "%h": "short_commit_hash: ", + "@TAG_OFFSET@": "commits_since_last_tag: "} + + for field in ("%h", "%ci", "@TAG_OFFSET@"): + fake_args = args.copy() + fake_args["versionformat"] = field + value = str(scm_object.detect_version(fake_args)) + metafile.write(names[field] + value + "\n") metafile.close()