Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 19305:b500a663a2c7 stable
commit: amending with --close-branch (issue3445)
You can't close a branch that hasn't got a head.
newbranch + commit --close-branch must fail
newbranch + commit + commit --amend --close-branch must fail
You must not be allowed to close a branch that is not defined.
author | Iulian Stana <julian.stana@gmail.com> |
---|---|
date | Thu, 02 May 2013 19:36:47 +0300 |
parents | e078ea9b4ce4 |
children | 59cdd3a7e281 |
comparison
equal
deleted
inserted
replaced
19296:da16d21cf4ed | 19305:b500a663a2c7 |
---|---|
1317 | 1317 |
1318 if repo.vfs.exists('graftstate'): | 1318 if repo.vfs.exists('graftstate'): |
1319 raise util.Abort(_('cannot commit an interrupted graft operation'), | 1319 raise util.Abort(_('cannot commit an interrupted graft operation'), |
1320 hint=_('use "hg graft -c" to continue graft')) | 1320 hint=_('use "hg graft -c" to continue graft')) |
1321 | 1321 |
1322 branch = repo[None].branch() | |
1323 bheads = repo.branchheads(branch) | |
1324 | |
1322 extra = {} | 1325 extra = {} |
1323 if opts.get('close_branch'): | 1326 if opts.get('close_branch'): |
1324 extra['close'] = 1 | 1327 extra['close'] = 1 |
1325 | 1328 |
1326 branch = repo[None].branch() | 1329 if not bheads: |
1327 bheads = repo.branchheads(branch) | 1330 raise util.Abort(_('can only close branch heads')) |
1331 elif opts.get('amend'): | |
1332 if repo.parents()[0].p1().branch() != branch and \ | |
1333 repo.parents()[0].p2().branch() != branch: | |
1334 raise util.Abort(_('can only close branch heads')) | |
1328 | 1335 |
1329 if opts.get('amend'): | 1336 if opts.get('amend'): |
1330 if ui.configbool('ui', 'commitsubrepos'): | 1337 if ui.configbool('ui', 'commitsubrepos'): |
1331 raise util.Abort(_('cannot amend with ui.commitsubrepos enabled')) | 1338 raise util.Abort(_('cannot amend with ui.commitsubrepos enabled')) |
1332 | 1339 |