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
f5cf87f8
Commit
f5cf87f8
authored
Jul 26, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add management command for syncing with github
parent
c9e57069
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
6 deletions
+38
-6
cms/djangoapps/contentstore/management/commands/import.py
+1
-1
cms/djangoapps/github_sync/__init__.py
+18
-0
cms/djangoapps/github_sync/management/__init__.py
+0
-0
cms/djangoapps/github_sync/management/commands/__init__.py
+0
-0
cms/djangoapps/github_sync/management/commands/sync_with_github.py
+14
-0
cms/djangoapps/github_sync/views.py
+4
-5
cms/envs/common.py
+1
-0
No files found.
cms/djangoapps/contentstore/management/commands/import.py
View file @
f5cf87f8
###
###
One-off s
cript for importing courseware form XML format
###
S
cript for importing courseware form XML format
###
from
django.core.management.base
import
BaseCommand
,
CommandError
...
...
cms/djangoapps/github_sync/__init__.py
View file @
f5cf87f8
...
...
@@ -16,6 +16,24 @@ log = logging.getLogger(__name__)
RepoSettings
=
namedtuple
(
'RepoSettings'
,
'path branch origin'
)
def
sync_all_with_github
():
"""
Sync all defined repositories from github
"""
for
repo_name
in
settings
.
REPOS
:
sync_with_github
(
load_repo_settings
(
repo_name
))
def
sync_with_github
(
repo_settings
):
"""
Sync specified repository from github
repo_settings: A RepoSettings defining which repo to sync
"""
revision
,
course
=
import_from_github
(
repo_settings
)
export_to_github
(
course
,
"Changes from cms import of revision
%
s"
%
revision
,
"CMS <cms@edx.org>"
)
def
setup_repo
(
repo_settings
):
"""
Reset the local github repo specified by repo_settings
...
...
cms/djangoapps/github_sync/management/__init__.py
0 → 100644
View file @
f5cf87f8
cms/djangoapps/github_sync/management/commands/__init__.py
0 → 100644
View file @
f5cf87f8
cms/djangoapps/github_sync/management/commands/sync_with_github.py
0 → 100644
View file @
f5cf87f8
###
### Script for syncing CMS with defined github repos
###
from
django.core.management.base
import
NoArgsCommand
from
github_sync
import
sync_all_with_github
class
Command
(
NoArgsCommand
):
help
=
\
'''Sync the CMS with the defined github repos'''
def
handle_noargs
(
self
,
**
options
):
sync_all_with_github
()
cms/djangoapps/github_sync/views.py
View file @
f5cf87f8
...
...
@@ -5,7 +5,7 @@ from django.http import HttpResponse
from
django.conf
import
settings
from
django_future.csrf
import
csrf_exempt
from
.
import
import_from_github
,
export_to_github
from
.
import
sync_with_github
,
load_repo_settings
log
=
logging
.
getLogger
()
...
...
@@ -40,13 +40,12 @@ def github_post_receive(request):
log
.
info
(
'No repository matching
%
s found'
%
repo_name
)
return
HttpResponse
(
'No Repo Found'
)
repo
=
settings
.
REPOS
[
repo_name
]
repo
=
load_repo_settings
(
repo_name
)
if
repo
[
'branch'
]
!=
branch_name
:
if
repo
.
branch
!=
branch_name
:
log
.
info
(
'Ignoring changes to non-tracked branch
%
s in repo
%
s'
%
(
branch_name
,
repo_name
))
return
HttpResponse
(
'Ignoring non-tracked branch'
)
revision
,
course
=
import_from_github
(
repo
)
export_to_github
(
course
,
repo
[
'path'
],
"Changes from cms import of revision
%
s"
%
revision
)
sync_with_github
(
repo
)
return
HttpResponse
(
'Push received'
)
cms/envs/common.py
View file @
f5cf87f8
...
...
@@ -309,6 +309,7 @@ INSTALLED_APPS = (
# For CMS
'contentstore'
,
'github_sync'
,
'student'
,
# misleading name due to sharing with lms
# For asset pipelining
...
...
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