Merge pull request #21570 from edx/BOM-368

BOM-368
This commit is contained in:
Ayub
2019-09-06 12:01:31 +05:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -108,7 +108,7 @@ def export_to_git(course_id, repo, user='', rdir=None):
# Get current branch
cmd = ['git', 'symbolic-ref', '--short', 'HEAD']
try:
branch = cmd_log(cmd, cwd).strip('\n')
branch = cmd_log(cmd, cwd).decode('utf-8').strip('\n')
except subprocess.CalledProcessError as ex:
log.exception(u'Failed to get branch: %r', ex.output)
raise GitExportError(GitExportError.DETACHED_HEAD)
@@ -146,7 +146,7 @@ def export_to_git(course_id, repo, user='', rdir=None):
if not branch:
cmd = ['git', 'symbolic-ref', '--short', 'HEAD']
try:
branch = cmd_log(cmd, os.path.abspath(rdirp)).strip('\n')
branch = cmd_log(cmd, os.path.abspath(rdirp)).decode('utf-8').strip('\n')
except subprocess.CalledProcessError as ex:
log.exception(u'Failed to get branch from freshly cloned repo: %r',
ex.output)

View File

@@ -162,7 +162,7 @@ class TestGitExport(CourseTestCase):
)
cwd = os.path.abspath(git_export_utils.GIT_REPO_EXPORT_DIR / 'test_bare')
git_log = subprocess.check_output(['git', 'log', '-1',
'--format=%an|%ae'], cwd=cwd)
'--format=%an|%ae'], cwd=cwd).decode('utf-8')
self.assertEqual(expect_string, git_log)
# Make changes to course so there is something to commit
@@ -177,7 +177,7 @@ class TestGitExport(CourseTestCase):
self.user.email,
)
git_log = subprocess.check_output(
['git', 'log', '-1', '--format=%an|%ae'], cwd=cwd)
['git', 'log', '-1', '--format=%an|%ae'], cwd=cwd).decode('utf-8')
self.assertEqual(expect_string, git_log)
def test_no_change(self):