178 Aborts a multistep operation like graft, histedit, rebase, merge, |
178 Aborts a multistep operation like graft, histedit, rebase, merge, |
179 and unshelve if they are in an unfinished state. |
179 and unshelve if they are in an unfinished state. |
180 |
180 |
181 use --dry-run/-n to dry run the command. |
181 use --dry-run/-n to dry run the command. |
182 """ |
182 """ |
183 dryrun = opts.get(r'dry_run') |
183 dryrun = opts.get('dry_run') |
184 abortstate = cmdutil.getunfinishedstate(repo) |
184 abortstate = cmdutil.getunfinishedstate(repo) |
185 if not abortstate: |
185 if not abortstate: |
186 raise error.Abort(_(b'no operation in progress')) |
186 raise error.Abort(_(b'no operation in progress')) |
187 if not abortstate.abortfunc: |
187 if not abortstate.abortfunc: |
188 raise error.Abort( |
188 raise error.Abort( |
2017 with repo.wlock(), repo.lock(): |
2017 with repo.wlock(), repo.lock(): |
2018 return _docommit(ui, repo, *pats, **opts) |
2018 return _docommit(ui, repo, *pats, **opts) |
2019 |
2019 |
2020 |
2020 |
2021 def _docommit(ui, repo, *pats, **opts): |
2021 def _docommit(ui, repo, *pats, **opts): |
2022 if opts.get(r'interactive'): |
2022 if opts.get('interactive'): |
2023 opts.pop(r'interactive') |
2023 opts.pop('interactive') |
2024 ret = cmdutil.dorecord( |
2024 ret = cmdutil.dorecord( |
2025 ui, repo, commit, None, False, cmdutil.recordfilter, *pats, **opts |
2025 ui, repo, commit, None, False, cmdutil.recordfilter, *pats, **opts |
2026 ) |
2026 ) |
2027 # ret can be 0 (no changes to record) or the value returned by |
2027 # ret can be 0 (no changes to record) or the value returned by |
2028 # commit(), 1 if nothing changed or None on success. |
2028 # commit(), 1 if nothing changed or None on success. |
2293 Finishes a multistep operation like graft, histedit, rebase, merge, |
2293 Finishes a multistep operation like graft, histedit, rebase, merge, |
2294 and unshelve if they are in an interrupted state. |
2294 and unshelve if they are in an interrupted state. |
2295 |
2295 |
2296 use --dry-run/-n to dry run the command. |
2296 use --dry-run/-n to dry run the command. |
2297 """ |
2297 """ |
2298 dryrun = opts.get(r'dry_run') |
2298 dryrun = opts.get('dry_run') |
2299 contstate = cmdutil.getunfinishedstate(repo) |
2299 contstate = cmdutil.getunfinishedstate(repo) |
2300 if not contstate: |
2300 if not contstate: |
2301 raise error.Abort(_(b'no operation in progress')) |
2301 raise error.Abort(_(b'no operation in progress')) |
2302 if not contstate.continuefunc: |
2302 if not contstate.continuefunc: |
2303 raise error.Abort( |
2303 raise error.Abort( |
2373 norepo=True, |
2373 norepo=True, |
2374 ) |
2374 ) |
2375 def debugcomplete(ui, cmd=b'', **opts): |
2375 def debugcomplete(ui, cmd=b'', **opts): |
2376 """returns the completion list associated with the given command""" |
2376 """returns the completion list associated with the given command""" |
2377 |
2377 |
2378 if opts.get(r'options'): |
2378 if opts.get('options'): |
2379 options = [] |
2379 options = [] |
2380 otables = [globalopts] |
2380 otables = [globalopts] |
2381 if cmd: |
2381 if cmd: |
2382 aliases, entry = cmdutil.findcmd(cmd, table, False) |
2382 aliases, entry = cmdutil.findcmd(cmd, table, False) |
2383 otables.append(entry[1]) |
2383 otables.append(entry[1]) |
3454 m.append(s) |
3454 m.append(s) |
3455 |
3455 |
3456 def difflinestates(a, b): |
3456 def difflinestates(a, b): |
3457 sm = difflib.SequenceMatcher(None, a, b) |
3457 sm = difflib.SequenceMatcher(None, a, b) |
3458 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
3458 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
3459 if tag == r'insert': |
3459 if tag == 'insert': |
3460 for i in pycompat.xrange(blo, bhi): |
3460 for i in pycompat.xrange(blo, bhi): |
3461 yield (b'+', b[i]) |
3461 yield (b'+', b[i]) |
3462 elif tag == r'delete': |
3462 elif tag == 'delete': |
3463 for i in pycompat.xrange(alo, ahi): |
3463 for i in pycompat.xrange(alo, ahi): |
3464 yield (b'-', a[i]) |
3464 yield (b'-', a[i]) |
3465 elif tag == r'replace': |
3465 elif tag == 'replace': |
3466 for i in pycompat.xrange(alo, ahi): |
3466 for i in pycompat.xrange(alo, ahi): |
3467 yield (b'-', a[i]) |
3467 yield (b'-', a[i]) |
3468 for i in pycompat.xrange(blo, bhi): |
3468 for i in pycompat.xrange(blo, bhi): |
3469 yield (b'+', b[i]) |
3469 yield (b'+', b[i]) |
3470 |
3470 |
5697 |
5697 |
5698 Returns 0 if successful, 1 if nothing to recover or verify fails. |
5698 Returns 0 if successful, 1 if nothing to recover or verify fails. |
5699 """ |
5699 """ |
5700 ret = repo.recover() |
5700 ret = repo.recover() |
5701 if ret: |
5701 if ret: |
5702 if opts[r'verify']: |
5702 if opts['verify']: |
5703 return hg.verify(repo) |
5703 return hg.verify(repo) |
5704 else: |
5704 else: |
5705 msg = _( |
5705 msg = _( |
5706 b"(verify step skipped, run `hg verify` to check your " |
5706 b"(verify step skipped, run `hg verify` to check your " |
5707 b"repository content)\n" |
5707 b"repository content)\n" |
6342 if not ui.configbool(b'ui', b'rollback'): |
6342 if not ui.configbool(b'ui', b'rollback'): |
6343 raise error.Abort( |
6343 raise error.Abort( |
6344 _(b'rollback is disabled because it is unsafe'), |
6344 _(b'rollback is disabled because it is unsafe'), |
6345 hint=b'see `hg help -v rollback` for information', |
6345 hint=b'see `hg help -v rollback` for information', |
6346 ) |
6346 ) |
6347 return repo.rollback(dryrun=opts.get(r'dry_run'), force=opts.get(r'force')) |
6347 return repo.rollback(dryrun=opts.get('dry_run'), force=opts.get('force')) |
6348 |
6348 |
6349 |
6349 |
6350 @command( |
6350 @command( |
6351 b'root', |
6351 b'root', |
6352 [] + formatteropts, |
6352 [] + formatteropts, |
7653 |
7653 |
7654 See :hg:`help dates` for a list of formats valid for -d/--date. |
7654 See :hg:`help dates` for a list of formats valid for -d/--date. |
7655 |
7655 |
7656 Returns 0 on success, 1 if there are unresolved files. |
7656 Returns 0 on success, 1 if there are unresolved files. |
7657 """ |
7657 """ |
7658 rev = opts.get(r'rev') |
7658 rev = opts.get('rev') |
7659 date = opts.get(r'date') |
7659 date = opts.get('date') |
7660 clean = opts.get(r'clean') |
7660 clean = opts.get('clean') |
7661 check = opts.get(r'check') |
7661 check = opts.get('check') |
7662 merge = opts.get(r'merge') |
7662 merge = opts.get('merge') |
7663 if rev and node: |
7663 if rev and node: |
7664 raise error.Abort(_(b"please specify just one revision")) |
7664 raise error.Abort(_(b"please specify just one revision")) |
7665 |
7665 |
7666 if ui.configbool(b'commands', b'update.requiredest'): |
7666 if ui.configbool(b'commands', b'update.requiredest'): |
7667 if not node and not rev and not date: |
7667 if not node and not rev and not date: |
7700 if rev: |
7700 if rev: |
7701 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn') |
7701 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn') |
7702 ctx = scmutil.revsingle(repo, rev, default=None) |
7702 ctx = scmutil.revsingle(repo, rev, default=None) |
7703 rev = ctx.rev() |
7703 rev = ctx.rev() |
7704 hidden = ctx.hidden() |
7704 hidden = ctx.hidden() |
7705 overrides = {(b'ui', b'forcemerge'): opts.get(r'tool', b'')} |
7705 overrides = {(b'ui', b'forcemerge'): opts.get('tool', b'')} |
7706 with ui.configoverride(overrides, b'update'): |
7706 with ui.configoverride(overrides, b'update'): |
7707 ret = hg.updatetotally( |
7707 ret = hg.updatetotally( |
7708 ui, repo, rev, brev, clean=clean, updatecheck=updatecheck |
7708 ui, repo, rev, brev, clean=clean, updatecheck=updatecheck |
7709 ) |
7709 ) |
7710 if hidden: |
7710 if hidden: |