changeset 5156:49554ba98951

debugstate: print symlinks as 'lnk', not '777'
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 09 Aug 2007 20:03:34 -0700
parents 13d23d66a6cd
children f6c520fd70cf
files mercurial/commands.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Aug 09 19:42:33 2007 -0700
+++ b/mercurial/commands.py	Thu Aug 09 20:03:34 2007 -0700
@@ -759,20 +759,21 @@
 
 def debugstate(ui, repo):
     """show the contents of the current dirstate"""
-    dc = repo.dirstate._map
-    k = dc.keys()
+    k = repo.dirstate._map.items()
     k.sort()
-    for file_ in k:
-        if dc[file_][3] == -1:
+    for file_, ent in k:
+        if ent[3] == -1:
             # Pad or slice to locale representation
             locale_len = len(time.strftime("%x %X", time.localtime(0)))
             timestr = 'unset'
             timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr))
         else:
-            timestr = time.strftime("%x %X", time.localtime(dc[file_][3]))
-        ui.write("%c %3o %10d %s %s\n"
-                 % (dc[file_][0], dc[file_][1] & 0777, dc[file_][2],
-                    timestr, file_))
+            timestr = time.strftime("%x %X", 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_))
     for f in repo.dirstate.copies():
         ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))