From 87f8dbefda89bf6cb9e4b88f23a5317b054da0d4 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 13 Apr 2015 14:17:29 +0000 Subject: Add version guessing function to gitdir and cached repo. Change-Id: I1c79ce68a7a7534d36a9e83210e18a58e7b648e8 --- morphlib/gitdir.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'morphlib/gitdir.py') diff --git a/morphlib/gitdir.py b/morphlib/gitdir.py index 1c286720..a6dd26a1 100644 --- a/morphlib/gitdir.py +++ b/morphlib/gitdir.py @@ -707,6 +707,12 @@ class GitDirectory(object): args = ['branch', '--contains', ref] return self._gitcmd_output_list(*args) + def version_guess(self, ref): # pragma: no cover + self._check_ref_exists(ref) + + args = ['describe', '--tags', '--always', ref] + return morphlib.git.gitcmd(self._runcmd, *args).strip() + def _update_ref(self, ref_args, message): args = ['update-ref'] # No test coverage, since while this functionality is useful, -- cgit v1.2.1