##// END OF EJS Templates
histedit: factor most commit creation in a function...
Pierre-Yves David -
r18436:b38c1050 default
parent child Browse files
Show More
@@ -176,6 +176,22 b' editcomment = _("""# Edit history betwee'
176 #
176 #
177 """)
177 """)
178
178
179 def commitfuncfor(repo, src):
180 """Build a commit function for the replacement of <src>
181
182 This function ensure we apply the same treatement to all changesets.
183
184 No such treatment is done yet.
185
186 Note that fold have its own separated logic because its handling is a bit
187 different and not easily factored out of the fold method.
188 """
189 def commitfunc(**kwargs):
190 return repo.commit(**kwargs)
191 return commitfunc
192
193
194
179 def applychanges(ui, repo, ctx, opts):
195 def applychanges(ui, repo, ctx, opts):
180 """Merge changeset from ctx (only) in the current working directory"""
196 """Merge changeset from ctx (only) in the current working directory"""
181 wcpar = repo.dirstate.parents()[0]
197 wcpar = repo.dirstate.parents()[0]
@@ -279,7 +295,8 b' def pick(ui, repo, ctx, ha, opts):'
279 raise util.Abort(_('Fix up the change and run '
295 raise util.Abort(_('Fix up the change and run '
280 'hg histedit --continue'))
296 'hg histedit --continue'))
281 # drop the second merge parent
297 # drop the second merge parent
282 n = repo.commit(text=oldctx.description(), user=oldctx.user(),
298 commit = commitfuncfor(repo, oldctx)
299 n = commit(text=oldctx.description(), user=oldctx.user(),
283 date=oldctx.date(), extra=oldctx.extra())
300 date=oldctx.date(), extra=oldctx.extra())
284 if n is None:
301 if n is None:
285 ui.warn(_('%s: empty changeset\n')
302 ui.warn(_('%s: empty changeset\n')
@@ -356,7 +373,8 b' def message(ui, repo, ctx, ha, opts):'
356 'hg histedit --continue'))
373 'hg histedit --continue'))
357 message = oldctx.description() + '\n'
374 message = oldctx.description() + '\n'
358 message = ui.edit(message, ui.username())
375 message = ui.edit(message, ui.username())
359 new = repo.commit(text=message, user=oldctx.user(), date=oldctx.date(),
376 commit = commitfuncfor(repo, oldctx)
377 new = commit(text=message, user=oldctx.user(), date=oldctx.date(),
360 extra=oldctx.extra())
378 extra=oldctx.extra())
361 newctx = repo[new]
379 newctx = repo[new]
362 if oldctx.node() != newctx.node():
380 if oldctx.node() != newctx.node():
@@ -558,7 +576,8 b' def bootstrapcontinue(ui, repo, parentct'
558 editor = cmdutil.commitforceeditor
576 editor = cmdutil.commitforceeditor
559 else:
577 else:
560 editor = False
578 editor = False
561 new = repo.commit(text=message, user=ctx.user(),
579 commit = commitfuncfor(repo, ctx)
580 new = commit(text=message, user=ctx.user(),
562 date=ctx.date(), extra=ctx.extra(),
581 date=ctx.date(), extra=ctx.extra(),
563 editor=editor)
582 editor=editor)
564 if new is not None:
583 if new is not None:
General Comments 0
You need to be logged in to leave comments. Login now