From 1885a8b11faee380f311ac4d88dbfc1b19a13b0c Mon Sep 17 00:00:00 2001 From: mprahl Date: Mon, 29 Apr 2019 14:20:23 -0400 Subject: [PATCH] Improve the readability of SCM.get_latest --- module_build_service/scm.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/module_build_service/scm.py b/module_build_service/scm.py index 8124e355..d2c1b55c 100644 --- a/module_build_service/scm.py +++ b/module_build_service/scm.py @@ -197,15 +197,17 @@ class SCM(object): raise RuntimeError("checkout: Unhandled SCM scheme.") return self.sourcedir - def get_latest(self, ref="master"): + def get_latest(self, ref=None): """ Get the latest commit hash based on the provided git ref - :param ref: a string of a git ref (either a branch or commit hash) + :param ref: a string of a git ref (either a branch or commit hash). This defaults to + self.branch. :returns: a string of the latest commit hash :raises: RuntimeError """ if ref is None: - ref = "master" + ref = self.branch + if self.scheme == "git": log.debug("Getting/verifying commit hash for %s" % self.repository) try: