comparison mercurial/commands.py @ 44401:92b7caf4cb9e stable

branch: make --force work even when specifying revs The `hg branch` command accepts a `--force` parameter that allows to "set branch name even if it shadows an existing branch". However, before this patch, that didn?t work when specifying revs with `-r`.
author Manuel Jacob <me@manueljacob.de>
date Sun, 01 Mar 2020 19:39:23 +0100
parents 0ab651b5f77c
children d543ef183eb8
comparison
equal deleted inserted replaced
44378:bb58931d0c4f 44401:92b7caf4cb9e
1336 ui.status(_(b'reset working directory to branch %s\n') % label) 1336 ui.status(_(b'reset working directory to branch %s\n') % label)
1337 elif label: 1337 elif label:
1338 1338
1339 scmutil.checknewlabel(repo, label, b'branch') 1339 scmutil.checknewlabel(repo, label, b'branch')
1340 if revs: 1340 if revs:
1341 return cmdutil.changebranch(ui, repo, revs, label) 1341 return cmdutil.changebranch(ui, repo, revs, label, opts)
1342 1342
1343 if not opts.get(b'force') and label in repo.branchmap(): 1343 if not opts.get(b'force') and label in repo.branchmap():
1344 if label not in [p.branch() for p in repo[None].parents()]: 1344 if label not in [p.branch() for p in repo[None].parents()]:
1345 raise error.Abort( 1345 raise error.Abort(
1346 _(b'a branch of the same name already exists'), 1346 _(b'a branch of the same name already exists'),