def get_tagsinfo(rep=None): if gitcmd is None: return '' command = gitcmd + ' for-each-ref --format ' '%(tag)|%(objectname)|%(taggerdate:raw)' ' refs/tags --sort=taggerdate | awk ' 'BEGIN{FS="|"};{t=strftime("%Y-%m-%d|%H:%M:%S",$3);printf"%s|%s|%s\n",$1,$2,t}' '' status, out = cdrun_and_get_stdout(command.split(' '), rep) if status == 0: return out.strip() else: return ''
def get_commit(rep=None): if gitcmd is None: return '' command = gitcmd + ' rev-parse HEAD' status, out = cdrun_and_get_stdout(command.split(' '), rep) if status == 0: return out.strip() else: return ''
def get_tags(rep=None): if gitcmd is None: return '' command = gitcmd + ' tag' status, out = cdrun_and_get_stdout(command.split(' '), rep) if status == 0: return out.strip() else: return ''
def get_exacttag(rep=None): if gitcmd is None: return '' command = gitcmd + ' describe --tags --exact-match' status, out = cdrun_and_get_stdout(command.split(' '), rep) if status == 0: return out.strip() else: return ''
def get_url(rep=None): if gitcmd is None: return '' command = gitcmd + ' config --get remote.origin.url' status, out = cdrun_and_get_stdout(command.split(' '), rep) if status == 0: return out.strip() else: return ''
def get_rawdate(rep=None): if gitcmd is None: return '' command = gitcmd + ' log -1 --pretty="%at"' status, out = cdrun_and_get_stdout(command.split(' '), rep) if status == 0: t = int(out.strip().replace('"', '')) return t else: return ''
def isup2date(rep=None): if gitcmd is None: return '' command = gitcmd + ' ls-files -m' status, out = cdrun_and_get_stdout(command.split(' '), rep) if status == 0: #print(out) return len(out) == 0 else: return ''
def get_date(rep=None): if gitcmd is None: return '' command = gitcmd + ' log -1 --pretty="%at"' status, out = cdrun_and_get_stdout(command.split(' '), rep) if status == 0: from time import localtime, strftime t = int(out.strip().replace('"', '')) return strftime('%Y-%m-%d', localtime(t)) else: return ''
def get_tag(rep=None): if gitcmd is None: return '' command = gitcmd + ' log -1 --pretty="format:%d"' status, out = cdrun_and_get_stdout(command.split(' '), rep) if status == 0: I = out.find('tag:') if I == -1: return '' else: return out[I + 4::].split(')')[0].split(',')[0].strip() else: return ''