##// END OF EJS Templates
commit: amending with --close-branch (issue3445)...
Iulian Stana -
r19305:b500a663 stable
parent child Browse files
Show More
@@ -1319,12 +1319,19 b' def commit(ui, repo, *pats, **opts):'
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'):
@@ -267,14 +267,16 b' verify update will accept invalid legacy'
267 $ hg up -C b
267 $ hg up -C b
268 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
268 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
269 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
270 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
271 abort: can only close branch heads
272 [255]
270
273
271 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
272 $ hg log -r tip --debug
274 $ hg log -r tip --debug
273 changeset: 13:c2601d54b1427e99506bee25a566ef3a5963af0b
275 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
274 branch: b
276 branch: b
275 tag: tip
277 tag: tip
276 phase: draft
278 phase: draft
277 parent: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
279 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
278 parent: -1:0000000000000000000000000000000000000000
280 parent: -1:0000000000000000000000000000000000000000
279 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
281 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
280 user: test
282 user: test
@@ -282,13 +284,9 b' verify update will accept invalid legacy'
282 extra: branch=b
284 extra: branch=b
283 extra: close=1
285 extra: close=1
284 description:
286 description:
285 re-closing this branch
287 close this part branch too
286
288
287
289
288 $ hg rollback
289 repository tip rolled back to revision 12 (undo commit)
290 working directory now based on revision 12
291
292 --- b branch should be inactive
290 --- b branch should be inactive
293
291
294 $ hg branches
292 $ hg branches
@@ -743,3 +743,27 b' Amend a merge changeset (with manifest-l'
743 -aa
743 -aa
744 -aa
744 -aa
745
745
746 Issue 3445: amending with --close-branch a commit that created a new head should fail
747 This shouldn't be possible:
748
749 $ hg up -q default
750 $ hg branch closewithamend
751 marked working directory as branch closewithamend
752 (branches are permanent and global, did you want a bookmark?)
753 $ hg ci -Am..
754 adding cc.orig
755 adding obs.py
756 adding obs.pyc
757 $ hg ci --amend --close-branch -m 'closing'
758 abort: can only close branch heads
759 [255]
760
761 This silliness fails:
762
763 $ hg branch silliness
764 marked working directory as branch silliness
765 (branches are permanent and global, did you want a bookmark?)
766 $ echo b >> b
767 $ hg ci --close-branch -m'open and close'
768 abort: can only close branch heads
769 [255]
General Comments 0
You need to be logged in to leave comments. Login now