@@ -64,14 +64,18 @@ def shell_out(cmd):
64
64
65
65
66
66
def build_one (version , isdev , quick , sphinxbuild , build_root , www_root ,
67
- skip_cache_invalidation = False , group = 'docs' ):
67
+ skip_cache_invalidation = False , group = 'docs' , git = False ):
68
68
checkout = build_root + "/python" + str (version ).replace ('.' , '' )
69
69
target = www_root + "/" + str (version )
70
70
logging .info ("Doc autobuild started in %s" , checkout )
71
71
os .chdir (checkout )
72
72
73
73
logging .info ("Updating checkout" )
74
- shell_out ("hg pull -u" )
74
+ if git :
75
+ shell_out ("git reset --hard HEAD" )
76
+ shell_out ("git pull --ff-only" )
77
+ else :
78
+ shell_out ("hg pull -u" )
75
79
76
80
maketarget = "autobuild-" + ("dev" if isdev else "stable" ) + ("-html" if quick else "" )
77
81
logging .info ("Running make %s" , maketarget )
@@ -176,6 +180,10 @@ def parse_args():
176
180
"--group" ,
177
181
help = "Group files on targets and www-root file should get." ,
178
182
default = "docs" )
183
+ parser .add_argument (
184
+ "--git" ,
185
+ help = "Use git instead of mercurial." ,
186
+ action = "store_true" )
179
187
return parser .parse_args ()
180
188
181
189
@@ -194,12 +202,12 @@ def parse_args():
194
202
build_one (args .branch , args .devel , args .quick , sphinxbuild ,
195
203
args .build_root , args .www_root ,
196
204
args .skip_cache_invalidation ,
197
- args .group )
205
+ args .group , args . git )
198
206
else :
199
207
for version , devel in BRANCHES :
200
208
build_one (version , devel , args .quick , sphinxbuild ,
201
209
args .build_root , args .www_root ,
202
- args .skip_cache_invalidation , args .group )
210
+ args .skip_cache_invalidation , args .group , args . git )
203
211
build_devguide (args .devguide_checkout , args .devguide_target ,
204
212
sphinxbuild , args .skip_cache_invalidation )
205
213
except Exception :
0 commit comments