##// 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 202 self, wire, message, parents, commit_time, commit_timezone,
203 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 215 Marks given path as added/changed/removed in a given _repo. This is
208 216 for internal mercurial commit function.
@@ -218,7 +226,7 b' class HgRemote(object):'
218 226 if node['path'] == path:
219 227 return memfilectx(
220 228 _repo,
221 changectx=memctx,
229 changectx=ctx,
222 230 path=node['path'],
223 231 data=node['content'],
224 232 islink=False,
@@ -229,22 +237,22 b' class HgRemote(object):'
229 237 "Given path haven't been marked as added, "
230 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(
235 repo=repo,
236 parents=parents,
237 text=message,
238 files=files,
239 filectxfn=_filectxfn,
240 user=user,
241 date=(commit_time, commit_timezone),
242 extra=extra)
242 commit_ctx = memctx(
243 repo=repo,
244 parents=parents,
245 text=message,
246 files=files,
247 filectxfn=_filectxfn,
248 user=user,
249 date=(commit_time, commit_timezone),
250 extra=extra)
243 251
244 n = repo.commitctx(commit_ctx)
245 new_id = hex(n)
252 n = repo.commitctx(commit_ctx)
253 new_id = hex(n)
246 254
247 return new_id
255 return new_id
248 256
249 257 @reraise_safe_exceptions
250 258 def ctx_branch(self, wire, revision):
General Comments 0
You need to be logged in to leave comments. Login now