Try to use git hash in crash reports

This commit is contained in:
Johann Bauer 2018-02-26 19:53:16 +01:00
parent 22daffbbea
commit 5893af5025
No known key found for this signature in database
GPG Key ID: 84F1BF925B1F484D
1 changed files with 13 additions and 1 deletions

View File

@ -25,6 +25,9 @@ import json
import locale import locale
import platform import platform
import traceback import traceback
import os
import sys
import subprocess
import requests import requests
from PyQt5.QtCore import QObject from PyQt5.QtCore import QObject
@ -33,7 +36,6 @@ from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
from electrum.i18n import _ from electrum.i18n import _
import sys
from electrum import ELECTRUM_VERSION, bitcoin from electrum import ELECTRUM_VERSION, bitcoin
issue_template = """<h2>Traceback</h2> issue_template = """<h2>Traceback</h2>
@ -165,6 +167,11 @@ class Exception_Window(QWidget):
except: except:
# Maybe the wallet isn't loaded yet # Maybe the wallet isn't loaded yet
pass pass
try:
args["app_version"] = self.get_git_version()
except:
# This is probably not running from source
pass
return args return args
def get_report_string(self): def get_report_string(self):
@ -172,6 +179,11 @@ class Exception_Window(QWidget):
info["traceback"] = "".join(traceback.format_exception(*self.exc_args)) info["traceback"] = "".join(traceback.format_exception(*self.exc_args))
return issue_template.format(**info) return issue_template.format(**info)
@staticmethod
def get_git_version():
dir = os.path.dirname(os.path.realpath(sys.argv[0]))
return subprocess.check_output(['git', 'describe', '--always'], cwd=dir)
def _show_window(*args): def _show_window(*args):
if not Exception_Window._active_window: if not Exception_Window._active_window: