##// 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 195 def applychanges(ui, repo, ctx, opts):
180 196 """Merge changeset from ctx (only) in the current working directory"""
181 197 wcpar = repo.dirstate.parents()[0]
@@ -279,8 +295,9 b' def pick(ui, repo, ctx, ha, opts):'
279 295 raise util.Abort(_('Fix up the change and run '
280 296 'hg histedit --continue'))
281 297 # drop the second merge parent
282 n = repo.commit(text=oldctx.description(), user=oldctx.user(),
283 date=oldctx.date(), extra=oldctx.extra())
298 commit = commitfuncfor(repo, oldctx)
299 n = commit(text=oldctx.description(), user=oldctx.user(),
300 date=oldctx.date(), extra=oldctx.extra())
284 301 if n is None:
285 302 ui.warn(_('%s: empty changeset\n')
286 303 % node.hex(ha))
@@ -356,8 +373,9 b' def message(ui, repo, ctx, ha, opts):'
356 373 'hg histedit --continue'))
357 374 message = oldctx.description() + '\n'
358 375 message = ui.edit(message, ui.username())
359 new = repo.commit(text=message, user=oldctx.user(), date=oldctx.date(),
360 extra=oldctx.extra())
376 commit = commitfuncfor(repo, oldctx)
377 new = commit(text=message, user=oldctx.user(), date=oldctx.date(),
378 extra=oldctx.extra())
361 379 newctx = repo[new]
362 380 if oldctx.node() != newctx.node():
363 381 return newctx, [(oldctx.node(), (new,))]
@@ -558,9 +576,10 b' def bootstrapcontinue(ui, repo, parentct'
558 576 editor = cmdutil.commitforceeditor
559 577 else:
560 578 editor = False
561 new = repo.commit(text=message, user=ctx.user(),
562 date=ctx.date(), extra=ctx.extra(),
563 editor=editor)
579 commit = commitfuncfor(repo, ctx)
580 new = commit(text=message, user=ctx.user(),
581 date=ctx.date(), extra=ctx.extra(),
582 editor=editor)
564 583 if new is not None:
565 584 newchildren.append(new)
566 585
@@ -722,7 +741,7 b' def movebookmarks(ui, repo, mapping, old'
722 741 moves = []
723 742 for bk, old in sorted(repo._bookmarks.iteritems()):
724 743 if old == oldtopmost:
725 # special case ensure bookmark stay on tip.
744 # special case ensure bookmark stay on tip.
726 745 #
727 746 # This is arguably a feature and we may only want that for the
728 747 # active bookmark. But the behavior is kept compatible with the old
General Comments 0
You need to be logged in to leave comments. Login now