From 77cb1a713a766742344af72a338a2f795a03405e Mon Sep 17 00:00:00 2001 From: idziubenko Date: Fri, 19 Nov 2021 09:22:35 +0300 Subject: [PATCH] added getCurrentTag to git wrapper --- pym/calculate/lib/utils/git.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pym/calculate/lib/utils/git.py b/pym/calculate/lib/utils/git.py index bea3e61..7f36bf7 100644 --- a/pym/calculate/lib/utils/git.py +++ b/pym/calculate/lib/utils/git.py @@ -835,6 +835,18 @@ class Git(): return [x.strip() for x in git_tag if x.strip()] return [] + def getCurrentTag(self, rpath): + """ + Получить выбранный в данный момент тэг + """ + git_dir = self._gitDir(rpath) + git_tag = self.process(self._git, "--git-dir", git_dir, "--work-tree", + rpath, + "describe", "--tags", stderr=STDOUT) + if git_tag.success(): + return git_tag.read().strip() + return "" + def checkoutBranch(self, rpath, branch): """ Сменить ветку