##// END OF EJS Templates
Mercurial: commitctx, properly set new commits phase based on publishing flag
marcink -
r659:c518c95a default
parent child Browse files
Show More
@@ -202,7 +202,15 b' class HgRemote(object):'
202 self, wire, message, parents, commit_time, commit_timezone,
202 self, wire, message, parents, commit_time, commit_timezone,
203 user, files, extra, removed, updated):
203 user, files, extra, removed, updated):
204
204
205 def _filectxfn(_repo, memctx, path):
205 repo = self._factory.repo(wire)
206 baseui = self._factory._create_config(wire['config'])
207 publishing = baseui.configbool('phases', 'publish')
208 if publishing:
209 new_commit = 'public'
210 else:
211 new_commit = 'draft'
212
213 def _filectxfn(_repo, ctx, path):
206 """
214 """
207 Marks given path as added/changed/removed in a given _repo. This is
215 Marks given path as added/changed/removed in a given _repo. This is
208 for internal mercurial commit function.
216 for internal mercurial commit function.
@@ -218,7 +226,7 b' class HgRemote(object):'
218 if node['path'] == path:
226 if node['path'] == path:
219 return memfilectx(
227 return memfilectx(
220 _repo,
228 _repo,
221 changectx=memctx,
229 changectx=ctx,
222 path=node['path'],
230 path=node['path'],
223 data=node['content'],
231 data=node['content'],
224 islink=False,
232 islink=False,
@@ -229,22 +237,22 b' class HgRemote(object):'
229 "Given path haven't been marked as added, "
237 "Given path haven't been marked as added, "
230 "changed or removed (%s)" % path)
238 "changed or removed (%s)" % path)
231
239
232 repo = self._factory.repo(wire)
240 with repo.ui.configoverride({('phases', 'new-commit'): new_commit}):
233
241
234 commit_ctx = memctx(
242 commit_ctx = memctx(
235 repo=repo,
243 repo=repo,
236 parents=parents,
244 parents=parents,
237 text=message,
245 text=message,
238 files=files,
246 files=files,
239 filectxfn=_filectxfn,
247 filectxfn=_filectxfn,
240 user=user,
248 user=user,
241 date=(commit_time, commit_timezone),
249 date=(commit_time, commit_timezone),
242 extra=extra)
250 extra=extra)
243
251
244 n = repo.commitctx(commit_ctx)
252 n = repo.commitctx(commit_ctx)
245 new_id = hex(n)
253 new_id = hex(n)
246
254
247 return new_id
255 return new_id
248
256
249 @reraise_safe_exceptions
257 @reraise_safe_exceptions
250 def ctx_branch(self, wire, revision):
258 def ctx_branch(self, wire, revision):
General Comments 0
You need to be logged in to leave comments. Login now