D6490: branch: add --force flag to close branch from a not-head changeset

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Fri Jun 7 13:26:10 EDT 2019


mharbison72 requested changes to this revision.
mharbison72 added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> commands.py:1680
> +        elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
> +              and not opts.get('force')):
>              raise error.Abort(_('can only close branch heads'))

I didn't realize that `--force` wasn't already an option for commit, because it is an option to internal commit functions.  I still like this idea, but maybe you need to remove this from `opts` after completing the check here (and also in the `--no-close-branch` case).  Otherwise, it risks bypassing existing safeguards.

https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/localrepo.py#l2498

(I have no idea why that's allowed at all.  MQ maybe?)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6490

To: khanchi97, #hg-reviewers, mharbison72
Cc: mharbison72, mercurial-devel


More information about the Mercurial-devel mailing list