# HG changeset patch # User Gregory Szorc # Date 1471491509 25200 # Node ID 6bfb333a6f2f353e1e154497d37e373907988e24 # Parent 6da03049666716e90b303af1bf4f55bde24f6b64 debugcommands: move 'debugcheckstate' in the new module diff -r 6da030496667 -r 6bfb333a6f2f mercurial/commands.py --- a/mercurial/commands.py Wed Aug 17 20:37:54 2016 -0700 +++ b/mercurial/commands.py Wed Aug 17 20:38:29 2016 -0700 @@ -1867,34 +1867,6 @@ with repo.wlock(False): return cmdutil.copy(ui, repo, pats, opts) -@command('debugcheckstate', [], '') -def debugcheckstate(ui, repo): - """validate the correctness of the current dirstate""" - parent1, parent2 = repo.dirstate.parents() - m1 = repo[parent1].manifest() - m2 = repo[parent2].manifest() - errors = 0 - for f in repo.dirstate: - state = repo.dirstate[f] - if state in "nr" and f not in m1: - ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) - errors += 1 - if state in "a" and f in m1: - ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) - errors += 1 - if state in "m" and f not in m1 and f not in m2: - ui.warn(_("%s in state %s, but not in either manifest\n") % - (f, state)) - errors += 1 - for f in m1: - state = repo.dirstate[f] - if state not in "nrm": - ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) - errors += 1 - if errors: - error = _(".hg/dirstate inconsistent with current parent's manifest") - raise error.Abort(error) - @command('debugcommands', [], _('[COMMAND]'), norepo=True) def debugcommands(ui, cmd='', *args): """list all available commands and options""" diff -r 6da030496667 -r 6bfb333a6f2f mercurial/debugcommands.py --- a/mercurial/debugcommands.py Wed Aug 17 20:37:54 2016 -0700 +++ b/mercurial/debugcommands.py Wed Aug 17 20:38:29 2016 -0700 @@ -293,3 +293,31 @@ f = hg.openpath(ui, fname) gen = exchange.readbundle(ui, f, fname) gen.apply(repo) + +@command('debugcheckstate', [], '') +def debugcheckstate(ui, repo): + """validate the correctness of the current dirstate""" + parent1, parent2 = repo.dirstate.parents() + m1 = repo[parent1].manifest() + m2 = repo[parent2].manifest() + errors = 0 + for f in repo.dirstate: + state = repo.dirstate[f] + if state in "nr" and f not in m1: + ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) + errors += 1 + if state in "a" and f in m1: + ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) + errors += 1 + if state in "m" and f not in m1 and f not in m2: + ui.warn(_("%s in state %s, but not in either manifest\n") % + (f, state)) + errors += 1 + for f in m1: + state = repo.dirstate[f] + if state not in "nrm": + ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) + errors += 1 + if errors: + error = _(".hg/dirstate inconsistent with current parent's manifest") + raise error.Abort(error)