Show More
@@ -1007,7 +1007,7 b' def findcmd(cmd, table, strict=True):' | |||||
1007 | raise error.UnknownCommand(cmd, allcmds) |
|
1007 | raise error.UnknownCommand(cmd, allcmds) | |
1008 |
|
1008 | |||
1009 |
|
1009 | |||
1010 | def changebranch(ui, repo, revs, label, opts): |
|
1010 | def changebranch(ui, repo, revs, label, **opts): | |
1011 | """Change the branch name of given revs to label""" |
|
1011 | """Change the branch name of given revs to label""" | |
1012 |
|
1012 | |||
1013 | with repo.wlock(), repo.lock(), repo.transaction(b'branches'): |
|
1013 | with repo.wlock(), repo.lock(), repo.transaction(b'branches'): | |
@@ -1026,7 +1026,7 b' def changebranch(ui, repo, revs, label, ' | |||||
1026 | root = repo[roots.first()] |
|
1026 | root = repo[roots.first()] | |
1027 | rpb = {parent.branch() for parent in root.parents()} |
|
1027 | rpb = {parent.branch() for parent in root.parents()} | |
1028 | if ( |
|
1028 | if ( | |
1029 |
not opts.get( |
|
1029 | not opts.get('force') | |
1030 | and label not in rpb |
|
1030 | and label not in rpb | |
1031 | and label in repo.branchmap() |
|
1031 | and label in repo.branchmap() | |
1032 | ): |
|
1032 | ): |
@@ -1339,12 +1339,11 b' def branch(ui, repo, label=None, **opts)' | |||||
1339 |
|
1339 | |||
1340 | Returns 0 on success. |
|
1340 | Returns 0 on success. | |
1341 | """ |
|
1341 | """ | |
1342 | opts = pycompat.byteskwargs(opts) |
|
1342 | revs = opts.get('rev') | |
1343 | revs = opts.get(b'rev') |
|
|||
1344 | if label: |
|
1343 | if label: | |
1345 | label = label.strip() |
|
1344 | label = label.strip() | |
1346 |
|
1345 | |||
1347 |
if not opts.get( |
|
1346 | if not opts.get('clean') and not label: | |
1348 | if revs: |
|
1347 | if revs: | |
1349 | raise error.InputError( |
|
1348 | raise error.InputError( | |
1350 | _(b"no branch name specified for the revisions") |
|
1349 | _(b"no branch name specified for the revisions") | |
@@ -1353,7 +1352,7 b' def branch(ui, repo, label=None, **opts)' | |||||
1353 | return |
|
1352 | return | |
1354 |
|
1353 | |||
1355 | with repo.wlock(): |
|
1354 | with repo.wlock(): | |
1356 |
if opts.get( |
|
1355 | if opts.get('clean'): | |
1357 | label = repo[b'.'].branch() |
|
1356 | label = repo[b'.'].branch() | |
1358 | repo.dirstate.setbranch(label, repo.currenttransaction()) |
|
1357 | repo.dirstate.setbranch(label, repo.currenttransaction()) | |
1359 | ui.status(_(b'reset working directory to branch %s\n') % label) |
|
1358 | ui.status(_(b'reset working directory to branch %s\n') % label) | |
@@ -1361,9 +1360,9 b' def branch(ui, repo, label=None, **opts)' | |||||
1361 |
|
1360 | |||
1362 | scmutil.checknewlabel(repo, label, b'branch') |
|
1361 | scmutil.checknewlabel(repo, label, b'branch') | |
1363 | if revs: |
|
1362 | if revs: | |
1364 | return cmdutil.changebranch(ui, repo, revs, label, opts) |
|
1363 | return cmdutil.changebranch(ui, repo, revs, label, **opts) | |
1365 |
|
1364 | |||
1366 |
if not opts.get( |
|
1365 | if not opts.get('force') and label in repo.branchmap(): | |
1367 | if label not in [p.branch() for p in repo[None].parents()]: |
|
1366 | if label not in [p.branch() for p in repo[None].parents()]: | |
1368 | raise error.InputError( |
|
1367 | raise error.InputError( | |
1369 | _(b'a branch of the same name already exists'), |
|
1368 | _(b'a branch of the same name already exists'), |
General Comments 0
You need to be logged in to leave comments.
Login now