seitime-frappe/frappe/utils/gitutils.py
Achilles Rasquinha 473d3eb6be Fixes for Python 3 (#4940)
* Fixed dict_keys and lists

* [FIX] config.get keys must be list

* [FIX] pickle all objects

* [FIX] get versions in unicode

* [FIX] get log versions

* debugging

* Fixed commit ID reference

* Fixed branch reference

* Fixed doc keys to list

* [LOG] test log

* [LOG] test log

* Convert iterators to list

* removed logs

* [FIX] Trial to load templates

* Fixed codacy
2018-01-31 10:51:13 +05:30

24 lines
617 B
Python

from __future__ import unicode_literals
import subprocess
def get_app_branch(app):
'''Returns branch of an app'''
try:
branch = subprocess.check_output('cd ../apps/{0} && git rev-parse --abbrev-ref HEAD'.format(app),
shell=True)
branch = branch.decode('utf-8')
branch = branch.strip()
return branch
except Exception:
return ''
def get_app_last_commit_ref(app):
try:
commit_id = subprocess.check_output('cd ../apps/{0} && git rev-parse HEAD'.format(app),
shell=True)
commit_id = commit_id.decode('utf-8')
commit_id = commit_id.strip()[:7]
return commit_id
except Exception:
return ''