291 def debugapplystreamclonebundle(ui, repo, fname): |
291 def debugapplystreamclonebundle(ui, repo, fname): |
292 """apply a stream clone bundle file""" |
292 """apply a stream clone bundle file""" |
293 f = hg.openpath(ui, fname) |
293 f = hg.openpath(ui, fname) |
294 gen = exchange.readbundle(ui, f, fname) |
294 gen = exchange.readbundle(ui, f, fname) |
295 gen.apply(repo) |
295 gen.apply(repo) |
|
296 |
|
297 @command('debugcheckstate', [], '') |
|
298 def debugcheckstate(ui, repo): |
|
299 """validate the correctness of the current dirstate""" |
|
300 parent1, parent2 = repo.dirstate.parents() |
|
301 m1 = repo[parent1].manifest() |
|
302 m2 = repo[parent2].manifest() |
|
303 errors = 0 |
|
304 for f in repo.dirstate: |
|
305 state = repo.dirstate[f] |
|
306 if state in "nr" and f not in m1: |
|
307 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) |
|
308 errors += 1 |
|
309 if state in "a" and f in m1: |
|
310 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) |
|
311 errors += 1 |
|
312 if state in "m" and f not in m1 and f not in m2: |
|
313 ui.warn(_("%s in state %s, but not in either manifest\n") % |
|
314 (f, state)) |
|
315 errors += 1 |
|
316 for f in m1: |
|
317 state = repo.dirstate[f] |
|
318 if state not in "nrm": |
|
319 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
|
320 errors += 1 |
|
321 if errors: |
|
322 error = _(".hg/dirstate inconsistent with current parent's manifest") |
|
323 raise error.Abort(error) |