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