##// 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,8 +295,9 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)
283 date=oldctx.date(), extra=oldctx.extra())
299 n = commit(text=oldctx.description(), user=oldctx.user(),
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')
286 % node.hex(ha))
303 % node.hex(ha))
@@ -356,8 +373,9 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)
360 extra=oldctx.extra())
377 new = commit(text=message, user=oldctx.user(), date=oldctx.date(),
378 extra=oldctx.extra())
361 newctx = repo[new]
379 newctx = repo[new]
362 if oldctx.node() != newctx.node():
380 if oldctx.node() != newctx.node():
363 return newctx, [(oldctx.node(), (new,))]
381 return newctx, [(oldctx.node(), (new,))]
@@ -558,9 +576,10 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)
562 date=ctx.date(), extra=ctx.extra(),
580 new = commit(text=message, user=ctx.user(),
563 editor=editor)
581 date=ctx.date(), extra=ctx.extra(),
582 editor=editor)
564 if new is not None:
583 if new is not None:
565 newchildren.append(new)
584 newchildren.append(new)
566
585
@@ -722,7 +741,7 b' def movebookmarks(ui, repo, mapping, old'
722 moves = []
741 moves = []
723 for bk, old in sorted(repo._bookmarks.iteritems()):
742 for bk, old in sorted(repo._bookmarks.iteritems()):
724 if old == oldtopmost:
743 if old == oldtopmost:
725 # special case ensure bookmark stay on tip.
744 # special case ensure bookmark stay on tip.
726 #
745 #
727 # This is arguably a feature and we may only want that for the
746 # This is arguably a feature and we may only want that for the
728 # active bookmark. But the behavior is kept compatible with the old
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