mercurial/commands.py
changeset 6296 a9e6b8875805
parent 6276 c93ca83a3354
child 6299 653ddd1d7cd7
equal deleted inserted replaced
6295:bace1990ab12 6296:a9e6b8875805
   695     try:
   695     try:
   696         repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2))
   696         repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2))
   697     finally:
   697     finally:
   698         del wlock
   698         del wlock
   699 
   699 
   700 def debugstate(ui, repo):
   700 def debugstate(ui, repo, nodates=None):
   701     """show the contents of the current dirstate"""
   701     """show the contents of the current dirstate"""
   702     k = repo.dirstate._map.items()
   702     k = repo.dirstate._map.items()
   703     k.sort()
   703     k.sort()
       
   704     timestr = ""
       
   705     showdate = not nodates
   704     for file_, ent in k:
   706     for file_, ent in k:
   705         if ent[3] == -1:
   707         if showdate:
   706             # Pad or slice to locale representation
   708             if ent[3] == -1:
   707             locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(0)))
   709                 # Pad or slice to locale representation
   708             timestr = 'unset'
   710                 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(0)))
   709             timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr))
   711                 timestr = 'unset'
   710         else:
   712                 timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr))
   711             timestr = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ent[3]))
   713             else:
       
   714                 timestr = time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(ent[3]))
   712         if ent[1] & 020000:
   715         if ent[1] & 020000:
   713             mode = 'lnk'
   716             mode = 'lnk'
   714         else:
   717         else:
   715             mode = '%3o' % (ent[1] & 0777)
   718             mode = '%3o' % (ent[1] & 0777)
   716         ui.write("%c %s %10d %s %s\n" % (ent[0], mode, ent[2], timestr, file_))
   719         ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
   717     for f in repo.dirstate.copies():
   720     for f in repo.dirstate.copies():
   718         ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
   721         ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
   719 
   722 
   720 def debugdata(ui, file_, rev):
   723 def debugdata(ui, file_, rev):
   721     """dump the contents of a data file revision"""
   724     """dump the contents of a data file revision"""
  2942          _('hg debugrename [-r REV] FILE')),
  2945          _('hg debugrename [-r REV] FILE')),
  2943     "debugsetparents":
  2946     "debugsetparents":
  2944         (debugsetparents,
  2947         (debugsetparents,
  2945          [],
  2948          [],
  2946          _('hg debugsetparents REV1 [REV2]')),
  2949          _('hg debugsetparents REV1 [REV2]')),
  2947     "debugstate": (debugstate, [], _('hg debugstate')),
  2950     "debugstate":
       
  2951         (debugstate,
       
  2952          [('', 'nodates', None, _('do not display the saved mtime'))],
       
  2953          _('hg debugstate [OPTS]')),
  2948     "debugwalk": (debugwalk, walkopts, _('hg debugwalk [OPTION]... [FILE]...')),
  2954     "debugwalk": (debugwalk, walkopts, _('hg debugwalk [OPTION]... [FILE]...')),
  2949     "^diff":
  2955     "^diff":
  2950         (diff,
  2956         (diff,
  2951          [('r', 'rev', [], _('revision')),
  2957          [('r', 'rev', [], _('revision')),
  2952           ('a', 'text', None, _('treat all files as text')),
  2958           ('a', 'text', None, _('treat all files as text')),