in src/buildstream_plugins/sources/git.py [0:0]
def track(self): # pylint: disable=arguments-differ
# If self.tracking is not specified it's not an error, just silently return
if not self.tracking:
# Is there a better way to check if a ref is given.
if self.mirror.ref is None:
detail = "Without a tracking branch ref can not be updated. Please " + "provide a ref or a track."
raise SourceError(
"{}: No track or ref".format(self),
detail=detail,
reason="track-attempt-no-track",
)
return None
# Resolve the URL for the message
resolved_url = self.translate_url(self.mirror.url)
with self.timed_activity(
"Tracking {} from {}".format(self.tracking, resolved_url),
silent_nested=True,
):
self.mirror._fetch(resolved_url, fetch_all=True)
ref = self.mirror.to_commit(self.tracking)
tags = self.mirror.reachable_tags(ref) if self.track_tags else []
if self.ref_format == _RefFormat.GIT_DESCRIBE:
ref = self.mirror.describe(ref)
return ref, tags