equal
deleted
inserted
replaced
959 return list(choice.values())[0] |
959 return list(choice.values())[0] |
960 |
960 |
961 raise error.UnknownCommand(cmd, allcmds) |
961 raise error.UnknownCommand(cmd, allcmds) |
962 |
962 |
963 |
963 |
964 def changebranch(ui, repo, revs, label): |
964 def changebranch(ui, repo, revs, label, opts): |
965 """ Change the branch name of given revs to label """ |
965 """ Change the branch name of given revs to label """ |
966 |
966 |
967 with repo.wlock(), repo.lock(), repo.transaction(b'branches'): |
967 with repo.wlock(), repo.lock(), repo.transaction(b'branches'): |
968 # abort in case of uncommitted merge or dirty wdir |
968 # abort in case of uncommitted merge or dirty wdir |
969 bailifchanged(repo) |
969 bailifchanged(repo) |
977 ) |
977 ) |
978 rewriteutil.precheck(repo, revs, b'change branch of') |
978 rewriteutil.precheck(repo, revs, b'change branch of') |
979 |
979 |
980 root = repo[roots.first()] |
980 root = repo[roots.first()] |
981 rpb = {parent.branch() for parent in root.parents()} |
981 rpb = {parent.branch() for parent in root.parents()} |
982 if label not in rpb and label in repo.branchmap(): |
982 if ( |
|
983 not opts.get(b'force') |
|
984 and label not in rpb |
|
985 and label in repo.branchmap() |
|
986 ): |
983 raise error.Abort(_(b"a branch of the same name already exists")) |
987 raise error.Abort(_(b"a branch of the same name already exists")) |
984 |
988 |
985 if repo.revs(b'obsolete() and %ld', revs): |
989 if repo.revs(b'obsolete() and %ld', revs): |
986 raise error.Abort( |
990 raise error.Abort( |
987 _(b"cannot change branch of a obsolete changeset") |
991 _(b"cannot change branch of a obsolete changeset") |