mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +00:00
make git log call simpler
This commit is contained in:
parent
32614e55b5
commit
25bcf2c438
@ -98,14 +98,16 @@ def get_git_log(path):
|
|||||||
"""
|
"""
|
||||||
path = path.replace(os.path.dirname(settings.BASE_DIR), '')[1:]
|
path = path.replace(os.path.dirname(settings.BASE_DIR), '')[1:]
|
||||||
command = ['git', 'log', '-n', '1', "--pretty=format:'%H%n%aN%n%aE%n%aI%n%f%n%G?%n%GK'", '--follow', '--', path]
|
command = ['git', 'log', '-n', '1', "--pretty=format:'%H%n%aN%n%aE%n%aI%n%f%n%G?%n%GK'", '--follow', '--', path]
|
||||||
|
output = None
|
||||||
try:
|
try:
|
||||||
output = str(subprocess.check_output(command, cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')[1:-1]
|
output = str(subprocess.check_output(command, cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')[1:-1]
|
||||||
if output:
|
if output:
|
||||||
output = output.split('\n')
|
output = output.split('\n')
|
||||||
else:
|
except subprocess.CalledProcessError: # pragma: no cover
|
||||||
output = 7 * ['']
|
pass
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
output = 7 * ['']
|
if not output:
|
||||||
|
output = 7 * [''] # pragma: no cover
|
||||||
return {'hash': output[0], 'author': output[1], 'mail': output[2], 'date': output[3], 'message': output[4], 'verified': output[5], 'key': output[6]}
|
return {'hash': output[0], 'author': output[1], 'mail': output[2], 'date': output[3], 'message': output[4], 'verified': output[5], 'key': output[6]}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user