mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-06 00:36:32 +08:00
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
import subprocess
|
||||
from selfdrive.swaglog import cloudlog
|
||||
|
||||
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "common", "version.h")) as _versionf:
|
||||
version = _versionf.read().split('"')[1]
|
||||
|
||||
@@ -12,9 +14,18 @@ try:
|
||||
branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).rstrip()
|
||||
branch = 'origin/' + branch
|
||||
dirty = subprocess.call(["git", "diff-index", "--quiet", branch, "--"]) != 0
|
||||
if dirty:
|
||||
dirty_files = subprocess.check_output(["git", "diff-index", "--name-only", branch, "--"])
|
||||
commit = subprocess.check_output(["git", "rev-parse", "--verify", "HEAD"]).rstrip()
|
||||
origin_commit = subprocess.check_output(["git", "rev-parse", "--verify", branch]).rstrip()
|
||||
cloudlog.event("dirty comma branch", vesion=version, dirty=dirty, origin=origin, branch=branch, dirty_files=dirty_files, commit=commit, origin_commit=origin_commit)
|
||||
else:
|
||||
dirty = True
|
||||
except subprocess.CalledProcessError:
|
||||
try:
|
||||
cloudlog.exception("git subprocess failed while finding version")
|
||||
except:
|
||||
pass
|
||||
dirty = True
|
||||
|
||||
# put this here
|
||||
|
||||
Reference in New Issue
Block a user