Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 42202:8d14d91584f1
branch: abort if closing branch from a non-branchhead cset
This patch make sure that we abort if the user is trying to
close a branch from a cset which is not a branch head.
Changes in test file reflect the fixed behaviour.
Differential Revision: https://phab.mercurial-scm.org/D6282
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Tue, 16 Apr 2019 02:06:20 +0530 |
parents | 90d48c1c6224 |
children | 0f01394457a0 |
comparison
equal
deleted
inserted
replaced
42201:258821f2d465 | 42202:8d14d91584f1 |
---|---|
1673 if opts.get('close_branch'): | 1673 if opts.get('close_branch'): |
1674 extra['close'] = '1' | 1674 extra['close'] = '1' |
1675 | 1675 |
1676 if not bheads: | 1676 if not bheads: |
1677 raise error.Abort(_('can only close branch heads')) | 1677 raise error.Abort(_('can only close branch heads')) |
1678 elif branch == repo['.'].branch() and repo['.'].node() not in bheads: | |
1679 raise error.Abort(_('can only close branch heads')) | |
1678 elif opts.get('amend'): | 1680 elif opts.get('amend'): |
1679 if (repo['.'].p1().branch() != branch and | 1681 if (repo['.'].p1().branch() != branch and |
1680 repo['.'].p2().branch() != branch): | 1682 repo['.'].p2().branch() != branch): |
1681 raise error.Abort(_('can only close branch heads')) | 1683 raise error.Abort(_('can only close branch heads')) |
1682 | 1684 |