Skip to content

Commit 4ca7bf2

Browse files
committed
Start work on the auto merging
1 parent 7c1b9bc commit 4ca7bf2

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

make

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import markdown
33
import shutil
44
import os
5+
import sys
6+
import subprocess
57

68
def create_index():
79
articles = []
@@ -73,6 +75,33 @@ def to_markdown(text):
7375
return markdown.markdown(text, ['abbr'])
7476

7577

78+
def merge_pages():
79+
git = subprocess.Popen(['git', 'status'], stdout=subprocess.PIPE)
80+
81+
result = git.communicate()[0].strip().split('\n')
82+
if not result[-1].startswith('nothing to commit'):
83+
print 'ERROR: Please commit to master first'
84+
print 'Merge aborted.'
85+
86+
else:
87+
print 'Copying files...'
88+
if not os.path.exists('build'):
89+
os.mkdir('build')
90+
7691
if __name__ == '__main__':
77-
create_index()
92+
if len(sys.argv) > 1:
93+
if sys.argv[1] == 'pages':
94+
print 'Merging into pages...'
95+
merge_pages()
7896

97+
elif sys.argv[1] == 'all':
98+
print 'Generating index...'
99+
create_index()
100+
101+
print 'Merging into pages...'
102+
merge_pages()
103+
104+
else:
105+
print 'Generating index...'
106+
create_index()
107+

0 commit comments

Comments
 (0)