##// END OF EJS Templates
rebase: add --edit switch
Matt Mackall -
r15219:9d58569a default
parent child Browse files
Show More
@@ -39,6 +39,7 command = cmdutil.command(cmdtable)
39 ('', 'collapse', False, _('collapse the rebased changesets')),
39 ('', 'collapse', False, _('collapse the rebased changesets')),
40 ('m', 'message', '',
40 ('m', 'message', '',
41 _('use text as collapse commit message'), _('TEXT')),
41 _('use text as collapse commit message'), _('TEXT')),
42 ('e', 'edit', False, _('invoke editor on commit messages')),
42 ('l', 'logfile', '',
43 ('l', 'logfile', '',
43 _('read collapse commit message from file'), _('FILE')),
44 _('read collapse commit message from file'), _('FILE')),
44 ('', 'keep', False, _('keep original changesets')),
45 ('', 'keep', False, _('keep original changesets')),
@@ -105,6 +106,10 def rebase(ui, repo, **opts):
105 skipped = set()
106 skipped = set()
106 targetancestors = set()
107 targetancestors = set()
107
108
109 editor = None
110 if opts.get('edit'):
111 editor = cmdutil.commitforceeditor
112
108 lock = wlock = None
113 lock = wlock = None
109 try:
114 try:
110 lock = repo.lock()
115 lock = repo.lock()
@@ -217,7 +222,8 def rebase(ui, repo, **opts):
217 ui.setconfig('ui', 'forcemerge', '')
222 ui.setconfig('ui', 'forcemerge', '')
218 cmdutil.duplicatecopies(repo, rev, target, p2)
223 cmdutil.duplicatecopies(repo, rev, target, p2)
219 if not collapsef:
224 if not collapsef:
220 newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn)
225 newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn,
226 editor=editor)
221 else:
227 else:
222 # Skip commit if we are collapsing
228 # Skip commit if we are collapsing
223 repo.dirstate.setparents(repo[p1].node())
229 repo.dirstate.setparents(repo[p1].node())
@@ -247,7 +253,7 def rebase(ui, repo, **opts):
247 commitmsg += '\n* %s' % repo[rebased].description()
253 commitmsg += '\n* %s' % repo[rebased].description()
248 commitmsg = ui.edit(commitmsg, repo.ui.username())
254 commitmsg = ui.edit(commitmsg, repo.ui.username())
249 newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
255 newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
250 extrafn=extrafn)
256 extrafn=extrafn, editor=editor)
251
257
252 if 'qtip' in repo.tags():
258 if 'qtip' in repo.tags():
253 updatemq(repo, state, skipped, **opts)
259 updatemq(repo, state, skipped, **opts)
@@ -301,7 +307,7 def checkexternal(repo, state, targetanc
301 external = p.rev()
307 external = p.rev()
302 return external
308 return external
303
309
304 def concludenode(repo, rev, p1, p2, commitmsg=None, extrafn=None):
310 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None):
305 'Commit the changes and store useful information in extra'
311 'Commit the changes and store useful information in extra'
306 try:
312 try:
307 repo.dirstate.setparents(repo[p1].node(), repo[p2].node())
313 repo.dirstate.setparents(repo[p1].node(), repo[p2].node())
@@ -313,7 +319,7 def concludenode(repo, rev, p1, p2, comm
313 extrafn(ctx, extra)
319 extrafn(ctx, extra)
314 # Commit might fail if unresolved files exist
320 # Commit might fail if unresolved files exist
315 newrev = repo.commit(text=commitmsg, user=ctx.user(),
321 newrev = repo.commit(text=commitmsg, user=ctx.user(),
316 date=ctx.date(), extra=extra)
322 date=ctx.date(), extra=extra, editor=editor)
317 repo.dirstate.setbranch(repo[newrev].branch())
323 repo.dirstate.setbranch(repo[newrev].branch())
318 return newrev
324 return newrev
319 except util.Abort:
325 except util.Abort:
General Comments 0
You need to be logged in to leave comments. Login now