Patchwork [3,of,8] debugcommands: move 'debugstate' in the new module

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 14, 2017, 6:43 p.m.
Message ID <bfbf47caee84bcd1f69b.1487097783@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18490/
State Accepted
Headers show

Comments

Pierre-Yves David - Feb. 14, 2017, 6:43 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1486026274 -3600
#      Thu Feb 02 10:04:34 2017 +0100
# Node ID bfbf47caee84bcd1f69be1dc55df4c642aaf40cb
# Parent  4df6f88591c6e70edddadea4bf6e5cb1f8e87b3a
# EXP-Topic debugcommands
debugcommands: move 'debugstate' in the new module

Patch

diff -r 4df6f88591c6 -r bfbf47caee84 mercurial/commands.py
--- a/mercurial/commands.py	Thu Feb 02 10:04:02 2017 +0100
+++ b/mercurial/commands.py	Thu Feb 02 10:04:34 2017 +0100
@@ -11,7 +11,6 @@  import difflib
 import errno
 import os
 import re
-import time
 
 from .i18n import _
 from .node import (
@@ -1855,37 +1854,6 @@  def copy(ui, repo, *pats, **opts):
     with repo.wlock(False):
         return cmdutil.copy(ui, repo, pats, opts)
 
-@command('debugdirstate|debugstate',
-    [('', 'nodates', None, _('do not display the saved mtime')),
-    ('', 'datesort', None, _('sort by saved mtime'))],
-    _('[OPTION]...'))
-def debugstate(ui, repo, **opts):
-    """show the contents of the current dirstate"""
-
-    nodates = opts.get('nodates')
-    datesort = opts.get('datesort')
-
-    timestr = ""
-    if datesort:
-        keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
-    else:
-        keyfunc = None # sort by filename
-    for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
-        if ent[3] == -1:
-            timestr = 'unset               '
-        elif nodates:
-            timestr = 'set                 '
-        else:
-            timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
-                                    time.localtime(ent[3]))
-        if ent[1] & 0o20000:
-            mode = 'lnk'
-        else:
-            mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
-        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))
-
 @command('debugsub',
     [('r', 'rev', '',
      _('revision to check'), _('REV'))],
diff -r 4df6f88591c6 -r bfbf47caee84 mercurial/debugcommands.py
--- a/mercurial/debugcommands.py	Thu Feb 02 10:04:02 2017 +0100
+++ b/mercurial/debugcommands.py	Thu Feb 02 10:04:34 2017 +0100
@@ -585,6 +585,37 @@  def debugdeltachain(ui, repo, file_=None
 
     fm.end()
 
+@command('debugdirstate|debugstate',
+    [('', 'nodates', None, _('do not display the saved mtime')),
+    ('', 'datesort', None, _('sort by saved mtime'))],
+    _('[OPTION]...'))
+def debugstate(ui, repo, **opts):
+    """show the contents of the current dirstate"""
+
+    nodates = opts.get('nodates')
+    datesort = opts.get('datesort')
+
+    timestr = ""
+    if datesort:
+        keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
+    else:
+        keyfunc = None # sort by filename
+    for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
+        if ent[3] == -1:
+            timestr = 'unset               '
+        elif nodates:
+            timestr = 'set                 '
+        else:
+            timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
+                                    time.localtime(ent[3]))
+        if ent[1] & 0o20000:
+            mode = 'lnk'
+        else:
+            mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
+        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))
+
 @command('debugdiscovery',
     [('', 'old', None, _('use old-style discovery')),
     ('', 'nonheads', None,