mercurial/commands.py
changeset 13767 0f9282dc87f8
parent 13751 85d74f6babf6
child 13803 e380964d53f8
equal deleted inserted replaced
13766:627e50e9e316 13767:0f9282dc87f8
  1338     try:
  1338     try:
  1339         repo.dirstate.setparents(r1, r2)
  1339         repo.dirstate.setparents(r1, r2)
  1340     finally:
  1340     finally:
  1341         wlock.release()
  1341         wlock.release()
  1342 
  1342 
  1343 def debugstate(ui, repo, nodates=None):
  1343 def debugstate(ui, repo, nodates=None, datesort=None):
  1344     """show the contents of the current dirstate"""
  1344     """show the contents of the current dirstate"""
  1345     timestr = ""
  1345     timestr = ""
  1346     showdate = not nodates
  1346     showdate = not nodates
  1347     for file_, ent in sorted(repo.dirstate._map.iteritems()):
  1347     if datesort:
       
  1348         keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
       
  1349     else:
       
  1350         keyfunc = None # sort by filename
       
  1351     for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
  1348         if showdate:
  1352         if showdate:
  1349             if ent[3] == -1:
  1353             if ent[3] == -1:
  1350                 # Pad or slice to locale representation
  1354                 # Pad or slice to locale representation
  1351                 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ",
  1355                 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ",
  1352                                                time.localtime(0)))
  1356                                                time.localtime(0)))
  4510         (debugrevspec, [], ('REVSPEC')),
  4514         (debugrevspec, [], ('REVSPEC')),
  4511     "debugsetparents":
  4515     "debugsetparents":
  4512         (debugsetparents, [], _('REV1 [REV2]')),
  4516         (debugsetparents, [], _('REV1 [REV2]')),
  4513     "debugstate":
  4517     "debugstate":
  4514         (debugstate,
  4518         (debugstate,
  4515          [('', 'nodates', None, _('do not display the saved mtime'))],
  4519          [('', 'nodates', None, _('do not display the saved mtime')),
       
  4520           ('', 'datesort', None, _('sort by saved mtime'))],
  4516          _('[OPTION]...')),
  4521          _('[OPTION]...')),
  4517     "debugsub":
  4522     "debugsub":
  4518         (debugsub,
  4523         (debugsub,
  4519          [('r', 'rev', '',
  4524          [('r', 'rev', '',
  4520            _('revision to check'), _('REV'))],
  4525            _('revision to check'), _('REV'))],