plugins/git.py: Warn if ref is not in given track
Description
Produce a warning if a git element has a specified track & the elements ref does not exist in the local mirror when staged or initing the workspace. If the element has been tracked with bst, it is assumed that the value of ref exists in the track as it was generated from it (_fetch) & as such is not asserted. Tests has been included for this new helper function. The tests also check the that the configurable CoreWarning token for ref-not-in-track is captured if set in project.conf, see https://buildstream.gitlab.io/buildstream/format_project.html?highlight=warning#configurable-warnings
Changes proposed in this merge request:
- plugins/git.py: Add assert_ref_in_track helper function to GitMirror()
- plugins/git.py: Add tracked attribute got GitSource() to avoid wasted overheads asserting a ref that was generated from a bst track.
- plugins/git.py: Call assert_ref_in_track within stage & init_workspace functions, should only be called if an element has a track & ref which has not been touched by bst track. Provide warning with configurable CoreWarning token.
- tests/sources/git.py: Add test_ref_not_in_track test_warn & test_ref_not_in_track test_error
This merge request, when approved, will close issue/bug: #483 (closed)
Edited by Tom Pollard