##// END OF EJS Templates
debugcommands: move 'debugstate' in the new module
Pierre-Yves David -
r30954:dad96892 default
parent child Browse files
Show More
@@ -11,7 +11,6 b' import difflib'
11 import errno
11 import errno
12 import os
12 import os
13 import re
13 import re
14 import time
15
14
16 from .i18n import _
15 from .i18n import _
17 from .node import (
16 from .node import (
@@ -1855,37 +1854,6 b' def copy(ui, repo, *pats, **opts):'
1855 with repo.wlock(False):
1854 with repo.wlock(False):
1856 return cmdutil.copy(ui, repo, pats, opts)
1855 return cmdutil.copy(ui, repo, pats, opts)
1857
1856
1858 @command('debugdirstate|debugstate',
1859 [('', 'nodates', None, _('do not display the saved mtime')),
1860 ('', 'datesort', None, _('sort by saved mtime'))],
1861 _('[OPTION]...'))
1862 def debugstate(ui, repo, **opts):
1863 """show the contents of the current dirstate"""
1864
1865 nodates = opts.get('nodates')
1866 datesort = opts.get('datesort')
1867
1868 timestr = ""
1869 if datesort:
1870 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
1871 else:
1872 keyfunc = None # sort by filename
1873 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
1874 if ent[3] == -1:
1875 timestr = 'unset '
1876 elif nodates:
1877 timestr = 'set '
1878 else:
1879 timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
1880 time.localtime(ent[3]))
1881 if ent[1] & 0o20000:
1882 mode = 'lnk'
1883 else:
1884 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
1885 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
1886 for f in repo.dirstate.copies():
1887 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
1888
1889 @command('debugsub',
1857 @command('debugsub',
1890 [('r', 'rev', '',
1858 [('r', 'rev', '',
1891 _('revision to check'), _('REV'))],
1859 _('revision to check'), _('REV'))],
@@ -585,6 +585,37 b' def debugdeltachain(ui, repo, file_=None'
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,
General Comments 0
You need to be logged in to leave comments. Login now