Mercurial > hg
diff mercurial/commands.py @ 6296:a9e6b8875805
debugstate: add --nodates
This can be useful for tests.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Tue, 18 Mar 2008 04:07:39 -0300 |
parents | c93ca83a3354 |
children | 653ddd1d7cd7 |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Mar 17 23:36:45 2008 +0100 +++ b/mercurial/commands.py Tue Mar 18 04:07:39 2008 -0300 @@ -697,23 +697,26 @@ finally: del wlock -def debugstate(ui, repo): +def debugstate(ui, repo, nodates=None): """show the contents of the current dirstate""" k = repo.dirstate._map.items() k.sort() + timestr = "" + showdate = not nodates for file_, ent in k: - if ent[3] == -1: - # Pad or slice to locale representation - locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(0))) - timestr = 'unset' - timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr)) - else: - timestr = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ent[3])) + if showdate: + if ent[3] == -1: + # Pad or slice to locale representation + locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(0))) + timestr = 'unset' + timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr)) + else: + timestr = time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(ent[3])) if ent[1] & 020000: mode = 'lnk' else: mode = '%3o' % (ent[1] & 0777) - ui.write("%c %s %10d %s %s\n" % (ent[0], mode, ent[2], timestr, file_)) + ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) for f in repo.dirstate.copies(): ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) @@ -2944,7 +2947,10 @@ (debugsetparents, [], _('hg debugsetparents REV1 [REV2]')), - "debugstate": (debugstate, [], _('hg debugstate')), + "debugstate": + (debugstate, + [('', 'nodates', None, _('do not display the saved mtime'))], + _('hg debugstate [OPTS]')), "debugwalk": (debugwalk, walkopts, _('hg debugwalk [OPTION]... [FILE]...')), "^diff": (diff,