comparison hgext/evolution.py @ 103:23c232a81fbe

amend: add a --branch option
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 11 Oct 2011 19:22:41 +0200
parents 780a222d547d
children 6c3c7a18f079
comparison
equal deleted inserted replaced
102:5111329280f1 103:23c232a81fbe
207 [('A', 'addremove', None, 207 [('A', 'addremove', None,
208 _('mark new/missing files as added/removed before committing')), 208 _('mark new/missing files as added/removed before committing')),
209 ('n', 'note', '', 209 ('n', 'note', '',
210 _('use text as commit message for this update')), 210 _('use text as commit message for this update')),
211 ('c', 'change', '', 211 ('c', 'change', '',
212 _('specifies the changeset to amend'), _('REV')) 212 _('specifies the changeset to amend'), _('REV')),
213 ('b', 'branch', '',
214 _('specifies a branch for the new.'), _('REV')),
213 ] + walkopts + commitopts + commitopts2, 215 ] + walkopts + commitopts + commitopts2,
214 _('[OPTION]... [FILE]...')) 216 _('[OPTION]... [FILE]...'))
215 217
216 def amend(ui, repo, *pats, **opts): 218 def amend(ui, repo, *pats, **opts):
217 """combine a changeset with updates and replace it with a new one 219 """combine a changeset with updates and replace it with a new one
241 # determine updates to subsume 243 # determine updates to subsume
242 change = opts.get('change') 244 change = opts.get('change')
243 if change == '.': 245 if change == '.':
244 change = 'p1(p1())' 246 change = 'p1(p1())'
245 old = scmutil.revsingle(repo, change) 247 old = scmutil.revsingle(repo, change)
248 branch = opts.get('branch')
249 if branch:
250 opts.setdefault('extra', {})['branch'] = branch
246 251
247 wlock = repo.wlock() 252 wlock = repo.wlock()
248 try: 253 try:
249 if not old.state().mutable: 254 if not old.state().mutable:
250 raise util.Abort(_("can not rewrite immutable changeset %s") % old) 255 raise util.Abort(_("can not rewrite immutable changeset %s") % old)