The new ms3 precommit command is simply a wrapper around ms3 review that accepts the --files arguments as positional arguments. This is required for the command to be useable as an entry point for a Git pre-commit, which passes the paths of modified or added files as positional arguments. In addition, the command executes git add -A after the review so that all changed files are included.
This is to work in the first version of the new, localized, DCML annotation workflow that runs on the annotator's machine before committing, rather than on a GitHub runner after pushing. Things that might be changed in the future:
The ms3 precommit command could convert the positional arguments into a regular expression to be passed to -i/--include instead of using the deprecated --files.
At some point a mechanism might be needed that makes it possible for the hook to ignore warnings that were already there, i.e., which are not caused/added by the current commit. Currently one would have to remove --fail from the repo's args configuration but that would let all warnings pass and would be besides the point.
As an aside
New method score.mscx.update_metadata() to facilitate (manual) updating of the key-value pairs.
Comparison files come with the metadata key compared_against=<commit hash> when the comparison has been performed against a particular git revision.
"LATEST_VERSION" is now accepted as argument to git_revision and resolves to the latest version tag (falling back to the current HEAD if the repo has no tags)
The new
ms3 precommit
command is simply a wrapper aroundms3 review
that accepts the--files
arguments as positional arguments. This is required for the command to be useable as an entry point for a Git pre-commit, which passes the paths of modified or added files as positional arguments. In addition, the command executesgit add -A
after the review so that all changed files are included.This is to work in the first version of the new, localized, DCML annotation workflow that runs on the annotator's machine before committing, rather than on a GitHub runner after pushing. Things that might be changed in the future:
ms3 precommit
command could convert the positional arguments into a regular expression to be passed to-i/--include
instead of using the deprecated--files
.--fail
from the repo'sargs
configuration but that would let all warnings pass and would be besides the point.As an aside
score.mscx.update_metadata()
to facilitate (manual) updating of the key-value pairs.compared_against=<commit hash>
when the comparison has been performed against a particular git revision."LATEST_VERSION"
is now accepted as argument togit_revision
and resolves to the latest version tag (falling back to the current HEAD if the repo has no tags)