341 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
342 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
342 errors += 1 |
343 errors += 1 |
343 if errors: |
344 if errors: |
344 error = _(".hg/dirstate inconsistent with current parent's manifest") |
345 error = _(".hg/dirstate inconsistent with current parent's manifest") |
345 raise error.Abort(error) |
346 raise error.Abort(error) |
|
347 |
|
348 @command('debugcolor', |
|
349 [('', 'style', None, _('show all configured styles'))], |
|
350 'hg debugcolor') |
|
351 def debugcolor(ui, repo, **opts): |
|
352 """show available color, effects or style""" |
|
353 ui.write(('color mode: %s\n') % ui._colormode) |
|
354 if opts.get('style'): |
|
355 return _debugdisplaystyle(ui) |
|
356 else: |
|
357 return _debugdisplaycolor(ui) |
|
358 |
|
359 def _debugdisplaycolor(ui): |
|
360 oldstyle = ui._styles.copy() |
|
361 try: |
|
362 ui._styles.clear() |
|
363 for effect in color._effects.keys(): |
|
364 ui._styles[effect] = effect |
|
365 if ui._terminfoparams: |
|
366 for k, v in ui.configitems('color'): |
|
367 if k.startswith('color.'): |
|
368 ui._styles[k] = k[6:] |
|
369 elif k.startswith('terminfo.'): |
|
370 ui._styles[k] = k[9:] |
|
371 ui.write(_('available colors:\n')) |
|
372 # sort label with a '_' after the other to group '_background' entry. |
|
373 items = sorted(ui._styles.items(), |
|
374 key=lambda i: ('_' in i[0], i[0], i[1])) |
|
375 for colorname, label in items: |
|
376 ui.write(('%s\n') % colorname, label=label) |
|
377 finally: |
|
378 ui._styles.clear() |
|
379 ui._styles.update(oldstyle) |
|
380 |
|
381 def _debugdisplaystyle(ui): |
|
382 ui.write(_('available style:\n')) |
|
383 width = max(len(s) for s in ui._styles) |
|
384 for label, effects in sorted(ui._styles.items()): |
|
385 ui.write('%s' % label, label=label) |
|
386 if effects: |
|
387 # 50 |
|
388 ui.write(': ') |
|
389 ui.write(' ' * (max(0, width - len(label)))) |
|
390 ui.write(', '.join(ui.label(e, e) for e in effects.split())) |
|
391 ui.write('\n') |
346 |
392 |
347 @command('debugcommands', [], _('[COMMAND]'), norepo=True) |
393 @command('debugcommands', [], _('[COMMAND]'), norepo=True) |
348 def debugcommands(ui, cmd='', *args): |
394 def debugcommands(ui, cmd='', *args): |
349 """list all available commands and options""" |
395 """list all available commands and options""" |
350 for cmd, vals in sorted(commands.table.iteritems()): |
396 for cmd, vals in sorted(commands.table.iteritems()): |