You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ha...@apache.org on 2011/12/28 07:48:32 UTC
svn commit: r1225114 - in
/hadoop/common/trunk/hadoop-common-project/hadoop-common: CHANGES.txt
src/main/java/org/apache/hadoop/fs/shell/Stat.java
src/test/resources/testConf.xml
Author: harsh
Date: Wed Dec 28 06:48:31 2011
New Revision: 1225114
URL: http://svn.apache.org/viewvc?rev=1225114&view=rev
Log:
HADOOP-7574. Improve FSShell -stat, add user/group elements (XieXianshan via harsh)
Modified:
hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml
Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1225114&r1=1225113&r2=1225114&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Wed Dec 28 06:48:31 2011
@@ -77,6 +77,8 @@ Trunk (unreleased changes)
HADOOP-7899. Generate proto java files as part of the build. (tucu)
+ HADOOP-7574. Improve FSShell -stat, add user/group elements (XieXianshan via harsh)
+
BUGS
HADOOP-7851. Configuration.getClasses() never returns the default value.
Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java?rev=1225114&r1=1225113&r2=1225114&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java Wed Dec 28 06:48:31 2011
@@ -32,9 +32,11 @@ import org.apache.hadoop.fs.FileStatus;
* Print statistics about path in specified format.
* Format sequences:
* %b: Size of file in blocks
+ * %g: Group name of owner
* %n: Filename
* %o: Block size
* %r: replication
+ * %u: User name of owner
* %y: UTC date as "yyyy-MM-dd HH:mm:ss"
* %Y: Milliseconds since January 1, 1970 UTC
*/
@@ -50,8 +52,8 @@ class Stat extends FsCommand {
public static final String USAGE = "[format] <path> ...";
public static final String DESCRIPTION =
"Print statistics about the file/directory at <path>\n" +
- "in the specified format. Format accepts filesize in blocks (%b), filename (%n),\n" +
- "block size (%o), replication (%r), modification date (%y, %Y)\n";
+ "in the specified format. Format accepts filesize in blocks (%b), group name of owner(%g),\n" +
+ "filename (%n), block size (%o), replication (%r), user name of owner(%u), modification date (%y, %Y)\n";
protected static final SimpleDateFormat timeFmt;
static {
@@ -92,6 +94,9 @@ class Stat extends FsCommand {
? "directory"
: (stat.isFile() ? "regular file" : "symlink"));
break;
+ case 'g':
+ buf.append(stat.getGroup());
+ break;
case 'n':
buf.append(item.path.getName());
break;
@@ -101,6 +106,9 @@ class Stat extends FsCommand {
case 'r':
buf.append(stat.getReplication());
break;
+ case 'u':
+ buf.append(stat.getOwner());
+ break;
case 'y':
buf.append(timeFmt.format(new Date(stat.getModificationTime())));
break;
@@ -118,4 +126,4 @@ class Stat extends FsCommand {
}
out.println(buf.toString());
}
-}
\ No newline at end of file
+}
Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml?rev=1225114&r1=1225113&r2=1225114&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml Wed Dec 28 06:48:31 2011
@@ -606,11 +606,11 @@
</comparator>
<comparator>
<type>RegexpComparator</type>
- <expected-output>^( |\t)*in the specified format. Format accepts filesize in blocks \(%b\), filename \(%n\),( )*</expected-output>
+ <expected-output>^( |\t)*in the specified format. Format accepts filesize in blocks \(%b\), group name of owner\(%g\),( )*</expected-output>
</comparator>
<comparator>
<type>RegexpComparator</type>
- <expected-output>^( |\t)*block size \(%o\), replication \(%r\), modification date \(%y, %Y\)( )*</expected-output>
+ <expected-output>^( |\t)*filename \(%n\), block size \(%o\), replication \(%r\), user name of owner\(%u\), modification date \(%y, %Y\)( )*</expected-output>
</comparator>
</comparators>
</test>