Show More
@@ -1584,6 +1584,8 b' def clone(ui, source, dest=None, **opts)' | |||
|
1584 | 1584 | ('', 'amend', None, _('amend the parent of the working directory')), |
|
1585 | 1585 | ('s', 'secret', None, _('use the secret phase for committing')), |
|
1586 | 1586 | ('e', 'edit', None, _('invoke editor on commit messages')), |
|
1587 | ('', 'force-close-branch', None, | |
|
1588 | _('forcibly close branch from a non-head changeset (ADVANCED)')), | |
|
1587 | 1589 | ('i', 'interactive', None, _('use interactive mode')), |
|
1588 | 1590 | ] + walkopts + commitopts + commitopts2 + subrepoopts, |
|
1589 | 1591 | _('[OPTION]... [FILE]...'), |
@@ -1671,7 +1673,7 b' def _docommit(ui, repo, *pats, **opts):' | |||
|
1671 | 1673 | bheads = repo.branchheads(branch) |
|
1672 | 1674 | |
|
1673 | 1675 | extra = {} |
|
1674 | if opts.get('close_branch'): | |
|
1676 | if opts.get('close_branch') or opts.get('force_close_branch'): | |
|
1675 | 1677 | extra['close'] = '1' |
|
1676 | 1678 | |
|
1677 | 1679 | if repo['.'].closesbranch(): |
@@ -1679,8 +1681,11 b' def _docommit(ui, repo, *pats, **opts):' | |||
|
1679 | 1681 | ' head')) |
|
1680 | 1682 | elif not bheads: |
|
1681 | 1683 | raise error.Abort(_('branch "%s" has no heads to close') % branch) |
|
1682 |
elif branch == repo['.'].branch() and repo['.'].node() not in bheads |
|
|
1683 | raise error.Abort(_('can only close branch heads')) | |
|
1684 | elif (branch == repo['.'].branch() and repo['.'].node() not in bheads | |
|
1685 | and not opts.get('force_close_branch')): | |
|
1686 | hint = _('use --force-close-branch to close branch from a non-head' | |
|
1687 | ' changeset') | |
|
1688 | raise error.Abort(_('can only close branch heads'), hint=hint) | |
|
1684 | 1689 | elif opts.get('amend'): |
|
1685 | 1690 | if (repo['.'].p1().branch() != branch and |
|
1686 | 1691 | repo['.'].p2().branch() != branch): |
@@ -958,6 +958,7 b' trying to close branch from a cset which' | |||
|
958 | 958 | it should abort: |
|
959 | 959 | $ hg ci -m "closing branch" --close-branch |
|
960 | 960 | abort: can only close branch heads |
|
961 | (use --force-close-branch to close branch from a non-head changeset) | |
|
961 | 962 | [255] |
|
962 | 963 | |
|
963 | 964 | $ hg up 0 |
@@ -972,3 +973,18 b' it should abort:' | |||
|
972 | 973 | @ 0: 9092f1db7931 added a |
|
973 | 974 | default |
|
974 | 975 | |
|
976 | Test --force-close-branch to close a branch from a non-head changeset: | |
|
977 | --------------------------------------------------------------------- | |
|
978 | ||
|
979 | $ hg show stack --config extensions.show= | |
|
980 | o 1553 added c | |
|
981 | o 5f6d added b | |
|
982 | @ 9092 added a | |
|
983 | ||
|
984 | $ hg ci -m "branch closed" --close-branch | |
|
985 | abort: can only close branch heads | |
|
986 | (use --force-close-branch to close branch from a non-head changeset) | |
|
987 | [255] | |
|
988 | ||
|
989 | $ hg ci -m "branch closed" --force-close-branch | |
|
990 | created new head |
@@ -247,7 +247,7 b' Show all commands + options' | |||
|
247 | 247 | bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure |
|
248 | 248 | cat: output, rev, decode, include, exclude, template |
|
249 | 249 | clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure |
|
250 | commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos | |
|
250 | commit: addremove, close-branch, amend, secret, edit, force-close-branch, interactive, include, exclude, message, logfile, date, user, subrepos | |
|
251 | 251 | config: untrusted, edit, local, global, template |
|
252 | 252 | copy: after, force, include, exclude, dry-run |
|
253 | 253 | debugancestor: |
General Comments 0
You need to be logged in to leave comments.
Login now