Show More
@@ -1319,12 +1319,19 b' def commit(ui, repo, *pats, **opts):' | |||
|
1319 | 1319 | raise util.Abort(_('cannot commit an interrupted graft operation'), |
|
1320 | 1320 | hint=_('use "hg graft -c" to continue graft')) |
|
1321 | 1321 | |
|
1322 | branch = repo[None].branch() | |
|
1323 | bheads = repo.branchheads(branch) | |
|
1324 | ||
|
1322 | 1325 | extra = {} |
|
1323 | 1326 | if opts.get('close_branch'): |
|
1324 | 1327 | extra['close'] = 1 |
|
1325 | 1328 | |
|
1326 | branch = repo[None].branch() | |
|
1327 | bheads = repo.branchheads(branch) | |
|
1329 | if not bheads: | |
|
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 | 1336 | if opts.get('amend'): |
|
1330 | 1337 | if ui.configbool('ui', 'commitsubrepos'): |
@@ -267,14 +267,16 b' verify update will accept invalid legacy' | |||
|
267 | 267 | $ hg up -C b |
|
268 | 268 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
269 | 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 | 274 |
$ |
|
273 | changeset: 13:c2601d54b1427e99506bee25a566ef3a5963af0b | |
|
275 | changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f | |
|
274 | 276 | branch: b |
|
275 | 277 | tag: tip |
|
276 | 278 | phase: draft |
|
277 | parent: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f | |
|
279 | parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1 | |
|
278 | 280 | parent: -1:0000000000000000000000000000000000000000 |
|
279 | 281 | manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee |
|
280 | 282 | user: test |
@@ -282,13 +284,9 b' verify update will accept invalid legacy' | |||
|
282 | 284 | extra: branch=b |
|
283 | 285 | extra: close=1 |
|
284 | 286 | description: |
|
285 |
|
|
|
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 | 290 | --- b branch should be inactive |
|
293 | 291 | |
|
294 | 292 | $ hg branches |
@@ -743,3 +743,27 b' Amend a merge changeset (with manifest-l' | |||
|
743 | 743 | -aa |
|
744 | 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