Explorar o código

HADOOP-3459. Change in the output format of dfs -ls to more closely match
/bin/ls. New format is: perm repl owner group size date name. Contributed by Mukund Madhugiri.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@663317 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley %!s(int64=17) %!d(string=hai) anos
pai
achega
cf1ddea205
Modificáronse 2 ficheiros con 13 adicións e 7 borrados
  1. 3 0
      CHANGES.txt
  2. 10 7
      src/java/org/apache/hadoop/fs/FsShell.java

+ 3 - 0
CHANGES.txt

@@ -71,6 +71,9 @@ Trunk (unreleased changes)
     A connection with outstanding requests won't be treated as idle.
     (hairong)
 
+    HADOOP-3459. Change in the output format of dfs -ls to more closely match
+    /bin/ls. New format is: perm repl owner group size date name (Mukund Madhugiri via omally)
+
   NEW FEATURES
 
     HADOOP-3074. Provides a UrlStreamHandler for DFS and other FS,

+ 10 - 7
src/java/org/apache/hadoop/fs/FsShell.java

@@ -652,13 +652,16 @@ public class FsShell extends Configured implements Tool {
         FileStatus stat = items[i];
         Path cur = stat.getPath();
         String mdate = dateForm.format(new Date(stat.getModificationTime()));
-        System.out.printf("%-"+ (maxReplication + BORDER)
-            +"s", (!stat.isDir() ? stat.getReplication() : ""));
-        System.out.printf("%-"+ (maxLen + BORDER) +"d", stat.getLen());
-        System.out.print(mdate + "  " 
-            + (stat.isDir() ? "d" : "-") + stat.getPermission() + "  ");
-        System.out.printf("%-"+ (maxOwner + BORDER) +"s", stat.getOwner());
-        System.out.printf("%-"+ (maxGroup + BORDER) +"s", stat.getGroup());
+        
+        System.out.print((stat.isDir() ? "d" : "-") + 
+          stat.getPermission() + " ");
+        System.out.printf("%"+ maxReplication + 
+          "s ", (!stat.isDir() ? stat.getReplication() : "-"));
+        System.out.printf("%-"+ maxOwner +
+          "s ", stat.getOwner());
+        System.out.printf("%-"+ maxGroup +"s ", stat.getGroup());
+        System.out.printf("%"+ maxLen + "d ", stat.getLen());
+        System.out.print(mdate + " ");
         System.out.println(cur.toUri().getPath());
         if (recursive && stat.isDir()) {
           ls(cur,srcFs, recursive, printHeader);