comparison mercurial/commands.py @ 4615:a8be3c875988

dirstate: hide internal vars Add an __iter__ method so commands don't need to poke at _map.
author Matt Mackall <mpm@selenic.com>
date Mon, 18 Jun 2007 13:24:34 -0500
parents e69da61e467e
children 63b9d2deed48
comparison
equal deleted inserted replaced
4614:3a645af7fb76 4615:a8be3c875988
675 repo.dirstate.rebuild(rev, files) 675 repo.dirstate.rebuild(rev, files)
676 676
677 def debugcheckstate(ui, repo): 677 def debugcheckstate(ui, repo):
678 """validate the correctness of the current dirstate""" 678 """validate the correctness of the current dirstate"""
679 parent1, parent2 = repo.dirstate.parents() 679 parent1, parent2 = repo.dirstate.parents()
680 repo.dirstate.read() 680 dc = repo.dirstate
681 dc = repo.dirstate.map
682 keys = dc.keys()
683 keys.sort()
684 m1 = repo.changectx(parent1).manifest() 681 m1 = repo.changectx(parent1).manifest()
685 m2 = repo.changectx(parent2).manifest() 682 m2 = repo.changectx(parent2).manifest()
686 errors = 0 683 errors = 0
687 for f in dc: 684 for f in dc:
688 state = repo.dirstate.state(f) 685 state = repo.dirstate.state(f)
747 finally: 744 finally:
748 wlock.release() 745 wlock.release()
749 746
750 def debugstate(ui, repo): 747 def debugstate(ui, repo):
751 """show the contents of the current dirstate""" 748 """show the contents of the current dirstate"""
752 repo.dirstate.read() 749 dc = repo.dirstate
753 dc = repo.dirstate.map 750 for file_ in dc:
754 keys = dc.keys()
755 keys.sort()
756 for file_ in keys:
757 if dc[file_][3] == -1: 751 if dc[file_][3] == -1:
758 # Pad or slice to locale representation 752 # Pad or slice to locale representation
759 locale_len = len(time.strftime("%x %X", time.localtime(0))) 753 locale_len = len(time.strftime("%x %X", time.localtime(0)))
760 timestr = 'unset' 754 timestr = 'unset'
761 timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr)) 755 timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr))