Set EDX_PLATFORM_REVISION to unknown if not in a git repo.

- Set EDX_PLATFORM_REVISION to unknown if not in a git repo.
- Use the path of the configuration file to determine where the
  repository is.
This commit is contained in:
Carlos Andrés Rocha
2014-12-22 16:58:10 -05:00
parent fe01291d34
commit 75cfcd7292
3 changed files with 15 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ from path import path
from warnings import simplefilter
from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin
from dealer.git import git
import dealer.git
from xmodule.modulestore.edit_info import EditInfoMixin
############################ FEATURE CONFIGURATION #############################
@@ -296,7 +296,12 @@ MANAGERS = ADMINS
EDX_PLATFORM_REVISION = os.environ.get('EDX_PLATFORM_REVISION')
if not EDX_PLATFORM_REVISION:
EDX_PLATFORM_REVISION = git.revision
try:
# Get git revision of the current file
EDX_PLATFORM_REVISION = dealer.git.Backend(path=REPO_ROOT).revision
except TypeError:
# Not a git repository
EDX_PLATFORM_REVISION = 'unknown'
# Static content
STATIC_URL = '/static/' + EDX_PLATFORM_REVISION + "/"

View File

@@ -33,7 +33,7 @@ from warnings import simplefilter
from django.utils.translation import ugettext_lazy as _
from .discussionsettings import *
from dealer.git import git
import dealer.git
from xmodule.modulestore.modulestore_settings import update_module_store_settings
from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin
@@ -688,7 +688,12 @@ MANAGERS = ADMINS
EDX_PLATFORM_REVISION = os.environ.get('EDX_PLATFORM_REVISION')
if not EDX_PLATFORM_REVISION:
EDX_PLATFORM_REVISION = git.revision
try:
# Get git revision of the current file
EDX_PLATFORM_REVISION = dealer.git.Backend(path=REPO_ROOT).revision
except TypeError:
# Not a git repository
EDX_PLATFORM_REVISION = 'unknown'
# Static content
STATIC_URL = '/static/'

View File

@@ -11,7 +11,7 @@ html5lib==0.999
boto==2.32.1
celery==3.0.19
cssselect==0.9.1
dealer==0.2.3
dealer==2.0.4
defusedxml==0.4.1
distribute>=0.6.28, <0.7
django-babel-underscore==0.1.0