mercurial/debugcommands.py
changeset 30954 dad968920130
parent 30953 5b09e9bc0902
child 30955 8e38fa360a12
equal deleted inserted replaced
30953:5b09e9bc0902 30954:dad968920130
   583                  chainratio=chainratio, lindist=lineardist,
   583                  chainratio=chainratio, lindist=lineardist,
   584                  extradist=extradist, extraratio=extraratio)
   584                  extradist=extradist, extraratio=extraratio)
   585 
   585 
   586     fm.end()
   586     fm.end()
   587 
   587 
       
   588 @command('debugdirstate|debugstate',
       
   589     [('', 'nodates', None, _('do not display the saved mtime')),
       
   590     ('', 'datesort', None, _('sort by saved mtime'))],
       
   591     _('[OPTION]...'))
       
   592 def debugstate(ui, repo, **opts):
       
   593     """show the contents of the current dirstate"""
       
   594 
       
   595     nodates = opts.get('nodates')
       
   596     datesort = opts.get('datesort')
       
   597 
       
   598     timestr = ""
       
   599     if datesort:
       
   600         keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
       
   601     else:
       
   602         keyfunc = None # sort by filename
       
   603     for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
       
   604         if ent[3] == -1:
       
   605             timestr = 'unset               '
       
   606         elif nodates:
       
   607             timestr = 'set                 '
       
   608         else:
       
   609             timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
       
   610                                     time.localtime(ent[3]))
       
   611         if ent[1] & 0o20000:
       
   612             mode = 'lnk'
       
   613         else:
       
   614             mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
       
   615         ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
       
   616     for f in repo.dirstate.copies():
       
   617         ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
       
   618 
   588 @command('debugdiscovery',
   619 @command('debugdiscovery',
   589     [('', 'old', None, _('use old-style discovery')),
   620     [('', 'old', None, _('use old-style discovery')),
   590     ('', 'nonheads', None,
   621     ('', 'nonheads', None,
   591      _('use old-style discovery with non-heads included')),
   622      _('use old-style discovery with non-heads included')),
   592     ] + commands.remoteopts,
   623     ] + commands.remoteopts,