828 ) |
828 ) |
829 repo.setparents(op1, op2) |
829 repo.setparents(op1, op2) |
830 hg._showstats(repo, stats) |
830 hg._showstats(repo, stats) |
831 if stats.unresolvedcount: |
831 if stats.unresolvedcount: |
832 repo.ui.status( |
832 repo.ui.status( |
833 _(b"use 'hg resolve' to retry unresolved " b"file merges\n") |
833 _(b"use 'hg resolve' to retry unresolved file merges\n") |
834 ) |
834 ) |
835 return 1 |
835 return 1 |
836 else: |
836 else: |
837 hg.clean(repo, node, show_stats=False) |
837 hg.clean(repo, node, show_stats=False) |
838 repo.dirstate.setbranch(branch) |
838 repo.dirstate.setbranch(branch) |
839 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) |
839 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) |
840 |
840 |
841 if opts.get(b'no_commit'): |
841 if opts.get(b'no_commit'): |
842 msg = _(b"changeset %s backed out, " b"don't forget to commit.\n") |
842 msg = _(b"changeset %s backed out, don't forget to commit.\n") |
843 ui.status(msg % short(node)) |
843 ui.status(msg % short(node)) |
844 return 0 |
844 return 0 |
845 |
845 |
846 def commitfunc(ui, repo, message, match, opts): |
846 def commitfunc(ui, repo, message, match, opts): |
847 editform = b'backout' |
847 editform = b'backout' |
1351 return cmdutil.changebranch(ui, repo, revs, label) |
1351 return cmdutil.changebranch(ui, repo, revs, label) |
1352 |
1352 |
1353 if not opts.get(b'force') and label in repo.branchmap(): |
1353 if not opts.get(b'force') and label in repo.branchmap(): |
1354 if label not in [p.branch() for p in repo[None].parents()]: |
1354 if label not in [p.branch() for p in repo[None].parents()]: |
1355 raise error.Abort( |
1355 raise error.Abort( |
1356 _(b'a branch of the same name already' b' exists'), |
1356 _(b'a branch of the same name already exists'), |
1357 # i18n: "it" refers to an existing branch |
1357 # i18n: "it" refers to an existing branch |
1358 hint=_(b"use 'hg update' to switch to it"), |
1358 hint=_(b"use 'hg update' to switch to it"), |
1359 ) |
1359 ) |
1360 |
1360 |
1361 repo.dirstate.setbranch(label) |
1361 repo.dirstate.setbranch(label) |
1560 try: |
1560 try: |
1561 bundlespec = exchange.parsebundlespec(repo, bundletype, strict=False) |
1561 bundlespec = exchange.parsebundlespec(repo, bundletype, strict=False) |
1562 except error.UnsupportedBundleSpecification as e: |
1562 except error.UnsupportedBundleSpecification as e: |
1563 raise error.Abort( |
1563 raise error.Abort( |
1564 pycompat.bytestr(e), |
1564 pycompat.bytestr(e), |
1565 hint=_( |
1565 hint=_(b"see 'hg help bundlespec' for supported values for --type"), |
1566 b"see 'hg help bundlespec' for supported " b"values for --type" |
|
1567 ), |
|
1568 ) |
1566 ) |
1569 cgversion = bundlespec.contentopts[b"cg.version"] |
1567 cgversion = bundlespec.contentopts[b"cg.version"] |
1570 |
1568 |
1571 # Packed bundles are a pseudo bundle format for now. |
1569 # Packed bundles are a pseudo bundle format for now. |
1572 if cgversion == b's1': |
1570 if cgversion == b's1': |
1591 ) |
1589 ) |
1592 |
1590 |
1593 if base: |
1591 if base: |
1594 if dest: |
1592 if dest: |
1595 raise error.Abort( |
1593 raise error.Abort( |
1596 _(b"--base is incompatible with specifying " b"a destination") |
1594 _(b"--base is incompatible with specifying a destination") |
1597 ) |
1595 ) |
1598 common = [repo[rev].node() for rev in base] |
1596 common = [repo[rev].node() for rev in base] |
1599 heads = [repo[r].node() for r in revs] if revs else None |
1597 heads = [repo[r].node() for r in revs] if revs else None |
1600 outgoing = discovery.outgoing(repo, common, heads) |
1598 outgoing = discovery.outgoing(repo, common, heads) |
1601 else: |
1599 else: |
2046 if opts.get(b'close_branch') or opts.get(b'force_close_branch'): |
2044 if opts.get(b'close_branch') or opts.get(b'force_close_branch'): |
2047 extra[b'close'] = b'1' |
2045 extra[b'close'] = b'1' |
2048 |
2046 |
2049 if repo[b'.'].closesbranch(): |
2047 if repo[b'.'].closesbranch(): |
2050 raise error.Abort( |
2048 raise error.Abort( |
2051 _(b'current revision is already a branch closing' b' head') |
2049 _(b'current revision is already a branch closing head') |
2052 ) |
2050 ) |
2053 elif not bheads: |
2051 elif not bheads: |
2054 raise error.Abort(_(b'branch "%s" has no heads to close') % branch) |
2052 raise error.Abort(_(b'branch "%s" has no heads to close') % branch) |
2055 elif ( |
2053 elif ( |
2056 branch == repo[b'.'].branch() |
2054 branch == repo[b'.'].branch() |
2296 if not contstate: |
2294 if not contstate: |
2297 raise error.Abort(_(b'no operation in progress')) |
2295 raise error.Abort(_(b'no operation in progress')) |
2298 if not contstate.continuefunc: |
2296 if not contstate.continuefunc: |
2299 raise error.Abort( |
2297 raise error.Abort( |
2300 ( |
2298 ( |
2301 _(b"%s in progress but does not support " b"'hg continue'") |
2299 _(b"%s in progress but does not support 'hg continue'") |
2302 % (contstate._opname) |
2300 % (contstate._opname) |
2303 ), |
2301 ), |
2304 hint=contstate.continuemsg(), |
2302 hint=contstate.continuemsg(), |
2305 ) |
2303 ) |
2306 if dryrun: |
2304 if dryrun: |
2985 |
2983 |
2986 cont = False |
2984 cont = False |
2987 if opts.get(b'no_commit'): |
2985 if opts.get(b'no_commit'): |
2988 if opts.get(b'edit'): |
2986 if opts.get(b'edit'): |
2989 raise error.Abort( |
2987 raise error.Abort( |
2990 _(b"cannot specify --no-commit and " b"--edit together") |
2988 _(b"cannot specify --no-commit and --edit together") |
2991 ) |
2989 ) |
2992 if opts.get(b'currentuser'): |
2990 if opts.get(b'currentuser'): |
2993 raise error.Abort( |
2991 raise error.Abort( |
2994 _(b"cannot specify --no-commit and " b"--currentuser together") |
2992 _(b"cannot specify --no-commit and --currentuser together") |
2995 ) |
2993 ) |
2996 if opts.get(b'currentdate'): |
2994 if opts.get(b'currentdate'): |
2997 raise error.Abort( |
2995 raise error.Abort( |
2998 _(b"cannot specify --no-commit and " b"--currentdate together") |
2996 _(b"cannot specify --no-commit and --currentdate together") |
2999 ) |
2997 ) |
3000 if opts.get(b'log'): |
2998 if opts.get(b'log'): |
3001 raise error.Abort( |
2999 raise error.Abort( |
3002 _(b"cannot specify --no-commit and " b"--log together") |
3000 _(b"cannot specify --no-commit and --log together") |
3003 ) |
3001 ) |
3004 |
3002 |
3005 graftstate = statemod.cmdstate(repo, b'graftstate') |
3003 graftstate = statemod.cmdstate(repo, b'graftstate') |
3006 |
3004 |
3007 if opts.get(b'stop'): |
3005 if opts.get(b'stop'): |
3008 if opts.get(b'continue'): |
3006 if opts.get(b'continue'): |
3009 raise error.Abort( |
3007 raise error.Abort( |
3010 _(b"cannot use '--continue' and " b"'--stop' together") |
3008 _(b"cannot use '--continue' and '--stop' together") |
3011 ) |
3009 ) |
3012 if opts.get(b'abort'): |
3010 if opts.get(b'abort'): |
3013 raise error.Abort(_(b"cannot use '--abort' and '--stop' together")) |
3011 raise error.Abort(_(b"cannot use '--abort' and '--stop' together")) |
3014 |
3012 |
3015 if any( |
3013 if any( |
3026 raise error.Abort(_(b"cannot specify any other flag with '--stop'")) |
3024 raise error.Abort(_(b"cannot specify any other flag with '--stop'")) |
3027 return _stopgraft(ui, repo, graftstate) |
3025 return _stopgraft(ui, repo, graftstate) |
3028 elif opts.get(b'abort'): |
3026 elif opts.get(b'abort'): |
3029 if opts.get(b'continue'): |
3027 if opts.get(b'continue'): |
3030 raise error.Abort( |
3028 raise error.Abort( |
3031 _(b"cannot use '--continue' and " b"'--abort' together") |
3029 _(b"cannot use '--continue' and '--abort' together") |
3032 ) |
3030 ) |
3033 if any( |
3031 if any( |
3034 ( |
3032 ( |
3035 opts.get(b'edit'), |
3033 opts.get(b'edit'), |
3036 opts.get(b'log'), |
3034 opts.get(b'log'), |
4902 clearable=True, |
4900 clearable=True, |
4903 allowcommit=True, |
4901 allowcommit=True, |
4904 cmdmsg=_(b'outstanding uncommitted merge'), |
4902 cmdmsg=_(b'outstanding uncommitted merge'), |
4905 abortfunc=hg.abortmerge, |
4903 abortfunc=hg.abortmerge, |
4906 statushint=_( |
4904 statushint=_( |
4907 b'To continue: hg commit\n' b'To abort: hg merge --abort' |
4905 b'To continue: hg commit\nTo abort: hg merge --abort' |
4908 ), |
4906 ), |
4909 cmdhint=_(b"use 'hg commit' or 'hg merge --abort'"), |
4907 cmdhint=_(b"use 'hg commit' or 'hg merge --abort'"), |
4910 ) |
4908 ) |
4911 |
4909 |
4912 |
4910 |
5303 ui.status( |
5301 ui.status( |
5304 _(b"(run 'hg heads' to see heads, 'hg merge' to merge)\n") |
5302 _(b"(run 'hg heads' to see heads, 'hg merge' to merge)\n") |
5305 ) |
5303 ) |
5306 elif currentbranchheads > 1: |
5304 elif currentbranchheads > 1: |
5307 ui.status( |
5305 ui.status( |
5308 _(b"(run 'hg heads .' to see heads, 'hg merge' to " b"merge)\n") |
5306 _(b"(run 'hg heads .' to see heads, 'hg merge' to merge)\n") |
5309 ) |
5307 ) |
5310 else: |
5308 else: |
5311 ui.status(_(b"(run 'hg heads' to see heads)\n")) |
5309 ui.status(_(b"(run 'hg heads' to see heads)\n")) |
5312 elif not ui.configbool(b'commands', b'update.requiredest'): |
5310 elif not ui.configbool(b'commands', b'update.requiredest'): |
5313 ui.status(_(b"(run 'hg update' to get a working copy)\n")) |
5311 ui.status(_(b"(run 'hg update' to get a working copy)\n")) |
5613 expr = revsetlang.formatspec(b'heads(%r)', path.pushrev) |
5611 expr = revsetlang.formatspec(b'heads(%r)', path.pushrev) |
5614 revs = scmutil.revrange(repo, [expr]) |
5612 revs = scmutil.revrange(repo, [expr]) |
5615 revs = [repo[rev].node() for rev in revs] |
5613 revs = [repo[rev].node() for rev in revs] |
5616 if not revs: |
5614 if not revs: |
5617 raise error.Abort( |
5615 raise error.Abort( |
5618 _(b'default push revset for path evaluates to an ' b'empty set') |
5616 _(b'default push revset for path evaluates to an empty set') |
5619 ) |
5617 ) |
5620 |
5618 |
5621 repo._subtoppath = dest |
5619 repo._subtoppath = dest |
5622 try: |
5620 try: |
5623 # push subrepos depth-first for coherent ordering |
5621 # push subrepos depth-first for coherent ordering |
6472 raise error.Abort(_(b"cannot use --print-url with --verbose")) |
6470 raise error.Abort(_(b"cannot use --print-url with --verbose")) |
6473 |
6471 |
6474 if opts[b"stdio"]: |
6472 if opts[b"stdio"]: |
6475 if repo is None: |
6473 if repo is None: |
6476 raise error.RepoError( |
6474 raise error.RepoError( |
6477 _(b"there is no Mercurial repository here" b" (.hg not found)") |
6475 _(b"there is no Mercurial repository here (.hg not found)") |
6478 ) |
6476 ) |
6479 s = wireprotoserver.sshserver(ui, repo) |
6477 s = wireprotoserver.sshserver(ui, repo) |
6480 s.serve_forever() |
6478 s.serve_forever() |
6481 |
6479 |
6482 service = server.createservice(ui, repo, opts) |
6480 service = server.createservice(ui, repo, opts) |
7232 raise error.Abort(_(b'tag names must be unique')) |
7230 raise error.Abort(_(b'tag names must be unique')) |
7233 for n in names: |
7231 for n in names: |
7234 scmutil.checknewlabel(repo, n, b'tag') |
7232 scmutil.checknewlabel(repo, n, b'tag') |
7235 if not n: |
7233 if not n: |
7236 raise error.Abort( |
7234 raise error.Abort( |
7237 _(b'tag names cannot consist entirely of ' b'whitespace') |
7235 _(b'tag names cannot consist entirely of whitespace') |
7238 ) |
7236 ) |
7239 if opts.get(b'rev') and opts.get(b'remove'): |
7237 if opts.get(b'rev') and opts.get(b'remove'): |
7240 raise error.Abort(_(b"--rev and --remove are incompatible")) |
7238 raise error.Abort(_(b"--rev and --remove are incompatible")) |
7241 if opts.get(b'rev'): |
7239 if opts.get(b'rev'): |
7242 rev_ = opts[b'rev'] |
7240 rev_ = opts[b'rev'] |
7267 message = b'Removed tag %s' % b', '.join(names) |
7265 message = b'Removed tag %s' % b', '.join(names) |
7268 elif not opts.get(b'force'): |
7266 elif not opts.get(b'force'): |
7269 for n in names: |
7267 for n in names: |
7270 if n in repo.tags(): |
7268 if n in repo.tags(): |
7271 raise error.Abort( |
7269 raise error.Abort( |
7272 _(b"tag '%s' already exists " b"(use -f to force)") % n |
7270 _(b"tag '%s' already exists (use -f to force)") % n |
7273 ) |
7271 ) |
7274 if not opts.get(b'local'): |
7272 if not opts.get(b'local'): |
7275 p1, p2 = repo.dirstate.parents() |
7273 p1, p2 = repo.dirstate.parents() |
7276 if p2 != nullid: |
7274 if p2 != nullid: |
7277 raise error.Abort(_(b'uncommitted merge')) |
7275 raise error.Abort(_(b'uncommitted merge')) |