##// END OF EJS Templates
commit: add --force-close-branch flag to close a non-head changeset...
Sushil khanchi -
r42745:2e1d9414 default
parent child Browse files
Show More
@@ -1584,6 +1584,8 b' def clone(ui, source, dest=None, **opts)'
1584 ('', 'amend', None, _('amend the parent of the working directory')),
1584 ('', 'amend', None, _('amend the parent of the working directory')),
1585 ('s', 'secret', None, _('use the secret phase for committing')),
1585 ('s', 'secret', None, _('use the secret phase for committing')),
1586 ('e', 'edit', None, _('invoke editor on commit messages')),
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 ('i', 'interactive', None, _('use interactive mode')),
1589 ('i', 'interactive', None, _('use interactive mode')),
1588 ] + walkopts + commitopts + commitopts2 + subrepoopts,
1590 ] + walkopts + commitopts + commitopts2 + subrepoopts,
1589 _('[OPTION]... [FILE]...'),
1591 _('[OPTION]... [FILE]...'),
@@ -1671,7 +1673,7 b' def _docommit(ui, repo, *pats, **opts):'
1671 bheads = repo.branchheads(branch)
1673 bheads = repo.branchheads(branch)
1672
1674
1673 extra = {}
1675 extra = {}
1674 if opts.get('close_branch'):
1676 if opts.get('close_branch') or opts.get('force_close_branch'):
1675 extra['close'] = '1'
1677 extra['close'] = '1'
1676
1678
1677 if repo['.'].closesbranch():
1679 if repo['.'].closesbranch():
@@ -1679,8 +1681,11 b' def _docommit(ui, repo, *pats, **opts):'
1679 ' head'))
1681 ' head'))
1680 elif not bheads:
1682 elif not bheads:
1681 raise error.Abort(_('branch "%s" has no heads to close') % branch)
1683 raise error.Abort(_('branch "%s" has no heads to close') % branch)
1682 elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
1684 elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
1683 raise error.Abort(_('can only close branch heads'))
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 elif opts.get('amend'):
1689 elif opts.get('amend'):
1685 if (repo['.'].p1().branch() != branch and
1690 if (repo['.'].p1().branch() != branch and
1686 repo['.'].p2().branch() != branch):
1691 repo['.'].p2().branch() != branch):
@@ -958,6 +958,7 b' trying to close branch from a cset which'
958 it should abort:
958 it should abort:
959 $ hg ci -m "closing branch" --close-branch
959 $ hg ci -m "closing branch" --close-branch
960 abort: can only close branch heads
960 abort: can only close branch heads
961 (use --force-close-branch to close branch from a non-head changeset)
961 [255]
962 [255]
962
963
963 $ hg up 0
964 $ hg up 0
@@ -972,3 +973,18 b' it should abort:'
972 @ 0: 9092f1db7931 added a
973 @ 0: 9092f1db7931 added a
973 default
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 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
247 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
248 cat: output, rev, decode, include, exclude, template
248 cat: output, rev, decode, include, exclude, template
249 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
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 config: untrusted, edit, local, global, template
251 config: untrusted, edit, local, global, template
252 copy: after, force, include, exclude, dry-run
252 copy: after, force, include, exclude, dry-run
253 debugancestor:
253 debugancestor:
General Comments 0
You need to be logged in to leave comments. Login now