Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
9abd3534
Commit
9abd3534
authored
Sep 05, 2014
by
Carson Gee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes git export to support repositories with dots in their name
parent
58e6dcf7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
15 deletions
+31
-15
cms/djangoapps/contentstore/git_export_utils.py
+1
-1
cms/djangoapps/contentstore/tests/test_export_git.py
+30
-14
No files found.
cms/djangoapps/contentstore/git_export_utils.py
View file @
9abd3534
...
@@ -126,7 +126,7 @@ def export_to_git(course_id, repo, user='', rdir=None):
...
@@ -126,7 +126,7 @@ def export_to_git(course_id, repo, user='', rdir=None):
# export course as xml before commiting and pushing
# export course as xml before commiting and pushing
root_dir
=
os
.
path
.
dirname
(
rdirp
)
root_dir
=
os
.
path
.
dirname
(
rdirp
)
course_dir
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
rdirp
)
)[
0
]
course_dir
=
os
.
path
.
basename
(
rdirp
)
.
rsplit
(
'.git'
,
1
)[
0
]
try
:
try
:
export_to_xml
(
modulestore
(),
contentstore
(),
course_id
,
export_to_xml
(
modulestore
(),
contentstore
(),
course_id
,
root_dir
,
course_dir
)
root_dir
,
course_dir
)
...
...
cms/djangoapps/contentstore/tests/test_export_git.py
View file @
9abd3534
...
@@ -34,6 +34,28 @@ class TestExportGit(CourseTestCase):
...
@@ -34,6 +34,28 @@ class TestExportGit(CourseTestCase):
self
.
course_module
=
modulestore
()
.
get_course
(
self
.
course
.
id
)
self
.
course_module
=
modulestore
()
.
get_course
(
self
.
course
.
id
)
self
.
test_url
=
reverse_course_url
(
'export_git'
,
self
.
course
.
id
)
self
.
test_url
=
reverse_course_url
(
'export_git'
,
self
.
course
.
id
)
def
make_bare_repo_with_course
(
self
,
repo_name
):
"""
Make a local bare repo suitable for exporting to in
tests
"""
# Build out local bare repo, and set course git url to it
repo_dir
=
os
.
path
.
abspath
(
git_export_utils
.
GIT_REPO_EXPORT_DIR
)
os
.
mkdir
(
repo_dir
)
self
.
addCleanup
(
shutil
.
rmtree
,
repo_dir
)
bare_repo_dir
=
'{0}/{1}.git'
.
format
(
os
.
path
.
abspath
(
git_export_utils
.
GIT_REPO_EXPORT_DIR
),
repo_name
)
os
.
mkdir
(
bare_repo_dir
)
self
.
addCleanup
(
shutil
.
rmtree
,
bare_repo_dir
)
subprocess
.
check_output
([
'git'
,
'--bare'
,
'init'
,
],
cwd
=
bare_repo_dir
)
self
.
populate_course
()
self
.
course_module
.
giturl
=
'file://{}'
.
format
(
bare_repo_dir
)
modulestore
()
.
update_item
(
self
.
course_module
,
self
.
user
.
id
)
def
test_giturl_missing
(
self
):
def
test_giturl_missing
(
self
):
"""
"""
Test to make sure an appropriate error is displayed
Test to make sure an appropriate error is displayed
...
@@ -79,21 +101,15 @@ class TestExportGit(CourseTestCase):
...
@@ -79,21 +101,15 @@ class TestExportGit(CourseTestCase):
"""
"""
Test successful course export response.
Test successful course export response.
"""
"""
# Build out local bare repo, and set course git url to it
repo_dir
=
os
.
path
.
abspath
(
git_export_utils
.
GIT_REPO_EXPORT_DIR
)
os
.
mkdir
(
repo_dir
)
self
.
addCleanup
(
shutil
.
rmtree
,
repo_dir
)
bare_repo_dir
=
'{0}/test_repo.git'
.
format
(
os
.
path
.
abspath
(
git_export_utils
.
GIT_REPO_EXPORT_DIR
))
os
.
mkdir
(
bare_repo_dir
)
self
.
addCleanup
(
shutil
.
rmtree
,
bare_repo_dir
)
subprocess
.
check_output
([
'git'
,
'--bare'
,
'init'
,
],
cwd
=
bare_repo_dir
)
self
.
populate_course
(
)
self
.
make_bare_repo_with_course
(
'test_repo'
)
self
.
course_module
.
giturl
=
'file://{}'
.
format
(
bare_repo_dir
)
response
=
self
.
client
.
get
(
'{}?action=push'
.
format
(
self
.
test_url
)
)
modulestore
()
.
update_item
(
self
.
course_module
,
self
.
user
.
id
)
self
.
assertIn
(
'Export Succeeded'
,
response
.
content
)
def
test_repo_with_dots
(
self
):
"""
Regression test for a bad directory pathing of repo's that have dots.
"""
self
.
make_bare_repo_with_course
(
'test.repo'
)
response
=
self
.
client
.
get
(
'{}?action=push'
.
format
(
self
.
test_url
))
response
=
self
.
client
.
get
(
'{}?action=push'
.
format
(
self
.
test_url
))
self
.
assertIn
(
'Export Succeeded'
,
response
.
content
)
self
.
assertIn
(
'Export Succeeded'
,
response
.
content
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment